changeset 61:355d00c749d9

STUB
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 28 Oct 2013 21:18:23 -0700
parents ab07751849c9
children 2c130bdd4a5c
files bzconsole/main.py
diffstat 1 files changed, 26 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/bzconsole/main.py	Fri Sep 27 14:30:24 2013 -0700
+++ b/bzconsole/main.py	Mon Oct 28 21:18:23 2013 -0700
@@ -9,13 +9,38 @@
 class BZcli(BZapi):
     """command line interface front-end for the API class"""
 
+    ### TODO
+
     def file(self, component, title, path, **kwargs):
         """read from a file [NOTIMPLEMENTED]"""
         raise NotImplementedError
 
+    def pypi(self, blocker, package, version):
+        """
+        file a bug for  http://pypi.pub.build.mozilla.org/pub, a la
+        https://bugzilla.mozilla.org/show_bug.cgi?id=931342
+        """
+
+        title = 'Please upload %(package)s-%(version)s to http://pypi.pub.build.mozilla.org/pub'
+        # STUB
+        raise NotImplementedError("TODO")
+
+    ###
+
     def ls(self, directory=os.getcwd()):
         """list bug related files in the given directory"""
-        
+        # TODO: upstream -> new package
+        def is_bug(string):
+            """
+            returns bug number if a string matches the pattern
+            """
+            import re
+            regex = re.compile('bug[-_]([1-9][0-9]+)')
+            match = regex.match(string)
+            if match:
+                return match.groups()[0]
+        return [filename for filename in os.listdir(directory):
+                if is_bug(string)]
 
     def unique(self, component=None):
         """display unique and duplicated components"""