Ejemplo n.º 1
0
 def commit_or_abort(self, msg, files):
     check_call(['git', 'diff'] + files)
     if self.args.yes:
         commit = True
     else:
         commit = input('\n\nCommit this? [Y/n] ') or True
         commit = as_bool(commit)
     if commit:
         if not self.args.yes:
             msg = input('Commit message ["{}"] '.format(msg)) or msg
         check_call(['git', 'commit', '-m', msg] + files)
     else:
         self.exit('Aborted')
Ejemplo n.º 2
0
 def upload(self):
     if self.args.yes:
         upload_to_pypi = True
     else:
         upload_to_pypi = input('Create sdist and upload to PyPI? [y/N] ')
         upload_to_pypi = as_bool(upload_to_pypi or False)
     if upload_to_pypi:
         # This feels kinda hacky, but it ensures that setup() is run
         # in the same environment the `tangled release` script was
         # run in (versus using a subprocess and trying to set the
         # executable correctly).
         original_argv = sys.argv
         sys.argv = [sys.executable, 'sdist', 'register', 'upload']
         with open('setup.py') as fp:
             exec(fp.read())
         sys.argv = original_argv