shrinkwrap_pkgs_snoplus / geant4.py

try:
    from shrinkwrap.install import ShrinkwrapInstall
except ImportError:
    import subprocess; subprocess.check_call('pip install -b $VIRTUAL_ENV/build/build-shrinkwrap shrinkwrap', shell=True)
    from shrinkwrap.install import ShrinkwrapInstall
from setuptools import setup
import os

version = '4.9.5.p01'
source_url = 'http://geant4.cern.ch/support/source/geant%s.tar.gz' % version

def installer(inst):
    # Get source and unpack to $VIRTUAL_ENV/src
    inst.download_and_unpack_tarball(source_url, to_src_dir=True)

    # Create build directory
    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.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' % (inst.virtualenv, g4src_dir)
    inst.shell(config_cmd)

    inst.make(extra_opts=['install'])

    # Setup environment
    env_contents = '''
pushd .  > /dev/null
cd %s
source geant4.sh
popd  > /dev/null
''' % os.path.join(inst.virtualenv, 'bin')
    inst.install_env('geant4.sh', contents=env_contents)

setup(
    name='geant4',
    version=version,
    author='Stan Seibert',
    author_email='stan@mtrr.org',
    shrinkwrap_installer=installer,
    shrinkwrap_requires=['cmake'],
    cmdclass={'install': ShrinkwrapInstall},
)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.