def main(args=None): if args is None: args = sys.argv[1:] # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parse_command(args) except PipError as exc: sys.stderr.write("ERROR: %s" % exc) sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, "") except locale.Error as e: # setlocale can apparently crash if locale are uninitialized logger.debug("Ignoring error %s when setting locale", e) command = commands_dict[cmd_name](isolated=("--isolated" in cmd_args)) return command.main(cmd_args)
def main(args=None): if args is None: args = sys.argv[1:] # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parse_command(args) except PipError as exc: sys.stderr.write("ERROR: %s" % exc) sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, '') except locale.Error as e: # setlocale can apparently crash if locale are uninitialized logger.debug("Ignoring error %s when setting locale", e) command = commands_dict[cmd_name](isolated=("--isolated" in cmd_args)) return command.main(cmd_args)
def main(args=None): # type: (Optional[List[str]]) -> int if args is None: args = sys.argv[1:] #parser.update_loacl_board_json() from aip.command import commands_dict, parse_command # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parse_command(args) except PipError as exc: sys.stderr.write("ERROR: {}".format(exc)) sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, '') except locale.Error as e: # setlocale can apparently crash if locale are uninitialized print("Ignoring error %s when setting locale", e) module = importlib.import_module("aip."+cmd_name) command_class = getattr(module, cmd_name+"Command") command = command_class(name=cmd_name, summary="...") return command.main(cmd_args)
def main(args=None): # type: (Optional[List[str]]) -> int if args is None: args = sys.argv[1:] # is update package_seeeduino_ardupy_index.json user_config_dir = str(appdirs.user_config_dir(appname="aip")) if not os.path.exists(user_config_dir): os.makedirs(user_config_dir) today = date.today() user_config_dir_files = os.listdir(user_config_dir) current_package_seeeduino_ardupy = "xxxxx" is_update = True for files in user_config_dir_files: if files[0:30] == "package_seeeduino_ardupy_index": file_data = datetime.strptime(files[31:41], '%Y-%m-%d').date() current_package_seeeduino_ardupy = files if file_data == today: is_update = False break if is_update: log.info("update latest package_seeeduino_ardupy_index.json ...") try: urllib.request.urlretrieve( 'https://files.seeedstudio.com/ardupy/package_seeeduino_ardupy_index.json', str( Path( user_config_dir, "package_seeeduino_ardupy_index_" + today.isoformat() + ".json"))) if os.path.exists( str(Path(user_config_dir, current_package_seeeduino_ardupy))): os.remove( str(Path(user_config_dir, current_package_seeeduino_ardupy))) except Exception as e: log.error(e) log.warning( "update latest package_seeeduino_ardupy_index.json Failed! Please check you network connction!" ) sys.exit(1) from aip.command import commands_dict, parse_command # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parse_command(args) except PipError as exc: sys.stderr.write("ERROR: {}".format(exc)) sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, '') except locale.Error as e: # setlocale can apparently crash if locale are uninitialized print("Ignoring error %s when setting locale", e) module = importlib.import_module("aip." + cmd_name) command_class = getattr(module, cmd_name + "Command") command = command_class(name=cmd_name, summary="...") return command.main(cmd_args)