<s> """<STR_LIT>""" <EOL> import argparse <EOL> import os <EOL> import zipfile <EOL> from qisys import ui <EOL> import qisys . archive <EOL> import qisys . worktree <EOL> import qitoolchain . parsers <EOL> def configure_parser ( parser ) : <EOL> """<STR_LIT>""" <EOL> qisys . parsers . worktree_parser ( parser ) <EOL> qitoolchain . parsers . toolchain_parser ( parser ) <EOL> parser . add_argument ( "<STR_LIT>" , metavar = '<STR_LIT>' , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_argument ( "<STR_LIT>" , help = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def do ( args ) : <EOL> """<STR_LIT>""" <EOL> toolchain = qitoolchain . parsers . get_toolchain ( args ) <EOL> name = args . name <EOL> package_path = args . package_path <EOL> legacy = False <EOL> try : <EOL> archive = zipfile . ZipFile ( package_path ) <EOL> archive . read ( "<STR_LIT>" ) <EOL> except KeyError : <EOL> legacy = True <EOL> if legacy and not args . name : <EOL> ui . fatal ( "<STR_LIT>" ) <EOL> if args . name and not legacy : <EOL> ui . warning ( "<STR_LIT>" ) <EOL> package = None <EOL> if legacy : <EOL> package = qitoolchain . qipackage . QiPackage ( args . name ) <EOL> else : <EOL> package = qitoolchain . qipackage . from_archive ( package_path ) <EOL> tc_name = toolchain . name <EOL> tc_packages_path = qitoolchain . toolchain . get_default_packages_path ( tc_name ) <EOL> dest = os . path . join ( tc_packages_path , package . name ) <EOL> qisys . sh . rm ( dest ) <EOL> qitoolchain . qipackage . extract ( package_path , dest ) <EOL> package . path = dest <EOL> toolchain . add_package ( package ) </s>
