Commits

Stan Seibert committed 4adb511

New style package definitions

Comments (0)

Files changed (8)

-from setuptools import setup
 try:
     from shrinkwrap.install import ShrinkwrapInstall
 except ImportError:
-    ShrinkwrapInstall = object
+    import subprocess; subprocess.check_call('pip install shrinkwrap', shell=True)
+    from shrinkwrap.install import ShrinkwrapInstall
+from setuptools import setup
 import os
 
-class Install(ShrinkwrapInstall):
-    version = '1.51.0'
-    version_alt = version.replace('.', '_')
-    source_url = 'http://sourceforge.net/projects/boost/files/boost/%s/boost_%s.tar.bz2' % (version, version_alt)
+version = '1.51.0'
+version_alt = version.replace('.', '_')
+source_url = 'http://sourceforge.net/projects/boost/files/boost/%s/boost_%s.tar.bz2' % (version, version_alt)
 
-    def run(self):
-        self.download_and_unpack_tarball(self.source_url)
-        # Remove .tar and .gz
-        basename, ext = os.path.splitext(os.path.basename(self.source_url))
-        basename, ext = os.path.splitext(basename)
-        self.build_dir = basename
+def installer(self):
+    self.download_and_unpack_tarball(source_url)
+    # Remove .tar and .gz
+    basename, ext = os.path.splitext(os.path.basename(source_url))
+    basename, ext = os.path.splitext(basename)
+    self.build_dir = basename
 
-        os.chdir(self.build_dir)
-        self.shell('./bootstrap.sh --prefix=' + self.virtualenv)
-        self.shell('./b2 install')
+    os.chdir(self.build_dir)
+    self.shell('./bootstrap.sh --prefix=' + self.virtualenv)
+    self.shell('./b2 install')
 
 setup(
     name='boost',
-    version=Install.version,
+    version=version,
     author='Stan Seibert',
     author_email='stan@mtrr.org',
-    setup_requires=['shrinkwrap'],
-    install_requires=['shrinkwrap'],
-    cmdclass={'install': Install},
+    shrinkwrap_installer=installer,
+    cmdclass={'install': ShrinkwrapInstall},
 )
-from setuptools import setup
 try:
     from shrinkwrap.install import ShrinkwrapInstall
 except ImportError:
-    ShrinkwrapInstall = object
+    import subprocess; subprocess.check_call('pip install shrinkwrap', shell=True)
+    from shrinkwrap.install import ShrinkwrapInstall
+from setuptools import setup
 import os
 
-class Install(ShrinkwrapInstall):
-    version = '2.8.9'
-    source_url = "http://www.cmake.org/files/v2.8/cmake-%s.tar.gz" % version
 
-    def run(self):
-        self.download_and_unpack_tarball(self.source_url)
-        # Remove .tar and .gz
-        basename, ext = os.path.splitext(os.path.basename(self.source_url))
-        basename, ext = os.path.splitext(basename)
-        self.build_dir = basename
+version = '2.8.9'
+source_url = "http://www.cmake.org/files/v2.8/cmake-%s.tar.gz" % version
 
-        os.chdir(self.build_dir)
-        self.shell('./bootstrap --prefix=' + self.virtualenv)
-        self.make()
-        self.make(extra_opts=['install'])
+def installer(self):
+    self.download_and_unpack_tarball(source_url)
+    # Remove .tar and .gz
+    basename, ext = os.path.splitext(os.path.basename(source_url))
+    basename, ext = os.path.splitext(basename)
+    self.build_dir = basename
+
+    os.chdir(self.build_dir)
+    self.shell('./bootstrap --prefix=' + self.virtualenv)
+    self.make()
+    self.make(extra_opts=['install'])
 
 setup(
     name='cmake',
-    version=Install.version,
+    version=version,
     author='Stan Seibert',
     author_email='stan@mtrr.org',
-    setup_requires=['shrinkwrap'],
-    install_requires=['shrinkwrap'],
-    cmdclass={'install': Install},
+    shrinkwrap_installer=installer,
+    cmdclass={'install': ShrinkwrapInstall},
 )
+try:
+    from shrinkwrap.install import ShrinkwrapInstall
+except ImportError:
+    import subprocess; subprocess.check_call('pip install shrinkwrap', shell=True)
+    from shrinkwrap.install import ShrinkwrapInstall
 from setuptools import setup
