[checker/pypi] allow to configure the pypi repo to use draft default tip
authorDavid Douard <david.douard@logilab.fr>
Wed, 27 Sep 2017 12:39:06 +0200
changeset 1871 980e20892562
parent 1868 64d8949910f2
[checker/pypi] allow to configure the pypi repo to use and defaults to 'pypi'.
_narval/checkers/apycot/pypi.py
--- a/_narval/checkers/apycot/pypi.py	Thu Dec 22 12:14:25 2016 +0100
+++ b/_narval/checkers/apycot/pypi.py	Wed Sep 27 12:39:06 2017 +0200
@@ -16,6 +16,11 @@
             'type': 'int', 'default': False,
             'help': 'set verbose mode'
             },
+        'pypi.repository': {
+            'default': 'pypi',
+            'help': ('name of the pypi repository to use; must exists in '
+                     'the .pypirc file of the narval built bot'),
+            },
         }
 
     def do_check(self, test):
@@ -28,9 +33,19 @@
         if not exists(join(path, 'setup.py')):
             raise apycotlib.SetupException('No file %s' % abspath(join(path, 'setup.py')))
         python = pyversions(test)[0]
-        cmdargs = [python, 'setup.py', 'register', 'sdist', 'upload']
-        if not self.options.get('verbose'):
-            cmdargs.append('--quiet')
+        repo = self.options.get('pypi.repository')
+
+        cmdargs = [python, 'setup.py', 'register',]
+        if repo:
+            cmdargs += ['-r', repo]
+        if self.options.get('verbose'):
+            cmdargs.append('-v)
+        cmdargs += ['sdist', 'upload']
+        if repo:
+            cmdargs += ['-r', repo]
+        if self.options.get('verbose'):
+            cmdargs.append('-v)
+
         cmd = apycotlib.Command(self.writer, cmdargs, raises=True, cwd=path)
         cmdstatus = cmd.run()
         if cmdstatus == apycotlib.SUCCESS: