From ae6cc14a2da9d7f1f113b62a3c212d07d0d5eff8 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@allmydata.com>
Date: Wed, 10 Sep 2008 16:34:32 -0700
Subject: [PATCH] Makefile: give setup.py develop a '--site-dirs' arg to work
 around the #249 setuptools bug which causes us to unnecessarily rebuild
 pyopenssl and other support libs installed via debian's python-support.
 Should be harmless on other platforms.

---
 Makefile | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 23855910..94c5cb4c 100644
--- a/Makefile
+++ b/Makefile
@@ -41,6 +41,7 @@ else
 	SUPPORTLIB = $(SUPPORT)/lib/$(PYVER)/site-packages
 	SRCPATH := $(shell pwd)/src
 	CHECK_PYWIN32_DEP := 
+	SITEDIRARG = --site-dirs=/var/lib/python-support/$(PYVER)
 endif
 
 ifneq ($(REACTOR),)
@@ -118,9 +119,15 @@ build: src/allmydata/_version.py
 	-$(MAKE) build-once
 	$(MAKE) build-once
 
+# setuptools has a bug (Issue17, see tahoe #229 for details) that causes it
+# to mishandle dependencies that are installed in non-site-directories,
+# including the /var/lib/ place that debian's python-support system uses. We
+# add this debian/ubuntu-specific directory (via $SITEDIRARG) to the setup.py
+# command line to work around this. Some day this will probably be fixed in
+# setuptools.
 build-once:
 	mkdir -p "$(SUPPORTLIB)"
-	$(PP) $(PYTHON) ./setup.py develop --prefix="$(SUPPORT)"
+	$(PP) $(PYTHON) ./setup.py develop --prefix="$(SUPPORT)" $(SITEDIRARG)
 	chmod +x bin/tahoe
 	touch .built
 
-- 
2.45.2