-try:
-    from shrinkwrap.install import AutoconfInstall
-except ImportError:
-    AutoconfInstall = object
 
 
-class Install(AutoconfInstall):
-    version = '7.27.0'
-    source_url = 'http://curl.haxx.se/download/curl-%s.tar.bz2' % version
+version = '7.27.0'
 
 setup(
     name='curl',
-    version=Install.version,
+    version=version,
     author='Stan Seibert',
     author_email='stan@mtrr.org',
-    setup_requires=['shrinkwrap'],
-    install_requires=['shrinkwrap'],
-    cmdclass={'install': Install},
+    shrinkwrap_installer='autoconf',
+    shrinkwrap_source_url='http://curl.haxx.se/download/curl-%s.tar.bz2' % version,
+    cmdclass={'install': ShrinkwrapInstall},
 )
+try:
+    from shrinkwrap.install import ShrinkwrapInstall
+except ImportError:
+    import subprocess; subprocess.check_call('pip install shrinkwrap', shell=True)
+    from shrinkwrap.install import ShrinkwrapInstall
 from setuptools import setup
-try:
-    from shrinkwrap.install import AutoconfInstall
-except ImportError:
-    AutoconfInstall = object
 
 
-class Install(AutoconfInstall):
-    version = '3.3.2'
-    source_url = 'http://www.fftw.org/fftw-%s.tar.gz' % version
+version = '3.3.2'
 
 setup(
     name='fftw',
-    version=Install.version,
+    version=version,
     author='Stan Seibert',
     author_email='stan@mtrr.org',
-    setup_requires=['shrinkwrap'],
-    install_requires=['shrinkwrap'],
-    cmdclass={'install': Install},
+    shrinkwrap_installer='autoconf',
+    shrinkwrap_source_url='http://www.fftw.org/fftw-%s.tar.gz' % version,
+    cmdclass={'install': ShrinkwrapInstall},
 )
-from setuptools import setup
 try:
     from shrinkwrap.install import ShrinkwrapInstall
 except ImportError:
-    ShrinkwrapInstall = object
+    import subprocess; subprocess.check_call('pip install shrinkwrap', shell=True)
+    from shrinkwrap.install import ShrinkwrapInstall
+from setuptools import setup
 import os
 import platform
 
-class Install(ShrinkwrapInstall):
-    version = '4.9.5.p01'
-    source_url = 'https://bitbucket.org/seibert/g4py#geant4.9.5.p01'
 
-    def run(self):
-        # Get source and unpack to $VIRTUAL_ENV/src
-        os.chdir(self.src_dir)
-        self.shell('hg clone ' + self.source_url)
-        os.chdir('g4py')
-        os.environ['CLHEP_BASE_DIR'] = self.virtualenv
-        system = platform.system()
-        bits = platform.architecture()[0]
-        
-        if system == 'Linux' and bits == '64bit':
-            platform_string = 'linux64'
-        elif system == 'Linux':
-            platform_string = 'linux'
-        elif system == 'Darwin':
-            platform_string = 'macosx'
+version = '4.9.5.p01'
+source_url = 'https://bitbucket.org/seibert/g4py#geant4.9.5.p01'
 
