summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hammond <chipx86@chipx86.com>2009-09-21 01:59:11 -0700
committerChristian Hammond <chipx86@chipx86.com>2009-09-21 02:02:50 -0700
commitae8a82e11d6878e7305daaaa75a875dc1a45dc1c (patch)
treea2f4a1b0f2b168f7b2b380967bcc92cbb3e095d4
parent90a926840e3647225654dc60354f1d5f85dca2dd (diff)
Release RBTools v0.2 beta 2.release-0.2beta2
-rwxr-xr-xcontrib/internal/release.py155
-rw-r--r--rbtools/__init__.py68
-rwxr-xr-xsetup.py14
3 files changed, 230 insertions, 7 deletions
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'<a href="http://www.review-board.org/bug/\2">\1</a>',
+ 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 += "</li>\n"
+ in_item = False
+
+ if in_list:
+ html_content += "</ul>\n"
+
+ html_content += "<p><b>%s</b></p>\n" % line[3:]
+ html_content += "<ul>\n"
+ in_list = True
+ elif line.startswith("\t\t* "):
+ if not in_list:
+ sys.stderr.write("*** Found a list item without a list!\n")
+ continue
+
+ if in_item:
+ html_content += "</li>\n"
+
+ html_content += " <li>%s" % linkify_bugs(line[4:])
+ in_item = True
+ elif line.startswith("\t\t "):
+ if not in_item:
+ sys.stderr.write("*** Found list item content without "
+ "a list item!\n")
+ continue
+
+ html_content += " " + linkify_bugs(line[4:])
+
+ content += line + "\n"
+
+ fp.close()
+
+ if in_item:
+ html_content += "</li>\n"
+
+ if in_list:
+ html_content += "</ul>\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 = {