[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-catalog-sig
Subject:    Re: [Catalog-sig] How to determine if archive is an sdist or bdist
From:       James Carpenter <nawkboy () gmail ! com>
Date:       2013-03-31 22:13:46
Message-ID: CAAndj4tLh1N7PiBi9P_O=d4Z7axmUS6z56uDcn5q=_QK1BRyTA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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 <pje@telecommunity.com> wrote:

> On Fri, Mar 29, 2013 at 11:00 AM, James Carpenter <nawkboy@gmail.com>
> 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 <pje@telecommunity.com> wrote:
> >>
> >> On Thu, Mar 28, 2013 at 3:57 PM, James Carpenter <nawkboy@gmail.com>
> >> 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.
> >
> >
>

[Attachment #5 (text/html)]

<div dir="ltr">Do you have a module/function/line number in easy_install I should \
use? I&#39;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.<div><br> </div><div>Same question \
for a pre-existing utility function for reading a requirements file. I&#39;m guessing \
there is one burried down in the PIP code, but I haven&#39;t looked \
yet.</div><div><br></div><div>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 &quot;type&quot; 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.</div> <div><br></div><div>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.</div> \
<div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div \
class="gmail_quote">On Fri, Mar 29, 2013 at 1:54 PM, PJ Eby <span dir="ltr">&lt;<a \
href="mailto:pje@telecommunity.com" \
target="_blank">pje@telecommunity.com</a>&gt;</span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div class="im">On Fri, Mar 29, 2013 at 11:00 AM, James \
Carpenter &lt;<a href="mailto:nawkboy@gmail.com">nawkboy@gmail.com</a>&gt; wrote:<br>

&gt; Looks like the idea of using a custom command is a better approach then.<br>
<br>
</div>I&#39;m not sure why you think that.  The only kinds of archives whose<br>
file types are ambiguous from the name, are sdist, bdist_dumb, and<br>
random raw source dumps.  Everything else has a unique extension like<br>
.egg, .exe, .msi, rpm, etc.  If you have a .zip, .tar.gz, .tgz, or<br>
some other archive name, you can find out if it&#39;s an sdist by<br>
inspecting its contents as I described.  And if it&#39;s not an sdist, you<br>
can usually tell if it&#39;s a raw source dump by checking for a setup.py<br>
in the archive root or a depth-1 subdirectory off the root.  (That&#39;s<br>
what easy_install does, anyway, when it&#39;s given an archive it doesn&#39;t<br>
know what to do with.)<br>
<div class="HOEnZb"><div class="h5"><br>
&gt;<br>
&gt; Is a custom command my only choice or can I register pre/post hooks to any<br>
&gt; given command?<br>
&gt;<br>
&gt;<br>
&gt; On Thu, Mar 28, 2013 at 3:36 PM, PJ Eby &lt;<a \
href="mailto:pje@telecommunity.com">pje@telecommunity.com</a>&gt; wrote:<br> \
&gt;&gt;<br> &gt;&gt; On Thu, Mar 28, 2013 at 3:57 PM, James Carpenter &lt;<a \
href="mailto:nawkboy@gmail.com">nawkboy@gmail.com</a>&gt;<br> &gt;&gt; wrote:<br>
&gt;&gt; &gt; Is there an easy way to programmatically tell if an archive \
(tar.gz,<br> &gt;&gt; &gt; zip,<br>
&gt;&gt; &gt; etc.) in the dist directory is a binary or sdist? I would like to<br>
&gt;&gt; &gt; post-process the contents of a dist directory and classify each \
build<br> &gt;&gt; &gt; artifact there (egg, sdist, bdist, etc.).<br>
&gt;&gt;<br>
&gt;&gt; An sdist always has a single subdirectory in the archive&#39;s root<br>
&gt;&gt; directory, named for the package+version, and containing a PKG-INFO<br>
&gt;&gt; and setup.py (plus a bunch of other stuff).<br>
&gt;&gt;<br>
&gt;&gt; A bdist_dumb will not have such a subdirectory in the archive root;<br>
&gt;&gt; instead it will have one or more directories like /usr, /opt, /Program<br>
&gt;&gt; Files.<br>
&gt;&gt;<br>
&gt;&gt; Other bdist formats?  Hard to say.<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br></div>



_______________________________________________
Catalog-SIG mailing list
Catalog-SIG@python.org
http://mail.python.org/mailman/listinfo/catalog-sig


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic