Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cli option to supply path to the construct yaml file #728

Closed
wants to merge 8 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions constructor/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ def get_output_filename(info):

def main_build(dir_path, output_dir='.', platform=cc_platform,
verbose=True, cache_dir=DEFAULT_CACHE_DIR,
dry_run=False, conda_exe="conda.exe"):
dry_run=False, conda_exe="conda.exe",
construct_yaml_path="construct.yaml"):
millsks marked this conversation as resolved.
Show resolved Hide resolved
logger.info('platform: %s', platform)
if not os.path.isfile(conda_exe):
sys.exit("Error: Conda executable '%s' does not exist!" % conda_exe)
Expand All @@ -76,7 +77,7 @@ def main_build(dir_path, output_dir='.', platform=cc_platform,
except ValueError:
sys.exit("Error: invalid platform string '%s'" % platform)

construct_path = join(dir_path, 'construct.yaml')
construct_path = construct_yaml_path
millsks marked this conversation as resolved.
Show resolved Hide resolved
info = construct_parse(construct_path, platform)
construct_verify(info)
info['CONSTRUCTOR_VERSION'] = __version__
Expand Down Expand Up @@ -303,6 +304,13 @@ def main():
action="store",
metavar="CONDA_EXE")

p.add_argument('--construct-yaml-path',
millsks marked this conversation as resolved.
Show resolved Hide resolved
help="path to construct YAML file ready by constructor",
action="store",
metavar="CONSTRUCT_YAML_PATH",
millsks marked this conversation as resolved.
Show resolved Hide resolved
default=join(os.getcwd(), 'construct.yaml')
millsks marked this conversation as resolved.
Show resolved Hide resolved
)

p.add_argument('dir_path',
help="directory containing construct.yaml",
action="store",
Expand All @@ -311,6 +319,7 @@ def main():
metavar='DIRECTORY')

args = p.parse_args()

logger.info("Got the following cli arguments: '%s'", args)

if args.verbose or args.debug:
Expand Down Expand Up @@ -350,7 +359,8 @@ def main():
out_dir = normalize_path(args.output_dir)
main_build(dir_path, output_dir=out_dir, platform=args.platform,
verbose=args.verbose, cache_dir=args.cache_dir,
dry_run=args.dry_run, conda_exe=conda_exe)
dry_run=args.dry_run, conda_exe=conda_exe,
construct_yaml_path=normalize_path(args.construct_yaml_path))
millsks marked this conversation as resolved.
Show resolved Hide resolved


if __name__ == '__main__':
Expand Down