From ae8a82e11d6878e7305daaaa75a875dc1a45dc1c Mon Sep 17 00:00:00 2001 From: Christian Hammond Date: Mon, 21 Sep 2009 01:59:11 -0700 Subject: Release RBTools v0.2 beta 2. --- contrib/internal/release.py | 155 ++++++++++++++++++++++++++++++++++++++++++++ rbtools/__init__.py | 68 +++++++++++++++++++ setup.py | 14 ++-- 3 files changed, 230 insertions(+), 7 deletions(-) create mode 100755 contrib/internal/release.py diff --git a/contrib/internal/release.py b/contrib/internal/release.py new file mode 100755 index 0000000..ea52333 --- /dev/null +++ b/contrib/internal/release.py @@ -0,0 +1,155 @@ +#!/usr/bin/env python +# +# Performs a release of Review Board. This can only be run by the core +# developers with release permissions. +# + +import os +import re +import sys + +sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..")) +from rbtools import get_package_version, VERSION + + +PY_VERSIONS = ["2.4", "2.5", "2.6"] + +LATEST_PY_VERSION = PY_VERSIONS[-1] + +PACKAGE_NAME = 'RBTools' + +RELEASES_URL = \ + 'review-board.org:/var/www/downloads.review-board.org/' \ + 'htdocs/releases/%s/%s.%s/' % (PACKAGE_NAME, VERSION[0], VERSION[1]) + + +built_files = [] + + +def execute(cmdline): + print ">>> %s" % cmdline + + if os.system(cmdline) != 0: + print "!!! Error invoking command." + sys.exit(1) + + +def run_setup(target, pyver = LATEST_PY_VERSION): + execute("python%s ./setup.py release %s" % (pyver, target)) + + +def build_targets(): + for pyver in PY_VERSIONS: + run_setup("bdist_egg", pyver) + built_files.append("dist/%s-%s-py%s.egg" % + (PACKAGE_NAME, get_package_version(), pyver)) + + run_setup("sdist") + built_files.append("dist/%s-%s.tar.gz" % + (PACKAGE_NAME, get_package_version())) + + +def build_news(): + def linkify_bugs(line): + return re.sub(r'(Bug #(\d+))', + r'\1', + line) + + content = "" + html_content = "" + + saw_version = False + in_list = False + in_item = False + + fp = open("NEWS", "r") + + for line in fp.xreadlines(): + line = line.rstrip() + + if line.startswith("version "): + if saw_version: + # We're done. + break + + saw_version = True + elif line.startswith("\t* "): + if in_item: + html_content += "\n" + in_item = False + + if in_list: + html_content += "\n" + + html_content += "

%s

\n" % line[3:] + html_content += "\n" + + content = content.rstrip() + + filename = "dist/%s-%s.NEWS" % (PACKAGE_NAME, get_package_version()) + built_files.append(filename) + fp = open(filename, "w") + fp.write(content) + fp.close() + + filename = "dist/%s-%s.NEWS.html" % (PACKAGE_NAME, get_package_version()) + fp = open(filename, "w") + fp.write(html_content) + fp.close() + + +def upload_files(): + execute("scp %s %s" % (" ".join(built_files), RELEASES_URL)) + + +def tag_release(): + execute("git tag release-%s" % get_package_version()) + + +def register_release(): + run_setup("register") + + +def main(): + if not os.path.exists("setup.py"): + sys.stderr.write("This must be run from the root of the " + "Djblets tree.\n") + sys.exit(1) + + build_targets() + build_news() + upload_files() + tag_release() + register_release() + + +if __name__ == "__main__": + main() diff --git a/rbtools/__init__.py b/rbtools/__init__.py index e69de29..e77df5d 100644 --- a/rbtools/__init__.py +++ b/rbtools/__init__.py @@ -0,0 +1,68 @@ +# +# __init__.py -- Basic version and package information +# +# Copyright (c) 2007-2009 Christian Hammond +# Copyright (c) 2007-2009 David Trowbridge +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + + +# The version of RBTools +# +# This is in the format of: +# +# (Major, Minor, Micro, alpha/beta/rc/final, Release Number, Released) +# +VERSION = (0, 2, 0, 'beta', 2, True) + + +def get_version_string(): + version = '%s.%s' % (VERSION[0], VERSION[1]) + + if VERSION[2]: + version += ".%s" % VERSION[2] + + if VERSION[3] != 'final': + if VERSION[3] == 'rc': + version += ' RC%s' % VERSION[4] + else: + version += ' %s %s' % (VERSION[3], VERSION[4]) + + if not is_release(): + version += " (dev)" + + return version + + +def get_package_version(): + version = '%s.%s' % (VERSION[0], VERSION[1]) + + if VERSION[2]: + version += ".%s" % VERSION[2] + + if VERSION[3] != 'final': + version += '%s%s' % (VERSION[3], VERSION[4]) + + return version + + +def is_release(): + return VERSION[5] diff --git a/setup.py b/setup.py index d848d23..02fbeb8 100755 --- a/setup.py +++ b/setup.py @@ -23,22 +23,22 @@ from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages - from setuptools.command.test import test +from rbtools import get_package_version, is_release, VERSION -VERSION = "0.2beta2" -IS_RELEASE = False +PACKAGE_NAME = 'RBTools' -if IS_RELEASE: - download_url = "http://downloads.review-board.org/releases/" +if is_release(): + download_url = "http://downloads.review-board.org/releases/%s/%s.%s/" % \ + (PACKAGE_NAME, VERSION[0], VERSION[1]) else: download_url = "http://downloads.review-board.org/nightlies/" -setup(name="RBTools", - version=VERSION, +setup(name=PACKAGE_NAME, + version=get_package_version(), license="MIT", description="Command line tools for use with Review Board", entry_points = { -- cgit v1.2.3