[Python-checkins] cpython (2.7): Closes #16112: platform.architecture does not correctly escape argument to

jesus.cea python-checkins at python.org
Thu Oct 4 15:15:11 CEST 2012


http://hg.python.org/cpython/rev/d6d908dc11f2
changeset:   79451:d6d908dc11f2
branch:      2.7
user:        Jesus Cea <jcea at jcea.es>
date:        Thu Oct 04 15:14:56 2012 +0200
summary:
  Closes #16112: platform.architecture does not correctly escape argument to /usr/bin/file. Solve a 2.7 bootstrap issue

files:
  Lib/platform.py |  22 +++++++++++++++++++++-
  1 files changed, 21 insertions(+), 1 deletions(-)


diff --git a/Lib/platform.py b/Lib/platform.py
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -113,7 +113,7 @@
 
 __version__ = '1.0.7'
 
-import sys,string,os,re,subprocess
+import sys,string,os,re
 
 ### Globals & Constants
 
@@ -1020,6 +1020,26 @@
         case the command should fail.
 
     """
+
+    # We do the import here to avoid a bootstrap issue.
+    # See c73b90b6dadd changeset.
+    #
+    # [..]
+    # ranlib libpython2.7.a
+    # gcc   -o python \
+    #        Modules/python.o \
+    #        libpython2.7.a -lsocket -lnsl -ldl    -lm
+    # Traceback (most recent call last):
+    #  File "./setup.py", line 8, in <module>
+    #    from platform import machine as platform_machine
+    #  File "[..]/build/Lib/platform.py", line 116, in <module>
+    #    import sys,string,os,re,subprocess
+    #  File "[..]/build/Lib/subprocess.py", line 429, in <module>
+    #    import select
+    # ImportError: No module named select
+
+    import subprocess
+
     if sys.platform in ('dos','win32','win16','os2'):
         # XXX Others too ?
         return default

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list