From eaed7a06906106afe3072f1c699870761457a65f Mon Sep 17 00:00:00 2001
From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Tue, 22 Jan 2008 17:42:54 -0700
Subject: [PATCH] setup: use setuptools (if it is present) at run-time to give
 a specific error message on startup if a too-old version of a dependency is
 installed

---
 Makefile                  |  7 +++----
 setup.py                  |  2 +-
 src/allmydata/__init__.py | 13 +++++++++++++
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 7725ec10..6efdd971 100644
--- a/Makefile
+++ b/Makefile
@@ -32,8 +32,6 @@ else
  CHECK_PYWIN32_DEP := 
 endif
 
-TRIALCMD = $(shell PYTHONPATH="$(PYTHONPATH)$(PATHSEP)$(SRCPATH)" $(PYTHON) misc/find_trial.py)
-
 ifeq ($(PLAT),cygwin)
 REACTOR = poll
 endif
@@ -44,8 +42,6 @@ else
 	REACTOROPT := 
 endif
 
-TRIAL=PYTHONUNBUFFERED=1 $(TRIALCMD) --rterrors $(REACTOROPT)
-
 # The following target is here because I don't know how to tell the buildmaster
 # to start instructing his slaves to "build" instead of instructing them to
 # "build-deps".  --Z
@@ -61,6 +57,9 @@ ifneq ($(PYTHONPATH),)
 endif
 PP=PYTHONPATH="$(SRCPATH)$(PATHSEP)$(PYTHONPATH)$(PATHSEP)$(EGGSPATH)"
 
+TRIALCMD = $(shell $(PP) $(PYTHON) misc/find_trial.py)
+TRIAL=PYTHONUNBUFFERED=1 $(TRIALCMD) --rterrors $(REACTOROPT)
+
 .PHONY: make-version build
 
 # The 'darcsver' setup.py command comes in the 'darcsver' package:
diff --git a/setup.py b/setup.py
index d995a9f6..8ede2810 100644
--- a/setup.py
+++ b/setup.py
@@ -101,7 +101,7 @@ setup_requires.append('darcsver >= 1.0.0')
 # that this is itself a source distribution.
 # http://pypi.python.org/pypi/setuptools_darcs
 if not os.path.exists('PKG-INFO'):
-    setup_requires.append('setuptools_darcs >= 1.0.5')
+    setup_requires.append('setuptools_darcs >= 1.1.0')
 
 install_requires=["zfec >= 1.3.0",
                   "foolscap >= 0.2.3",
diff --git a/src/allmydata/__init__.py b/src/allmydata/__init__.py
index e40a3043..2d6e7340 100644
--- a/src/allmydata/__init__.py
+++ b/src/allmydata/__init__.py
@@ -19,6 +19,19 @@ except ImportError:
 hush_pyflakes = __version__
 del hush_pyflakes
 
+try:
+    import pkg_resources
+except ImportError:
+    # nevermind
+    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")
+
 def get_package_versions():
     import OpenSSL, allmydata, foolscap, nevow, pycryptopp, simplejson, twisted, zfec
     setuptools_version = "unavailable"
-- 
2.45.2