Esempio n. 1
0
def install(dir_name,version=None,data_dir=None):
    if not os.path.exists(os.path.join(dir_name,'bin','geant4-config')):
        print('installing geant4 version',version)
        name = 'v'+str(version)+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('https://github.com/Geant4/geant4/archive',name)
            wget(url,path)
            unpack(path,tmp_dir)
            geant4_dir = os.path.join(tmp_dir,'geant4-'+version)
            build_dir = os.path.join(tmp_dir,'build')
            os.mkdir(build_dir)
            options = ['-DGEANT4_INSTALL_DATA=ON',
                       '-DCMAKE_BUILD_TYPE=Release',
                      ]
            if data_dir:
                options.append('-DGEANT4_INSTALL_DATADIR='+data_dir)
            if subprocess.call(['cmake',
                                '-DCMAKE_INSTALL_PREFIX='+dir_name]
                                +options+[geant4_dir],cwd=build_dir):
                raise Exception('geant4 failed to cmake')
            if subprocess.call(['make','-j',cpu_cores],cwd=build_dir):
                raise Exception('geant4 failed to make')
            if subprocess.call(['make','install'],cwd=build_dir):
                raise Exception('geant4 failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 2
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'lib', 'libcphotospline.so')):
        print('installing photospline version', version)
        if version == 'master':
            name = 'master.tar.gz'
        else:
            name = 'v' + str(version) + '.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            url = os.path.join(
                'https://github.com/cnweaver/photospline/archive/', name)
            wget(url, path)
            unpack(path, tmp_dir)
            photospline_dir = os.path.join(tmp_dir, 'photospline-' + version)
            build_dir = os.path.join(photospline_dir, 'build')
            if os.path.exists(build_dir):
                shutil.rmtree(build_dir)
            os.mkdir(build_dir)
            cmd = [
                'cmake', '-DCMAKE_BUILD_TYPE=Release',
                '-DCMAKE_INSTALL_PREFIX=' + dir_name
            ]
            cmd += ['..']
            if subprocess.call(cmd, cwd=build_dir):
                raise Exception('photospline failed to configure')
            if subprocess.call(['make', '-j', cpu_cores], cwd=build_dir):
                raise Exception('photospline failed to make')
            if subprocess.call(['make', 'install'], cwd=build_dir):
                raise Exception('photospline failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 3
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'lib','libfftw3l.so')):
        print('installing fftw version',version)
        name = 'fftw-'+str(version)+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('http://www.fftw.org',name)
            wget(url,path)
            fftw_dir = os.path.join(tmp_dir,'fftw-'+version)
            mod_env = copy.deepcopy(os.environ)
            mod_env['CC'] = 'cc -mtune=generic'
            for options in ('--enable-float','--enable-long-double',None):
                if os.path.exists(fftw_dir):
                    shutil.rmtree(fftw_dir)
                unpack(path,tmp_dir)
                cmd = [os.path.join(fftw_dir,'configure'),'--prefix',
                       dir_name,'--enable-shared','--enable-threads']
                if options:
                    cmd += options.split(' ')
                if subprocess.call(cmd, env=mod_env, cwd=fftw_dir):
                    raise Exception('fftw failed to configure')
                if subprocess.call(['make'],cwd=fftw_dir):
                    raise Exception('fftw failed to make')
                if subprocess.call(['make','install'],cwd=fftw_dir):
                    raise Exception('fftw failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 4
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'bin','globus-url-copy')):
        print('installing globus version',version)
        url = get_url(version)
        name = os.path.basename(url)
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            wget(url,path)
            unpack(path,tmp_dir)
            globus_dir = os.path.join(tmp_dir,name.rsplit('.',2)[0])
            if int(version[0]) <= 5:
#                if subprocess.call(['cpanm','--local-lib',dir_name,
#                                    'Archive::Tar','Compress::Zlib','Digest::MD5',
#                                    'File::Spec','IO::Zlib','Pod::Parser',
#                                    'Test::Simple','XML::Parser']):
#                    raise Exception('failed to install globus perl modules')
                if subprocess.call([os.path.join(globus_dir,'configure'),
                                    '--prefix',dir_name],cwd=globus_dir):
                    raise Exception('globus failed to configure')
                if subprocess.call(['make','gpt','globus-data-management-client'],cwd=globus_dir):
                    raise Exception('globus failed to make')
            elif int(version[0]) >= 6:
                if subprocess.call([os.path.join(globus_dir,'configure'),
                                    '--disable-gram5','--disable-myproxy',
                                    '--with-ltdl-include='+os.path.join(dir_name,'include'),
                                    '--with-ltdl-lib='+os.path.join(dir_name,'lib'),
                                    '--prefix',dir_name],cwd=globus_dir):
                    raise Exception('globus failed to configure')
                if subprocess.call(['make', '-j', cpu_cores],cwd=globus_dir):
                    raise Exception('globus failed to make')
            if subprocess.call(['make','install'],cwd=globus_dir):
                raise Exception('globus failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 5
0
File: zmq.py Progetto: briedel/cvmfs
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'lib','libzmq.so')):
        print('installing zmq version',version)
        name = 'zeromq-'+str(version)+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('http://download.zeromq.org',name)
            wget(url,path)
            unpack(path,tmp_dir)
            zmq_dir = os.path.join(tmp_dir,'zeromq-'+version)
            if subprocess.call([os.path.join(zmq_dir,'configure'),
                                '--prefix',dir_name,'--without-libsodium'],cwd=zmq_dir):
                raise Exception('zmq failed to configure')
            if subprocess.call(['make'],cwd=zmq_dir):
                raise Exception('zmq failed to make')
            if subprocess.call(['make','install'],cwd=zmq_dir):
                raise Exception('zmq failed to install')
            
            # the c++ bindings
            url = 'https://raw.githubusercontent.com/zeromq/cppzmq/master/zmq.hpp'
            path = os.path.join(dir_name,'include','zmq.hpp')
            wget(url,path)
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 6
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'bin','gnuplot')):
        print('installing gnuplot version',version)
        name = 'gnuplot-'+str(version)+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('http://iweb.dl.sourceforge.net/project/gnuplot/gnuplot/',version,name)
            wget(url,path)
            unpack(path,tmp_dir)
            gnuplot_dir = os.path.join(tmp_dir,'gnuplot-'+version)
            if subprocess.call([os.path.join(gnuplot_dir,'configure'),
                                '--prefix',dir_name,'--without-linux-vga',
                                '--without-lisp-files','--without-tutorial',
                                '--with-bitmap-terminals'],cwd=gnuplot_dir):
                raise Exception('gnuplot failed to configure')
            if subprocess.call(['make'],cwd=gnuplot_dir):
                raise Exception('gnuplot failed to make')
            # touch two files to convince make they are new again
            for f in (os.path.join(gnuplot_dir,'docs','gnuplot-eldoc.el'),
                      os.path.join(gnuplot_dir,'docs','gnuplot-eldoc.elc')):
                if os.path.exists(f):
                    os.utime(f,None)
            if subprocess.call(['make','install'],cwd=gnuplot_dir):
                raise Exception('gnuplot failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 7
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'lib', 'libfftw3l.so')):
        print('installing fftw version', version)
        name = 'fftw-' + str(version) + '.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            url = os.path.join('http://www.fftw.org', name)
            wget(url, path)
            fftw_dir = os.path.join(tmp_dir, 'fftw-' + version)
            mod_env = dict(os.environ)
            if 'CC' in mod_env:
                mod_env['CC'] = mod_env['CC'] + ' -mtune=generic'
            else:
                mod_env['CC'] = 'cc -mtune=generic'
            for options in ('--enable-float', '--enable-long-double', None):
                if os.path.exists(fftw_dir):
                    shutil.rmtree(fftw_dir)
                unpack(path, tmp_dir)
                cmd = [
                    os.path.join(fftw_dir, 'configure'), '--prefix', dir_name,
                    '--enable-shared', '--enable-threads'
                ]
                if options:
                    cmd += options.split(' ')
                if subprocess.call(cmd, env=mod_env, cwd=fftw_dir):
                    raise Exception('fftw failed to configure')
                if subprocess.call(['make', '-j', cpu_cores], cwd=fftw_dir):
                    raise Exception('fftw failed to make')
                if subprocess.call(['make', 'install'], cwd=fftw_dir):
                    raise Exception('fftw failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 8
0
def install(dir_name,version=None,for_clang=False):
    if not os.path.exists(os.path.join(dir_name,'lib','libboost_python.so')):
        if for_clang:
            print('installing boost version',version,' (for clang/c++14)')
        else:
            print('installing boost version',version)
        name = 'boost_'+version.replace('.','_')+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('http://downloads.sourceforge.net/project/boost/boost',version,name)
            wget(url,path)
            unpack(path,tmp_dir)
            boost_dir = os.path.join(tmp_dir,'boost_'+version.replace('.','_'))
            if version == "1.61.0":
                wget("https://github.com/scopeInfinity/iostreams/commit/61a91325d936b0a9e6baaed6c974d0808e166822.patch",
                      os.path.join(boost_dir,"61a91325d936b0a9e6baaed6c974d0808e166822.patch"))
                subprocess.call(["patch", "-p2", "<", "61a91325d936b0a9e6baaed6c974d0808e166822.patch"], cwd=boost_dir)
            if for_clang:
                if subprocess.call([os.path.join(boost_dir,'bootstrap.sh'),
                                    '--prefix='+dir_name,'--with-toolset=clang'],cwd=boost_dir):
                    raise Exception('boost failed to bootstrap')
                if subprocess.call([os.path.join(boost_dir,'b2'),'install','-j'+cpu_cores,'toolset=clang','cxxflags="-std=c++14"'],cwd=boost_dir):
                    raise Exception('boost failed to b2 install')
            else:
                if subprocess.call([os.path.join(boost_dir,'bootstrap.sh'),
                                    '--prefix='+dir_name],cwd=boost_dir):
                    raise Exception('boost failed to bootstrap')
                if subprocess.call([os.path.join(boost_dir,'b2'),'install','-j'+cpu_cores],cwd=boost_dir):
                    raise Exception('boost failed to b2 install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 9
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'bin','python')):
        print('installing python version',version)
        name = 'Python-'+str(version)+'.tgz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('http://www.python.org/ftp/python',version,name)
            wget(url,path)
            unpack(path,tmp_dir)
            python_dir = os.path.join(tmp_dir,'Python-'+version)
            if subprocess.call([os.path.join(python_dir,'configure'),
                                '--prefix',dir_name,'--enable-shared']
                               ,cwd=python_dir):
                raise Exception('python failed to configure')
            if subprocess.call(['make'],cwd=python_dir):
                raise Exception('python failed to make')
            if subprocess.call(['make','install'],cwd=python_dir):
                raise Exception('python failed to install')
            
            # check for modules
            for m in ('sqlite3','zlib','bz2','_ssl','_curses','readline'):
                if subprocess.call([os.path.join(dir_name,'bin','python'),
                                    '-c','import '+m]):
                    if os.path.exists(os.path.join(dir_name,'bin','python')):
                        os.remove(os.path.join(dir_name,'bin','python'))
                    raise Exception('failed to build with '+m+' support')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 10
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'lib','libsqlite3.so')):
        print('installing sqlite version',version)
        name = 'sqlite-autoconf-'+str(version)+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            y = None
            for v in sorted(years):
                if version >= v:
                    y = years[v]
            if y is None:
                raise Exception('cannot find version')
            url = os.path.join('http://www.sqlite.org',y,name)
            wget(url,path)
            unpack(path,tmp_dir)
            sqlite_dir = os.path.join(tmp_dir,'sqlite-autoconf-'+str(version))

            mod_env = dict(os.environ)
            mod_env['CFLAGS'] = '-I'+os.path.join(dir_name,'include')
            if subprocess.call([os.path.join(sqlite_dir,'configure'),
                                '--prefix='+dir_name],cwd=sqlite_dir,env=mod_env):
                raise Exception('sqlite failed to configure')
            if subprocess.call(['make', '-j', cpu_cores],cwd=sqlite_dir,env=mod_env):
                raise Exception('sqlite failed to make')
            if subprocess.call(['make','install'],cwd=sqlite_dir,env=mod_env):
                raise Exception('sqlite failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 11
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'bin','voms-proxy-init')):
        print('installing voms version',version)
        name = 'v'+str(version)+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('https://github.com/italiangrid/voms/archive',name)
            wget(url,path)
            unpack(path,tmp_dir)
            voms_dir = os.path.join(tmp_dir,'voms-'+version)
            if subprocess.call([os.path.join(voms_dir,'autogen.sh')],cwd=voms_dir):
                raise Exception('voms failed to autogen')
            if subprocess.call([os.path.join(voms_dir,'configure'),
                                '--prefix',dir_name,'--without-interfaces',
                                '--without-server','--disable-shared',
                                '--with-gsoap-wsdl2h='+os.path.join(dir_name,'bin','wsdl2h')
                               ],cwd=voms_dir):
                raise Exception('voms failed to configure')
            if subprocess.call(['make', '-j', cpu_cores],cwd=voms_dir):
                raise Exception('voms failed to make')
            if subprocess.call(['make','install'],cwd=voms_dir):
                raise Exception('voms failed to install')
        finally:
            shutil.rmtree(tmp_dir)

    # make symlinks
    i3_data = os.path.abspath(os.environ['I3_DATA'])
    for path in ('etc/vomsdir','etc/vomses','share/certificates',
                 'share/vomsdir'):
        if not os.path.lexists(os.path.join(dir_name,path)):
            os.symlink(os.path.join(i3_data,'voms',path),
                       os.path.join(dir_name,path))
