Commit 67704550 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Add user interface integration for psot repositories via cli and environment variable

parent 660a0d11
......@@ -123,8 +123,20 @@ class Config:
config['repository_paths'] = self.repo_paths
return config
def load_config():
return Config([pkg_resources.resource_filename('psot', '')]).load_config()
def load_config(repositories=None):
# always use the installed repository as the first repo
all_repositories = [pkg_resources.resource_filename('psot', '')]
# check for repositories via environment variable
if 'PSOT_REPOSITORIES' in os.environ:
variable = os.environ['PSOT_REPOSITORIES']
env_repos = variable.split(':')
all_repositories.extend(env_repos)
if repositories:
all_repositories.extend(repositories)
return Config(all_repositories).load_config()
if __name__ == "__main__":
"""prints the configuration"""
......
......@@ -15,6 +15,7 @@ def main():
subparsers = parser.add_subparsers()
info_parser = subparsers.add_parser('info')
info_parser.add_argument('--listanalyses', '-l', action='store_true', help='Show available analysis steps')
info_parser.add_argument('--repository', '-r', action='append', help='Include the given repository')
info_parser.set_defaults(func=info)
analyze_parser = subparsers.add_parser('analyze')
......@@ -28,10 +29,11 @@ def main():
analyze_parser.add_argument('--debug', '-d', action='store_true', help='Debug mode, computation directory will not be removed after computation')
analyze_parser.add_argument('--execution_dir', '-e', help='Use the specified execution directory and do not delete it after the computation')
analyze_parser.add_argument('--use_cluster', '-C', action='store_true', help='Use compute cluster for execution')
analyze_parser.add_argument('--repository', '-r', action='append', help='Include the given repository')
analyze_parser.set_defaults(func=analyze)
args = parser.parse_args()
config = load_config()
config = load_config(repositories=args.repository)
args.parser = parser
args.func(args, config)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment