[issue148] setup_requires dependency removal causes installation failure

New submission from Ian Wienand: I noticed the following issue installing the keyring package [1] --- Downloading/unpacking keyring Downloading keyring-1.2.2.zip (79Kb): 79Kb downloaded Running setup.py egg_info for package keyring zip_safe flag not set; analyzing archive contents... Installed /tmp/easy_install-u0ESXQ/pytest-runner-1.2/hgtools-2.0.3-py2.6.egg Installed /root/build/keyring/pytest_runner-1.2-py2.6.egg Traceback (most recent call last): File "<string>", line 14, in <module> File "/root/build/keyring/setup.py", line 114, in <module> setup_mod.setup(**setup_params) File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup dist.run_commands() File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands self.run_command(cmd) File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command cmd_obj.run() File "<string>", line 12, in replacement_run File "/usr/lib/python2.6/site-packages/setuptools/command/egg_info.py", line 254, in find_sources mm.run() File "/usr/lib/python2.6/site-packages/setuptools/command/egg_info.py", line 308, in run self.add_defaults() File "/usr/lib/python2.6/site-packages/setuptools/command/egg_info.py", line 335, in add_defaults rcfiles = list(walk_revctrl()) File "/usr/lib/python2.6/site-packages/setuptools/command/sdist.py", line 46, in walk_revctrl for item in ep.load()(dirname): File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1948, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) ImportError: No module named hgtools.plugins Complete output from command python setup.py egg_info: zip_safe flag not set; analyzing archive contents... --- The dependency chain works out to be keyring -> pytest-runner -> hgtools hgtools is a "setup_requires" dependency for pytest-runner. This means the following code is run: /usr/lib/python2.6/site-packages/setuptools/dist.py --- class Distribution(_Distribution): def __init__(): ... if attrs and 'setup_requires' in attrs: self.fetch_build_eggs(attrs.pop('setup_requires')) def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" from pkg_resources import working_set, parse_requirements for dist in working_set.resolve( parse_requirements(requires), installer=self.fetch_build_egg ): working_set.add(dist) --- That goes fine, hgtools gets installed into whatever /tmp directory, is added to sys.path and pytest-runner is happy. However, the temporary hgtools has registered some entry points with its distribution object in working_set. It then disappears but doesn't remove itself. Later on in sdist.py we have --- def walk_revctrl(dirname=''): """Find all files under revision control""" for ep in pkg_resources.iter_entry_points('setuptools.file_finders'): for item in ep.load()(dirname): yield item ---- pkg_resources.iter_entry_points walks all the distribution objects in working_set, finds hgtools' entry points for this "setuptools.file_finders" stuff, tries to call it and a backtrace ensues because that temporary directory with hgtools has now gone. This also explains why it works when run the second time around; pytest-runner is already there, so we don't need to look at its setup_requires and the problematic distribution doesn't get added. Somehow or other, hgtools needs to get removed from the working_set in dist.py before it is removed? [1] https://bugzilla.redhat.com/show_bug.cgi?id=924038 ---------- messages: 709 nosy: iwienand priority: bug status: unread title: setup_requires dependency removal causes installation failure _______________________________________________ Setuptools tracker <setuptools@bugs.python.org> <http://bugs.python.org/setuptools/issue148> _______________________________________________
participants (1)
-
Ian Wienand