Example #1
0
def install(rpkg_tar_gz, dir_fpath):
    assert os.path.isdir(dir_fpath)
    def set_current(to_last):
        src = "last" if to_last else "previous"
        # :TRICKY: для переопределения сущ. ссылки нужно одновременно -f и -n ,-
        # артефакт *nix
        call_cmd("ln -s -f -n %s current" % src, cwd=dir_fpath)
    
    last_fpath = o_p.join(dir_fpath, "last")
    curr_fpath = o_p.join(dir_fpath, "current")
    if os.path.exists(last_fpath):
        curr_exists = False
        if os.path.exists(curr_fpath):
            assert os.path.islink(curr_fpath)
            curr_exists = True
        
        prev_fpath = o_p.join(dir_fpath, "previous")
        if os.path.exists(prev_fpath):
            shutil.rmtree(prev_fpath)
            
        shutil.move(last_fpath, prev_fpath)
        if curr_exists:
            set_current(False)
        
    os.mkdir(last_fpath)
    
    call_cmd("tar -xzf %(rpkg_tar_gz)s -C %(last_fpath)s" % locals())
    set_current(True)
Example #2
0
def install(rpkg_tar_gz, dir_fpath):
    assert os.path.isdir(dir_fpath)

    def set_current(to_last):
        src = "last" if to_last else "previous"
        # :TRICKY: для переопределения сущ. ссылки нужно одновременно -f и -n ,-
        # артефакт *nix
        call_cmd("ln -s -f -n %s current" % src, cwd=dir_fpath)

    last_fpath = o_p.join(dir_fpath, "last")
    curr_fpath = o_p.join(dir_fpath, "current")
    if os.path.exists(last_fpath):
        curr_exists = False
        if os.path.exists(curr_fpath):
            assert os.path.islink(curr_fpath)
            curr_exists = True

        prev_fpath = o_p.join(dir_fpath, "previous")
        if os.path.exists(prev_fpath):
            shutil.rmtree(prev_fpath)

        shutil.move(last_fpath, prev_fpath)
        if curr_exists:
            set_current(False)

    os.mkdir(last_fpath)

    call_cmd("tar -xzf %(rpkg_tar_gz)s -C %(last_fpath)s" % locals())
    set_current(True)
Example #3
0
    # политика: вроде как bcp сам не удаляет boost_dst, поэтому работаем по месту
    if os.path.exists(boost_dst):
        # удаляем все кроме своего
        lst = ['LICENSE_1_0.txt', 'README', 'SConscript', 'test_include']
        for fname in os.listdir(boost_dst):
            if not fname in lst:
                fpath = os.path.join(boost_dst, fname)
                print 'rm', fpath
                o_p.del_any_fpath(fpath)

    cmd = '''%(bcp)s --boost=%(boost_src)s boost/smart_ptr.hpp boost/test boost/function.hpp boost/lambda boost/bind \
boost/filesystem system boost/regex format boost/foreach.hpp boost/iterator boost/cast.hpp boost/range/reference.hpp \
boost/assign/list_of.hpp boost/assign.hpp boost/mpl/print.hpp %(boost_dst)s''' % locals(
    )
    #print cmd
    call_cmd(cmd, err_msg='bcp failed.')

    call_in_dst = make_call_in_dst(boost_dst)
    # Чистим все неиспользуемое

    # I boost/preprocessor
    # 1 - iteration - 1 файл для Function
    call_in_dst('rm -rf `ls | grep -v forward1.hpp`',
                'boost/preprocessor/iteration/detail/iter')

    # 2 - не gcc
    call_in_dst(
        'rm -rf list/detail/dmc list/detail/edg \
repetition/detail/dmc repetition/detail/edg repetition/detail/msvc \
control/detail/dmc control/detail/edg control/detail/msvc',
        'boost/preprocessor')
