From 07be2e4ffbafa554166150bbd2d4942c46e3aee1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20O=C5=BCarowski?= <piotr@debian.org>
Date: Sun, 6 Feb 2011 19:57:43 +0100
Subject: [PATCH] * pycompile:   - --exclude now works with private dirs   -
 use /usr/bin/pythonX.Y rather than pythonX.Y (to avoid /usr/local    
 interpreters)

---
 debian/changelog | 6 +++++-
 pycompile        | 7 ++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index fab6cfb..ed2af22 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,7 +6,11 @@ python-defaults (2.6.6-11) UNRELEASED; urgency=low
     - replace a file with a symlink also if there's a matching one in
       pyshared directory already
     - add support for DH_OPTIONS env. variable
-  * pycompile: --exclude now works with private dirs
+  * pycompile:
+    - --exclude now works with private dirs
+    - use /usr/bin/pythonX.Y rather than pythonX.Y (to avoid /usr/local
+      interpreters)
+    
 
  -- Piotr Ożarowski <piotr@debian.org>  Sat, 15 Jan 2011 21:14:38 +0100
 
diff --git a/pycompile b/pycompile
index 3e1b5a1..8c90fe5 100755
--- a/pycompile
+++ b/pycompile
@@ -125,11 +125,12 @@ def get_exclude_patterns_from_dir(name='/usr/share/python/bcep/'):
 
 def get_exclude_patterns(directory='/', patterns=None, versions=None):
     """Return patterns for files that shouldn't be compiled in given dir."""
+    if versions is not None:
+        # make sure it's a set (debsorted returns a list)
+        versions = set(versions)
     if patterns:
         if versions is None:
             versions = set(SUPPORTED)
-        else:
-            versions = set(versions)
         patterns = [('re', versions, directory, i) for i in patterns]
     else:
         patterns = []
@@ -171,7 +172,7 @@ def filter_files(files, e_patterns, compile_versions):
 def py_compile(version, optimize, workers):
     if not isinstance(version, basestring):
         version = vrepr(version)
-    cmd = "python%s%s -m py_compile -" \
+    cmd = "/usr/bin/python%s%s -m py_compile -" \
         % (version, '' if (__debug__ or not optimize) else ' -O')
     process = Popen(cmd, bufsize=1, shell=True,
                     stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
-- 
GitLab