summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--Makefile8
1 files changed, 6 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index dc030b5a..57a3f8f2 100644
--- a/Makefile
+++ b/Makefile
@@ -20,8 +20,12 @@ DOCDIR ?= doc/pydoc
 PREFIX ?= /usr
 MANPREFIX ?= /share/man
 PYOPTIMIZE ?= 1
-PYTHON_SITE_DEST ?= $(shell $(PYTHON) -c 'import sys; sys.stdout.write( \
-	[p for p in sys.path if "site" in p][0])' 2> /dev/null)
+# this finds the shortest item in sys.path that contains "site" or "dist"
+# for example: /usr/lib/python2.6/site-packages
+PYTHON_SITE_DEST ?= $(shell $(PYTHON) -c 'import sys; \
+	dests = sorted([p for p in sys.path if "site" in p or "dist" in p], \
+	key=lambda dest: len(dest)); \
+	sys.stdout.write(dests[0])' 2> /dev/null)
 BMCOUNT ?= 5  # how often to run the benchmarks?
 
 CWD = $(shell pwd)
a> 100 101 102 103 104 105 106 107 108 109 110