Example #4
0
    # политика: вроде как bcp сам не удаляет boost_dst, поэтому работаем по месту
    if os.path.exists(boost_dst):
        # удаляем все кроме своего
        lst = ['LICENSE_1_0.txt', 'README', 'SConscript', 'test_include']
        for fname in os.listdir(boost_dst):
            if not fname in lst:
                fpath = os.path.join(boost_dst, fname)
                print 'rm', fpath
                o_p.del_any_fpath(fpath)
    
    cmd = '''%(bcp)s --boost=%(boost_src)s boost/smart_ptr.hpp boost/test boost/function.hpp boost/lambda boost/bind \
boost/filesystem system boost/regex format boost/foreach.hpp boost/iterator boost/cast.hpp boost/range/reference.hpp \
boost/assign/list_of.hpp boost/assign.hpp boost/mpl/print.hpp %(boost_dst)s''' % locals()
    #print cmd
    call_cmd(cmd, err_msg='bcp failed.')

    call_in_dst = make_call_in_dst(boost_dst)
    # Чистим все неиспользуемое

    # I boost/preprocessor
    # 1 - iteration - 1 файл для Function
    call_in_dst('rm -rf `ls | grep -v forward1.hpp`', 'boost/preprocessor/iteration/detail/iter')
    
    # 2 - не gcc
    call_in_dst('rm -rf list/detail/dmc list/detail/edg \
repetition/detail/dmc repetition/detail/edg repetition/detail/msvc \
control/detail/dmc control/detail/edg control/detail/msvc', 'boost/preprocessor')
    
    # 3 - ?
    #call_in_dst('rm -rf boost/preprocessor/seq/fold_left.hpp')
Example #5
0
    args = parser.parse_args()
    
    is_libav = args.is_libav
    src_dir  = os.path.abspath(args.src_path)
    if is_libav:
        add_opts = ""
    else:
        if args.is_debug:
            add_opts = "--disable-stripping"
        else:
            add_opts = ""
    bld_dir = o_p.join(src_dir, "objs")

    if os.path.exists(bld_dir):
        import shutil
        shutil.rmtree(bld_dir)
        
    o_p.force_makedirs(bld_dir)
    inst_dir = o_p.join(bld_dir, "inst")
    
    enable_x264 = True
    x264_support = "--enable-libx264 --enable-gpl" if enable_x264 else ""
    if x264_support:
        x264_support = " " + x264_support
    
    debug_opts = "--disable-optimizations --extra-cflags='-O0 -g' " if args.is_debug else ""
    call_cmd("../configure --prefix=%(inst_dir)s %(debug_opts)s--extra-ldflags='-Wl,-rpath=%(inst_dir)s/lib' \
%(add_opts)s --enable-shared --disable-static%(x264_support)s" % locals(), bld_dir)
    
    call_cmd("make -j 7 V=1 install", bld_dir)
Example #6
0
#!/usr/bin/env python
# coding: utf-8

import o_p
from call_cmd import call_cmd

if __name__ == '__main__':
    from parse_options import parse_args
    dir_fpath, tar_fname = parse_args("local_dir", "tar_fname")

    if o_p.exists(tar_fname):
        res = o_p.remove_file(tar_fname)
        assert res

    # :REFACTOR:
    call_cmd("tar -cf %(tar_fname)s -C %(dir_fpath)s ." % locals())
    
Example #7
0
 def set_current(to_last):
     src = "last" if to_last else "previous"
     # :TRICKY: для переопределения сущ. ссылки нужно одновременно -f и -n ,-
     # артефакт *nix
     call_cmd("ln -s -f -n %s current" % src, cwd=dir_fpath)
Example #8
0
 def set_current(to_last):
     src = "last" if to_last else "previous"
     # :TRICKY: для переопределения сущ. ссылки нужно одновременно -f и -n ,-
     # артефакт *nix
     call_cmd("ln -s -f -n %s current" % src, cwd=dir_fpath)