Changes in python/lib/aubio/cmd.py [f5921b9:e126e65]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/aubio/cmd.py
rf5921b9 re126e65 248 248 action = "store", dest = "cut_until_nslices", default = None, 249 249 help="how many extra slices should be added at the end of each slice") 250 self.add_argument("--create-first", 251 action = "store_true", dest = "create_first", default = False, 252 help="always include first slice") 250 253 251 254 # some utilities … … 500 503 def main(): 501 504 parser = aubio_parser() 502 if sys.version_info[0] != 3: 503 # on py2, create a dummy ArgumentParser to workaround the 504 # optional subcommand issue. See https://bugs.python.org/issue9253 505 # This ensures that: 506 # - version string is shown when only '-V' is passed 507 # - help is printed if '-V' is passed with any other argument 508 # - any other argument get forwarded to the real parser 509 parser_root = argparse.ArgumentParser(add_help=False) 510 parser_root.add_argument('-V', '--version', help="show version", 511 action="store_true", dest="show_version") 512 args, extras = parser_root.parse_known_args() 513 if args.show_version == False: # no -V, forward to parser 514 args = parser.parse_args(extras, namespace=args) 515 elif len(extras) != 0: # -V with other arguments, print help 516 parser.print_help() 517 sys.exit(1) 518 else: # in py3, we can simply use parser directly 519 args = parser.parse_args() 505 args = parser.parse_args() 520 506 if 'show_version' in args and args.show_version: 521 507 sys.stdout.write('aubio version ' + aubio.version + '\n')
Note: See TracChangeset
for help on using the changeset viewer.