[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /usr/local is loved by Debian Python people?



ok -- here is my tentative cruel patch as a proof of concept. It should
not alter current behavior, but would allow to control for it.

See it attached

> configuration (.ini) needs to be under /etc, and that is what I am
> aiming at...

-- 
Yaroslav Halchenko
Research Assistant, Psychology Department, Rutgers-Newark
Student  Ph.D. @ CS Dept. NJIT
Office: (973) 353-1412 | FWD: 82823 | Fax: (973) 353-1171
        101 Warren Str, Smith Hall, Rm 4-105, Newark NJ 07102
WWW:     http://www.linkedin.com/in/yarik        
--- /etc/python/debian_config.orig	2009-02-03 10:26:30.000000000 -0500
+++ /etc/python/debian_config	2009-02-03 10:40:03.000000000 -0500
@@ -1,3 +1,7 @@
 [DEFAULT]
 # how to byte-compile (comma separated: standard, optimize)
 byte-compile = standard
+
+# either to add /usr/local/lib/pythonX.X/site-packages
+# to default sys.path. 
+path-add-local = true
--- /usr/lib/python2.5/site.py.orig2	2009-02-03 10:25:45.000000000 -0500
+++ /usr/lib/python2.5/site.py	2009-02-03 10:39:14.000000000 -0500
@@ -171,7 +171,17 @@
     prefixes = [sys.prefix]
     if sys.exec_prefix != sys.prefix:
         prefixes.append(sys.exec_prefix)
-    prefixes.insert(0, '/usr/local')
+    try:
+        cfg_pref = 'path-add-local'
+        path_add_local = \
+            bool({'0':0,  'false':0, '1':1, 'true':1}[
+               [l.replace(cfg_pref, '').strip(' =\t\n').lower()
+                for l in open('/etc/python/debian_config').readlines()
+                if l.startswith(cfg_pref)][-1]])
+    except:
+        path_add_local = False
+    if path_add_local:
+        prefixes.insert(0, '/usr/local')
     for prefix in prefixes:
         if prefix:
             if sys.platform in ('os2emx', 'riscos'):

Attachment: signature.asc
Description: Digital signature


Reply to: