Esempio n. 1
0
def localize_hesaff():
    print('____ Localizing hessaff ____')
    hesaff_build = __CODE__ + '/hesaff/build'
    hesaff_pybnd = __CODE__ + '/hesaff/python_bindings'
    check_path(hesaff_build)
    tpl_hesaff = tpl_root + '/hesaff'
    ensure_path(tpl_hesaff) 
    copy_all(hesaff_build, tpl_hesaff, 'hesaff*')
    copy_all(hesaff_pybnd, tpl_hesaff, '*.py')
    os.system('chmod +x ' + tpl_hesaff + '/hesaff*')
Esempio n. 2
0
def localize_hesaff():
    print('____ Localizing hessaff ____')
    hesaff_build = __CODE__ + '/hesaff/build'
    hesaff_pybnd = __CODE__ + '/hesaff/python_bindings'
    check_path(hesaff_build)
    tpl_hesaff = tpl_root + '/hesaff'
    ensure_path(tpl_hesaff)
    copy_all(hesaff_build, tpl_hesaff, 'hesaff*')
    copy_all(hesaff_pybnd, tpl_hesaff, '*.py')
    os.system('chmod +x ' + tpl_hesaff + '/hesaff*')
Esempio n. 3
0
def __build(pkg_name,
            branchname='hotspotter_branch',
            cmake_flags={},
            noinstall=False,
            rm_build=False,
            nomake=False):
    ''' 
    Generic build function for hotspotter third party libraries: 
        All libraries should be hosted under github.com:Erotemic/<pkg_name>
    '''
    from hs_setup.git_helpers import git_branch, git_version, git_fetch_url
    cmd_args = ['raise', 'print']
    # ---- INIT ---- #
    init_str = '_____ Python is building: '+ pkg_name +' _____'
    print('\n\n'+'='*len(init_str))
    print(init_str)
    code_src = __CODE__+'/'+pkg_name
    code_build = code_src+'/build'
    # ---- CHECK SOURCE ---- #
    print('\n --- Checking code source dir: '+code_src+'\n')
    if not check_path(code_src): 
        if not check_path(__CODE__):
            raise Exception('We have problems')
        cd(__CODE__)
        __cmd('git clone [email protected]:Erotemic/'+pkg_name+'.git', *cmd_args)
    cd(code_src)
    # ---- CHECK GIT ---- #
    print('\n --- Checking git info')
    current_branch = git_branch()
    fetch_url = git_fetch_url()
    version = git_version()
    print('   * fetch_url='+str(fetch_url))
    print('   * branch='+str(current_branch))
    #print('  * version='+str(version))
    if current_branch != branchname:
        __cmd('git checkout '+branchname, *cmd_args)
    # ---- CHECK BUILD ---- #
    if rm_build:
        print('\n --- Forcing rm build dir: ' + code_build + '\n')
        if check_path(code_build):
            __cmd('rm -rf '+code_build)
    print('\n --- Creating build dir: ' + code_build + '\n')
    ensure_path(code_build)
    cd(code_build)
    # ---- CMAKE ---- #
    print('\n --- Running cmake\n')
    if not 'CMAKE_INSTALL_PREFIX' in cmake_flags: 
        _cm_install_prefix = install_prefix
        if sys.platform == 'win32': _cm_install_prefix += '/' + pkg_name
        cmake_flags['CMAKE_INSTALL_PREFIX'] = _cm_install_prefix
    _cmake_args = cmake_flags2str(cmake_flags).replace('\n',' ')
    __cmd(cmake_cmd + _cmake_args + ' ..', *cmd_args)
    # ---- MAKE ---- #
    print('\n --- Running make\n') 
    __cmd(make_cmd, *cmd_args)
    # ---- INSTALL ---- #
    if noinstall:
        print('\n --- Not Installing\n')
    else:
        print('\n --- Installing to: '+cmake_flags['CMAKE_INSTALL_PREFIX']+'\n')
        __sudo_cmd('make install', *cmd_args)
    # ---- END ---- #
    cd(hotspotter_root)
    exit_msg =  ' --- Finished building: '+pkg_name
    print('\n'+exit_msg)
    print('='*len(exit_msg)+'\n')
Esempio n. 4
0
def __build(pkg_name,
            branchname='hotspotter_branch',
            cmake_flags={},
            noinstall=False,
            rm_build=False,
            nomake=False):
    ''' 
    Generic build function for hotspotter third party libraries: 
        All libraries should be hosted under github.com:Erotemic/<pkg_name>
    '''
    from hs_setup.git_helpers import git_branch, git_version, git_fetch_url
    cmd_args = ['raise', 'print']
    # ---- INIT ---- #
    init_str = '_____ Python is building: ' + pkg_name + ' _____'
    print('\n\n' + '=' * len(init_str))
    print(init_str)
    code_src = __CODE__ + '/' + pkg_name
    code_build = code_src + '/build'
    # ---- CHECK SOURCE ---- #
    print('\n --- Checking code source dir: ' + code_src + '\n')
    if not check_path(code_src):
        if not check_path(__CODE__):
            raise Exception('We have problems')
        cd(__CODE__)
        __cmd('git clone [email protected]:Erotemic/' + pkg_name + '.git',
              *cmd_args)
    cd(code_src)
    # ---- CHECK GIT ---- #
    print('\n --- Checking git info')
    current_branch = git_branch()
    fetch_url = git_fetch_url()
    version = git_version()
    print('   * fetch_url=' + str(fetch_url))
    print('   * branch=' + str(current_branch))
    #print('  * version='+str(version))
    if current_branch != branchname:
        __cmd('git checkout ' + branchname, *cmd_args)
    # ---- CHECK BUILD ---- #
    if rm_build:
        print('\n --- Forcing rm build dir: ' + code_build + '\n')
        if check_path(code_build):
            __cmd('rm -rf ' + code_build)
    print('\n --- Creating build dir: ' + code_build + '\n')
    ensure_path(code_build)
    cd(code_build)
    # ---- CMAKE ---- #
    print('\n --- Running cmake\n')
    if not 'CMAKE_INSTALL_PREFIX' in cmake_flags:
        _cm_install_prefix = install_prefix
        if sys.platform == 'win32': _cm_install_prefix += '/' + pkg_name
        cmake_flags['CMAKE_INSTALL_PREFIX'] = _cm_install_prefix
    _cmake_args = cmake_flags2str(cmake_flags).replace('\n', ' ')
    __cmd(cmake_cmd + _cmake_args + ' ..', *cmd_args)
    # ---- MAKE ---- #
    print('\n --- Running make\n')
    __cmd(make_cmd, *cmd_args)
    # ---- INSTALL ---- #
    if noinstall:
        print('\n --- Not Installing\n')
    else:
        print('\n --- Installing to: ' + cmake_flags['CMAKE_INSTALL_PREFIX'] +
              '\n')
        __sudo_cmd('make install', *cmd_args)
    # ---- END ---- #
    cd(hotspotter_root)
    exit_msg = ' --- Finished building: ' + pkg_name
    print('\n' + exit_msg)
    print('=' * len(exit_msg) + '\n')