|
20 | 20 | import sys |
21 | 21 | from optparse import OptionParser |
22 | 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:]) |
| 23 | +"""This script is a shortcut to making the python distribution releases. This should be run from the folder it is in.""" |
| 24 | + |
| 25 | +# This is the base version of this release. |
| 26 | +version = "0.6.0" |
| 27 | + |
| 28 | +parser = OptionParser(usage="usage: %prog [-h|--help] [options]") |
| 29 | +parser.add_option("-c", "--clean", action="store_true", dest="clean", default=False, help="Clean out current target build.") |
| 30 | +parser.add_option("-b", "--build", action="store_true", dest="package", default=False, help="Same as the package option.") |
| 31 | +parser.add_option("-v", "--version", action="store", dest="version", default="", help="For --package, this specifies a special tag, generate version tag %s-<version>" % version) |
| 32 | +parser.add_option("-t", "--test", action="store_true", dest="test", default=False, help="Test everything, generating JUnit-style XML outputs.") |
| 33 | +parser.add_option("", "--package", action="store_true", dest="package", default=False, help="Package everything up into a tarball for release to sourceforge.") |
| 34 | +parser.add_option("", "--publish", action="store_true", dest="publish", default=False, help="Publish this release to the deployment server.") |
| 35 | +parser.add_option("-r", "--register", action="store_true", dest="register", default=False, help="Register this release with http://pypi.python.org/pypi") |
| 36 | +(options, args) = parser.parse_args() |
| 37 | + |
| 38 | +if options.version: |
| 39 | + version += "-%s" % options.version |
| 40 | + |
| 41 | +if options.clean: |
| 42 | + print "Cleaning out the target directory" |
| 43 | + os.system("rm -rf target") |
| 44 | + |
| 45 | +elif options.test: |
| 46 | + os.system("mkdir -p target/test-results") |
| 47 | + os.system("nosetests --with-nosexunit --source-folder=src --where=test/springpythontest --xml-report-folder=target/test-results") |
| 48 | + |
| 49 | +elif options.package: |
| 50 | + os.system("mkdir -p target/test-results") |
| 51 | + os.system("cd src ; python setup.py --version %s sdist ; mv dist/* .. ; \\rm -rf dist ; \\rm -f MANIFEST" % version) |
| 52 | + os.system("cd samples ; python setup.py --version %s sdist ; mv dist/* .. ; \\rm -rf dist ; \\rm -f MANIFEST" % version) |
| 53 | + os.system("mv *.tar.gz target") |
| 54 | + |
| 55 | +elif options.publish: |
| 56 | + # TODO(8/28/2008 GLT): Implement automated solution for this. |
| 57 | + print "+++ Upload the tarballs using sftp manually to <user>@frs.sourceforge.net, into dir uploads and create a release." |
| 58 | + |
| 59 | +elif options.register: |
| 60 | + # TODO(8/28/2008 GLT): Test this part when making official release and registering to PyPI. |
| 61 | + os.system("cd src ; python setup.py --version %s register" % version) |
| 62 | + os.system("cd samples ; python setup.py --version %s register" % version) |
| 63 | + |
0 commit comments