-parser = argparse.ArgumentParser()
-parser.add_argument('command')
-parser.add_argument('-p', '--project', help='project name', required=True)
-parser.add_argument('-d', '--directory', help='directory within project repo', default='.')
-parser.add_argument('--beta', help='beta release', action='store_true')
-parser.add_argument('--full', help='full release', action='store_true')
-parser.add_argument('-c', '--checkout', help='string to pass to git for checkout')
-parser.add_argument('-o', '--output', help='output directory', default='.')
-parser.add_argument('-q', '--quiet', help='be quiet', action='store_true')
-parser.add_argument('-t', '--target', help='target')
-parser.add_argument('-k', '--keep', help='keep working tree', action='store_true')
-parser.add_argument('--debug', help='build with debugging symbols where possible', action='store_true')
-parser.add_argument('--work', help='override default work directory')
-args = parser.parse_args()
-
-args.output = os.path.abspath(args.output)
-if args.work is not None:
- args.work = os.path.abspath(args.work)
-
-if args.project is None:
- error('you must specify -p or --project')
-
-project = Project(args.project, args.directory, args.checkout)
-
-if args.command == 'build':
- if args.target is None:
- error('you must specify -t or --target')
-
- target = target_factory(args.target, args.debug, args.work)
- project.checkout(target)
- target.build_dependencies(project)
- target.build(project)
- if not args.keep:
- target.cleanup()
+def main():
+
+ commands = {
+ "build": "build project",
+ "package": "package and build project",
+ "release": "release a project using its next version number (changing wscript and tagging)",
+ "pot": "build the project's .pot files",
+ "changelog": "generate a simple HTML changelog",
+ "manual": "build the project's manual",
+ "doxygen": "build the project's Doxygen documentation",
+ "latest": "print out the latest version",
+ "test": "run the project's unit tests",
+ "shell": "build the project then start a shell in its chroot",
+ "revision": "print the head git revision number"
+ }
+
+ one_of = "Command is one of:\n"
+ summary = ""
+ for k, v in commands.iteritems():
+ one_of += "\t%s\t%s\n" % (k, v)
+ summary += k + " "
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument('command', help=summary)
+ parser.add_argument('-p', '--project', help='project name')
+ parser.add_argument('--minor', help='minor version number bump', action='store_true')
+ parser.add_argument('--micro', help='micro version number bump', action='store_true')
+ parser.add_argument('--major', help='major version to return with latest', type=int)
+ parser.add_argument('-c', '--checkout', help='string to pass to git for checkout')
+ parser.add_argument('-o', '--output', help='output directory', default='.')
+ parser.add_argument('-q', '--quiet', help='be quiet', action='store_true')
+ parser.add_argument('-t', '--target', help='target')
+ parser.add_argument('-k', '--keep', help='keep working tree', action='store_true')
+ parser.add_argument('--debug', help='build with debugging symbols where possible', action='store_true')
+ parser.add_argument('-w', '--work', help='override default work directory')
+ args = parser.parse_args()
+
+ if args.output.find(':') == -1:
+ # This isn't of the form host:path so make it absolute
+ args.output = os.path.abspath(args.output) + '/'
+ else:
+ if args.output[-1] != ':' and args.output[-1] != '/':
+ args.output += '/'