Add '--' separator to explicitly pass extra arguments to build commands.

This commit is contained in:
Ryan Volz 2021-05-21 17:07:51 -04:00
parent 15f8c891bd
commit 373d93e450
3 changed files with 19 additions and 5 deletions

View File

@ -69,7 +69,7 @@ jobs:
if [ "$OS_NAME" == "Windows" ]; then
PATH=$CONDA_PREFIX/NSIS:$PATH
fi
python build_installer.py -v --conda-exe $MAMBA_EXE
python build_installer.py -- -v --conda-exe $MAMBA_EXE
- name: Build metapackage
shell: bash -l {0}

View File

@ -34,7 +34,8 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(
description=(
"Build installer package(s) using conda constructor."
" Additional command-line options will be passed to constructor."
" Additional command-line options following '--' will be passed to"
" constructor."
)
)
parser.add_argument(
@ -59,7 +60,13 @@ if __name__ == "__main__":
),
)
args, constructor_args = parser.parse_known_args()
# allow a delimiter to separate constructor arguments
argv = sys.argv[1:]
if "--" in argv:
i = argv.index("--")
args, constructor_args = parser.parse_args(argv[:i]), argv[i + 1 :]
else:
args, constructor_args = parser.parse_args(argv), []
platform = spec_dir_extract_platform(args.installer_spec_dir)

View File

@ -73,7 +73,8 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(
description=(
"Build environment metapackage using conda-build."
" Additional command-line options will be passed to conda metapackage."
" Additional command-line options following '--' will be passed to conda"
" metapackage."
)
)
parser.add_argument(
@ -113,7 +114,13 @@ if __name__ == "__main__":
help="Summary of the package. (default: %(default)s)",
)
args, metapackage_args = parser.parse_known_args()
# allow a delimiter to separate metapackage arguments
argv = sys.argv[1:]
if "--" in argv:
i = argv.index("--")
args, metapackage_args = parser.parse_args(argv[:i]), argv[i + 1 :]
else:
args, metapackage_args = parser.parse_args(argv), []
env_dict = read_env_file(
args.env_file,