Re: How to determine if archive is an sdist or bdist

James Carpenter <[email protected]> Sun, 31 Mar 2013 17:13:46 -0500
Newsgroups gmane.comp.python.catalog
Message-ID <CAAndj4tLh1N7PiBi9P_O=d4Z7axmUS6z56uDcn5q=_QK1BRyTA@mail.gmail.com>
--===============0668835822==
Content-Type: multipart/alternative; boundary=047d7b343e2a756e5b04d93fd1ed

--047d7b343e2a756e5b04d93fd1ed
Content-Type: text/plain; charset=ISO-8859-1

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 <[email protected]> wrote:

> On Fri, Mar 29, 2013 at 11:00 AM, James Carpenter <[email protected]>
> 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 <[email protected]> wrote:
> >>
> >> On Thu, Mar 28, 2013 at 3:57 PM, James Carpenter <[email protected]>
> >> 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.
> >
> >
>

--047d7b343e2a756e5b04d93fd1ed
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"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 m=
ight 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 co=
de, but I haven&#39;t looked yet.</div><div><br></div><div>A third more int=
eresting question, is whether there is any way to determine the origin of a=
n 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 utilitie=
s to support continuous deployment within Python. I am using Artifactory as=
 my repository manager (think internal PyPI server). I hope to publish thes=
e utilities externally when I get done in a few weeks.</div>
<div><br></div><div><br></div></div><div class=3D"gmail_extra"><br><br><div=
 class=3D"gmail_quote">On Fri, Mar 29, 2013 at 1:54 PM, PJ Eby <span dir=3D=
"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_blank">pje@te=
lecommunity.com</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div class=3D"im">On Fri, Mar 29, 2013 at 11=
:00 AM, James Carpenter &lt;<a href=3D"mailto:[email protected]">nawkboy@gm=
ail.com</a>&gt; wrote:<br>

&gt; Looks like the idea of using a custom command is a better approach the=
n.<br>
<br>
</div>I&#39;m not sure why you think that. =A0The only kinds of archives wh=
ose<br>
file types are ambiguous from the name, are sdist, bdist_dumb, and<br>
random raw source dumps. =A0Everything else has a unique extension like<br>
.egg, .exe, .msi, rpm, etc. =A0If 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. =A0And if it&#39;s not an sdist, yo=
u<br>
can usually tell if it&#39;s a raw source dump by checking for a setup.py<b=
r>
in the archive root or a depth-1 subdirectory off the root. =A0(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=3D"HOEnZb"><div class=3D"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=3D"mailto:pje@tele=
community.com">[email protected]</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On Thu, Mar 28, 2013 at 3:57 PM, James Carpenter &lt;<a href=3D"ma=
ilto:[email protected]">[email protected]</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 lik=
e to<br>
&gt;&gt; &gt; post-process the contents of a dist directory and classify ea=
ch 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 roo=
t<br>
&gt;&gt; directory, named for the package+version, and containing a PKG-INF=
O<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, /Pro=
gram<br>
&gt;&gt; Files.<br>
&gt;&gt;<br>
&gt;&gt; Other bdist formats? =A0Hard to say.<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br></div>

--047d7b343e2a756e5b04d93fd1ed--

--===============0668835822==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Catalog-SIG mailing list
[email protected]
http://mail.python.org/mailman/listinfo/catalog-sig

--===============0668835822==--