[Distutils] Install egg from SVN sources => AttributeError: 'module' object has no attribute '__getstate__'
Eemeli Kantola
eemeli.kantola at iki.fi
Thu Dec 17 17:10:26 CET 2009
Hi all,
I'm getting a crash in setuptools-0.6c11-py2.6 when trying to install
an egg directly from SVN sources. This happens both on OSX and Ubuntu,
versions:
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) [GCC 4.2.1 (Apple
Inc. build 5646)] on darwin
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2
Command and stack trace:
$ sudo easy_install
https://asibsync.svn.sourceforge.net/svnroot/asibsync/src/asilib
Downloading https://asibsync.svn.sourceforge.net/svnroot/asibsync/src/asilib
Doing subversion checkout from
https://asibsync.svn.sourceforge.net/svnroot/asibsync/src/asilib to
/tmp/easy_install-WYCRs6/asilib
Processing asilib
Running setup.py -q bdist_egg --dist-dir
/tmp/easy_install-WYCRs6/asilib/egg-dist-tmp-6_PSoY
Traceback (most recent call last):
File "/usr/local/bin/easy_install", line 8, in <module>
load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
File "/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py",
line 1712, in main
File "/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py",
line 1700, in with_ei_usage
File "/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py",
line 1716, in <lambda>
File "/usr/lib/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py",
line 211, in run
File "/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py",
line 422, in easy_install
File "/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py",
line 476, in install_item
File "/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py",
line 655, in install_eggs
File "/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py",
line 930, in build_and_install
File "/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py",
line 919, in run_setup
File "/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg/setuptools/sandbox.py",
line 52, in run_setup
AttributeError: 'module' object has no attribute '__getstate__'
This is the first time I look at setuptools' code, but it seems the
problem goes away when I conditionally disabled the __getstate__ and
__setstate__ lines in sandbox.py, as per this batch:
--- sandbox.py.old 2009-10-19 13:35:44.000000000 +0300
+++ sandbox.py 2009-12-17 17:49:10.000000000 +0200
@@ -49,7 +49,8 @@
if not os.path.isdir(temp_dir): os.makedirs(temp_dir)
save_tmp = tempfile.tempdir
save_modules = sys.modules.copy()
- pr_state = pkg_resources.__getstate__()
+ if hasattr(pkg_resources, '__getstate__'):
+ pr_state = pkg_resources.__getstate__()
try:
tempfile.tempdir = temp_dir; os.chdir(setup_dir)
try:
@@ -69,7 +70,8 @@
raise
# Normal exit, just return
finally:
- pkg_resources.__setstate__(pr_state)
+ if hasattr(pkg_resources, '__getstate__'):
+ pkg_resources.__setstate__(pr_state)
sys.modules.update(save_modules)
for key in list(sys.modules):
if key not in save_modules: del sys.modules[key]
So is this a bug? My fix is presumably only treating the symptoms,
because I've got only little clue of what is happening in the code...
Best,
Eemeli Kantola
More information about the Distutils-SIG
mailing list