From nawkboy at gmail.com Mon Apr 1 00:13:46 2013 From: nawkboy at gmail.com (James Carpenter) Date: Sun, 31 Mar 2013 17:13:46 -0500 Subject: [Catalog-sig] How to determine if archive is an sdist or bdist In-Reply-To: References: Message-ID: Do you have a module/function/line number in easy_install I should use? I'm sure I can dig it out myself but it sounds like you might just be able to put your finger on it in only a minute or two. Same question for a pre-existing utility function for reading a requirements file. I'm guessing there is one burried down in the PIP code, but I haven't looked yet. A third more interesting question, is whether there is any way to determine the origin of an installed package. I am building up a build-info to push into Artifactory and it takes a "type" if available when listing dependencies of a build. In Java/Maven land a typical type would be jar, war, pom, etc. My current understanding is this is a non-sense question, since once a Python module is installed it looks the same regardless of whether it came from an sdist, wheel, etc. In case your wondering, I am building a set of utilities to support continuous deployment within Python. I am using Artifactory as my repository manager (think internal PyPI server). I hope to publish these utilities externally when I get done in a few weeks. On Fri, Mar 29, 2013 at 1:54 PM, PJ Eby wrote: > On Fri, Mar 29, 2013 at 11:00 AM, James Carpenter > wrote: > > Looks like the idea of using a custom command is a better approach then. > > I'm not sure why you think that. The only kinds of archives whose > file types are ambiguous from the name, are sdist, bdist_dumb, and > random raw source dumps. Everything else has a unique extension like > .egg, .exe, .msi, rpm, etc. If you have a .zip, .tar.gz, .tgz, or > some other archive name, you can find out if it's an sdist by > inspecting its contents as I described. And if it's not an sdist, you > can usually tell if it's a raw source dump by checking for a setup.py > in the archive root or a depth-1 subdirectory off the root. (That's > what easy_install does, anyway, when it's given an archive it doesn't > know what to do with.) > > > > > Is a custom command my only choice or can I register pre/post hooks to > any > > given command? > > > > > > On Thu, Mar 28, 2013 at 3:36 PM, PJ Eby wrote: > >> > >> On Thu, Mar 28, 2013 at 3:57 PM, James Carpenter > >> wrote: > >> > Is there an easy way to programmatically tell if an archive (tar.gz, > >> > zip, > >> > etc.) in the dist directory is a binary or sdist? I would like to > >> > post-process the contents of a dist directory and classify each build > >> > artifact there (egg, sdist, bdist, etc.). > >> > >> An sdist always has a single subdirectory in the archive's root > >> directory, named for the package+version, and containing a PKG-INFO > >> and setup.py (plus a bunch of other stuff). > >> > >> A bdist_dumb will not have such a subdirectory in the archive root; > >> instead it will have one or more directories like /usr, /opt, /Program > >> Files. > >> > >> Other bdist formats? Hard to say. > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ncoghlan at gmail.com Mon Apr 1 03:36:19 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Mon, 1 Apr 2013 11:36:19 +1000 Subject: [Catalog-sig] How to determine if archive is an sdist or bdist In-Reply-To: References: Message-ID: On Mon, Apr 1, 2013 at 8:13 AM, James Carpenter wrote: > Do you have a module/function/line number in easy_install I should use? > I'm sure I can dig it out myself but it sounds like you might just be able > to put your finger on it in only a minute or two. > > Same question for a pre-existing utility function for reading a > requirements file. I'm guessing there is one burried down in the PIP code, > but I haven't looked yet. > > A third more interesting question, is whether there is any way to > determine the origin of an installed package. I am building up a build-info > to push into Artifactory and it takes a "type" if available when listing > dependencies of a build. In Java/Maven land a typical type would be jar, > war, pom, etc. My current understanding is this is a non-sense question, > since once a Python module is installed it looks the same regardless of > whether it came from an sdist, wheel, etc. > The closest equivalent is PEP 376's "INSTALLER" file, but that only tells you which installer was used to add the distribution, rather than where that installer retrieved it from. An "ORIGIN" entry in the installation database could be an interesting future addition. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia -------------- next part -------------- An HTML attachment was scrubbed... URL: From pje at telecommunity.com Mon Apr 1 06:59:55 2013 From: pje at telecommunity.com (PJ Eby) Date: Mon, 1 Apr 2013 00:59:55 -0400 Subject: [Catalog-sig] How to determine if archive is an sdist or bdist In-Reply-To: References: Message-ID: On Sun, Mar 31, 2013 at 6:13 PM, James Carpenter wrote: > Do you have a module/function/line number in easy_install I should use? I'm > sure I can dig it out myself but it sounds like you might just be able to > put your finger on it in only a minute or two. It's the install_eggs() method of setuptools.commands.easy_install.easy_install. You won't really be able to use it, it just looks for a setup.py after *unpacking* the archive. It also doesn't look for a PKG-INFO; PyPI does that. (And I only know that because it was relevant to the uploadability of eggs at one time.) From r1chardj0n3s at gmail.com Mon Apr 1 08:41:10 2013 From: r1chardj0n3s at gmail.com (Richard Jones) Date: Mon, 1 Apr 2013 17:41:10 +1100 Subject: [Catalog-sig] Reminder: catalog-sig is retired Message-ID: Please direct all followups / CCs to distutils-sig. Thankyou, Richard -------------- next part -------------- An HTML attachment was scrubbed... URL: