# HG changeset patch # User Jeff Hammel # Date 1333126928 25200 # Node ID 8beffeb750b3baf7d594387ed5d272c39fe6e871 # Parent c54411c721cba37d3f2f79e017b82f2359102db7 begin to add command parser diff -r c54411c721cb -r 8beffeb750b3 paint/main.py --- a/paint/main.py Thu Mar 29 16:25:07 2012 -0700 +++ b/paint/main.py Fri Mar 30 10:02:08 2012 -0700 @@ -4,41 +4,14 @@ python PAckage INTrospection """ +import commandparser +import package import sys -import optparse -import tempfile - -class InspectPackages(object): - def __init__(self): - pass - - def dependencies(self, *packages): - if len(packages) > 1: - retval = set() - for package in packages: - retval += self.dependencies(package) - else: - raise NotImplementedError - - def cleanup(self): - pass - __del__ = cleanup def main(args=sys.argv[:]): - # parse command line options - usage = '%prog [options]' - - # description formatter - class PlainDescriptionFormatter(optparse.IndentedHelpFormatter): - def format_description(self, description): - if description: - return description + '\n' - else: - return '' - - parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) - options, args = parser.parse_args(args) + parser = commandparser.CommandParser(package.Package) + parser.invoke(args) if __name__ == '__main__': main() diff -r c54411c721cb -r 8beffeb750b3 setup.py --- a/setup.py Thu Mar 29 16:25:07 2012 -0700 +++ b/setup.py Fri Mar 30 10:02:08 2012 -0700 @@ -5,7 +5,7 @@ import os version = "0.0" -dependencies = ['virtualenv >= 1.7.1.2', 'pip >= 1.1', 'pkginfo'] +dependencies = ['virtualenv >= 1.7.1.2', 'pip >= 1.1', 'pkginfo', 'CommandParser'] # allow use of setuptools/distribute or distutils kw = {} @@ -13,7 +13,7 @@ from setuptools import setup kw['entry_points'] = """ [console_scripts] - python-package = PaInt.main:main + python-package = paint.main:main """ kw['install_requires'] = dependencies except ImportError: