mirror of
https://github.com/Yubico/yubiadmin.git
synced 2025-02-22 02:54:16 +01:00
Added optional uploading to PyPI.
This commit is contained in:
parent
a185dd0b1e
commit
083d714d53
21
release.py
21
release.py
@ -37,12 +37,14 @@ class release(Command):
|
|||||||
user_options = [
|
user_options = [
|
||||||
('keyid', None, "GPG key to sign with"),
|
('keyid', None, "GPG key to sign with"),
|
||||||
('skip-tests', None, "skip running the tests"),
|
('skip-tests', None, "skip running the tests"),
|
||||||
|
('pypi', None, "publish to pypi"),
|
||||||
]
|
]
|
||||||
boolean_options = ['skip-tests']
|
boolean_options = ['skip-tests', 'pypi']
|
||||||
|
|
||||||
def initialize_options(self):
|
def initialize_options(self):
|
||||||
self.keyid = None
|
self.keyid = None
|
||||||
self.skip_tests = 0
|
self.skip_tests = 0
|
||||||
|
self.pypi = 0
|
||||||
|
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
self.cwd = os.getcwd()
|
self.cwd = os.getcwd()
|
||||||
@ -64,6 +66,12 @@ class release(Command):
|
|||||||
"Tag '%s' already exists!" % self.fullname)
|
"Tag '%s' already exists!" % self.fullname)
|
||||||
|
|
||||||
def _sign(self):
|
def _sign(self):
|
||||||
|
if os.path.isfile('dist/%s.tar.gz.asc' % self.fullname):
|
||||||
|
# Signature exists from upload, re-use it:
|
||||||
|
sign_opts = ['--output dist/%s.tar.gz.sig' % self.fullname,
|
||||||
|
'--dearmor dist%s.tar.gz.asc' % self.fullname]
|
||||||
|
else:
|
||||||
|
# No signature, create it:
|
||||||
sign_opts = ['--detach-sign', 'dist/%s.tar.gz' % self.fullname]
|
sign_opts = ['--detach-sign', 'dist/%s.tar.gz' % self.fullname]
|
||||||
if self.keyid:
|
if self.keyid:
|
||||||
sign_opts.insert(1, '--default-key ' + self.keyid)
|
sign_opts.insert(1, '--default-key ' + self.keyid)
|
||||||
@ -103,14 +111,21 @@ class release(Command):
|
|||||||
|
|
||||||
if not self.skip_tests:
|
if not self.skip_tests:
|
||||||
self.run_command('check')
|
self.run_command('check')
|
||||||
#Nosetests calls sys.exit(status)
|
# Nosetests calls sys.exit(status)
|
||||||
try:
|
try:
|
||||||
self.run_command('nosetests')
|
self.run_command('nosetests')
|
||||||
except SystemExit as e:
|
except SystemExit as e:
|
||||||
if e.code != 0:
|
if e.code != 0:
|
||||||
raise DistutilsSetupError("There were test failures!")
|
raise DistutilsSetupError("There were test failures!")
|
||||||
|
|
||||||
self.run_command('sdist') # upload --sign --identity keyid
|
self.run_command('sdist')
|
||||||
|
|
||||||
|
if self.pypi:
|
||||||
|
cmd_obj = self.distribution.get_command_obj('upload')
|
||||||
|
cmd_obj.sign = True
|
||||||
|
if self.keyid:
|
||||||
|
cmd_obj.identity = self.keyid
|
||||||
|
self.run_command('upload')
|
||||||
|
|
||||||
self._sign()
|
self._sign()
|
||||||
self._tag()
|
self._tag()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user