|
| 1 | +#!/usr/bin/python |
| 2 | +""" |
| 3 | + Copyright 2006-2008 SpringSource (http://springsource.com), All Rights Reserved |
| 4 | +
|
| 5 | + This script is free software: you can redistribute it and/or modify |
| 6 | + it under the terms of the GNU General Public License as published by |
| 7 | + the Free Software Foundation, either version 3 of the License, or |
| 8 | + (at your option) any later version. |
| 9 | +
|
| 10 | + This program is distributed in the hope that it will be useful, |
| 11 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | + GNU General Public License for more details. |
| 14 | +
|
| 15 | + You should have received a copy of the GNU General Public License |
| 16 | + along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | +""" |
| 18 | + |
| 19 | +import os |
| 20 | +import sys |
| 21 | +from optparse import OptionParser |
| 22 | + |
| 23 | +def main(argv): |
| 24 | + """This script is a shortcut to making the python distribution releases. This should be run from the folder it is in.""" |
| 25 | + |
| 26 | + parser = OptionParser(usage="usage: %prog [-h|--help] [options]") |
| 27 | + parser.add_option("-c", "--clean", action="store_true", dest="clean", default=False, help="Clean out current target build.") |
| 28 | + parser.add_option("-b", "--build", action="store", dest="build", help="Build everything, and optionally put a special tag on the end of the version.") |
| 29 | + parser.add_option("-t", "--test", action="store_true", dest="test", default=False, help="Test everything, generating JUnit-style XML outputs.") |
| 30 | + parser.add_option("", "--package", action="store_true", dest="package", default=False, help="Package everything up into a tarball for release to sourceforge.") |
| 31 | + parser.add_option("", "--publish", action="store_true", dest="publish", default=False, help="Publish this release to the deployment server.") |
| 32 | + parser.add_option("-r", "--register", action="store_true", dest="register", default=False, help="Register this release with http://pypi.python.org/pypi") |
| 33 | + (options, args) = parser.parse_args() |
| 34 | + |
| 35 | + parser.set_defaults(build="") |
| 36 | + |
| 37 | + if options.clean: |
| 38 | + print "Cleaning out the target directory" |
| 39 | + os.system("rm -rf target") |
| 40 | + |
| 41 | + elif options.build is not "": |
| 42 | + print "+++ Working on this option." |
| 43 | + |
| 44 | + elif options.build: |
| 45 | + print "+++ Working on this option." |
| 46 | + |
| 47 | + elif options.package: |
| 48 | + # Make the main source code distribution |
| 49 | + os.system("cd src ; python setup.py sdist ; mv dist/* .. ; \\rm -rf dist ; \\rm -f MANIFEST ") |
| 50 | + |
| 51 | + # Make the sample distribution |
| 52 | + os.system("cd samples ; python setup.py sdist ; mv dist/* .. ; \\rm -rf dist ; \\rm -f MANIFEST ") |
| 53 | + |
| 54 | + elif options.publish: |
| 55 | + print "+++ Upload the tarballs using sftp manually to <user>@frs.sourceforge.net, into dir uploads and create a release." |
| 56 | + |
| 57 | + elif options.register: |
| 58 | + os.system("cd src ; python setup.py register") |
| 59 | + os.system("cd samples ; python setup.py register") |
| 60 | + |
| 61 | + |
| 62 | +if __name__ == "__main__": |
| 63 | + main(sys.argv[1:]) |
0 commit comments