Limitations of setup_requires

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

At 04:47 PM 9/29/2006 -0700, Joshua Boverhof wrote:
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)
I don't understand what the purpose of this code is. find_packages() is not going to give you a different result by being called here, than if you just called it in setup().

Yes it is since I'm "generating" code when I do "make_generated_packages". On Oct 1, 2006, at 5:44 PM, Phillip J. Eby wrote:
At 04:47 PM 9/29/2006 -0700, Joshua Boverhof wrote:
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)
I don't understand what the purpose of this code is. find_packages () is not going to give you a different result by being called here, than if you just called it in setup().

At 06:20 PM 10/1/2006 -0700, Joshua Boverhof wrote:
Yes it is since I'm "generating" code when I do "make_generated_packages".
Okay, then before you call setup() in your setup script, create an instance of setuptools.dist.Distribution() that has setup_requires set, but doesn't include any packages; and don't do anything besides create it. Then, run your package generation, and finally run setup(). You do not need a custom Distribution subclass, as far as I can tell. The only disadvantage to doing it this way is that if somebody does "setup.py --help", your package is still going to do dependency downloads and code generation. But then, that also happens the way you're doing it now.

I have a package specified in both "setup_requires" and "install_requires", the package is downloaded and used during setup but it is never installed in site-packages like the other entry. This is happening on both my Mac and a Linux box. This fails for me with setuptools-0.6c3, python2.5, but works with w/ python2.4 Here is what I'm doing: install_requires=[ "ZSI >= 1.2.0rc2", "4Suite-XML >= 1.0rc4", ], setup_requires=[ "ZSI >= 1.2.0rc2", ], ssh1:%python setup.py install Now if I remove it from "setup_requires" and remove the egg (otherwise it does nothing): %rm ZSI-2.0_rc2-py2.5.egg install_requires=[ "ZSI >= 1.2.0rc2", "4Suite-XML >= 1.0rc4", ], setup_requires=[ ], boverhof@pabst(341)-ssh1:%rm ZSI-2.0_rc2-py2.5.egg boverhof@pabst(342)-ssh1:%rm -rf pyGridWare.egg-info/boverhof@pabst (343)-ssh1:%python setup.py install --force It now installs. Reading http://www.python.org/pypi/ZSI/2.0-rc2 Best match: ZSI 2.0-rc2 Downloading http://cheeseshop.python.org/packages/source/Z/ZSI/ ZSI-2.0-rc2.tar.gz#md5=25b3ab7a3ff8285d51c35c223359c060 Processing ZSI-2.0-rc2.tar.gz Running ZSI-2.0-rc2/setup.py -q bdist_egg --dist-dir /tmp/ easy_install-kps9vS/ZSI-2.0-rc2/egg-dist-tmp-pQbxQp zip_safe flag not set; analyzing archive contents... Adding ZSI 2.0-rc2 to easy-install.pth file Has anyone else noticed this behavior? -josh On Oct 1, 2006, at 6:40 PM, Phillip J. Eby wrote:
At 06:20 PM 10/1/2006 -0700, Joshua Boverhof wrote:
Yes it is since I'm "generating" code when I do "make_generated_packages".
Okay, then before you call setup() in your setup script, create an instance of setuptools.dist.Distribution() that has setup_requires set, but doesn't include any packages; and don't do anything besides create it. Then, run your package generation, and finally run setup(). You do not need a custom Distribution subclass, as far as I can tell.
The only disadvantage to doing it this way is that if somebody does "setup.py --help", your package is still going to do dependency downloads and code generation. But then, that also happens the way you're doing it now.

At 06:04 PM 10/2/2006 -0700, Joshua Boverhof wrote:
I have a package specified in both "setup_requires" and "install_requires", the package is downloaded and used during setup but it is never installed in site-packages like the other entry. This is happening on both my Mac and a Linux box.
This fails for me with setuptools-0.6c3, python2.5, but works with w/ python2.4
Interesting. My one theory of how this problem might be happening, should cause it to fail on *all* versions of Python. Are you sure that you don't just happen to already have ZSI installed in your python 2.4 site-packages directory? Thanks.
participants (2)
-
Joshua Boverhof
-
Phillip J. Eby