summaryrefslogtreecommitdiffstats
path: root/release.py
diff options
context:
space:
mode:
authorIrina Truong <i.chernyavska@gmail.com>2019-05-25 13:08:56 -0700
committerGitHub <noreply@github.com>2019-05-25 13:08:56 -0700
commit8cb7009bcd0f0062942932c853706a36178f566c (patch)
treecb5bb42674ccce90b173e7a2f09bf72157ae4a86 /release.py
parenta5e607b6fc889afd3f8960ca3903ae16b641c304 (diff)
black all the things. (#1049)
* added black to develop guide * no need for pep8radius. * changelog. * Add pre-commit checkbox. * Add pre-commit to dev reqs. * Add pyproject.toml for black. * Pre-commit config. * Add black to travis and dev reqs. * Install and run black in travis. * Remove black from dev reqs. * Lower black target version. * Re-format with black.
Diffstat (limited to 'release.py')
-rw-r--r--release.py72
1 files changed, 41 insertions, 31 deletions
diff --git a/release.py b/release.py
index 6526128d..9ac18d24 100644
--- a/release.py
+++ b/release.py
@@ -23,7 +23,7 @@ def skip_step():
global CONFIRM_STEPS
if CONFIRM_STEPS:
- return not click.confirm('--- Run this step?', default=True)
+ return not click.confirm("--- Run this step?", default=True)
return False
@@ -36,90 +36,100 @@ def run_step(*args):
global DRY_RUN
cmd = args
- print(' '.join(cmd))
+ print (" ".join(cmd))
if skip_step():
- print('--- Skipping...')
+ print ("--- Skipping...")
elif DRY_RUN:
- print('--- Pretending to run...')
+ print ("--- Pretending to run...")
else:
subprocess.check_output(cmd)
def version(version_file):
_version_re = re.compile(
- r'__version__\s+=\s+(?P<quote>[\'"])(?P<version>.*)(?P=quote)')
+ r'__version__\s+=\s+(?P<quote>[\'"])(?P<version>.*)(?P=quote)'
+ )
- with io.open(version_file, encoding='utf-8') as f:
- ver = _version_re.search(f.read()).group('version')
+ with io.open(version_file, encoding="utf-8") as f:
+ ver = _version_re.search(f.read()).group("version")
return ver
def commit_for_release(version_file, ver):
- run_step('git', 'reset')
- run_step('git', 'add', version_file)
- run_step('git', 'commit', '--message',
- 'Releasing version {}'.format(ver))
+ run_step("git", "reset")
+ run_step("git", "add", version_file)
+ run_step("git", "commit", "--message", "Releasing version {}".format(ver))
def create_git_tag(tag_name):
- run_step('git', 'tag', tag_name)
+ run_step("git", "tag", tag_name)
def create_distribution_files():
- run_step('python', 'setup.py', 'clean', '--all', 'sdist', 'bdist_wheel')
+ run_step("python", "setup.py", "clean", "--all", "sdist", "bdist_wheel")
def upload_distribution_files():
- run_step('twine', 'upload', 'dist/*')
+ run_step("twine", "upload", "dist/*")
def push_to_github():
- run_step('git', 'push', 'origin', 'master')
+ run_step("git", "push", "origin", "master")
def push_tags_to_github():
- run_step('git', 'push', '--tags', 'origin')
+ run_step("git", "push", "--tags", "origin")
def checklist(questions):
for question in questions:
- if not click.confirm('--- {}'.format(question), default=False):
+ if not click.confirm("--- {}".format(question), default=False):
sys.exit(1)
-if __name__ == '__main__':
+if __name__ == "__main__":
if DEBUG:
subprocess.check_output = lambda x: x
- checks = ['Have you updated the AUTHORS file?',
- 'Have you updated the `Usage` section of the README?',
- ]
+ checks = [
+ "Have you updated the AUTHORS file?",
+ "Have you updated the `Usage` section of the README?",
+ ]
checklist(checks)
- ver = version('pgcli/__init__.py')
- print('Releasing Version:', ver)
+ ver = version("pgcli/__init__.py")
+ print ("Releasing Version:", ver)
parser = OptionParser()
parser.add_option(
- "-c", "--confirm-steps", action="store_true", dest="confirm_steps",
- default=False, help=("Confirm every step. If the step is not "
- "confirmed, it will be skipped.")
+ "-c",
+ "--confirm-steps",
+ action="store_true",
+ dest="confirm_steps",
+ default=False,
+ help=(
+ "Confirm every step. If the step is not " "confirmed, it will be skipped."
+ ),
)
parser.add_option(
- "-d", "--dry-run", action="store_true", dest="dry_run",
- default=False, help="Print out, but not actually run any steps."
+ "-d",
+ "--dry-run",
+ action="store_true",
+ dest="dry_run",
+ default=False,
+ help="Print out, but not actually run any steps.",
)
popts, pargs = parser.parse_args()
CONFIRM_STEPS = popts.confirm_steps
DRY_RUN = popts.dry_run
- if not click.confirm('Are you sure?', default=False):
+ if not click.confirm("Are you sure?", default=False):
sys.exit(1)
- commit_for_release('pgcli/__init__.py', ver)
- create_git_tag('v{}'.format(ver))
+ commit_for_release("pgcli/__init__.py", ver)
+ create_git_tag("v{}".format(ver))
create_distribution_files()
push_to_github()
push_tags_to_github()