示例#1
0
def install_comp(filename):
    install = True
    base, ext = os.path.splitext(os.path.basename(filename))
    flavor = compat.default_flavor()
    moduleDir = compat.get_rtapi_config("RTLIB_DIR")
    moduleName = flavor.name + '/' + base + flavor.mod_ext
    modulePath = os.path.join(moduleDir, moduleName)
    if os.path.exists(modulePath):
        compTime = os.path.getmtime(filename)
        moduleTime = os.path.getmtime(modulePath)
        if (compTime < moduleTime):
            install = False

    if install is True:
        if ext == '.icomp':
            cmdBase = 'instcomp'
        else:
            cmdBase = 'comp'
        sys.stdout.write("installing " + filename + '... ')
        sys.stdout.flush()
        if os.access(
                moduleDir,
                os.W_OK):  # if we have write access we might not need sudo
            cmd = '%s --install %s' % (cmdBase, filename)
        else:
            cmd = 'sudo %s --install %s' % (cmdBase, filename)

        subprocess.check_call(cmd, shell=True)

        sys.stdout.write('done\n')
示例#2
0
def install_comp(filename):
    install = True
    base, ext = os.path.splitext(os.path.basename(filename))
    flavor = compat.default_flavor()
    moduleDir = compat.get_rtapi_config("RTLIB_DIR")
    moduleName = flavor.name + '/' + base + flavor.mod_ext
    modulePath = os.path.join(moduleDir, moduleName)
    if os.path.exists(modulePath):
        compTime = os.path.getmtime(filename)
        moduleTime = os.path.getmtime(modulePath)
        if (compTime < moduleTime):
            install = False

    if install is True:
        if ext == '.icomp':
            cmdBase = 'instcomp'
        else:
            cmdBase = 'comp'
        sys.stdout.write("installing " + filename + '... ')
        sys.stdout.flush()
        if os.access(moduleDir, os.W_OK):  # if we have write access we might not need sudo
            cmd = '%s --install %s' % (cmdBase, filename)
        else:
            cmd = 'sudo %s --install %s' % (cmdBase, filename)

        subprocess.check_call(cmd, shell=True)

        sys.stdout.write('done\n')
示例#3
0
def installComp(filename):
    install = True
    base = os.path.splitext(os.path.basename(filename))[0]
    modulePath = compat.get_rtapi_config("RTLIB_DIR") + '/' + compat.default_flavor().name + '/' + base + '.so'
    if os.path.exists(modulePath):
    	compTime = os.path.getmtime(filename)
    	moduleTime = os.path.getmtime(modulePath)
        if (compTime < moduleTime):
            install = False

    if install is True:
        sys.stdout.write("installing " + filename + '... ')
        sys.stdout.flush()
        subprocess.check_call('comp --install ' + filename, shell=True)
        sys.stdout.write('done\n')
示例#4
0
def install_comp(filename):
    install = True
    base = os.path.splitext(os.path.basename(filename))[0]
    flavor = compat.default_flavor()
    modulePath = compat.get_rtapi_config("RTLIB_DIR") + "/" + flavor.name + "/" + base + flavor.mod_ext
    if os.path.exists(modulePath):
        compTime = os.path.getmtime(filename)
        moduleTime = os.path.getmtime(modulePath)
        if compTime < moduleTime:
            install = False

    if install is True:
        sys.stdout.write("installing " + filename + "... ")
        sys.stdout.flush()
        subprocess.check_call("comp --install " + filename, shell=True)
        sys.stdout.write("done\n")
示例#5
0
def installComp(filename):
    install = True
    base = os.path.splitext(os.path.basename(filename))[0]
    modulePath = compat.get_rtapi_config(
        "RTLIB_DIR") + '/' + compat.default_flavor().name + '/' + base + '.so'
    if os.path.exists(modulePath):
        compTime = os.path.getmtime(filename)
        moduleTime = os.path.getmtime(modulePath)
        if (compTime < moduleTime):
            install = False

    if install is True:
        sys.stdout.write("installing " + filename + '... ')
        sys.stdout.flush()
        subprocess.check_call('comp --install ' + filename, shell=True)
        sys.stdout.write('done\n')