[apycotlib] Remove broken handling of C/C++ extensions from the distutils preprocessor stable
authorJulien Cristau <julien.cristau@logilab.fr>
Thu, 31 Jan 2013 14:22:16 +0100
branchstable
changeset 882 795f7976f9b2
parent 881 4b6f0f1c6775
child 883 6d7438499bbb
[apycotlib] Remove broken handling of C/C++ extensions from the distutils preprocessor The extensions were being installed to /tmp/tmpXXXXXX/local/lib/python2.X/site-packages, but INSTALL_PREFIX pretended it was in /tmp/tmpXXXX/local/lib/python2.X (or /usr/bin/python, if pyversions happened to return sys.executable). While I'm at it, make pyversions not do that. Closes #2683937
_apycotlib/preprocessors/distutils.py
--- a/_apycotlib/preprocessors/distutils.py	Fri Apr 05 17:14:52 2013 +0200
+++ b/_apycotlib/preprocessors/distutils.py	Thu Jan 31 14:22:16 2013 +0100
@@ -64,7 +64,7 @@
                 pyversions_.append(python)
         pyversions = pyversions_
     else:
-        pyversions = [sys.executable]
+        pyversions = ['python%s.%s' % sys.version_info[:2]]
     return pyversions
 
 INSTALL_PREFIX = {}
@@ -116,22 +116,14 @@
             return
         if not exists(join(path, 'setup.py')):
             raise SetupException('No file %s' % abspath(join(path, 'setup.py')))
-        # XXX need better detection of C extension
-        if glob(join(path, '*.c')) or glob(join(path, '*.cpp')):
-            pythons = pyversions(test) or [sys.executable]
-            installopt = '--prefix'
-            INSTALL_PREFIX[path] = join(test.tmpdir, 'local', 'lib', pythons[0])
-        else:
-            pythons = (pyversions(test) or [sys.executable])[0],
-            installopt = '--home'
-            INSTALL_PREFIX[path] = join(test.tmpdir, 'local', 'lib', 'python')
-        for python in pythons:
-            cmdargs = [python, 'setup.py', 'install', installopt,
-                       join(test.tmpdir, 'local')]
-            if not self.options.get('verbose'):
-                cmdargs.append('--quiet')
-            cmd = Command(self.writer, cmdargs, raises=True, cwd=path)
-            cmd.run()
+        python = pyversions(test)[0]
+        INSTALL_PREFIX[path] = join(test.tmpdir, 'local', 'lib', 'python')
+        cmdargs = [python, 'setup.py', 'install', '--home',
+                   join(test.tmpdir, 'local')]
+        if not self.options.get('verbose'):
+            cmdargs.append('--quiet')
+        cmd = Command(self.writer, cmdargs, raises=True, cwd=path)
+        cmd.run()
         if exists(join(path, 'build')):
             shutil.rmtree(join(path, 'build')) # remove the build directory