From aff7e8d436e86d3f0c641793a123054549523294 Mon Sep 17 00:00:00 2001
From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Fri, 21 Sep 2007 13:40:28 -0700
Subject: [PATCH] setup: alas, pywin32 doesn't actually work as an
 easy_install; also make dependency missing errors more useful

---
 Makefile    | 28 +++++++++++++++++++++++-----
 README      | 23 ++++++++++++-----------
 calcdeps.py |  5 +----
 3 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/Makefile b/Makefile
index 7282d599..8cf620ee 100644
--- a/Makefile
+++ b/Makefile
@@ -60,7 +60,7 @@ TRIAL=$(PYTHON) -u "$(TRIALPATH)" --rterrors $(REACTOROPT)
 
 # build-deps wants setuptools to have been built first. It's easiest to
 # accomplish this by depending upon the tahoe compile.
-build-deps: .built
+build-deps: .built check-twisted-dep
 	mkdir -p "$(SUPPORTLIB)"
 	PYTHONPATH="$(PYTHONPATH)$(PATHSEP)$(SUPPORTLIB)$(PATHSEP)." \
          $(PYTHON) misc/dependencies/build-deps-setup.py install \
@@ -103,17 +103,35 @@ endif
 
 # TESTING
 
-.PHONY: check-deps test test-figleaf figleaf-output
+.PHONY: check-deps check-twisted-dep check-pywin32-dep signal-error-deps, signal-error-twisted-dep, signal-error-pywin32-dep, test test-figleaf figleaf-output
 
 
-signal-error:
+signal-error-deps:
 	@echo "ERROR: Not all of Tahoe's dependencies are in place.  Please \
 see the README for help on installing dependencies."
 	exit 1
 
-check-deps:
+signal-error-twisted-dep:
+	@echo "ERROR: Before running \"make build-deps\" you have to ensure that \
+Twisted is installed (including its zope.interface dependency).  Twisted and \
+zope.interface are required for the automatic installation of certain other \
+libraries that Tahoe requires).  Please see the README for details."
+	exit 1
+
+signal-error-pywin32-dep:
+	@echo "ERROR: the pywin32 dependency is not in place.  Please see the README \
+for help on installing dependencies."
+	exit 1
+
+check-deps: check-twisted-dep check-pywin32-dep
 	$(PP) \
-	 $(PYTHON) -c 'import allmydata, zfec, foolscap, simplejson, nevow, OpenSSL' || $(MAKE) signal-error
+	 $(PYTHON) -c 'import allmydata, zfec, foolscap, simplejson, nevow, OpenSSL' || $(MAKE) signal-error-deps
+
+check-twisted-dep:
+	$(PYTHON) -c 'import twisted, zope.interface' || $(MAKE) signal-error-twisted-dep
+
+check-pywin32-dep:
+	$(PYTHON) -c 'import win32process' || $(MAKE) signal-error-pywin32-dep
 
 .checked-deps:
 	$(MAKE) check-deps
diff --git a/README b/README
index ee9c879d..58b7c3d5 100644
--- a/README
+++ b/README
@@ -77,10 +77,22 @@ apt-get install gcc make python-dev python-twisted python-pyopenssl".
    To install PyOpenSSL on Windows-native, download this:
    http://allmydata.org/source/pyOpenSSL-0.6.win32-py2.5.exe
 
+   or for Python 2.4, this:
+
+   http://allmydata.org/source/pyOpenSSL-0.6.win32-py2.4.exe
+
    To install PyOpenSSL on Windows-cygwin, install the OpenSSL development
    libraries with the cygwin package management tool, then get the pyOpenSSL
    source code, cd into it, and run "python ./setup.py install".
 
+ + the pywin32 package: required only on Windows
+
+   http://sourceforge.net/projects/pywin32/
+
+   (Tested with build 210, and known to not work with build 204.
+   Feedback with details of other builds is greatly appreciated.)
+
+
 In addition, the following Python packages are required, but they will
 normally be automatically installed as a side effect of installing Tahoe.
 
@@ -132,17 +144,6 @@ normally be automatically installed as a side effect of installing Tahoe.
    Python Package Index (PyPI), so it will be automatically installed when
    you install Tahoe (see INSTALLING).
 
- + the pywin32 package: required only on Windows
-
-   http://sourceforge.net/projects/pywin32/
-
-   (Tested with build 210, and known to not work with build 204.
-   Feedback with details of other builds is greatly appreciated.)
-
-   pywin32 is packaged in a setuptools-compatible way and included in the
-   Python Package Index (PyPI), so it will be automatically installed when
-   you install Tahoe (see INSTALLING).
-
 
 GETTING THE SOURCE CODE:
 
diff --git a/calcdeps.py b/calcdeps.py
index e2090bb6..66f98803 100644
--- a/calcdeps.py
+++ b/calcdeps.py
@@ -10,7 +10,7 @@ import os.path, sys
 
 dependency_tarballs=[ os.path.join("misc", "dependencies", fn)
                       for fn in os.listdir(os.path.join("misc", "dependencies"))
-                      if fn.endswith(".tar.gz") or fn.endswith(".zip") ]
+                      if fn.endswith(".tar.gz") ]
 
 dependency_links=["http://allmydata.org/trac/tahoe/wiki/Dependencies"] + dependency_tarballs
 
@@ -27,9 +27,6 @@ install_requires=["zfec >= 1.0.3",
                   "zope.interface >= 3.0",
                   ]
 
-if sys.platform == 'win32':
-    install_requires.append("pywin32")
-    
 
 # Ubuntu Dapper includes nevow-0.6.0 and twisted-2.2.0, both of which work.
 # However, setuptools doesn't know about them, so our install_requires=
-- 
2.45.2