[cig-commits] r6249 - cs/merlin/branches/v1/merlin/command

leif at geodynamics.org leif at geodynamics.org
Tue Mar 13 13:14:11 PDT 2007


Author: leif
Date: 2007-03-13 13:14:10 -0700 (Tue, 13 Mar 2007)
New Revision: 6249

Modified:
   cs/merlin/branches/v1/merlin/command/easy_install.py
Log:
Experimental change: if a 'setup.py' script isn't found, look for a
'configure' script instead.  If one exists, run "configure && make &&
make install".  (Works, but installs to the wrong location and
subsequently fails because there are no eggs.)


Modified: cs/merlin/branches/v1/merlin/command/easy_install.py
===================================================================
--- cs/merlin/branches/v1/merlin/command/easy_install.py	2007-03-13 18:38:14 UTC (rev 6248)
+++ cs/merlin/branches/v1/merlin/command/easy_install.py	2007-03-13 20:14:10 UTC (rev 6249)
@@ -641,23 +641,34 @@
 
         # Find the setup.py file
         setup_script = os.path.join(setup_base, 'setup.py')
+        configure_script = None
 
         if not os.path.exists(setup_script):
             setups = glob(os.path.join(setup_base, '*', 'setup.py'))
-            if not setups:
-                raise DistutilsError(
-                    "Couldn't find a setup script in %s" % dist_filename
-                )
-            if len(setups)>1:
-                raise DistutilsError(
-                    "Multiple setup scripts in %s" % dist_filename
-                )
-            setup_script = setups[0]
+            if setups:
+                if len(setups)>1:
+                    raise DistutilsError(
+                        "Multiple setup scripts in %s" % dist_filename
+                    )
+                setup_script = setups[0]
+            else:
+                configure_scripts = glob(os.path.join(setup_base, '*', 'configure'))
+                if not configure_scripts:
+                    raise DistutilsError(
+                        "Couldn't find a setup or configure script in %s" % dist_filename
+                        )
+                if len(configure_scripts)>1:
+                    raise DistutilsError(
+                        "Multiple configure scripts in %s" % dist_filename
+                    )
+                configure_script = configure_scripts[0]
 
         # Now run it, and return the result
         if self.editable:
             log.info(self.report_editable(spec, setup_script))
             return []
+        elif configure_script:
+            return self.configure_make_make_install(configure_script, setup_base)
         else:
             return self.build_and_install(setup_script, setup_base)
 
@@ -948,6 +959,28 @@
             rmtree(dist_dir)
             log.set_verbosity(self.verbose) # restore our log verbosity
 
+    def configure_make_make_install(self, configure_script, setup_base):
+        old_dir = os.getcwd()
+        os.chdir(setup_base)
+        eggs = []
+        try:
+            argv = [configure_script, '--prefix=%s' % self.install_dir] # this is wrong
+            status = os.spawnvp(os.P_WAIT, argv[0], argv)
+            if status != 0:
+                sys.exit("configure: %d" % status)
+            argv = ['make']
+            status = os.spawnvp(os.P_WAIT, argv[0], argv)
+            if status != 0:
+                sys.exit("make: %d" % status)
+            argv = ['make', 'install']
+            status = os.spawnvp(os.P_WAIT, argv[0], argv)
+            if status != 0:
+                sys.exit("make: %d" % status)
+        finally:
+            os.chdir(old_dir)
+            log.set_verbosity(self.verbose) # restore our log verbosity
+        return eggs
+
     def update_pth(self,dist):
         if self.pth_file is None:
             return



More information about the cig-commits mailing list