-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I am writing a recipe for buildout, and as such I would like to get the full name of a develop egg programatically as it would appear if I installed it. For example if the setup.py defines the name to "myproject", I would like to get myproject-0.3.0-py2.5-linux-x86_64.egg How to I get this ? I look a little bit in the setuptools source code, but it's not easy to find. Thanks, Martin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJLrHDPAAoJEBdvyODiyJI4LhkH/0ep+wfUtAT7IzHdStNUcInT i9WQx9zyzMmIlWKzgHwSjtN48os3JfKE6iww6QHI6bNH6srDR+dSgeuytfEX8eeh oMuIYKR5LNgsrol1ZYulQHVz2UGdY308uI4rjxGSFhbwMEs3TGIX4VqrisHK/0uq RciBMtsa2cmuLrjeTVZVlLHnjGEpili7OUMcjiwcrNch0n24UtuS+hmGDx30E6bl rGIdr8rWDz7L5KwkbVu/tDAiqy7WRE4uQ8Voc/KDCLks4bXG6CjtcqC264hFqhYS XmYGqXkk32rJOV6NR2hqAfUapq7EaAVv50DJ2QopvxIiI5lpkxIkgcfbUFvH0aM= =KIh9 -----END PGP SIGNATURE-----
On Fri, Mar 26, 2010 at 9:31 AM, Martin Raspaud
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi,
I am writing a recipe for buildout, and as such I would like to get the full name of a develop egg programatically as it would appear if I installed it. For example if the setup.py defines the name to "myproject", I would like to get myproject-0.3.0-py2.5-linux-x86_64.egg
How to I get this ?
I look a little bit in the setuptools source code, but it's not easy to find.
It's provided by the egg_name() function in the Distribution class (the one in pkg_resources, not the one in setuptools.dist)
from pkg_resources import Distribution, get_build_platform from distutils.sysconfig import get_python_version dist = Distribution(None, None, 'myproject', '0.3.0', get_python_version(), get_build_platform()) dist.egg_name() + '.egg' 'myproject-0.3.0-py2.6-macosx-10.3-fat.egg'
Thanks, Martin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJLrHDPAAoJEBdvyODiyJI4LhkH/0ep+wfUtAT7IzHdStNUcInT i9WQx9zyzMmIlWKzgHwSjtN48os3JfKE6iww6QHI6bNH6srDR+dSgeuytfEX8eeh oMuIYKR5LNgsrol1ZYulQHVz2UGdY308uI4rjxGSFhbwMEs3TGIX4VqrisHK/0uq RciBMtsa2cmuLrjeTVZVlLHnjGEpili7OUMcjiwcrNch0n24UtuS+hmGDx30E6bl rGIdr8rWDz7L5KwkbVu/tDAiqy7WRE4uQ8Voc/KDCLks4bXG6CjtcqC264hFqhYS XmYGqXkk32rJOV6NR2hqAfUapq7EaAVv50DJ2QopvxIiI5lpkxIkgcfbUFvH0aM= =KIh9 -----END PGP SIGNATURE-----
_______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig
-- Tarek Ziadé | http://ziade.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tarek Ziadé skrev:
On Fri, Mar 26, 2010 at 9:31 AM, Martin Raspaud
wrote: Hi, I am writing a recipe for buildout, and as such I would like to get the full name of a develop egg programatically as it would appear if I installed it. For example if the setup.py defines the name to "myproject", I would like to get myproject-0.3.0-py2.5-linux-x86_64.egg
How to I get this ?
I look a little bit in the setuptools source code, but it's not easy to find.
It's provided by the egg_name() function in the Distribution class (the one in pkg_resources, not the one in setuptools.dist)
from pkg_resources import Distribution, get_build_platform from distutils.sysconfig import get_python_version dist = Distribution(None, None, 'myproject', '0.3.0', get_python_version(), get_build_platform()) dist.egg_name() + '.egg' 'myproject-0.3.0-py2.6-macosx-10.3-fat.egg'
Nice, thanks ! and how do I get 'myproject' and '0.3.0' from a setup.py file ? (I'm working with develop eggs) Regards, Martin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJLrKouAAoJEBdvyODiyJI4nfMIAKKuq8AGSJ6j9lzbijD9jOMC GZXPdtktgNW+/HATQDARZayv8dClu3P33CvOfMrlhW1SpfqvuxMp8G7CWdJhHqG0 purmxH21jldLi2i2EMDN09cC6ehIC71+kaqKUi9wBjjlMIhM0vxsrdcGDNLJpciP chrVJnyhP42q+KHLffFwmnzdpII4Pkj0vBzOBG2KLaxLHI1ctjLDHcXZkpRyuBkR +DwtZm3kVaM6IZv9v6d+T4vN3opeg4JbUgwmaQSdlKEhztmlXFH4Qf8TK6YyUdtI 8Y3r1l/IcJwG2az5pFcpvCATEqPsLQQ8Fg4/vfa5EnqMQAaq+xjejOuHIq5LWHE= =kgUf -----END PGP SIGNATURE-----
On Fri, Mar 26, 2010 at 1:35 PM, Martin Raspaud
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Tarek Ziadé skrev:
On Fri, Mar 26, 2010 at 9:31 AM, Martin Raspaud
wrote: Hi, I am writing a recipe for buildout, and as such I would like to get the full name of a develop egg programatically as it would appear if I installed it. For example if the setup.py defines the name to "myproject", I would like to get myproject-0.3.0-py2.5-linux-x86_64.egg
How to I get this ?
I look a little bit in the setuptools source code, but it's not easy to find.
It's provided by the egg_name() function in the Distribution class (the one in pkg_resources, not the one in setuptools.dist)
from pkg_resources import Distribution, get_build_platform from distutils.sysconfig import get_python_version dist = Distribution(None, None, 'myproject', '0.3.0', get_python_version(), get_build_platform()) dist.egg_name() + '.egg' 'myproject-0.3.0-py2.6-macosx-10.3-fat.egg'
Nice, thanks !
and how do I get 'myproject' and '0.3.0' from a setup.py file ? (I'm working with develop eggs)
It depends on what your recipe is doing really (and when). If the egg is already installed in your environment, by the time your recipe code is run, you can grab these info using pkg_resources:
pkg_resources.get_distribution('myproject').version, pkg_resources.get_distribution('myproject').project_name
If it's not installed, well, is a bit trickier because you need to run a command on the project's setup.py. What are you trying to achieve ? Regards Tarek -- Tarek Ziadé | http://ziade.org
participants (2)
-
Martin Raspaud
-
Tarek Ziadé