From 924affa1d1dff509180090f104e1815395812284 Mon Sep 17 00:00:00 2001 From: Daniel Fett Date: Sat, 7 Apr 2012 20:55:27 +0200 Subject: [PATCH 1/2] Fix typo --- psa | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/psa b/psa index d598907..e7c3baa 100755 --- a/psa +++ b/psa @@ -850,7 +850,7 @@ def main(): elif args[0] == "list": psa_list_templates() else: - fatal("Unknow command. Try init, build-deb, update, or list") + fatal("Unknown command. Try init, build-deb, update, or list") def get_readme_path(): '''Returns the README file path''' From 7af260d9385495e83d3754248a19b5dc44db798e Mon Sep 17 00:00:00 2001 From: Daniel Fett Date: Sat, 7 Apr 2012 22:27:43 +0200 Subject: [PATCH 2/2] Add option to select the project name --- psa | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/psa b/psa index e7c3baa..bcf2157 100755 --- a/psa +++ b/psa @@ -832,6 +832,8 @@ def main(): parser.add_option("-v", "--verbose", action="store_true", default=False, help="Output debug messages") + parser.add_option("-P", "--project", action="store", default="", + type="string", help="Set project name manually") (options, args) = parser.parse_args() @@ -844,9 +846,9 @@ def main(): if args[0] == "init": psa_init(args) elif args[0] == "build-deb": - psa_build(args) + psa_build(args, options) elif args[0] == "update": - psa_update(args) + psa_update(args, options) elif args[0] == "list": psa_list_templates() else: @@ -943,13 +945,18 @@ def get_template(name): return TEMPLATES.get(name, None) -def get_local_config(path=None): +def get_local_config(options, path=None): '''Loads the local project config file''' if path is None: path = os.curdir - # Guess project name from current dir name - project = os.path.basename(os.path.abspath(path)) + if options.project == "": + # Guess project name from current dir name + project = os.path.basename(os.path.abspath(path)) + else: + # Take project name from arguments + project = options.project + print "Project name is %s" % project filename = os.path.join(os.curdir, project+'.psa') try: @@ -1018,10 +1025,10 @@ def psa_init(args): not supported, open the %s file and comment out the needed lines.""" % slug)) -def psa_build(args): +def psa_build(args, options): '''Builds the project''' - config = get_local_config() + config = get_local_config(options) if not config: fatal("""\ @@ -1050,10 +1057,10 @@ def psa_build(args): print "Done! The binary package can be found at ./deb_dist" return -def psa_update(args): +def psa_update(args, options): '''Updates fields of the project''' - config = get_local_config() + config = get_local_config(options) if not config: fatal("""\