def pioplus_call(args, **kwargs): pioplus_install() pm = PioPlusPackageManager() pioplus_path = join( pm.get_package_dir(PACKAGE_DEPS['tool']['name'], PACKAGE_DEPS['tool']['requirements']), "pioplus") os.environ['PYTHONEXEPATH'] = util.get_pythonexe_path() os.environ['PYTHONPYSITEDIR'] = pm.get_package_dir( PACKAGE_DEPS['pysite']['name'], PACKAGE_DEPS['pysite']['requirements']) util.copy_pythonpath_to_osenv() code = subprocess.call([pioplus_path] + args, **kwargs) # handle remote update request if code == 13: count_attr = "_update_count" try: count_value = getattr(pioplus_call, count_attr) except AttributeError: count_value = 0 setattr(pioplus_call, count_attr, 1) count_value += 1 setattr(pioplus_call, count_attr, count_value) if count_value < AUTO_UPDATES_MAX: pioplus_update() return pioplus_call(args, **kwargs) # handle reload request elif code == 14: return pioplus_call(args, **kwargs) if code != 0: raise exception.ReturnErrorCode(1)
def pioplus_call(args, **kwargs): if "windows" in util.get_systype() and sys.version_info < (2, 7, 6): raise exception.PlatformioException( "PlatformIO Core Plus v%s does not run under Python version %s.\n" "Minimum supported version is 2.7.6, please upgrade Python.\n" "Python 3 is not yet supported.\n" % (__version__, sys.version.split()[0])) pioplus_path = join(get_core_package_dir("tool-pioplus"), "pioplus") os.environ['PYTHONEXEPATH'] = util.get_pythonexe_path() os.environ['PYTHONPYSITEDIR'] = get_core_package_dir("pysite-pioplus") util.copy_pythonpath_to_osenv() code = subprocess.call([pioplus_path] + args, **kwargs) # handle remote update request if code == 13: count_attr = "_update_count" try: count_value = getattr(pioplus_call, count_attr) except AttributeError: count_value = 0 setattr(pioplus_call, count_attr, 1) count_value += 1 setattr(pioplus_call, count_attr, count_value) if count_value < PIOPLUS_AUTO_UPDATES_MAX: update_core_packages() return pioplus_call(args, **kwargs) # handle reload request elif code == 14: return pioplus_call(args, **kwargs) if code != 0: raise exception.ReturnErrorCode(1)
def pioplus_call(args, **kwargs): pioplus_path = get_pioplusexe_path() if system() == "Linux": os.environ['LD_LIBRARY_PATH'] = dirname(pioplus_path) os.environ['PYTHONEXEPATH'] = util.get_pythonexe_path() util.copy_pythonpath_to_osenv() subprocess.call([pioplus_path] + args, **kwargs)
def pioplus_call(args, **kwargs): pioplus_path = join(get_core_package_dir("tool-pioplus"), "pioplus") os.environ['PYTHONEXEPATH'] = util.get_pythonexe_path() os.environ['PYTHONPYSITEDIR'] = get_core_package_dir("pysite-pioplus") util.copy_pythonpath_to_osenv() code = subprocess.call([pioplus_path] + args, **kwargs) # handle remote update request if code == 13: count_attr = "_update_count" try: count_value = getattr(pioplus_call, count_attr) except AttributeError: count_value = 0 setattr(pioplus_call, count_attr, 1) count_value += 1 setattr(pioplus_call, count_attr, count_value) if count_value < PIOPLUS_AUTO_UPDATES_MAX: update_core_packages() return pioplus_call(args, **kwargs) # handle reload request elif code == 14: return pioplus_call(args, **kwargs) if code != 0: raise exception.ReturnErrorCode(1)
def _run_scons(self, variables, targets): cmd = [ util.get_pythonexe_path(), join(self.get_package_dir("tool-scons"), "script", "scons"), "-Q", "-j %d" % self.get_job_nums(), "--warn=no-no-parallel-support", "-f", join(util.get_source_dir(), "builder", "main.py") ] cmd.append("PIOVERBOSE=%d" % (1 if self.verbose else 0)) cmd += targets # encode and append variables for key, value in variables.items(): cmd.append("%s=%s" % (key.upper(), base64.b64encode(value))) util.copy_pythonpath_to_osenv() result = util.exec_command( cmd, stdout=util.AsyncPipe(self.on_run_out), stderr=util.AsyncPipe(self.on_run_err)) return result
def _run_scons(self, variables, targets): cmd = [ util.get_pythonexe_path(), join(self.get_package_dir("tool-scons"), "script", "scons"), "-Q", "-j %d" % self.get_job_nums(), "--warn=no-no-parallel-support", "-f", join(util.get_source_dir(), "builder", "main.py"), ] cmd.append("PIOVERBOSE=%d" % (1 if self.verbose else 0)) cmd += targets # encode and append variables for key, value in variables.items(): cmd.append("%s=%s" % (key.upper(), base64.b64encode(value))) util.copy_pythonpath_to_osenv() result = util.exec_command(cmd, stdout=util.AsyncPipe(self.on_run_out), stderr=util.AsyncPipe(self.on_run_err)) return result