-        python_version = '.'.join(platform.python_version_tuple()[:2])
-        config_cmd = './configure %s --prefix=%s --with-g4-incdir=%s --with-g4-libdir=%s --libdir=%s --with-python-incdir=%s --with-python-libdir=%s --with-boost-incdir=%s --with-boost-libdir=%s' % \
-            (platform_string, 
-             self.virtualenv,
-             os.path.join(self.virtualenv, 'include', 'Geant4'), 
-             os.path.join(self.virtualenv, 'lib'),
-             os.path.join(self.virtualenv, 'lib', 'python'+python_version, 'site-packages'),
-             os.path.join(self.virtualenv, 'include', 'python'+python_version),
-             self.python_libdir,
-             os.path.join(self.virtualenv, 'include'),
-             os.path.join(self.virtualenv, 'lib'))
-        self.shell(config_cmd)
-        self.make(extra_opts=['install'])
+def installer(self):
+    # Get source and unpack to $VIRTUAL_ENV/src
+    os.chdir(self.src_dir)
+    self.shell('hg clone ' + self.source_url)
+    os.chdir('g4py')
+    os.environ['CLHEP_BASE_DIR'] = self.virtualenv
+    system = platform.system()
+    bits = platform.architecture()[0]
+    
+    if system == 'Linux' and bits == '64bit':
+        platform_string = 'linux64'
+    elif system == 'Linux':
+        platform_string = 'linux'
+    elif system == 'Darwin':
+        platform_string = 'macosx'
+
+    python_version = '.'.join(platform.python_version_tuple()[:2])
+    config_cmd = './configure %s --prefix=%s --with-g4-incdir=%s --with-g4-libdir=%s --libdir=%s --with-python-incdir=%s --with-python-libdir=%s --with-boost-incdir=%s --with-boost-libdir=%s' % \
+        (platform_string, 
+         self.virtualenv,
+         os.path.join(self.virtualenv, 'include', 'Geant4'), 
+         os.path.join(self.virtualenv, 'lib'),
+         os.path.join(self.virtualenv, 'lib', 'python'+python_version, 'site-packages'),
+         os.path.join(self.virtualenv, 'include', 'python'+python_version),
+         self.python_libdir,
+         os.path.join(self.virtualenv, 'include'),
+         os.path.join(self.virtualenv, 'lib'))
+    self.shell(config_cmd)
+    self.make(extra_opts=['install'])
 
 
 setup(
     name='g4py_chroma',
-    version=Install.version,
+    version=version,
     author='Stan Seibert',
     author_email='stan@mtrr.org',
-    setup_requires=['shrinkwrap'],
-    install_requires=['shrinkwrap'],
-    cmdclass={'install': Install},
+    shrinkwrap_installer=installer,
+    shrinkwrap_requires=['boost', 'geant4'],
+    cmdclass={'install': ShrinkwrapInstall},
 )
-from setuptools import setup
 try:
     from shrinkwrap.install import ShrinkwrapInstall
 except ImportError:
-    ShrinkwrapInstall = object
+    import subprocess; subprocess.check_call('pip install shrinkwrap', shell=True)
+    from shrinkwrap.install import ShrinkwrapInstall
+from setuptools import setup
 import os
 
-class Geant4Install(ShrinkwrapInstall):
-    version = '4.9.5.p01'
-    source_url = 'http://geant4.cern.ch/support/source/geant%s.tar.gz' % version
+version = '4.9.5.p01'
+source_url = 'http://geant4.cern.ch/support/source/geant%s.tar.gz' % version
 
-    def run(self):
-        # Get source and unpack to $VIRTUAL_ENV/src
-        self.download_and_unpack_tarball(self.source_url, to_src_dir=True)
+def installer(self):
+    # Get source and unpack to $VIRTUAL_ENV/src
+    self.download_and_unpack_tarball(source_url, to_src_dir=True)
 
-        # Create build directory
-        os.chdir(self.src_dir)
-        g4src_dir = os.path.realpath('geant' + self.version)
-        build_dir = g4src_dir + '-build'
-        if not os.path.exists(build_dir):
-            os.mkdir(build_dir)
-        os.chdir(build_dir)
+    # Create build directory
+    os.chdir(self.src_dir)
+    g4src_dir = os.path.realpath('geant' + self.version)
+    build_dir = g4src_dir + '-build'
+    if not os.path.exists(build_dir):
+        os.mkdir(build_dir)
+    os.chdir(build_dir)
 
-        # Configure and compile in place
-        config_cmd = 'cmake -DCMAKE_INSTALL_PREFIX=%s -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_RAYTRACER_X11=ON %s' % (self.virtualenv, g4src_dir)
-        self.shell(config_cmd)
+    # Configure and compile in place
+    config_cmd = 'cmake -DCMAKE_INSTALL_PREFIX=%s -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_RAYTRACER_X11=ON %s' % (self.virtualenv, g4src_dir)
+    self.shell(config_cmd)
 
-        self.make(extra_opts=['install'])
+    self.make(extra_opts=['install'])
 
