Using pkg_resources.require() like this also apparently allows people to install multiple different versions of packages on their system and tahoe (if pkg_resources is available to it) will import the version of the package that it requires. I haven't tested this feature.
@echo
exit 1
-check-all-deps: check-deps
+check-auto-deps:
$(PP) \
- $(PYTHON) -c 'import allmydata, zfec, foolscap, simplejson, nevow, pycryptopp' || $(MAKE) signal-error-deps
+ $(PYTHON) -c 'import _auto_deps ; _auto_deps.require_auto_deps()' || $(MAKE) signal-error-deps
+
+check-all-deps: check-deps check-auto-deps
check-twisted-dep:
$(PYTHON) -c 'import twisted, zope.interface' || $(MAKE) signal-error-twisted-dep
--- /dev/null
+install_requires=["zfec >= 1.3.0",
+ "foolscap >= 0.2.3",
+ "simplejson >= 1.7.3",
+ "pycryptopp >= 0.2.9",
+ "nevow >= 0.6.0",
+ "zope.interface >= 3.1.0",
+ ]
+
+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:
+ pkg_resources.require(requirement)
+ for requirement in install_requires:
+ name, cmpop, verstr = requirement.split()
+ __import__(name)
+
+if __name__ == "__main__":
+ require_auto_deps()
from setuptools import Extension, find_packages, setup
+# Make the dependency-version-requirement, which is used by the Makefile at
+# build-time, also available to the app at runtime:
+import shutil
+try:
+ shutil.copyfile("_auto_deps.py", os.path.join("src", "allmydata", "_auto_deps.py"))
+except EnvironmentError:
+ # Nevermind then -- perhaps it is already in place and in any case we can do
+ # without it.
+ pass
+
trove_classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Console",
if not os.path.exists('PKG-INFO'):
setup_requires.append('setuptools_darcs >= 1.1.0')
-install_requires=["zfec >= 1.3.0",
- "foolscap >= 0.2.3",
- "simplejson >= 1.7.3",
- "pycryptopp >= 0.2.9",
- "nevow >= 0.6.0",
- "zope.interface >= 3.1.0",
- ]
+import _auto_deps
setup(name='allmydata-tahoe',
version=verstr,
packages=find_packages("src"),
classifiers=trove_classifiers,
test_suite="allmydata.test",
- install_requires=install_requires,
+ install_requires=_auto_deps.install_requires,
include_package_data=True,
setup_requires=setup_requires,
dependency_links=dependency_links,
del hush_pyflakes
try:
- import pkg_resources
+ import _auto_deps
except ImportError:
- # nevermind
+ # Never mind -- even if we can't use pkg_resources to check the required
+ # version numbers and to select the right one in the case that more than one
+ # version is available, we can still barrel on and if "import thingie" gives
+ # us a thingie that works, we're okay.
pass
else:
- pkg_resources.require("zfec >= 1.3.0")
- pkg_resources.require("foolscap >= 0.2.3")
- pkg_resources.require("simplejson >= 1.7.3")
- pkg_resources.require("pycryptopp >= 0.2.9")
- pkg_resources.require("nevow >= 0.6.0")
- pkg_resources.require("zope.interface >= 3.1.0")
+ _auto_deps.require_auto_deps()
def get_package_versions():
import OpenSSL, allmydata, foolscap, nevow, pycryptopp, simplejson, twisted, zfec