[Numpy-svn] r4075 - trunk/numpy/distutils

numpy-svn@scip... numpy-svn@scip...
Sat Sep 22 02:29:01 CDT 2007


Author: pearu
Date: 2007-09-22 02:28:45 -0500 (Sat, 22 Sep 2007)
New Revision: 4075

Modified:
   trunk/numpy/distutils/misc_util.py
Log:
backport the usage of get_build_architecture to pyhton <=2.4

Modified: trunk/numpy/distutils/misc_util.py
===================================================================
--- trunk/numpy/distutils/misc_util.py	2007-09-21 17:32:21 UTC (rev 4074)
+++ trunk/numpy/distutils/misc_util.py	2007-09-22 07:28:45 UTC (rev 4075)
@@ -22,7 +22,7 @@
            'get_script_files', 'get_lib_source_files', 'get_data_files',
            'dot_join', 'get_frame', 'minrelpath','njoin',
            'is_sequence', 'is_string', 'as_list', 'gpaths', 'get_language',
-           'quote_args']
+           'quote_args', 'get_build_architecture']
 
 def quote_args(args):
     # don't used _nt_quote_args as it does not check if
@@ -321,10 +321,6 @@
 def msvc_on_amd64():
     if not (sys.platform=='win32' or os.name=='nt'):
         return
-    try:  # get_build_architecture is only on Python 2.5
-        from distutils.msvccompiler import get_build_architecture
-    except ImportError:
-        return
     if get_build_architecture() != 'AMD64':
         return
     if os.environ.has_key('DISTUTILS_USE_SDK'):
@@ -1514,3 +1510,20 @@
 
     f.close()
     return target
+
+if sys.version[:3] >= '2.5':
+    from distutils.msvccompiler import get_build_architecture
+else:
+    #copied from python 2.5.1 distutils/msvccompiler.py
+    def get_build_architecture():
+        """Return the processor architecture.
+        
+        Possible results are "Intel", "Itanium", or "AMD64".
+        """
+        
+        prefix = " bit ("
+        i = string.find(sys.version, prefix)
+        if i == -1:
+            return "Intel"
+        j = string.find(sys.version, ")", i)
+        return sys.version[i+len(prefix):j]



More information about the Numpy-svn mailing list