Commits

Stan Seibert committed 904a235 Draft

Don't use self as the function argument.

Comments (0)

Files changed (6)

 version_alt = version.replace('.', '_')
 source_url = 'http://sourceforge.net/projects/boost/files/boost/%s/boost_%s.tar.bz2' % (version, version_alt)
 
-def installer(self):
-    self.download_and_unpack_tarball(source_url)
+def installer(inst):
+    inst.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
+    inst.build_dir = basename
 
-    os.chdir(self.build_dir)
-    self.shell('./bootstrap.sh --prefix=' + self.virtualenv)
-    self.shell('./b2 install')
+    os.chdir(inst.build_dir)
+    inst.shell('./bootstrap.sh --prefix=' + inst.virtualenv)
+    inst.shell('./b2 install')
 
 setup(
     name='boost',
 version = '2.8.9'
 source_url = "http://www.cmake.org/files/v2.8/cmake-%s.tar.gz" % version
 
-def installer(self):
-    self.download_and_unpack_tarball(source_url)
+def installer(inst):
+    inst.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
+    inst.build_dir = basename
 
-    os.chdir(self.build_dir)
-    self.shell('./bootstrap --prefix=' + self.virtualenv)
-    self.make()
-    self.make(extra_opts=['install'])
+    os.chdir(inst.build_dir)
+    inst.shell('./bootstrap --prefix=' + inst.virtualenv)
+    inst.make()
+    inst.make(extra_opts=['install'])
 
 setup(
     name='cmake',
 version = '4.9.5.p01'
 source_url = 'https://bitbucket.org/seibert/g4py#geant4.9.5.p01'
 
-def installer(self):
+def installer(inst):
     # Get source and unpack to $VIRTUAL_ENV/src
-    os.chdir(self.src_dir)
-    self.shell('hg clone ' + source_url)
+    os.chdir(inst.src_dir)
+    inst.shell('hg clone ' + source_url)
     os.chdir('g4py')
-    os.environ['CLHEP_BASE_DIR'] = self.virtualenv
+    os.environ['CLHEP_BASE_DIR'] = inst.virtualenv
     system = platform.system()
     bits = platform.architecture()[0]
     
     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'])
+         inst.virtualenv,
+         os.path.join(inst.virtualenv, 'include', 'Geant4'), 
+         os.path.join(inst.virtualenv, 'lib'),
+         os.path.join(inst.virtualenv, 'lib', 'python'+python_version, 'site-packages'),
+         os.path.join(inst.virtualenv, 'include', 'python'+python_version),
+         inst.python_libdir,
+         os.path.join(inst.virtualenv, 'include'),
+         os.path.join(inst.virtualenv, 'lib'))
+    inst.shell(config_cmd)
+    inst.make(extra_opts=['install'])
 
 
 setup(
 version = '4.9.5.p01'
 source_url = 'http://geant4.cern.ch/support/source/geant%s.tar.gz' % version
 
-def installer(self):
+def installer(inst):
     # Get source and unpack to $VIRTUAL_ENV/src
-    self.download_and_unpack_tarball(source_url, to_src_dir=True)
+    inst.download_and_unpack_tarball(source_url, to_src_dir=True)
 
     # Create build directory
-    os.chdir(self.src_dir)
+    os.chdir(inst.src_dir)
     g4src_dir = os.path.realpath('geant' + version)
     build_dir = g4src_dir + '-build'
     if not os.path.exists(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)
+    config_cmd = 'cmake -DCMAKE_INSTALL_PREFIX=%s -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_RAYTRACER_X11=ON %s' % (inst.virtualenv, g4src_dir)
+    inst.shell(config_cmd)
 
-    self.make(extra_opts=['install'])
+    inst.make(extra_opts=['install'])
 
     # Setup environment
     env_contents = '''
 cd %s
 source geant4.sh
 popd  > /dev/null
-''' % os.path.join(self.virtualenv, 'bin')
-    self.install_env('geant4.sh', contents=env_contents)
+''' % os.path.join(inst.virtualenv, 'bin')
+    inst.install_env('geant4.sh', contents=env_contents)
 
 setup(
     name='geant4',
 version = 'master'
 source_url = 'git@github.com:snoplus/rat.git'
 
-def installer(self):
+def installer(inst):
     # Get source and unpack to $VIRTUAL_ENV/src
-    os.chdir(self.src_dir)
+    os.chdir(inst.src_dir)
     if not os.path.exists('rat'):
-        self.shell('git clone %s rat' % source_url)
+        inst.shell('git clone %s rat' % source_url)
         os.chdir('rat')
     else:
-        print '******** Detected exisiting installation of rat in %s/rat ********' % self.src_dir
+        print '******** Detected exisiting installation of rat in %s/rat ********' % inst.src_dir
         print ' To update, cd to the rat installation and use git commands (e.g. git pull)'
-        print ' To reinstall, delete %s/rat and run this command again. This will delete any uncommitted changes.' % self.src_dir
+        print ' To reinstall, delete %s/rat and run this command again. This will delete any uncommitted changes.' % inst.src_dir
         raise RuntimeError('rat installation path exists')
 
     config_cmd = './configure'
-    self.shell(config_cmd)
+    inst.shell(config_cmd)
 
     # Install environment file to be used in future calls
-    env_contents = 'source %s\n' % os.path.join(self.src_dir, 'rat', 'env.sh')
-    self.install_env('rat.sh', contents=env_contents)
+    env_contents = 'source %s\n' % os.path.join(inst.src_dir, 'rat', 'env.sh')
+    inst.install_env('rat.sh', contents=env_contents)
 
-    self.shell('scons -j%d' % self.ncpu)
+    inst.shell('scons -j%d' % inst.ncpu)
 
 
 setup(
 source_url = 'ftp://root.cern.ch/root/root_v%s.source.tar.gz' % version
 
 
-def installer(self):
+def installer(inst):
     # Get source and unpack to $VIRTUAL_ENV/src
-    self.download_and_unpack_tarball(source_url, to_src_dir=True)
+    inst.download_and_unpack_tarball(source_url, to_src_dir=True)
 
     # Fix source directory name
-    os.chdir(self.src_dir)
+    os.chdir(inst.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()
+    config_options = '--enable-minuit2 --enable-roofit --with-python-libdir=%s' % inst.python_libdir
+    inst.shell('./configure ' + config_options)
+    inst.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)
+    env_contents = 'source %s' % os.path.join(inst.src_dir, root_dir, 'bin', 'thisroot.sh')
+    inst.install_env('root.sh', contents=env_contents)
 
 
 setup(