[126840] trunk/dports/lang

larryv at macports.org larryv at macports.org
Wed Oct 15 21:13:20 PDT 2014


Revision: 126840
          https://trac.macports.org/changeset/126840
Author:   larryv at macports.org
Date:     2014-10-15 21:13:20 -0700 (Wed, 15 Oct 2014)
Log Message:
-----------
python{27,3*}: Ignore local site-packages (#34763)

Beginning with 2.7, framework builds of CPython automatically add the
local site-packages directory (e.g., /Library/Python/2.7) to sys.path
(http://bugs.python.org/issue4865). Python 3.1 also adds user-local
site-packages (~/Library/Python/3.1). These behaviors conflict with
MacPorts' general policy of isolationism towards the host system.

Modified Paths:
--------------
    trunk/dports/lang/python27/Portfile
    trunk/dports/lang/python31/Portfile
    trunk/dports/lang/python32/Portfile
    trunk/dports/lang/python33/Portfile
    trunk/dports/lang/python34/Portfile

Added Paths:
-----------
    trunk/dports/lang/python27/files/omit-local-site-packages.patch
    trunk/dports/lang/python31/files/omit-local-site-packages.patch
    trunk/dports/lang/python32/files/omit-local-site-packages.patch
    trunk/dports/lang/python33/files/omit-local-site-packages.patch
    trunk/dports/lang/python34/files/omit-local-site-packages.patch

Modified: trunk/dports/lang/python27/Portfile
===================================================================
--- trunk/dports/lang/python27/Portfile	2014-10-16 03:08:24 UTC (rev 126839)
+++ trunk/dports/lang/python27/Portfile	2014-10-16 04:13:20 UTC (rev 126840)
@@ -8,7 +8,7 @@
 epoch               2
 # Remember to keep py27-tkinter and py27-gdbm's versions sync'd with this
 version             2.7.8
-revision            2
+revision            3
 
 set major           [lindex [split $version .] 0]
 set branch          [join [lrange [split ${version} .] 0 1] .]
@@ -38,7 +38,8 @@
                     patch-Lib-ctypes-macholib-dyld.py.diff \
                     patch-configure.diff \
                     patch-libedit.diff \
-                    patch-Include-pyport.h.diff
+                    patch-Include-pyport.h.diff \
+                    omit-local-site-packages.patch
 
 depends_lib         port:gettext \
                     port:zlib \

Added: trunk/dports/lang/python27/files/omit-local-site-packages.patch
===================================================================
--- trunk/dports/lang/python27/files/omit-local-site-packages.patch	                        (rev 0)
+++ trunk/dports/lang/python27/files/omit-local-site-packages.patch	2014-10-16 04:13:20 UTC (rev 126840)
@@ -0,0 +1,20 @@
+Index: Lib/site.py
+===================================================================
+--- Lib/site.py.orig
++++ Lib/site.py
+@@ -295,15 +295,6 @@ def getsitepackages():
+         else:
+             sitepackages.append(prefix)
+             sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
+-        if sys.platform == "darwin":
+-            # for framework builds *only* we add the standard Apple
+-            # locations.
+-            from sysconfig import get_config_var
+-            framework = get_config_var("PYTHONFRAMEWORK")
+-            if framework:
+-                sitepackages.append(
+-                        os.path.join("/Library", framework,
+-                            sys.version[:3], "site-packages"))
+     return sitepackages
+ 
+ def addsitepackages(known_paths):

Modified: trunk/dports/lang/python31/Portfile
===================================================================
--- trunk/dports/lang/python31/Portfile	2014-10-16 03:08:24 UTC (rev 126839)
+++ trunk/dports/lang/python31/Portfile	2014-10-16 04:13:20 UTC (rev 126840)
@@ -8,7 +8,7 @@
 epoch                   1
 # Remember to keep py31-tkinter and py31-gdbm's versions sync'd with this
 version                 3.1.5
-revision                1
+revision                2
 set major               [lindex [split $version .] 0]
 set branch              [join [lrange [split ${version} .] 0 1] .]
 categories              lang
@@ -34,7 +34,8 @@
                         patch-Lib-cgi.py.diff \
                         patch-Lib-distutils-dist.py.diff \
                         patch-setup.py-disabled_modules.diff \
-                        patch-libedit.diff
+                        patch-libedit.diff \
+                        omit-local-site-packages.patch
 
 # http://bugs.python.org/issue21811
 patchfiles-append       yosemite-configure-fixes.patch \

Added: trunk/dports/lang/python31/files/omit-local-site-packages.patch
===================================================================
--- trunk/dports/lang/python31/files/omit-local-site-packages.patch	                        (rev 0)
+++ trunk/dports/lang/python31/files/omit-local-site-packages.patch	2014-10-16 04:13:20 UTC (rev 126840)
@@ -0,0 +1,23 @@
+Index: Lib/site.py
+===================================================================
+--- Lib/site.py.orig
++++ Lib/site.py
+@@ -280,18 +280,6 @@ def addsitepackages(known_paths):
+             sitedirs.append(prefix)
+             sitedirs.append(os.path.join(prefix, "lib", "site-packages"))
+ 
+-        if sys.platform == "darwin":
+-            # for framework builds *only* we add the standard Apple
+-            # locations.
+-            if 'Python.framework' in prefix:
+-                sitedirs.append(
+-                    os.path.expanduser(
+-                        os.path.join("~", "Library", "Python",
+-                                     sys.version[:3], "site-packages")))
+-                sitedirs.append(
+-                        os.path.join("/Library", "Python",
+-                            sys.version[:3], "site-packages"))
+-
+     for sitedir in sitedirs:
+         if os.path.isdir(sitedir):
+             addsitedir(sitedir, known_paths)

Modified: trunk/dports/lang/python32/Portfile
===================================================================
--- trunk/dports/lang/python32/Portfile	2014-10-16 03:08:24 UTC (rev 126839)
+++ trunk/dports/lang/python32/Portfile	2014-10-16 04:13:20 UTC (rev 126840)
@@ -8,6 +8,7 @@
 epoch                   20120412
 # Remember to keep py32-tkinter and py32-gdbm's versions sync'd with this
 version                 3.2.6
+revision                1
 
 set major               [lindex [split $version .] 0]
 set branch              [join [lrange [split ${version} .] 0 1] .]
@@ -35,7 +36,8 @@
                         patch-Lib-distutils-dist.py.diff \
                         patch-configure.diff \
                         patch-setup.py-disabled_modules.diff \
-                        patch-libedit.diff
+                        patch-libedit.diff \
+                        omit-local-site-packages.patch
 
 # http://bugs.python.org/issue21811
 patchfiles-append       yosemite-configure-fixes.patch \

Added: trunk/dports/lang/python32/files/omit-local-site-packages.patch
===================================================================
--- trunk/dports/lang/python32/files/omit-local-site-packages.patch	                        (rev 0)
+++ trunk/dports/lang/python32/files/omit-local-site-packages.patch	2014-10-16 04:13:20 UTC (rev 126840)
@@ -0,0 +1,20 @@
+Index: Lib/site.py
+===================================================================
+--- Lib/site.py.orig
++++ Lib/site.py
+@@ -292,15 +292,6 @@ def getsitepackages():
+         else:
+             sitepackages.append(prefix)
+             sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
+-        if sys.platform == "darwin":
+-            # for framework builds *only* we add the standard Apple
+-            # locations.
+-            from sysconfig import get_config_var
+-            framework = get_config_var("PYTHONFRAMEWORK")
+-            if framework:
+-                sitepackages.append(
+-                        os.path.join("/Library", framework,
+-                            sys.version[:3], "site-packages"))
+     return sitepackages
+ 
+ def addsitepackages(known_paths):

Modified: trunk/dports/lang/python33/Portfile
===================================================================
--- trunk/dports/lang/python33/Portfile	2014-10-16 03:08:24 UTC (rev 126839)
+++ trunk/dports/lang/python33/Portfile	2014-10-16 04:13:20 UTC (rev 126840)
@@ -8,6 +8,7 @@
 
 # Remember to keep py33-tkinter and py33-gdbm's versions sync'd with this
 version                 3.3.6
+revision                1
 
 epoch                   20141012
 
@@ -38,7 +39,8 @@
                         patch-Lib-distutils-dist.py.diff \
                         patch-configure.diff \
                         patch-setup.py-disabled_modules.diff \
-                        patch-libedit.diff
+                        patch-libedit.diff \
+                        omit-local-site-packages.patch
 
 # http://bugs.python.org/issue21811
 patchfiles-append       yosemite-configure-fixes.patch \

Added: trunk/dports/lang/python33/files/omit-local-site-packages.patch
===================================================================
--- trunk/dports/lang/python33/files/omit-local-site-packages.patch	                        (rev 0)
+++ trunk/dports/lang/python33/files/omit-local-site-packages.patch	2014-10-16 04:13:20 UTC (rev 126840)
@@ -0,0 +1,20 @@
+Index: Lib/site.py
+===================================================================
+--- Lib/site.py.orig
++++ Lib/site.py
+@@ -310,15 +310,6 @@ def getsitepackages(prefixes=None):
+         else:
+             sitepackages.append(prefix)
+             sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
+-        if sys.platform == "darwin":
+-            # for framework builds *only* we add the standard Apple
+-            # locations.
+-            from sysconfig import get_config_var
+-            framework = get_config_var("PYTHONFRAMEWORK")
+-            if framework:
+-                sitepackages.append(
+-                        os.path.join("/Library", framework,
+-                            sys.version[:3], "site-packages"))
+     return sitepackages
+ 
+ def addsitepackages(known_paths, prefixes=None):

Modified: trunk/dports/lang/python34/Portfile
===================================================================
--- trunk/dports/lang/python34/Portfile	2014-10-16 03:08:24 UTC (rev 126839)
+++ trunk/dports/lang/python34/Portfile	2014-10-16 04:13:20 UTC (rev 126840)
@@ -8,6 +8,7 @@
 
 # Remember to keep py34-tkinter and py34-gdbm's versions sync'd with this
 version                 3.4.2
+revision                1
 
 epoch                   20141008
 
@@ -36,7 +37,8 @@
                         patch-Lib-cgi.py.diff \
                         patch-configure.diff \
                         patch-setup.py-disabled_modules.diff \
-                        patch-libedit.diff
+                        patch-libedit.diff \
+                        omit-local-site-packages.patch
 
 depends_lib             port:zlib port:openssl \
                         port:sqlite3 port:ncurses \

Added: trunk/dports/lang/python34/files/omit-local-site-packages.patch
===================================================================
--- trunk/dports/lang/python34/files/omit-local-site-packages.patch	                        (rev 0)
+++ trunk/dports/lang/python34/files/omit-local-site-packages.patch	2014-10-16 04:13:20 UTC (rev 126840)
@@ -0,0 +1,20 @@
+Index: Lib/site.py
+===================================================================
+--- Lib/site.py.orig
++++ Lib/site.py
+@@ -311,15 +311,6 @@ def getsitepackages(prefixes=None):
+         else:
+             sitepackages.append(prefix)
+             sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
+-        if sys.platform == "darwin":
+-            # for framework builds *only* we add the standard Apple
+-            # locations.
+-            from sysconfig import get_config_var
+-            framework = get_config_var("PYTHONFRAMEWORK")
+-            if framework:
+-                sitepackages.append(
+-                        os.path.join("/Library", framework,
+-                            sys.version[:3], "site-packages"))
+     return sitepackages
+ 
+ def addsitepackages(known_paths, prefixes=None):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20141015/f9319659/attachment-0001.html>


More information about the macports-changes mailing list