diff --git a/psa b/psa index d598907..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,13 +846,13 @@ 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: - 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''' @@ -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("""\