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')
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')
def install_comp(filename): install = True base, ext = os.path.splitext(os.path.basename(filename)) mk_module_dir = os.environ.get('MK_MODULE_DIR', None) if mk_module_dir and os.path.exists(mk_module_dir): module_dir = mk_module_dir else: module_dir = compat.get_rtapi_config("RTLIB_DIR") module_path = os.path.join(module_dir, 'modules', f'{base}.so') if os.path.exists(module_path): comp_time = os.path.getmtime(filename) module_time = os.path.getmtime(module_path) if comp_time < module_time: install = False if install: cmd_base = 'instcomp' if ext == '.icomp' else 'comp' sys.stdout.write("installing " + filename + '... ') sys.stdout.flush() if os.access( module_dir, os.W_OK): # if we have write access we might not need sudo cmd = '{} --install {}'.format(cmd_base, filename) else: cmd = 'sudo {} --install {}'.format(cmd_base, filename) subprocess.check_call(cmd, shell=True) sys.stdout.write('done\n')
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')
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")
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')
def test_get_rtapi_config(self): ld = compat.get_rtapi_config('LIBEXEC_DIR') print(repr(ld)) assert ld.endswith("libexec")