[Distutils] Limitations of setup_requires

Joshua Boverhof JRBoverhof at lbl.gov
Sat Sep 30 01:47:17 CEST 2006


I included the "ZSI" package in "setup_requires" and  
"install_requires", but it isn't retrieved/installed before I use it  
via "make_generated_packages".

Here is what I'm doing:

class PGDistribution(_Distribution):
     """Indirection so that setuptools grabs "setup_requires"  
dependencies
     before calling "_make_generated_package()"
     """
     def finalize_options (self):
         if _make_generated_package() is True:
              self.packages = find_packages()
         _Distribution.finalize_options(self)

What I'm experiencing doesn't seem to jive with the documentation:

setup_requires
A string or list of strings specifying what other distributions need  
to be present in order for the setup script to run.

So I get a big traceback because "fetch_build_egg" uses  
"self.__class__" to construct another Distribution instance, this  
time mine, and this ends up calling my "finalize_options" before I  
want it to...

There doesn't seem to be a nice way to deal with this issue, I used a  
boolean in the constructor to make it work, I'd like to be able to  
specify a different Distribution class for my "distribution" and  
another for all the stuff setuptools installs.

$ python setup.py installTraceback (most recent call last):
   File "setup.py", line 215, in <module>
     main()
   File "setup.py", line 209, in main
     dependency_links = [
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/distutils/core.py", line 112, in setup
     _setup_distribution = dist = klass(attrs)
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/setuptools-0.6c3-py2.5.egg/setuptools/ 
dist.py", line 219, in __init__
     self.fetch_build_eggs(attrs.pop('setup_requires'))
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/setuptools-0.6c3-py2.5.egg/setuptools/ 
dist.py", line 243, in fetch_build_eggs
     parse_requirements(requires), installer=self.fetch_build_egg
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/setuptools-0.6c3-py2.5.egg/pkg_resources.py",  
line 481, in resolve
     dist = best[req.key] = env.best_match(req, self, installer)
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/setuptools-0.6c3-py2.5.egg/pkg_resources.py",  
line 717, in best_match
     return self.obtain(req, installer) # try and download/install
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/setuptools-0.6c3-py2.5.egg/pkg_resources.py",  
line 729, in obtain
     return installer(requirement)
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/setuptools-0.6c3-py2.5.egg/setuptools/ 
dist.py", line 264, in fetch_build_egg
     dist = self.__class__({'script_args':['easy_install']})
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/setuptools-0.6c3-py2.5.egg/setuptools/ 
dist.py", line 223, in __init__
     _Distribution.__init__(self,attrs)
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/distutils/dist.py", line 267, in __init__
     self.finalize_options()
   File "setup.py", line 155, in finalize_options
     if _make_generated_package() is True:
   File "setup.py", line 124, in _make_generated_package
     _create_generated_files(cp.items(TYPES_SEC), services=False,  
stubs=False, cp=cp, web2=False)
   File "setup.py", line 52, in _create_generated_files
     from ZSI.wstools.WSDLTools import WSDLReader
ImportError: No module named ZSI.wstools.WSDLTools



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/distutils-sig/attachments/20060929/e7d1f32a/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2526 bytes
Desc: not available
Url : http://mail.python.org/pipermail/distutils-sig/attachments/20060929/e7d1f32a/attachment.bin 


More information about the Distutils-SIG mailing list