mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-07 10:56:49 +00:00
setup: don't try __import__(name) in _auto_deps.py
This happens to work, because all of our "distribution" (i.e. distributable packaged Python code) names to coincide with all of their "package" (i.e. a directory with a __init__.py in it, which is "import"-able) names, except, I think for Twisted on Brian's debian sid system. But there's no reason why it should always work, and the only reason for that __import__() was to give us an explicit error message indicating missing requirements in the case that pkg_resources isn't importable or that the requirements don't have correct .egg-info metadata. So, by removing this stanza we may allow certain places to get a more ad-hoc failure message, i.e. an ImportError from somewhere, instead of an ImportError from _auto_deps.py, but that's okay. Note that dependencies which do not have their .egg-info metadata with them are increasingly rare, since Python 2.5 distutils creates the .egg-info file by default, and Linux distributions have stopped their former practice of actively deleting the .egg-info files.
This commit is contained in:
parent
9cd5a46442
commit
dbde3d5632
@ -26,20 +26,14 @@ def require_auto_deps():
|
||||
pkg_resources.require(requirement)
|
||||
except pkg_resources.DistributionNotFound:
|
||||
# there is no .egg-info present for this requirement, which
|
||||
# either means that it isn't installed, or it is installed in
|
||||
# a way that pkg_resources can't find it (but regular python
|
||||
# might). The __import__ below will pass the second case,
|
||||
# which is good enough for us. There are several
|
||||
# distributions which provide our dependencies just fine, but
|
||||
# they don't ship .egg-info files. Note that if there *is* an
|
||||
# .egg-info file, but it indicates an older version, then
|
||||
# we'll get a VersionConflict error instead of
|
||||
# DistributionNotFound.
|
||||
# either means that it isn't installed, or it is installed in a
|
||||
# way that pkg_resources can't find it (but regular python
|
||||
# might). There are several older Linux distributions which
|
||||
# provide our dependencies just fine, but they don't ship
|
||||
# .egg-info files. Note that if there *is* an .egg-info file,
|
||||
# but it shows a too-old version, then we'll get a
|
||||
# VersionConflict error instead of DistributionNotFound.
|
||||
pass
|
||||
for requirement in install_requires:
|
||||
reqparts = requirement.split()
|
||||
name = reqparts[0]
|
||||
__import__(name)
|
||||
|
||||
if __name__ == "__main__":
|
||||
require_auto_deps()
|
||||
|
Loading…
x
Reference in New Issue
Block a user