Esempio n. 12
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'lib', 'libZThread.so')):
        print('installing zthread.  Fixed  version 2.3.2_IceCube')
        name = 'ZThread-2.3.2-patchedi3.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            t_url = 'http://code.icecube.wisc.edu/tools/distfiles/zthread'
            url = os.path.join(t_url, name)
            wget(url, path)
            unpack(path, tmp_dir)
            oo_dir = os.path.join(tmp_dir, 'ZThread-2.3.2')
            mod_env = dict(os.environ)
            mod_env['CFLAGS'] = '-fPIC'
            mod_env['CPPFLAGS'] = '-fPIC'
            if subprocess.call([
                    os.path.join(oo_dir, 'configure'), '--prefix', dir_name,
                    '--bindir', dir_name + '/bin/zthread-2.3.2',
                    '--includedir', dir_name + '/include/zthread-2.3.2',
                    '--datadir', dir_name + '/share/zthread-2.3.2',
                    '--enable-shared', '--enable-static'
            ],
                               cwd=oo_dir):
                raise Exception('zthread failed to configure')
            if subprocess.call(['make'], cwd=oo_dir):
                raise Exception('zthread failed to make')
            if subprocess.call(['make', 'install'], cwd=oo_dir):
                raise Exception('zthread failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 13
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'lib', 'libmpc.so')):
        print('installing mpc version', version)
        name = 'mpc-' + str(version) + '.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            url = os.path.join('https://ftp.gnu.org/gnu/mpc', name)
            wget(url, path)
            unpack(path, tmp_dir)
            if version[-1] == 'a':
                mpc_dir = os.path.join(tmp_dir, 'mpc-' + version[0:-1])
            else:
                mpc_dir = os.path.join(tmp_dir, 'mpc-' + version)
            if subprocess.call([
                    os.path.join(mpc_dir, 'configure'), '--prefix=' + dir_name,
                    '--with-mpfr=' + dir_name
            ],
                               cwd=mpc_dir):
                raise Exception('mpc failed to configure')
            if subprocess.call(['make'], cwd=mpc_dir):
                raise Exception('mpc failed to make')
            if subprocess.call(['make', 'install'], cwd=mpc_dir):
                raise Exception('mpc failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 14
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'lib', 'libcfitsio.so')):
        print('installing cfitsio version', version)
        name = 'cfitsio' + version.replace('.', '') + '.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            url = os.path.join(
                'https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c', name)
            wget(url, path)
            unpack(path, tmp_dir)
            cfitsio_dir = os.path.join(tmp_dir, 'cfitsio')
            mod_env = copy.deepcopy(os.environ)
            mod_env['CFLAGS'] = '-fPIC'
            if subprocess.call([
                    os.path.join(cfitsio_dir, 'configure'), '--prefix',
                    dir_name, '--enable-sse2'
            ],
                               env=mod_env,
                               cwd=cfitsio_dir):
                raise Exception('cfitsio failed to configure')
            if subprocess.call(['make', 'shared'],
                               env=mod_env,
                               cwd=cfitsio_dir):
                raise Exception('cfitsio failed to make')
            if subprocess.call(['make', 'install'],
                               env=mod_env,
                               cwd=cfitsio_dir):
                raise Exception('cfitsio failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 15
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'bin','h5ls')):
        print('installing hdf5 version',version)
        name = 'hdf5-'+str(version)+'.tar.gz'
        short_version = '.'.join(version.split('.')[:2])
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join("https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-"+short_version,"hdf5-"+version, 'src', name)
            try:
                wget(url,path)
            except Exception:
                try:
                    url = os.path.join("https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-"+short_version, name)
                    wget(url,path)
                except Exception:
                    url = os.path.join("https://support.hdfgroup.org/ftp/HDF5/current18", 'src', name)
                    wget(url,path)
            unpack(path,tmp_dir,flags=['-xz'])
            hdf5_dir = os.path.join(tmp_dir,'hdf5-'+version)
            if 'CC' in os.environ:
                os.environ['HDF5_CC'] = os.environ['CC']
            if subprocess.call([os.path.join(hdf5_dir,'configure'),
                                '--prefix',dir_name,'--disable-debug',
                                '--enable-cxx','--enable-production',
                                '--enable-strict-format-checks',
                                '--with-zlib=/usr'],cwd=hdf5_dir):
                raise Exception('hdf5 failed to configure')
            if subprocess.call(['make', '-j', cpu_cores],cwd=hdf5_dir):
                raise Exception('hdf5 failed to make')
            if subprocess.call(['make','install'],cwd=hdf5_dir):
                raise Exception('hdf5 failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 16
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'lib', 'liblog4cpp.so')):
        print('installing log4cpp version', version)
        if version > '1.2.0':
            raise Exception('unsupported version')
        name = 'log4cpp-' + str(version) + '.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            url = os.path.join(
                'http://downloads.sourceforge.net/project/log4cpp/log4cpp-1.1.x (new)/log4cpp-1.1',
                name)
            wget(url, path)
            unpack(path, tmp_dir)
            log4cpp_dir = os.path.join(tmp_dir, 'log4cpp')
            if subprocess.call(
                [os.path.join(log4cpp_dir, 'configure'), '--prefix', dir_name],
                    cwd=log4cpp_dir):
                raise Exception('log4cpp failed to configure')
            if subprocess.call(['make', '-j', cpu_cores], cwd=log4cpp_dir):
                raise Exception('log4cpp failed to make')
            if subprocess.call(['make', 'install'], cwd=log4cpp_dir):
                raise Exception('log4cpp failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 17
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'lib','libopenblas.so')):
        print('installing openblas version',version)
        name = 'v'+version+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('https://github.com/xianyi/OpenBLAS/archive',name)
            wget(url,path)
            unpack(path,tmp_dir)
            openblas_dir = os.path.join(tmp_dir,'OpenBLAS-'+version)
            makefile = os.path.join(openblas_dir,'Makefile.rule')
            data = open(makefile).read()
            f = open(makefile,'w')
            try:
                for line in data.split('\n'):
                    if 'DYNAMIC_ARCH' in line and line[0] == '#':
                        line = line[1:]
                    elif 'NO_AVX2' in line and line[0] == '#':
                        line = line[1:]
                    elif 'PREFIX' in line:
                        line = 'PREFIX = '+dir_name
                    elif 'NUM_THREADS' in line:
                        line = 'NUM_THREADS = 24'
                    f.write(line+'\n')
            finally:
                f.close()
            if subprocess.call(['make'],cwd=openblas_dir):
                raise Exception('openblas failed to make')
            if subprocess.call(['make','install'],cwd=openblas_dir):
                raise Exception('openblas failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 18
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'lib','libZThread.so')):
        print('installing zthread.  Fixed  version 2.3.2_IceCube')
        name = 'ZThread-2.3.2-patchedi3.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            t_url = 'http://code.icecube.wisc.edu/tools/distfiles/zthread'
            url = os.path.join(t_url,name)
            wget(url,path)
            unpack(path,tmp_dir)
            oo_dir = os.path.join(tmp_dir,'ZThread-2.3.2')
            mod_env = dict(os.environ)
            mod_env['CFLAGS'] = '-fPIC'
            mod_env['CPPFLAGS'] = '-fPIC'
            if subprocess.call([os.path.join(oo_dir,'configure'),
                                '--prefix', dir_name,
                                '--bindir', dir_name+'/bin/zthread-2.3.2',
                                '--includedir', dir_name+'/include/zthread-2.3.2',
                                '--datadir', dir_name+'/share/zthread-2.3.2',
                                '--enable-shared', '--enable-static'],
                                cwd=oo_dir):
                raise Exception('zthread failed to configure')
            if subprocess.call(['make'],cwd=oo_dir):
                raise Exception('zthread failed to make')
            if subprocess.call(['make','install'],cwd=oo_dir):
                raise Exception('zthread failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 19
0
def install(dir_name,version=None,for_clang=False):
    if not os.path.exists(os.path.join(dir_name,'lib','libboost_python.so')):
        if for_clang:
            print('installing boost version',version,' (for clang/c++14)')
        else:
            print('installing boost version',version)
        name = 'boost_'+version.replace('.','_')+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('http://iweb.dl.sourceforge.net/project/boost/boost',version,name)
            wget(url,path)
            unpack(path,tmp_dir)
            boost_dir = os.path.join(tmp_dir,'boost_'+version.replace('.','_'))
            if for_clang:
                if subprocess.call([os.path.join(boost_dir,'bootstrap.sh'),
                                    '--prefix='+dir_name,'--with-toolset=clang'],cwd=boost_dir):
                    raise Exception('boost failed to bootstrap')
                if subprocess.call([os.path.join(boost_dir,'b2'),'install','-j'+str(cpu_cores),'toolset=clang','cxxflags="-std=c++14"'],cwd=boost_dir):
                    raise Exception('boost failed to b2 install')
            else:
                if subprocess.call([os.path.join(boost_dir,'bootstrap.sh'),
                                    '--prefix='+dir_name],cwd=boost_dir):
                    raise Exception('boost failed to bootstrap')
                if subprocess.call([os.path.join(boost_dir,'b2'),'install','-j'+str(cpu_cores)],cwd=boost_dir):
                    raise Exception('boost failed to b2 install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 20
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'lib','libcfitsio.so')):
        print('installing cfitsio version',version)
        name = 'cfitsio'+version.replace('.','')+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('ftp://heasarc.gsfc.nasa.gov/software/fitsio/c',name)
            wget(url,path)
            unpack(path,tmp_dir)
            cfitsio_dir = os.path.join(tmp_dir,'cfitsio')
            mod_env = copy.deepcopy(os.environ)
            mod_env['CFLAGS'] = '-fPIC'
            if subprocess.call([os.path.join(cfitsio_dir,'configure'),
                                '--prefix',dir_name,'--enable-sse2'],
                               env=mod_env, cwd=cfitsio_dir):
                raise Exception('cfitsio failed to configure')
            if subprocess.call(['make','shared'], env=mod_env,
                               cwd=cfitsio_dir):
                raise Exception('cfitsio failed to make')
            if subprocess.call(['make','install'], env=mod_env,
                               cwd=cfitsio_dir):
                raise Exception('cfitsio failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 21
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'lib', 'libnlopt_cxx.so')):
        print('installing nlopt version', version)
        name = 'nlopt-' + str(version) + '.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            url = os.path.join('http://ab-initio.mit.edu/nlopt', name)
            wget(url, path)
            unpack(path, tmp_dir)
            nlopt_dir = os.path.join(tmp_dir, 'nlopt-' + version)
            options = [
                '--enable-shared',
                '--with-cxx',
                '--without-guile',
                '--without-octave',
                '--without-matlab',
            ]
            if subprocess.call(
                [os.path.join(nlopt_dir, 'configure'), '--prefix', dir_name] +
                    options,
                    cwd=nlopt_dir):
                raise Exception('nlopt failed to configure')
            if subprocess.call(['make', '-j', cpu_cores], cwd=nlopt_dir):
                raise Exception('nlopt failed to make')
            if subprocess.call(['make', 'install'], cwd=nlopt_dir):
                raise Exception('nlopt failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 22
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'lib','libcphotospline.so')):
        print('installing photospline version',version)
        if version=='master':
            name = 'master.tar.gz'
        elif version=='2.0.0':
            name = 'v'+str(version)+'.tar.gz'
        else:
            name = str(version)+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('https://github.com/cnweaver/photospline/archive/',name)
            wget(url,path)
            unpack(path,tmp_dir)
            photospline_dir = os.path.join(tmp_dir,'photospline-'+version)
            build_dir = os.path.join(photospline_dir,'build')
            if os.path.exists(build_dir):
                shutil.rmtree(build_dir)
            os.mkdir(build_dir)
            cmd = ['cmake','-DCMAKE_BUILD_TYPE=Release',
                   '-DCMAKE_INSTALL_PREFIX='+dir_name]
            cmd += ['..']
            if subprocess.call(cmd,cwd=build_dir):
                raise Exception('photospline failed to configure')
            if subprocess.call(['make','-j',cpu_cores],cwd=build_dir):
                raise Exception('photospline failed to make')
            if subprocess.call(['make','install'],cwd=build_dir):
                raise Exception('photospline failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 23
0
def install(dir_name,version=None,old_boost=False):
    if not os.path.exists(os.path.join(dir_name,'lib','libboost_numpy.so')):
        print('installing boostnumpy version',version)
        if version=='master':
            name = 'master.tar.gz'
        else:
            name = 'V'+str(version)+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('https://github.com/martwo/BoostNumpy/archive/',name)
            wget(url,path)
            unpack(path,tmp_dir)
            boostnumpy_dir = os.path.join(tmp_dir,'BoostNumpy-'+version)
            build_dir = os.path.join(boostnumpy_dir,'build')
            if os.path.exists(build_dir):
                shutil.rmtree(build_dir)
            os.mkdir(build_dir)
            cmd = ['cmake','-DCMAKE_BUILD_TYPE=Release',
                   '-DCMAKE_INSTALL_PREFIX='+dir_name]
            if old_boost:
                cmd += ['-DBOOST_INCLUDEDIR='+os.path.join(os.environ['I3_PORTS'],'include','boost-1.38.0'),
                        '-DBOOST_LIBRARYDIR='+os.path.join(os.environ['I3_PORTS'],'lib','boost-1.38.0')]
            cmd += ['..']
            if subprocess.call(cmd,cwd=build_dir):
                raise Exception('boostnumpy failed to configure')
            if subprocess.call(['make'],cwd=build_dir):
                raise Exception('boostnumpy failed to make')
            if subprocess.call(['make','install'],cwd=build_dir):
                raise Exception('boostnumpy failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 24
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'bin','lhapdf-config')):
        print('installing lhapdf5 version',version)
        name = 'lhapdf-'+str(version)+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('https://lhapdf.hepforge.org/downloads/?f='+name)
            wget(url,path)
            unpack(path,tmp_dir)
            lhapdf5_dir = os.path.join(tmp_dir,'lhapdf-'+version)

            pdfsets = ['mrst', 'mrst06', 'mrst98', 'mrstqed', 'cteq', 'grv',
                       'nnpdf', 'mstw', 'gjr', 'h1', 'zeus', 'hera', 'alekhin',
                       'botje', 'fermi', 'hkn', 'pions', 'photons', 'user']
            options = [
                '--disable-old-ccwrap',
                '--disable-doxygen',
                '--with-pic',
                '--enable-shared',
                '--enable-static',
                '--disable-pyext',
                '--disable-octave',
                '--enable-pdfsets={}'.format(','.join(pdfsets)),
            ]
            if subprocess.call([os.path.join(lhapdf5_dir,'configure'),
                                '--prefix',dir_name]+options,
                               cwd=lhapdf5_dir):
                raise Exception('lhapdf5 failed to configure')
            if subprocess.call(['make', '-j', cpu_cores],cwd=lhapdf5_dir):
                raise Exception('lhapdf5 failed to make')
            if subprocess.call(['make','install'],cwd=lhapdf5_dir):
                raise Exception('lhapdf5 failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 25
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'lib','libopenblas.so')):
        print('installing openblas version',version)
        name = 'v'+version+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('https://github.com/xianyi/OpenBLAS/archive',name)
            wget(url,path)
            unpack(path,tmp_dir)
            openblas_dir = os.path.join(tmp_dir,'OpenBLAS-'+version)
            makefile = os.path.join(openblas_dir,'Makefile.rule')
            with open(makefile,'a') as f:
                f.write('DYNAMIC_ARCH = 1\n')
                f.write('NO_AVX2 = 1\n')
                f.write('PREFIX = %s\n'%dir_name)
                f.write('NUM_THREADS = 24\n')
            #if subprocess.call(['make', '-j', cpu_cores],cwd=openblas_dir):
            print('cpu cores',cpu_cores)
            if subprocess.call(['make'],cwd=openblas_dir):
                raise Exception('openblas failed to make')
            if subprocess.call(['make','install'],cwd=openblas_dir):
                raise Exception('openblas failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 26
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'lib', 'libblosc.so')):
        print('installing blosc version', version)
        name = 'v' + str(version) + '.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            url = os.path.join('https://github.com/Blosc/c-blosc/archive',
                               name)
            wget(url, path)
            unpack(path, tmp_dir)
            blosc_dir = os.path.join(tmp_dir, 'c-blosc-' + version)
            build_dir = os.path.join(tmp_dir, 'build')
            os.mkdir(build_dir)
            if subprocess.call([
                    'cmake', '-DCMAKE_INSTALL_PREFIX=' + dir_name,
                    '-DPREFER_EXTERNAL_ZSTD=ON', blosc_dir
            ],
                               cwd=build_dir):
                raise Exception('blosc failed to make')
            if subprocess.call(['make'], cwd=build_dir):
                raise Exception('blosc failed to make')
            if subprocess.call(['make', 'install'], cwd=build_dir):
                raise Exception('blosc failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 27
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'bin','tclsh')):
        print('installing tcl/tk version',version)
        tcl_name = 'tcl'+version+'-src.tar.gz'
        tk_name = 'tk'+version+'-src.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            tcl_path = os.path.join(tmp_dir,tcl_name)
            tcl_url = os.path.join('http://downloads.sourceforge.net/project/tcl/Tcl/',version,tcl_name)
            tk_path = os.path.join(tmp_dir,tk_name)
            tk_url = os.path.join('http://downloads.sourceforge.net/project/tcl/Tcl/',version,tk_name)
            wget(tcl_url,tcl_path)
            wget(tk_url,tk_path)
            unpack(tcl_path,tmp_dir)
            unpack(tk_path,tmp_dir)
            tcl_dir = os.path.join(tmp_dir,'tcl'+str(version),'unix')
            print tcl_dir
            if subprocess.call([os.path.join(tcl_dir,'configure'),'--prefix',
                                dir_name,'--disable-shared'],cwd=tcl_dir):
                raise Exception('tcl failed to configure')
            if subprocess.call(['make'],cwd=tcl_dir):
                raise Exception('tcl failed to make')
            if subprocess.call(['make','install','install-libraries'],cwd=tcl_dir):
                raise Exception('tcl failed to install')
            tk_dir = os.path.join(tmp_dir,'tk'+str(version),'unix')
            if not subprocess.call([os.path.join(tk_dir,'configure'),'--prefix',
                                    dir_name],cwd=tk_dir):
                if not subprocess.call(['make'],cwd=tk_dir):
                    subprocess.call(['make','install'],cwd=tk_dir)
            os.symlink(os.path.expandvars('$SROOT/bin/tclsh'+'.'.join(version.split('.')[:2])),
                       os.path.expandvars('$SROOT/bin/tclsh'))
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 28
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'bin','nginx')):
        print('installing nginx version',version)
        name = 'nginx-'+str(version)+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('http://nginx.org/download',name)
            wget(url,path)
            unpack(path,tmp_dir)
            nginx_dir = os.path.join(tmp_dir,'nginx-'+str(version))
            options = ['--with-ipv6','--with-http_ssl_module',
                       '--without-http_geo_module',
                       '--without-http_map_module',
                       '--without-http_fastcgi_module',
                       '--without-http_uwsgi_module',
                       '--without-http_scgi_module',
                       '--without-http_memcached_module',
                       '--without-http_rewrite_module',
                       '--without-mail_pop3_module',
                       '--without-mail_imap_module',
                       '--without-mail_smtp_module',
#                       '--with-pcre='+os.path.join(os.environ['SROOT'],'lib'),
                       '--error-log-path=stderr',
                      ]
            if subprocess.call([os.path.join(nginx_dir,'configure'),
                                '--prefix='+dir_name]+options,
                                cwd=nginx_dir):
                raise Exception('nginx failed to configure')
            if subprocess.call(['make'],cwd=nginx_dir):
                raise Exception('nginx failed to make')
            if subprocess.call(['make','install'],cwd=nginx_dir):
                raise Exception('nginx failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 29
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'lib', 'libzmq.so')):
        print('installing zmq version', version)
        name = 'zeromq-' + str(version) + '.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            if LooseVersion(version) >= LooseVersion('4.1.0'):
                url = os.path.join(
                    'https://github.com/zeromq/zeromq4-1/releases/download/v' +
                    str(version), name)
            else:
                url = os.path.join('http://download.zeromq.org', name)
            wget(url, path)
            unpack(path, tmp_dir)
            zmq_dir = os.path.join(tmp_dir, 'zeromq-' + version)
            if subprocess.call([
                    os.path.join(zmq_dir, 'configure'), '--prefix', dir_name,
                    '--without-libsodium'
            ],
                               cwd=zmq_dir):
                raise Exception('zmq failed to configure')
            if subprocess.call(['make', '-j', cpu_cores], cwd=zmq_dir):
                raise Exception('zmq failed to make')
            if subprocess.call(['make', 'install'], cwd=zmq_dir):
                raise Exception('zmq failed to install')

            # the c++ bindings
            url = 'https://raw.githubusercontent.com/zeromq/cppzmq/master/zmq.hpp'
            path = os.path.join(dir_name, 'include', 'zmq.hpp')
            wget(url, path)
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 30
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'bin','uberftp')):
        print('installing uberftp version',version)
        url = 'https://github.com/WIPACrepo/UberFTP/archive/master.tar.gz'
        name = os.path.basename(url)
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            wget(url,path)
            unpack(path,tmp_dir)
            src_dir = os.path.join(tmp_dir,'UberFTP-master')
            globus_include = os.path.join(dir_name,'include','gcc64dbg')
            globus_flavor = 'gcc64dbg'
            if not os.path.exists(globus_include):
                globus_include = os.path.join(dir_name,'include')
                globus_flavor = 'gcc64'
            if subprocess.call([os.path.join(src_dir,'configure'),
                                '--with-globus='+dir_name,
                                '--with-globus-flavor='+globus_flavor,
                                '--with-globus_config='+globus_include,
                                '--prefix='+dir_name],
                                cwd=src_dir):
                raise Exception('failed to configure')
            if subprocess.call(['make', '-j', cpu_cores],cwd=src_dir):
                raise Exception('failed to make')
            if subprocess.call(['make','install'],cwd=src_dir):
                raise Exception('failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 31
0
def install(dir_name,version=None):
    fortran_compiler=None
    c_compiler=None
    if 'FC' in os.environ:
        fortran_compiler = os.environ['FC']
    if 'CC' in os.environ:
        c_compiler = os.environ['CC']

    if not os.path.exists(os.path.join(dir_name,'lib','libsprng.a')):
        print('installing sprng version',version)
        name = 'sprng'+version+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('http://www.sprng.org/Version'+version.strip(string.ascii_letters),name)
            wget(url,path)
            unpack(path,tmp_dir)
            sprng_dir = os.path.join(tmp_dir,'sprng'+version.strip(string.ascii_letters))
            choices = open(os.path.join(sprng_dir,'make.CHOICES')).read()
            f = open(os.path.join(sprng_dir,'make.CHOICES'),'w')
            try:
                for line in choices.split('\n'):
                    if not line.startswith('#'):
                        line = '#'+line
                    if 'INTEL' in line:
                        line = line[1:]
                    #elif 'LIB_REL_DIR' in line:
                    #    line = 'LIB_REL_DIR  = '+os.path.join(dir_name,'lib')
                    f.write(line+'\n')
            finally:
                f.close()
            make_intel = os.path.join(sprng_dir,'SRC','make.INTEL')
            data = open(make_intel).read()
            if fortran_compiler is not None:
                data = data.replace('g77',fortran_compiler).replace('-DAdd__','-DAdd_')
            else:
                data = data.replace('g77',get_fortran_compiler()).replace('-DAdd__','-DAdd_')
            if c_compiler is not None:
                data = data.replace('gcc',c_compiler).replace('-DAdd__','-DAdd_')
            data = data.replace('CFLAGS = ','CFLAGS = -fPIC ')
            open(make_intel,'w').write(data)
            if subprocess.call(['make','src'],cwd=sprng_dir):
                raise Exception('sprng failed to make')

            # manually install
            install_cmd = ['install','-D']
            if subprocess.call(install_cmd + [os.path.join(sprng_dir,'libsprng.a'),
                               os.path.join(dir_name,'lib','libsprng.a')],cwd=sprng_dir):
                raise Exception('failed to install library')
            install_cmd.extend(['-m','644'])
            include_dir = os.path.join(dir_name,'include','sprng')
            for f in glob.glob(os.path.join(sprng_dir,'include','*.h')):
                if subprocess.call(install_cmd + [f,
                                   os.path.join(include_dir,os.path.basename(f))],
                                   cwd=sprng_dir):
                    raise Exception('failed to install %s'%f)
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 32
0
def install(dir_name, version=None, for_clang=False):
    if not os.path.exists(os.path.join(dir_name, 'lib', 'libboost_python.so')):
        if for_clang:
            print('installing boost version', version, ' (for clang/c++14)')
        else:
            print('installing boost version', version)
        name = 'boost_' + version.replace('.', '_') + '.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            url = os.path.join(
                'http://downloads.sourceforge.net/project/boost/boost',
                version, name)
            wget(url, path)
            unpack(path, tmp_dir)
            boost_dir = os.path.join(tmp_dir,
                                     'boost_' + version.replace('.', '_'))
            if version == "1.61.0":
                wget(
                    "https://github.com/scopeInfinity/iostreams/commit/61a91325d936b0a9e6baaed6c974d0808e166822.patch",
                    os.path.join(
                        boost_dir,
                        "61a91325d936b0a9e6baaed6c974d0808e166822.patch"))
                subprocess.call([
                    "patch", "-p2", "<",
                    "61a91325d936b0a9e6baaed6c974d0808e166822.patch"
                ],
                                cwd=boost_dir)
            if for_clang:
                if subprocess.call([
                        os.path.join(boost_dir, 'bootstrap.sh'),
                        '--prefix=' + dir_name, '--with-toolset=clang'
                ],
                                   cwd=boost_dir):
                    raise Exception('boost failed to bootstrap')
                if subprocess.call([
                        os.path.join(boost_dir, 'b2'), 'install', '-j' +
                        cpu_cores, 'toolset=clang', 'cxxflags="-std=c++14"'
                ],
                                   cwd=boost_dir):
                    raise Exception('boost failed to b2 install')
            else:
                if subprocess.call([
                        os.path.join(boost_dir, 'bootstrap.sh'),
                        '--prefix=' + dir_name
                ],
                                   cwd=boost_dir):
                    raise Exception('boost failed to bootstrap')
                if subprocess.call([
                        os.path.join(boost_dir, 'b2'), 'install',
                        '-j' + cpu_cores
                ],
                                   cwd=boost_dir):
                    raise Exception('boost failed to b2 install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 33
0
def install(dir_name, version=None, gfortran_only=False):
    if gfortran_only:
        check_for = 'gfortran'
    else:
        check_for = 'gcc'

    if not os.path.exists(os.path.join(dir_name, 'bin', check_for)):
        if gfortran_only:
            print('installing gcc version', version, '(gfortran only)')
        else:
            print('installing gcc version', version)
        name = 'gcc-' + str(version) + '.tar.gz'

        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            url = os.path.join(
                'https://ftp.gnu.org/gnu/gcc/gcc-' + str(version), name)
            wget(url, path)
            unpack(path, tmp_dir)
            gcc_dir = os.path.join(tmp_dir, 'gcc-' + version)

            if gfortran_only:
                languages = 'c,fortran'
            else:
                languages = 'c,c++,fortran,lto'

            configure_options = [
                '--prefix=' + dir_name,
                '--enable-languages=' + languages,
                '--with-gmp=' + dir_name,
                '--with-mpfr=' + dir_name,
                '--with-mpc=' + dir_name,
                '--with-isl=' + dir_name,
                '--disable-multilib',
            ]

            if gfortran_only:
                configure_options += ['--disable-build-poststage1-with-cxx']

            if subprocess.call([os.path.join(gcc_dir, 'configure')] +
                               configure_options,
                               cwd=gcc_dir):
                raise Exception('gcc failed to configure')

            mod_env = copy.deepcopy(os.environ)
            mod_env['LD_LIBRARY_PATH'] = os.path.join(dir_name, 'lib')
            if subprocess.call(['make', '-j' + str(cpu_cores)],
                               cwd=gcc_dir,
                               env=mod_env):
                raise Exception('gcc failed to make')
            if subprocess.call(['make', 'install'], cwd=gcc_dir, env=mod_env):
                raise Exception('gcc failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 34
0
def install(dir_name, version=None):
    if (not (os.path.exists(os.path.join(dir_name, 'lib', 'libspqr.a'))
             or os.path.exists(os.path.join(dir_name, 'lib', 'libspqr.so')))):
        print('installing suitesparse version', version)
        name = 'SuiteSparse-' + version + '.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            url = os.path.join(
                'https://people.engr.tamu.edu/davis/SuiteSparse', name)
            wget(url, path)
            unpack(path, tmp_dir)
            suitesparse_dir = os.path.join(tmp_dir, 'SuiteSparse')

            ldflags = '-L' + os.path.join(suitesparse_dir, 'lib')
            ldflags += ' -L' + os.path.join(dir_name, 'lib')

            config_name = os.path.join(suitesparse_dir, 'SuiteSparse_config',
                                       'SuiteSparse_config.mk')
            config = open(config_name).read()
            with open(config_name, 'w') as f:
                f.write('BLAS = -L' + os.path.join(dir_name, 'lib') +
                        ' -lopenblas\n')
                f.write('LAPACK = -L' + os.path.join(dir_name, 'lib') +
                        ' -lopenblas\n')
                f.write('LDFLAGS = ' + ldflags + '\n')
                f.write('CFOPENMP=\n')
                for line in config.split('\n'):
                    if line.strip().startswith('INSTALL '):
                        line = 'INSTALL = ' + dir_name
                    elif line.strip().startswith('INSTALL_LIB '):
                        line = 'INSTALL_LIB = ' + os.path.join(dir_name, 'lib')
                    elif line.strip().startswith('INSTALL_INCLUDE '):
                        line = 'INSTALL_INCLUDE = ' + os.path.join(
                            dir_name, 'include')
                    elif line.strip().startswith('INSTALL_DOC '):
                        docs_dir = os.path.join(dir_name, 'share',
                                                'suitesparse')
                        line = 'INSTALL_DOC = ' + docs_dir
                        if not os.path.exists(docs_dir):
                            os.mkdir(docs_dir)
                    elif 'BLAS =' in line or 'LAPACK =' in line or 'CFOPENMP ' in line:
                        line = '#' + line
                    f.write(line + '\n')
            if subprocess.call([
                    'make',
                    'library',
            ], cwd=suitesparse_dir):
                raise Exception('suitesparse failed to make')
            if subprocess.call(['make', 'install'], cwd=suitesparse_dir):
                raise Exception('suitesparse failed to install')
        finally:
            pass  #shutil.rmtree(tmp_dir)
Esempio n. 35
0
def install(dir_name,version=None,pgo=False):
    if not os.path.exists(os.path.join(dir_name,'bin','python')):
        print('installing python version',version)
        name = 'Python-'+str(version)+'.tgz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('http://www.python.org/ftp/python',version,name)
            wget(url,path)
            unpack(path,tmp_dir)
            python_dir = os.path.join(tmp_dir,'Python-'+version)
            options = ['--enable-shared']
            v = LooseVersion(version)
            if v.version[0] < 3 or (v.version[0] == 3 and v.version[1] < 3):
                # 3.3+ is ucs4 by default, set it for older pythons
                options.append('--enable-unicode=ucs4')
            if pgo and (v.version[0] > 3 or (v.version[0] == 3 and v.version[1] > 5)):
                options.append('--enable-optimizations')
                os_arch = os.environ['OS_ARCH'].split('_')
                if ((os_arch[0] == 'RHEL' and float(os_arch[1]) > 7)
                    or (os_arch[0] == 'Ubuntu' and os_arch[1] not in ('12.04','14.04'))):
                    options.append('--with-lto')
            if subprocess.call([os.path.join(python_dir,'configure'),
                                '--prefix',dir_name,]+options
                               ,cwd=python_dir):
                raise Exception('python failed to configure')
            if subprocess.call(['make','-j',cpu_cores],cwd=python_dir):
                raise Exception('python failed to make')
            if subprocess.call(['make','install'],cwd=python_dir):
                raise Exception('python failed to install')
            # Python 3 specific symlinks
            # Assumes no python2 version is installed
            if v.version[0] == 3:
                version_short = '.'.join(map(str, v.version[:2]))
                symlink(os.path.join(dir_name,'bin','python3'),
                        os.path.join(dir_name,'bin','python'))
                symlink(os.path.join(dir_name, 'bin', 'python3-config'),
                        os.path.join(dir_name, 'bin', 'python-config'))
                symlink(os.path.join(dir_name, 'lib', 'pkgconfig', 'python3.pc'),
                        os.path.join(dir_name, 'lib', 'pkgconfig', 'python.pc'))
                symlink(os.path.join(dir_name, 'include', 'python%sm' % version_short),
                        os.path.join(dir_name, 'include', 'python%s' % version_short))
                symlink(os.path.join(dir_name,'bin','pip3'),
                        os.path.join(dir_name,'bin','pip'))
            # check for modules
            for m in ('sqlite3','zlib','bz2','_ssl','_curses','readline'):
                if subprocess.call([os.path.join(dir_name,'bin','python'),
                                    '-c','import '+m]):
                    if os.path.exists(os.path.join(dir_name,'bin','python')):
                        os.remove(os.path.join(dir_name,'bin','python'))
                    raise Exception('failed to build with '+m+' support')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 36
0
def install(dir_name,version=None,gfortran_only=False):
    if gfortran_only:
        check_for='gfortran'
    else:
        check_for='gcc'

    if not os.path.exists(os.path.join(dir_name,'bin',check_for)):
        if gfortran_only:
            print('installing gcc version',version,'(gfortran only)')
        else:
            print('installing gcc version',version)
        name = 'gcc-'+str(version)+'.tar.gz'

        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('https://ftp.gnu.org/gnu/gcc/gcc-'+str(version),name)
            wget(url,path)
            unpack(path,tmp_dir)
            gcc_dir = os.path.join(tmp_dir,'gcc-'+version)

            if gfortran_only:
                languages = 'c,fortran'
            else:
                languages = 'c,c++,fortran,lto'

            configure_options = [
                '--prefix='+dir_name,
                '--enable-languages='+languages,
                '--with-gmp='+dir_name,
                '--with-mpfr='+dir_name,
                '--with-mpc='+dir_name,
                '--with-isl='+dir_name,
                '--disable-multilib',
            ]

            if gfortran_only:
                configure_options+=[
                '--disable-build-poststage1-with-cxx']

            if subprocess.call([os.path.join(gcc_dir,'configure')]+configure_options,
                                cwd=gcc_dir):
                raise Exception('gcc failed to configure')

            mod_env = copy.deepcopy(os.environ)
            mod_env['LD_LIBRARY_PATH'] = os.path.join(dir_name,'lib')
            if subprocess.call(['make','-j'+str(cpu_cores)],cwd=gcc_dir,env=mod_env):
                raise Exception('gcc failed to make')
            if subprocess.call(['make','install'],cwd=gcc_dir,env=mod_env):
                raise Exception('gcc failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 37
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'bin','qmake')):
        print('installing qt version',version)
        name = 'qt-everywhere-opensource-src-'+version+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            major_version = '.'.join(version.split('.')[:2])
            if major_version == '4.8':
                url = os.path.join('http://download.qt.io/archive/qt/',major_version,version,name)
            else:
                url = os.path.join('http://download.qt.io/archive/qt/',major_version,version,'single',name)
            wget(url,path)
            unpack(path,tmp_dir)
            qt_dir = os.path.join(tmp_dir,'qt-everywhere-opensource-src-'+version)

            options = [
                   '-opensource','-opengl','-no-accessibility','-no-sql-db2',
                   '-no-sql-ibase','-no-sql-mysql','-no-sql-oci','-no-sql-odbc',
                   '-no-sql-psql','-no-sql-sqlite','-no-sql-sqlite2', '-no-sql-tds',
                   '-nomake','examples',
            ]

            cfg_path = os.path.join(qt_dir,'configure')
            if major_version == '4.8':
                # confirm the license early so it doesn't pause for user input
                cfg_data = open(cfg_path).read().replace('OPT_CONFIRM_LICENSE=no','OPT_CONFIRM_LICENSE=yes')
                open(cfg_path,'w').write(cfg_data)
                options.extend([
                        '-no-sql-sqlite_symbian',
                        '-no-xmlpatterns','-no-multimedia','-no-phonon','-no-phonon-backend',
                        '-no-webkit','-no-javascript-jit','-no-script','-no-scripttools',
                        '-no-declarative','-no-nis','-fast','-nomake','demos',
                        '-nomake','docs','-nomake','translations',
                ])
            else:
                cpu_cores = '1' # bug in dependencies
                options.extend([
                        '-confirm-license','-no-avx','-no-avx2','-no-avx512',
                        '-no-dbus','--no-harfbuzz','-no-ssl','-skip','wayland',
                ])

            # only install the required components
            if subprocess.call([cfg_path,'-prefix',dir_name]+options
                               ,cwd=qt_dir):
                raise Exception('qt failed to configure')
            if subprocess.call(['make','-j',cpu_cores],cwd=qt_dir):
                raise Exception('qt failed to make')
            if subprocess.call(['make','install'],cwd=qt_dir):
                raise Exception('qt failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 38
0
def install(dir_name,version=None,data_dir=None):
    if not os.path.exists(os.path.join(dir_name,'bin','genie')):
        print('installing genie version',version)
        name = 'R-{}.tar.gz'.format(version)
        base_url = 'https://github.com/GENIE-MC/Generator/archive'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join(base_url,name)
            wget(url,path)
            unpack(path,tmp_dir)
            genie_dir = os.path.join(tmp_dir,'Generator-R-{}'.format(version))

            with open(os.path.join(tmp_dir,'compiler_patch'), 'w') as f:
                f.write(compiler_patch)
            if subprocess.call("patch -p1 <"+os.path.join(tmp_dir,'compiler_patch'),cwd=genie_dir,shell=True):
                raise Exception('genie compiler could not be patched')
            with open(os.path.join(tmp_dir,'install_patch'), 'w') as f:
                f.write(install_patch)
            if subprocess.call("patch -p1 <"+os.path.join(tmp_dir,'install_patch'),cwd=genie_dir,shell=True):
                raise Exception('genie install could not be patched')
            
            options = [
                '--enable-rwght',
                '--with-pythia6-lib={}'.format(os.path.join(dir_name,'lib')),
                #'--with-libxml2-inc={}'.format(os.path.join(dir_name,'include')),
                #'--with-libxml2-lib={}'.format(os.path.join(dir_name,'lib')),
                '--with-log4cpp-inc={}'.format(os.path.join(dir_name,'include')),
                '--with-log4cpp-lib={}'.format(os.path.join(dir_name,'lib')),
                '--enable-lhapdf',
                '--with-lhapdf-inc={}'.format(os.path.join(dir_name,'include')),
                '--with-lhapdf-lib={}'.format(os.path.join(dir_name,'lib')),
            ]
            env = dict(os.environ)
            env['GENIE'] = genie_dir
            if 'CC' not in env:
                 env['CC'] = 'gcc'
            if 'CXX' not in env:
                 env['CXX'] = 'g++'

            if subprocess.call(['./configure',
                                '--prefix='+dir_name,]
                                +options,cwd=genie_dir,env=env):
                raise Exception('genie failed to cmake')
            if subprocess.call(['make'],cwd=genie_dir,env=env):
                raise Exception('genie failed to make')
            if subprocess.call(['make','install'],cwd=genie_dir,env=env):
                raise Exception('genie failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 39
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'lib','libPythia6.so')):
        print('installing pythia6 version',version)
        name = 'pythia-'+version+'.tgz'
        try:
            tmp_dir = tempfile.mkdtemp()
            root_name = 'pythia6'
            root_path = os.path.join(tmp_dir,'pythia6.tar.gz')
            root_url = 'https://root.cern.ch/download/pythia6.tar.gz'
            wget(root_url,root_path)
            unpack(root_path,tmp_dir)
            root_dir = os.path.join(tmp_dir,root_name)

            path = os.path.join(tmp_dir,name)
            url = os.path.join('http://www.hepforge.org/archive/pythiasix/',name)
            wget(url,path)
            build_dir = os.path.join(tmp_dir,'pythia-'+version)
            os.mkdir(build_dir)
            unpack(path,build_dir)
            
            placement = {
                'pythia6_common_address.c': 'pythia6_common_address.c',
                'tpythia6_called_from_cc.F': 'tpythia6_called_from_cc.F'
            }
            for src,dest in placement.items():
                shutil.copy2(os.path.join(root_dir,src), os.path.join(build_dir,dest))

            with open(os.path.join(build_dir,'CMakeLists.txt'), 'w') as f:
                f.write(cmakelists)
            with open(os.path.join(tmp_dir,'pythia6_patch'), 'w') as f:
                f.write(pythia6_patch)
            if subprocess.call("patch -p0 <"+os.path.join(tmp_dir,'pythia6_patch'),cwd=build_dir,shell=True):
                raise Exception('pythia6 install could not be patched')

            cmake_dir = os.path.join(tmp_dir,'build')
            os.mkdir(cmake_dir)

            mod_env = dict(os.environ)
            mod_env['FC'] = get_fortran_compiler()
            if subprocess.call(['cmake', '-DCMAKE_INSTALL_PREFIX={}'.format(dir_name),
                                '-DPYTHIA6_VERSION={}'.format(version), build_dir],
                               cwd=cmake_dir, env=mod_env):
                raise Exception('pythia6 failed to cmake')
            if subprocess.call(['make','-j',cpu_cores], cwd=cmake_dir, env=mod_env):
                raise Exception('pythia6 failed to make')
            if subprocess.call(['make','install'], cwd=cmake_dir, env=mod_env):
                raise Exception('pythia6 failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 40
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'bin','zstd')):
        print('installing zstd version',version)
        name = 'v'+str(version)+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('https://github.com/facebook/zstd/archive',name)
            wget(url,path)
            unpack(path,tmp_dir)
            zstd_dir = os.path.join(tmp_dir,'zstd-'+version)
            if subprocess.call(['make'],cwd=zstd_dir):
                raise Exception('zstd failed to make')
            if subprocess.call(['make','install','PREFIX='+dir_name],cwd=zstd_dir):
                raise Exception('zstd failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 41
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'bin', 'gfortran')):
        print('installing gcc version', version, '(gfortran only)')
        name = 'gcc-' + str(version) + '.tar.gz'

        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            url = os.path.join(
                'https://ftp.gnu.org/gnu/gcc/gcc-' + str(version), name)
            wget(url, path)
            unpack(path, tmp_dir)
            gcc_dir = os.path.join(tmp_dir, 'gcc-' + version)

            # this line does not seem to work correctly - it will still compile and install a g++ and libstdc++
            languages = 'c,fortran'

            configure_options = [
                '--prefix=' + dir_name,
                '--enable-languages=' + languages,
                '--with-gmp=' + dir_name,
                '--with-mpfr=' + dir_name,
                '--with-mpc=' + dir_name,
                '--with-isl=' + dir_name,
                '--disable-multilib',
            ]

            configure_options += ['--disable-build-poststage1-with-cxx']

            if subprocess.call([os.path.join(gcc_dir, 'configure')] +
                               configure_options,
                               cwd=gcc_dir):
                raise Exception('gcc failed to configure')

            mod_env = copy.deepcopy(os.environ)
            mod_env['LD_LIBRARY_PATH'] = os.path.join(dir_name, 'lib')
            if subprocess.call(['make', '-j' + str(cpu_cores)],
                               cwd=gcc_dir,
                               env=mod_env):
                raise Exception('gcc failed to make')
            # TODO: maybe install into a temporary DESTDIR, get rid of the gcc and g++ parts and only then move to the actual installation prefix
            if subprocess.call(['make', 'install'], cwd=gcc_dir, env=mod_env):
                raise Exception('gcc failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 42
0
def install(dir_name,version=None):
    if (not (os.path.exists(os.path.join(dir_name,'lib','libspqr.a'))
        or os.path.exists(os.path.join(dir_name,'lib','libspqr.so')))):
        print('installing suitesparse version',version)
        name = 'SuiteSparse-'+version+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('http://faculty.cse.tamu.edu/davis/SuiteSparse',name)
            wget(url,path)
            unpack(path,tmp_dir)
            suitesparse_dir = os.path.join(tmp_dir,'SuiteSparse')

            ldflags = '-L'+os.path.join(suitesparse_dir,'lib')
            ldflags += ' -L'+os.path.join(dir_name,'lib')

            config_name = os.path.join(suitesparse_dir,'SuiteSparse_config','SuiteSparse_config.mk')
            config = open(config_name).read()
            with open(config_name,'w') as f:
                f.write('BLAS = -L'+os.path.join(dir_name,'lib')+' -lopenblas\n')
                f.write('LAPACK = -L'+os.path.join(dir_name,'lib')+' -lopenblas\n')
                f.write('LDFLAGS = '+ldflags+'\n')
                f.write('CFOPENMP=\n')
                for line in config.split('\n'):
                    if line.strip().startswith('INSTALL '):
                        line = 'INSTALL = '+dir_name
                    elif line.strip().startswith('INSTALL_LIB '):
                        line = 'INSTALL_LIB = '+os.path.join(dir_name,'lib')
                    elif line.strip().startswith('INSTALL_INCLUDE '):
                        line = 'INSTALL_INCLUDE = '+os.path.join(dir_name,'include')
                    elif line.strip().startswith('INSTALL_DOC '):
                        docs_dir = os.path.join(dir_name,'share','suitesparse')
                        line = 'INSTALL_DOC = '+docs_dir
                        if not os.path.exists(docs_dir):
                            os.mkdir(docs_dir)
                    elif 'BLAS =' in line or 'LAPACK =' in line or 'CFOPENMP ' in line:
                        line = '#'+line
                    f.write(line+'\n')
            if subprocess.call(['make', 'library',],
                                cwd=suitesparse_dir):
                raise Exception('suitesparse failed to make')
            if subprocess.call(['make','install'],cwd=suitesparse_dir):
                raise Exception('suitesparse failed to install')
        finally:
            pass#shutil.rmtree(tmp_dir)
Esempio n. 43
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'bin', 'zstd')):
        print('installing zstd version', version)
        name = 'v' + str(version) + '.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            url = os.path.join('https://github.com/facebook/zstd/archive',
                               name)
            wget(url, path)
            unpack(path, tmp_dir)
            zstd_dir = os.path.join(tmp_dir, 'zstd-' + version)
            if subprocess.call(['make'], cwd=zstd_dir):
                raise Exception('zstd failed to make')
            if subprocess.call(['make', 'install', 'PREFIX=' + dir_name],
                               cwd=zstd_dir):
                raise Exception('zstd failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 44
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'lib/','libhiredis.so')):
        print('hiredis version',version)
        name = 'v'+version+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            t_url = 'https://github.com/redis/hiredis/archive/'
            url = os.path.join(t_url,name)
            wget(url,path)
            unpack(path,tmp_dir)
            oo_dir = os.path.join(tmp_dir,'hiredis-'+version)
            mod_env = dict(os.environ)
            if subprocess.call(['make'],cwd=oo_dir):
                raise Exception('hiredis failed to make')
            if subprocess.call(['make','PREFIX='+dir_name,'install'],cwd=oo_dir):
                raise Exception('hiredis failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 45
0
def install(dir_name, version=None):
    bin_path = os.path.join(dir_name, 'bin', 'tclsh')
    if not os.path.exists(bin_path):
        print('installing tcl/tk version', version)
        tcl_name = 'tcl' + version + '-src.tar.gz'
        tk_name = 'tk' + version + '-src.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            tcl_path = os.path.join(tmp_dir, tcl_name)
            tcl_url = os.path.join(
                'http://downloads.sourceforge.net/project/tcl/Tcl/', version,
                tcl_name)
            tk_path = os.path.join(tmp_dir, tk_name)
            tk_url = os.path.join(
                'http://downloads.sourceforge.net/project/tcl/Tcl/', version,
                tk_name)
            wget(tcl_url, tcl_path)
            wget(tk_url, tk_path)
            unpack(tcl_path, tmp_dir)
            unpack(tk_path, tmp_dir)
            tcl_dir = os.path.join(tmp_dir, 'tcl' + str(version), 'unix')
            print tcl_dir
            if subprocess.call([
                    os.path.join(tcl_dir, 'configure'), '--prefix', dir_name,
                    '--disable-shared'
            ],
                               cwd=tcl_dir):
                raise Exception('tcl failed to configure')
            if subprocess.call(['make'], cwd=tcl_dir):
                raise Exception('tcl failed to make')
            if subprocess.call(['make', 'install', 'install-libraries'],
                               cwd=tcl_dir):
                raise Exception('tcl failed to install')
            tk_dir = os.path.join(tmp_dir, 'tk' + str(version), 'unix')
            if not subprocess.call(
                [os.path.join(tk_dir, 'configure'), '--prefix', dir_name],
                    cwd=tk_dir):
                if not subprocess.call(['make'], cwd=tk_dir):
                    subprocess.call(['make', 'install'], cwd=tk_dir)
            os.symlink(bin_path + '.'.join(version.split('.')[:2]), bin_path)
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 46
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'bin/', 'redis-cli')):
        print('redis version', version)
        name = 'redis-' + str(version) + '.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            t_url = 'http://download.redis.io/releases'
            url = os.path.join(t_url, name)
            wget(url, path)
            unpack(path, tmp_dir)
            oo_dir = os.path.join(tmp_dir, 'redis-' + version)
            mod_env = dict(os.environ)
            if subprocess.call(['make'], cwd=oo_dir):
                raise Exception('redis failed to make')
            if subprocess.call(['make', 'PREFIX=' + dir_name, 'install'],
                               cwd=oo_dir):
                raise Exception('redis failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 47
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'bin','gzip')):
        print('installing gzip version',version)
        name = 'gzip-'+str(version)+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('http://ftp.gnu.org/gnu/gzip',name)
            wget(url,path)
            unpack(path,tmp_dir)
            gzip_dir = os.path.join(tmp_dir,'gzip-'+version)
            if subprocess.call([os.path.join(gzip_dir,'configure'),
                                '--prefix',dir_name],cwd=gzip_dir):
                raise Exception('gzip failed to configure')
            if subprocess.call(['make'],cwd=gzip_dir):
                raise Exception('gzip failed to make')
            if subprocess.call(['make','install'],cwd=gzip_dir):
                raise Exception('gzip failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 48
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'lib/', 'libhiredis.so')):
        print('hiredis version', version)
        name = 'v' + version + '.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            t_url = 'https://github.com/redis/hiredis/archive/'
            url = os.path.join(t_url, name)
            wget(url, path)
            unpack(path, tmp_dir)
            oo_dir = os.path.join(tmp_dir, 'hiredis-' + version)
            mod_env = dict(os.environ)
            if subprocess.call(['make'], cwd=oo_dir):
                raise Exception('hiredis failed to make')
            if subprocess.call(['make', 'PREFIX=' + dir_name, 'install'],
                               cwd=oo_dir):
                raise Exception('hiredis failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 49
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'bin','cmake')):
        print('installing cmake version',version)
        name = 'cmake-'+str(version)+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('http://www.cmake.org/files/v'+'.'.join(version.split('.')[:2]),name)
            wget(url,path)
            unpack(path,tmp_dir)
            cmake_dir = os.path.join(tmp_dir,'cmake-'+version)
            if subprocess.call([os.path.join(cmake_dir,'configure'),
                                '--prefix='+dir_name],cwd=cmake_dir):
                raise Exception('cmake failed to configure')
            if subprocess.call(['make', '-j', cpu_cores],cwd=cmake_dir):
                raise Exception('cmake failed to make')
            if subprocess.call(['make','install'],cwd=cmake_dir):
                raise Exception('cmake failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 50
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'bin', 'globus-url-copy')):
        print('installing globus version', version)
        url = get_url(version)
        name = os.path.basename(url)
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            wget(url, path)
            unpack(path, tmp_dir)
            globus_dir = os.path.join(tmp_dir, name.rsplit('.', 2)[0])
            if int(version[0]) <= 5:
                #                if subprocess.call(['cpanm','--local-lib',dir_name,
                #                                    'Archive::Tar','Compress::Zlib','Digest::MD5',
                #                                    'File::Spec','IO::Zlib','Pod::Parser',
                #                                    'Test::Simple','XML::Parser']):
                #                    raise Exception('failed to install globus perl modules')
                if subprocess.call([
                        os.path.join(globus_dir, 'configure'), '--prefix',
                        dir_name
                ],
                                   cwd=globus_dir):
                    raise Exception('globus failed to configure')
                if subprocess.call(
                    ['make', 'gpt', 'globus-data-management-client'],
                        cwd=globus_dir):
                    raise Exception('globus failed to make')
            elif int(version[0]) >= 6:
                if subprocess.call([
                        os.path.join(globus_dir,
                                     'configure'), '--disable-gram5',
                        '--disable-myproxy', '--prefix', dir_name
                ],
                                   cwd=globus_dir):
                    raise Exception('globus failed to configure')
                if subprocess.call(['make', '-j', cpu_cores], cwd=globus_dir):
                    raise Exception('globus failed to make')
            if subprocess.call(['make', 'install'], cwd=globus_dir):
                raise Exception('globus failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 51
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'bin', 'h5ls')):
        print('installing hdf5 version', version)
        name = 'hdf5-' + str(version) + '.tar.gz'
        short_version = '.'.join(version.split('.')[:2])
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            url = os.path.join(
                "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-" +
                short_version, "hdf5-" + version, 'src', name)
            try:
                wget(url, path)
            except Exception:
                try:
                    url = os.path.join(
                        "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-"
                        + short_version, name)
                    wget(url, path)
                except Exception:
                    url = os.path.join(
                        "https://support.hdfgroup.org/ftp/HDF5/current18",
                        'src', name)
                    wget(url, path)
            unpack(path, tmp_dir, flags=['-xz'])
            hdf5_dir = os.path.join(tmp_dir, 'hdf5-' + version)
            if 'CC' in os.environ:
                os.environ['HDF5_CC'] = os.environ['CC']
            if subprocess.call([
                    os.path.join(hdf5_dir, 'configure'), '--prefix', dir_name,
                    '--disable-debug', '--enable-cxx', '--enable-production',
                    '--enable-strict-format-checks', '--with-zlib=/usr'
            ],
                               cwd=hdf5_dir):
                raise Exception('hdf5 failed to configure')
            if subprocess.call(['make', '-j', cpu_cores], cwd=hdf5_dir):
                raise Exception('hdf5 failed to make')
            if subprocess.call(['make', 'install'], cwd=hdf5_dir):
                raise Exception('hdf5 failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 52
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'lib', 'libcdk.a')):
        print('installing cdk version', version)
        name = 'cdk-' + version + '.tgz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            url = os.path.join('ftp://ftp.invisible-island.net/cdk', name)
            wget(url, path)
            unpack(path, tmp_dir)
            cdk_dir = os.path.join(tmp_dir, 'cdk-' + version)
            if subprocess.call(
                [os.path.join(cdk_dir, 'configure'), '--prefix', dir_name],
                    cwd=cdk_dir):
                raise Exception('cdk failed to configure')
            if subprocess.call(['make'], cwd=cdk_dir):
                raise Exception('cdk failed to make')
            if subprocess.call(['make', 'install'], cwd=cdk_dir):
                raise Exception('cdk failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 53
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'bin', 'bzip2')):
        print('installing bzip2 version', version)
        name = 'bzip2-' + str(version) + '.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            url = os.path.join('http://www.bzip.org', str(version), name)
            wget(url, path)
            unpack(path, tmp_dir)
            bzip2_dir = os.path.join(tmp_dir, 'bzip2-' + version)
            if subprocess.call(['make', '-f', 'Makefile-libbz2_so'],
                               cwd=bzip2_dir):
                raise Exception('bzip2 so failed to make')
            if subprocess.call(['make'], cwd=bzip2_dir):
                raise Exception('bzip2 failed to make')
            if subprocess.call(['make', 'install', 'PREFIX=' + dir_name],
                               cwd=bzip2_dir):
                raise Exception('bzip2 failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 54
0
def install(dir_name, version=None):
    if not os.path.exists(os.path.join(dir_name, 'bin', 'curl')):
        print('installing curl version', version)
        name = 'curl-' + str(version) + '.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            url = os.path.join('http://curl.haxx.se/download', name)
            wget(url, path)
            unpack(path, tmp_dir)
            curl_dir = os.path.join(tmp_dir, 'curl-' + str(version))
            if subprocess.call(
                [os.path.join(curl_dir, 'configure'), '--prefix', dir_name],
                    cwd=curl_dir):
                raise Exception('curl failed to configure')
            if subprocess.call(['make', '-j', cpu_cores], cwd=curl_dir):
                raise Exception('curl failed to make')
            if subprocess.call(['make', 'install'], cwd=curl_dir):
                raise Exception('curl failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 55
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'lib','libxml2.so')):
        print('installing libxml2 version',version)
        name = 'libxml2-'+str(version)+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('ftp://xmlsoft.org/libxml2',name)
            wget(url,path)
            unpack(path,tmp_dir)
            libxml2_dir = os.path.join(tmp_dir,'libxml2-'+version)
            if subprocess.call([os.path.join(libxml2_dir,'configure'),
                                '--prefix',dir_name,'--without-python'],
                               cwd=libxml2_dir):
                raise Exception('libxml2 failed to configure')
            if subprocess.call(['make', '-j', cpu_cores],cwd=libxml2_dir):
                raise Exception('libxml2 failed to make')
            if subprocess.call(['make','install'],cwd=libxml2_dir):
                raise Exception('libxml2 failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 56
0
def install(dir_name,version=None):
    if not os.path.exists(os.path.join(dir_name,'lib','liberfa.so')):
        print('installing erfa version',version)
        name = 'erfa-'+str(version)+'.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir,name)
            url = os.path.join('https://github.com/liberfa/erfa/releases/download/v'+version,name)
            wget(url,path)
            unpack(path,tmp_dir)
            erfa_dir = os.path.join(tmp_dir,'erfa-'+version)
            if subprocess.call([os.path.join(erfa_dir,'configure'),
                                '--prefix',dir_name],
                               cwd=erfa_dir):
                raise Exception('erfa failed to configure')
            if subprocess.call(['make', '-j', cpu_cores],cwd=erfa_dir):
                raise Exception('erfa failed to make')
            if subprocess.call(['make','install'],cwd=erfa_dir):
                raise Exception('erfa failed to install')
        finally:
            shutil.rmtree(tmp_dir)
Esempio n. 57
0
def install(dir_name, version=None, x11=False):
    if not os.path.exists(os.path.join(dir_name, 'bin', 'gnuplot')):
        print('installing gnuplot version', version)
        name = 'gnuplot-' + str(version) + '.tar.gz'
        try:
            tmp_dir = tempfile.mkdtemp()
            path = os.path.join(tmp_dir, name)
            url = os.path.join(
                'http://downloads.sourceforge.net/project/gnuplot/gnuplot/',
                version, name)
            wget(url, path)
            unpack(path, tmp_dir)
            gnuplot_dir = os.path.join(tmp_dir, 'gnuplot-' + version)
            options = [
                '--without-linux-vga',
                '--without-lisp-files',
                '--without-tutorial',
                '--with-bitmap-terminals',
            ]
            if not x11:
                options.extend(
                    ['--without-x', '--without-lua', '--with-qt=no'])
            if subprocess.call([
                    os.path.join(gnuplot_dir, 'configure'),
                    '--prefix',
                    dir_name,
            ] + options,
                               cwd=gnuplot_dir):
                raise Exception('gnuplot failed to configure')
            if subprocess.call(['make', '-j', cpu_cores], cwd=gnuplot_dir):
                raise Exception('gnuplot failed to make')
            # touch two files to convince make they are new again
            for f in (os.path.join(gnuplot_dir, 'docs', 'gnuplot-eldoc.el'),
                      os.path.join(gnuplot_dir, 'docs', 'gnuplot-eldoc.elc')):
                if os.path.exists(f):
                    os.utime(f, None)
            if subprocess.call(['make', 'install'], cwd=gnuplot_dir):
                raise Exception('gnuplot failed to install')
        finally:
            shutil.rmtree(tmp_dir)