示例#1
0
def source_excenturyrc():
    """Source the .excenturyrc file in the .bashrc file. """
    make_dir(pth.expandvars('$HOME/.excentury'))
    if sys.platform in ['Darwin', 'darwin']:
        bashrc_path = pth.expandvars('$HOME/.bash_profile')
    else:
        bashrc_path = pth.expandvars('$HOME/.bashrc')
    disp('checking %s ... ' % bashrc_path)
    if pth.exists(bashrc_path):
        expr = [
            'source ~/.excentury/excenturyrc\n',
            'source $HOME/.excentury/excenturyrc\n',
            pth.expandvars('source $HOME/.excentury/excenturyrc\n'),
        ]
        for content_line in open(bashrc_path, 'r'):
            for line in expr:
                if line == content_line:
                    disp('ok\n')
                    return
    with open(bashrc_path, 'a') as content_file:
        disp('\n    including excenturyrc\n')
        content_file.write('source ~/.excentury/excenturyrc\n')
示例#2
0
def make_directories():
    """Creates the project directories. """
    dirs = [
        'xcpp',
        'bin',
        'lib',
        'cpp',
        'matlab',
        'python',
    ]
    disp('Creating directories ... \n')
    for path in dirs:
        if make_dir(path):
            disp('  creating %r\n' % path)
        else:
            disp('  %r already exists\n' % path)
示例#3
0
def make_dirs():
    """Creates standard directories to place binaries and libraries
    created by excentury. """
    root = site.getuserbase()
    make_dir(root+'/lib')
    make_dir(root+'/lib/excentury')
    make_dir(root+'/lib/excentury/bin')
    make_dir(root+'/lib/excentury/lib')
    make_dir(root+'/lib/excentury/cpp')
    make_dir(root+'/lib/excentury/matlab')
    make_dir(root+'/lib/excentury/python')
    make_dir(root+'/lib/excentury/tmp')