in src/prepare_dlc_dev_environment.py [0:0]
def main():
args = get_args()
toml_path = args.partner_toml
test_types = args.tests
buildspec_paths = args.buildspecs
restore = args.restore
to_commit = args.commit
to_push = args.push
is_currency = args.n
override_tags = args.o
# Update to require 1 of 2 options
if not buildspec_paths and not restore:
LOGGER.error("No options provided. Please use the '-h' flag to list all options and retry.")
exit(1)
restore_default_toml(toml_path)
if restore:
handle_restore_option(toml_path, buildspec_paths, to_commit, to_push)
return
overrider = TomlOverrider()
changes = {}
# Handle the -n option
if is_currency:
framework, job_type = handle_currency_option(buildspec_paths)
df_paths = create_dockerfile_paths(buildspec_paths, framework, job_type)
changes.update({df_path: "Created new dockerfile" for df_path in df_paths})
changes.update({bp: "Created new buildspec file" for bp in buildspec_paths})
if override_tags:
for buildspec_path in buildspec_paths:
override_existing_buildspec(buildspec_path)
changes.update({bp: "Overrode tags on buildspec file" for bp in buildspec_paths})
# handle frameworks to build
if buildspec_paths:
overrider.set_test_types(test_types=test_types)
overrider.set_buildspec(buildspec_paths=buildspec_paths)
LOGGER.info(overrider.overrides)
write_toml(toml_path, overrides=overrider.overrides)
if to_commit:
changes[toml_path] = overrider.overrides
commit_and_push_changes(
changes,
remote_push=to_push,
restore=restore,
)