Something that doesn't run from an egg
This is not wholly surprising, but py.test doesn't appear to run from an egg. (I say it's not surprising, given that py is doing its own import trickery...) The way it fails is interesting. I can import py from a python prompt, but not from the py.test script. /usr/local/bin/python Python 2.4.1 (#2, Mar 31 2005, 00:05:10) [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import py.test
py.test py lib is at /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py-0.8.0_alpha1-py2.4.egg/py/__init__.pyc Traceback (most recent call last): File "/usr/local/bin/py.test", line 4, in ? pkg_resources.run_main('py==0.8.0-alpha1', 'py.test') File "build\bdist.win32\egg\pkg_resources.py", line 110, in run_main File "build\bdist.win32\egg\pkg_resources.py", line 599, in run_script File "/Library/Frameworks/Python.framework/Versions/2.4/bin/py.test", line 3, in ? import pkg_resources ImportError: cannot import name py Another of the pylib scripts, py.countloc, works fine. That one may not depend on the rest of the package, though. I'd thought I'd toss this out there in case anyone cares, but I'm not sure if anyone will care about this particular case. Kevin
Can you give me the download URL for the py source distro so I can try to reproduce this? At 03:29 PM 7/6/2005 -0400, Kevin Dangoor wrote:
This is not wholly surprising, but py.test doesn't appear to run from an egg. (I say it's not surprising, given that py is doing its own import trickery...) The way it fails is interesting. I can import py from a python prompt, but not from the py.test script.
/usr/local/bin/python Python 2.4.1 (#2, Mar 31 2005, 00:05:10) [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import py.test
py.test py lib is at /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py-0.8.0_alpha1-py2.4.egg/py/__init__.pyc Traceback (most recent call last): File "/usr/local/bin/py.test", line 4, in ? pkg_resources.run_main('py==0.8.0-alpha1', 'py.test') File "build\bdist.win32\egg\pkg_resources.py", line 110, in run_main File "build\bdist.win32\egg\pkg_resources.py", line 599, in run_script File "/Library/Frameworks/Python.framework/Versions/2.4/bin/py.test", line 3, in ? import pkg_resources ImportError: cannot import name py
Another of the pylib scripts, py.countloc, works fine. That one may not depend on the rest of the package, though.
I'd thought I'd toss this out there in case anyone cares, but I'm not sure if anyone will care about this particular case.
Kevin _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig
On 7/6/05, Phillip J. Eby <pje@telecommunity.com> wrote:
Can you give me the download URL for the py source distro so I can try to reproduce this?
Right now, it's only available from subversion: svn co http://codespeak.net/svn/py/dist py-dist Here's the Getting Started page for it: http://codespeak.net/py/current/doc/getting-started.html Kevin
At 04:01 PM 7/6/2005 -0400, Kevin Dangoor wrote:
On 7/6/05, Phillip J. Eby <pje@telecommunity.com> wrote:
Can you give me the download URL for the py source distro so I can try to reproduce this?
Right now, it's only available from subversion:
svn co http://codespeak.net/svn/py/dist py-dist
Note that you can just "easy_install http://codespeak.net/svn/py/dist" to install it directly from subversion, without needing a manual checkout. (You *do* need a subversion client on your PATH, however.) Here's a patch to setuptools that appears to fix the problem (by not running imported scripts as __main__), and it's probably a good idea to add it to setuptools in any case. Meanwhile, however, somebody should probably tell the py folks that _findpy is a horrible, *horrible* hack and should be shot. :) Index: pkg_resources.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/pkg_resources.py,v retrieving revision 1.36 diff -u -r1.36 pkg_resources.py --- pkg_resources.py 6 Jul 2005 03:46:16 -0000 1.36 +++ pkg_resources.py 6 Jul 2005 20:42:14 -0000 @@ -104,11 +104,11 @@ def run_main(dist_spec, script_name): """Locate distribution `dist_spec` and run its `script_name` script""" - import __main__ - __main__.__dict__.clear() - __main__.__dict__.update({'__name__':'__main__'}) - require(dist_spec)[0].metadata.run_script(script_name, __main__.__dict__) - + ns = sys._getframe(1).f_globals + name = ns['__name__'] + ns.clear() + ns['__name__'] = name + require(dist_spec)[0].metadata.run_script(script_name, ns)
On 7/6/05, Phillip J. Eby <pje@telecommunity.com> wrote:
At 04:01 PM 7/6/2005 -0400, Kevin Dangoor wrote:
On 7/6/05, Phillip J. Eby <pje@telecommunity.com> wrote:
Can you give me the download URL for the py source distro so I can try to reproduce this?
Right now, it's only available from subversion:
svn co http://codespeak.net/svn/py/dist py-dist
Note that you can just "easy_install http://codespeak.net/svn/py/dist" to install it directly from subversion, without needing a manual checkout. (You *do* need a subversion client on your PATH, however.)
Neat. easy_install seems to have quite a few tricks up its sleeve.
Here's a patch to setuptools that appears to fix the problem (by not running imported scripts as __main__), and it's probably a good idea to add it to setuptools in any case. Meanwhile, however, somebody should probably tell the py folks that _findpy is a horrible, *horrible* hack and should be shot. :)
Cool. I'll give this a whirl. Kevin
"Phillip J. Eby" <pje@telecommunity.com> writes:
Here's a patch to setuptools that appears to fix the problem (by not running imported scripts as __main__), and it's probably a good idea to add it to setuptools in any case. Meanwhile, however, somebody should probably tell the py folks that _findpy is a horrible, *horrible* hack and should be shot. :)
I think they know :) Cheers, mwh -- But since I'm not trying to impress anybody in The Software Big Top, I'd rather walk the wire using a big pole, a safety harness, a net, and with the wire not more than 3 feet off the ground. -- Grant Griffin, comp.lang.python
On 7/6/05, Phillip J. Eby <pje@telecommunity.com> wrote:
Here's a patch to setuptools that appears to fix the problem (by not running imported scripts as __main__), and it's probably a good idea to add it to setuptools in any case. Meanwhile, however, somebody should probably tell the py folks that _findpy is a horrible, *horrible* hack and should be shot. :)
I just gave the patch a try. I just wanted to confirm that it's behaving the same way for me that it did for you. Running the py.test script no longer has trouble finding py, because of your patch. However, it still doesn't run (due to other things that py.test is doing). Specifically: py.error.ENOENT: [No such file or directory]: /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py-0.8.0_alpha1-py2.4.egg/py/test/defaultconftest.py Is that what you saw, or did py.test actually run for you? Kevin
At 08:58 AM 7/7/2005 -0400, Kevin Dangoor wrote:
On 7/6/05, Phillip J. Eby <pje@telecommunity.com> wrote:
Here's a patch to setuptools that appears to fix the problem (by not running imported scripts as __main__), and it's probably a good idea to add it to setuptools in any case. Meanwhile, however, somebody should probably tell the py folks that _findpy is a horrible, *horrible* hack and should be shot. :)
I just gave the patch a try. I just wanted to confirm that it's behaving the same way for me that it did for you. Running the py.test script no longer has trouble finding py, because of your patch. However, it still doesn't run (due to other things that py.test is doing). Specifically:
py.error.ENOENT: [No such file or directory]: /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py-0.8.0_alpha1-py2.4.egg/py/test/defaultconftest.py
Is that what you saw, or did py.test actually run for you?
Yes, it actually ran, and tried to test setuptools. :) So I gave it the --help option and it showed help. That's all I did with it. I was using Windows Python 2.3.
On Jul 7, 2005, at 8:58 AM, Kevin Dangoor wrote:
On 7/6/05, Phillip J. Eby <pje@telecommunity.com> wrote:
Here's a patch to setuptools that appears to fix the problem (by not running imported scripts as __main__), and it's probably a good idea to add it to setuptools in any case. Meanwhile, however, somebody should probably tell the py folks that _findpy is a horrible, *horrible* hack and should be shot. :)
I just gave the patch a try. I just wanted to confirm that it's behaving the same way for me that it did for you. Running the py.test script no longer has trouble finding py, because of your patch. However, it still doesn't run (due to other things that py.test is doing). Specifically:
py.error.ENOENT: [No such file or directory]: /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ site-packages/py-0.8.0_alpha1-py2.4.egg/py/test/defaultconftest.py
I think this is due to the py library using __file__ and path operations instead of pkg_resources to load package data. I wasn't able to run it within an egg. If you crack the egg with something like the following, it seems to work fine:: cd /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages mv py-0.8.0_alpha1-py2.4.egg py-0.8.0_alpha1-py2.4.egg.zip mkdir py-0.8.0_alpha1-py2.4.egg cd py-0.8.0_alpha1-py2.4.egg unzip ../py-0.8.0_alpha1-py2.4.egg.zip Now you should be able to run everything and as a kinda-egg (e.g. metadata and scripts are available). Of course, there's not much value in using setuptools at all at this point. :) I think the best path for getting the py lib to work with easy_install would be to just fix up their distutils setup and build a normal tar.gz source distributions. We can worry about porting the code to use pkg_resources at a later time. They've chosen to employ some interesting techniques for distribution, however, so I'm not sure how bad the problem is. Ryan Tomayko rtomayko@gmail.com http://naeblis.cx/rtomayko/
On 7/7/05, Ryan Tomayko <rtomayko@gmail.com> wrote:
cd /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages mv py-0.8.0_alpha1-py2.4.egg py-0.8.0_alpha1-py2.4.egg.zip mkdir py-0.8.0_alpha1-py2.4.egg cd py-0.8.0_alpha1-py2.4.egg unzip ../py-0.8.0_alpha1-py2.4.egg.zip
Now you should be able to run everything and as a kinda-egg (e.g. metadata and scripts are available). Of course, there's not much value in using setuptools at all at this point. :)
Yep. Of course, I already had a running py lib, I was just turning some parts used by my project into eggs.
I think the best path for getting the py lib to work with easy_install would be to just fix up their distutils setup and build a normal tar.gz source distributions. We can worry about porting the code to use pkg_resources at a later time. They've chosen to employ some interesting techniques for distribution, however, so I'm not sure how bad the problem is.
That's true... At least py lib is pure python, so you can easy_install it without having to have a functional C compiler. I'll give this a whirl on another day... Kevin
On Jul 6, 2005, at 3:29 PM, Kevin Dangoor wrote:
This is not wholly surprising, but py.test doesn't appear to run from an egg. (I say it's not surprising, given that py is doing its own import trickery...) The way it fails is interesting. I can import py from a python prompt, but not from the py.test script.
See also: <http://mail.python.org/pipermail/distutils-sig/2005-June/004638.html> Ryan Tomayko rtomayko@gmail.com http://naeblis.cx/rtomayko/
On 7/6/05, Ryan Tomayko <rtomayko@gmail.com> wrote:
See also:
<http://mail.python.org/pipermail/distutils-sig/2005-June/004638.html>
That's funny. I was looking around a little in the distutils archive earlier today, and I happened to miss that one. Nice to know that I'm not the only one who'd like to see an egg of py.test. Kevin
participants (4)
-
Kevin Dangoor
-
Michael Hudson
-
Phillip J. Eby
-
Ryan Tomayko