summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-06-27 15:53:59 -0400
committerJason R. Coombs <jaraco@jaraco.com>2014-06-27 15:53:59 -0400
commite89974999dbce3a0bde1f2745cd54fc84a54151b (patch)
treec5b05e25883d65a04928393d5395b93024b35773
parentfd95d8d5afe5baafb67d8285cc63ec32ff786d5f (diff)
downloadcherrypy-e89974999dbce3a0bde1f2745cd54fc84a54151b.tar.gz
Use jaraco.packaging.release, used by setuptools, keyring, and a number of other packages.
-rw-r--r--release.py119
-rw-r--r--setup.py31
2 files changed, 32 insertions, 118 deletions
diff --git a/release.py b/release.py
index d9362940..26bad57e 100644
--- a/release.py
+++ b/release.py
@@ -1,34 +1,19 @@
"""
-This script will walk a developer through the process of cutting a release.
+Use jaraco.packaging with this script to cut a release. After installing
+jaraco.packaging, invoke:
-Based on https://bitbucket.org/cherrypy/cherrypy/wiki/ReleaseProcess
-
-To cut a release, simply invoke this script at the changeset to be released.
+python -m jaraco.packaging.release
"""
from __future__ import print_function
-import subprocess
import sys
import os
-import platform
import shutil
import importlib
-
-from six.moves import input
-
-VERSION='3.3.0'
-
-
-def get_next_version():
- print("The last release on this branch was {version}".format(
- version=VERSION))
- return input("What version are you releasing? ")
-
-NEXT_VERSION = get_next_version()
+import textwrap
files_with_versions = (
- 'release.py',
'setup.py',
'cherrypy/__init__.py',
'cherrypy/wsgiserver/wsgiserver2.py',
@@ -48,102 +33,30 @@ def check_wheel():
raise SystemExit(5)
-def check_status():
- """
- Make sure there aren't outstanding changesets that are unpushed, maybe
- run the tests or ask the user if the tests are passing.
- """
- print("You're about to release CherryPy {NEXT_VERSION}".format(
- **globals()))
- res = input('Have you run the tests with `nosetests -s ./` on '
- 'Windows, Linux, and Mac on at least Python '
- '2.4, 2.5, 2.7, and 3.2? '
- .format(**globals()))
- if not res.lower().startswith('y'):
- print("Please do that")
- raise SystemExit(1)
-
-
-def bump_versions():
- """
- Bump the versions in each of the places where it appears and commit.
- """
- list(map(bump_version, files_with_versions))
-
- subprocess.check_call(['hg', 'ci', '-m',
- 'Bumped to {NEXT_VERSION} in preparation for next '
- 'release.'.format(**globals())])
-
-
-def bump_version(filename):
- with open(filename, 'rb') as f:
- b_version = VERSION.encode('ascii')
- b_next_version = NEXT_VERSION.encode('ascii')
- lines = [line.replace(b_version, b_next_version) for line in f]
- with open(filename, 'wb') as f:
- f.writelines(lines)
-
+def before_upload():
+ check_wheel()
+ remove_files()
-def tag_release():
- """
- Tag the release.
- """
- subprocess.check_call(['hg', 'tag', NEXT_VERSION])
+test_info = textwrap.dedent("""
+ Run tests with `nosetests -s ./` on Windows, Linux, and Mac on at least
+ Python 2.4, 2.5, 2.7, and 3.2.
+ """).lstrip()
-dist_commands = ['sdist', 'bdist_wininst', 'bdist_wheel']
+dist_commands = 'sdist', 'bdist_wininst', 'bdist_wheel'
-def build():
+def remove_files():
if os.path.isfile('MANIFEST'):
os.remove('MANIFEST')
if os.path.isdir('dist'):
shutil.rmtree('dist')
- subprocess.check_call([sys.executable, 'setup.py'] + dist_commands)
-
-def push():
- "The build went well, so let's push the SCM changesets"
- subprocess.check_call(['hg', 'push', '-r', '.'])
-
-def publish():
- """
- Publish the dists on PyPI
- """
- try:
- upload_dist_command = [sys.executable, 'setup.py'] + dist_commands + ['register', 'upload']
- subprocess.check_call(upload_dist_command)
- except:
- print("Unable to upload the dist files. Ask in IRC for help access 57"
- "or assistance.")
- raise SystemExit(4)
+def announce():
print('Distributions have been uploaded.')
- print('Please ask in IRC for others to help you test '
- 'CherryPy {NEXT_VERSION}.'
- .format(**globals()))
+ print('Please ask in IRC for others to help you test this release.')
print("Please confirm that the distro installs properly "
- "with `easy_install CherryPy=={NEXT_VERSION}`.".format(**globals()))
-
-
-def announce():
+ "with `easy_install CherryPy=={version}`.".format(**globals()))
print("Please change the Wiki: Home page (news), CherryPyDownload")
print("Please announce the release on newsgroups, mailing lists, "
"and IRC /topic.")
-
-
-def main():
- assert sys.version_info >= (2, 6), ("Release script requires Python 2.6 "
- "or later.")
- assert platform.system() == 'Windows', ('You must release on Windows '
- '(to create Windows installers)')
- check_wheel()
- check_status()
- bump_versions()
- tag_release()
- build()
- push()
- publish()
- announce()
-
-if __name__ == '__main__':
- main()
diff --git a/setup.py b/setup.py
index 8441be92..0e8ed818 100644
--- a/setup.py
+++ b/setup.py
@@ -126,6 +126,21 @@ else:
if 'bdist_wininst' in sys.argv or '--format=wininst' in sys.argv:
data_files = [(r'\PURELIB\%s' % path, files) for path, files in data_files]
+setup_params = dict(
+ name=name,
+ version=version,
+ description=desc,
+ long_description=long_desc,
+ classifiers=classifiers,
+ author=author,
+ author_email=author_email,
+ url=url,
+ license=cp_license,
+ packages=packages,
+ data_files=data_files,
+ scripts=scripts,
+ cmdclass=cmd_class,
+)
def main():
if sys.version < required_python_version:
@@ -137,21 +152,7 @@ def main():
for scheme in list(INSTALL_SCHEMES.values()):
scheme['data'] = scheme['purelib']
- setup(
- name=name,
- version=version,
- description=desc,
- long_description=long_desc,
- classifiers=classifiers,
- author=author,
- author_email=author_email,
- url=url,
- license=cp_license,
- packages=packages,
- data_files=data_files,
- scripts=scripts,
- cmdclass=cmd_class,
- )
+ setup(**setup_params)
if __name__ == "__main__":