tahoe-lafs/_auto_deps.py
Zooko O'Whielacronx dbde3d5632 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.
2008-04-18 12:17:22 -07:00

40 lines
1.5 KiB
Python

install_requires=["zfec >= 1.1.0",
"foolscap >= 0.2.5",
"simplejson >= 1.4",
"pycryptopp >= 0.2.8",
"nevow >= 0.6.0",
"zope.interface",
"twisted >= 2.4.0",
# we require 0.6c8 to build, but can handle older versions
# to run
"setuptools >= 0.6a9",
]
import sys
if hasattr(sys, 'frozen'):
install_requires=[]
def require_auto_deps():
try:
import pkg_resources
except:
# Then we can't assert that the versions of these packages are the right
# versions, but we can still try to use them anyway...
pass
else:
for requirement in install_requires:
try:
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). 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
if __name__ == "__main__":
require_auto_deps()