changeset 26:8beffeb750b3

begin to add command parser
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 30 Mar 2012 10:02:08 -0700
parents c54411c721cb
children 7e9eb858d086
files paint/main.py setup.py
diffstat 2 files changed, 6 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- 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()
--- 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: