Commits

Stan Seibert committed d566b6c

Autoconf install class to simplify a common installation procedure.

  • Participants
  • Parent commits 4ea3fe5

Comments (0)

Files changed (1)

File shrinkwrap/install.py

     def python_libdir(self):
         '''Location of python library.'''
         return os.path.join(self.virtualenv, 'lib', 'python%s.%s' % platform.python_version_tuple()[:2], 'config')
+
+
+class AutoconfInstall(ShrinkwrapInstall):
+    '''Convenience class that automates the installation of a standard autoconf/configure-based
+    package.  Just set the version and source_url class attributes.  If the source directory
+    in the tar file is not the basename of the source url with .tar.gz/bz2 removed, 
+    also set the build_dir class attribute.'''
+
+    def run(self):
+        self.download_and_unpack_tarball(self.source_url)
+        if not hasattr(self, 'build_dir'):
+            # Remove .tar or .gz or .bz2 if present
+            basename, ext = os.path.splitext(os.path.basename(self.source_url))
+            while ext in ['.gz', '.bz2', '.tar']:
+                basename, ext = os.path.splitext(basename)
+            # Went one too far, now back up, ext could also be empty
+            basename = basename + ext
+            self.build_dir = basename
+
+        os.chdir(self.build_dir)
+        self.shell('./configure --prefix=' + self.virtualenv)
+        self.make(extra_opts=['install'])