From a0fa3a97e3aa5e636aca2cfabb12961f297e07e9 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Mon, 22 Apr 2013 16:58:36 -0400 Subject: Argument parsing has been implemented --- ipsbuild.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/ipsbuild.py b/ipsbuild.py index 44a375c..3b649a7 100644 --- a/ipsbuild.py +++ b/ipsbuild.py @@ -13,12 +13,24 @@ # # You should have received a copy of the GNU General Public License # along with ipsutils. If not, see . +import ipsutils +import argparse +import os -from pprint import pprint -import ipsutils +# Initialize argument parser +parser = argparse.ArgumentParser(description='Build Solaris 11 packages from .ips spec files') +parser.add_argument('--version', nargs='?', metavar='-V', help='Show version information') +parser.add_argument('--verbose', nargs='?', metavar='-v', help='Increased verbosity') +parser.add_argument('spec', nargs='+', help='An ipsutils spec file') +args = parser.parse_args() -testfile = "test.ips" -build = ipsutils.build.Build(testfile) -build.show_summary() -build.controller.do_tasks() +# Record current path, because we change directories from within the class +# This way all spec files will be read +cwd = os.path.abspath(os.curdir) +if args.spec: + for spec in args.spec: + build = ipsutils.build.Build(spec) + build.show_summary() + build.controller.do_tasks() + os.chdir(cwd) -- cgit