-        # Setup environment
-        env_contents = 'source %s' % os.path.join(self.virtualenv, 'bin', 'geant4.sh')
-        self.install_env('geant4.sh', contents=env_contents)
+    # Setup environment
+    env_contents = 'source %s' % os.path.join(self.virtualenv, 'bin', 'geant4.sh')
+    self.install_env('geant4.sh', contents=env_contents)
 
 setup(
     name='geant4',
-    version=Geant4Install.version,
+    version=version,
     author='Stan Seibert',
     author_email='stan@mtrr.org',
-    setup_requires=['shrinkwrap'],
-    install_requires=['shrinkwrap'],
-    cmdclass={'install': Geant4Install},
+    shrinkwrap_installer=installer,
+    shrinkwrap_requires=['cmake'],
+    cmdclass={'install': ShrinkwrapInstall},
 )
+try:
+    from shrinkwrap.install import ShrinkwrapInstall
+except ImportError:
+    import subprocess; subprocess.check_call('pip install shrinkwrap', shell=True)
+    from shrinkwrap.install import ShrinkwrapInstall
 from setuptools import setup
-try:
-    from shrinkwrap.install import AutoconfInstall
-except ImportError:
-    AutoconfInstall = object
 
 
-class Install(AutoconfInstall):
-    version = '2012.08.22'
-    date = version.replace('.', '')
-    source_url = "http://ftp.gnu.org/gnu/parallel/parallel-%s.tar.bz2" % date
+version = '2012.08.22'
+date = version.replace('.', '')
 
 setup(
     name='gnu_parallel',
-    version=Install.version,
+    version=version,
     author='Stan Seibert',
     author_email='stan@mtrr.org',
-    setup_requires=['shrinkwrap'],
-    install_requires=['shrinkwrap'],
-    cmdclass={'install': Install},
+    shrinkwrap_installer='autoconf',
+    shrinkwrap_source_url="http://ftp.gnu.org/gnu/parallel/parallel-%s.tar.bz2" % date,
+    cmdclass={'install': ShrinkwrapInstall},
 )
-from setuptools import setup
 try:
     from shrinkwrap.install import ShrinkwrapInstall
 except ImportError:
-    ShrinkwrapInstall = object
+    import subprocess; subprocess.check_call('pip install shrinkwrap', shell=True)
+    from shrinkwrap.install import ShrinkwrapInstall
 import os
+from setuptools import setup
 
-class RootInstall(ShrinkwrapInstall):
-    version = '5.34.01'
-    source_url = 'ftp://root.cern.ch/root/root_v%s.source.tar.gz' % version
 
-    def run(self):
-        # Get source and unpack to $VIRTUAL_ENV/src
-        self.download_and_unpack_tarball(self.source_url, to_src_dir=True)
+version = '5.34.01'
+source_url = 'ftp://root.cern.ch/root/root_v%s.source.tar.gz' % version
 
-        # Fix source directory name
-        os.chdir(self.src_dir)
-        root_dir = 'root-v'+self.version
-        os.rename('root', root_dir)
 
-        # Configure and compile in place
-        os.chdir(root_dir)
-        config_options = '--enable-minuit2 --enable-roofit --with-python-libdir=%s' % self.python_libdir
-        self.shell('./configure ' + config_options)
-        self.make()
+def installer(self):
+    # Get source and unpack to $VIRTUAL_ENV/src
+    self.download_and_unpack_tarball(source_url, to_src_dir=True)
 
-        # Setup environment
-        env_contents = 'source %s' % os.path.join(self.src_dir, root_dir, 'bin', 'thisroot.sh')
-        self.install_env('root.sh', contents=env_contents)
+    # Fix source directory name
+    os.chdir(self.src_dir)
+    root_dir = 'root-v' + version
+    os.rename('root', root_dir)
+
+    # Configure and compile in place
+    os.chdir(root_dir)
+    config_options = '--enable-minuit2 --enable-roofit --with-python-libdir=%s' % self.python_libdir
+    self.shell('./configure ' + config_options)
+    self.make()
+
+    # Setup environment
+    env_contents = 'source %s' % os.path.join(self.src_dir, root_dir, 'bin', 'thisroot.sh')
+    self.install_env('root.sh', contents=env_contents)
+
 
 setup(
     name='root',
-    version=RootInstall.version,
+    version=version,
     author='Stan Seibert',
     author_email='stan@mtrr.org',
-    setup_requires=['shrinkwrap'],
-    install_requires=['shrinkwrap'],
-    cmdclass={'install': RootInstall},
+    shrinkwrap_installer=installer,
+    shrinkwrap_requires=['fftw'],
+    cmdclass={'install': ShrinkwrapInstall},
 )