Commit cec82f45 authored by Egor Dranischnikow's avatar Egor Dranischnikow

extract create_args_parser(), add hook parse_args_raw and add unit-tests

parent 652f061d
......@@ -148,7 +148,7 @@ def run_distutils(args):
shutil.rmtree(temp_dir)
def parse_args(args):
def create_args_parser():
from optparse import OptionParser
parser = OptionParser(usage='%prog [options] [sources and packages]+')
......@@ -196,8 +196,16 @@ def parse_args(args):
help='compile as much as possible, ignore compilation failures')
parser.add_option('--no-docstrings', dest='no_docstrings', action='store_true',
help='strip docstrings')
return parser
def parse_args_raw(parser, args):
return parser.parse_args(args)
options, args = parser.parse_args(args)
def parse_args(args):
parser = create_args_parser()
options, args = parse_args_raw(parser, args)
if not args:
parser.error("no source files provided")
if options.build_inplace:
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment