mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-19 07:52:56 +00:00
Unify common arguments in tagging/apps (#2230)
This commit is contained in:
@@ -42,7 +42,9 @@ def apply_tags(
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
arg_parser = common_arguments_parser()
|
arg_parser = common_arguments_parser(
|
||||||
|
registry=True, owner=True, short_image_name=True, variant=True, tags_dir=True
|
||||||
|
)
|
||||||
arg_parser.add_argument(
|
arg_parser.add_argument(
|
||||||
"--platform",
|
"--platform",
|
||||||
required=True,
|
required=True,
|
||||||
@@ -50,12 +52,6 @@ if __name__ == "__main__":
|
|||||||
choices=["x86_64", "aarch64", "arm64"],
|
choices=["x86_64", "aarch64", "arm64"],
|
||||||
help="Image platform",
|
help="Image platform",
|
||||||
)
|
)
|
||||||
arg_parser.add_argument(
|
|
||||||
"--tags-dir",
|
|
||||||
required=True,
|
|
||||||
type=Path,
|
|
||||||
help="Directory with saved tags file",
|
|
||||||
)
|
|
||||||
args = arg_parser.parse_args()
|
args = arg_parser.parse_args()
|
||||||
args.platform = unify_aarch64(args.platform)
|
args.platform = unify_aarch64(args.platform)
|
||||||
|
|
||||||
|
@@ -1,13 +1,18 @@
|
|||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import argparse
|
import argparse
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
def common_arguments_parser(
|
def common_arguments_parser(
|
||||||
registry: bool = True,
|
*,
|
||||||
owner: bool = True,
|
registry: bool = False,
|
||||||
short_image_name: bool = True,
|
owner: bool = False,
|
||||||
variant: bool = True,
|
short_image_name: bool = False,
|
||||||
|
variant: bool = False,
|
||||||
|
tags_dir: bool = False,
|
||||||
|
hist_lines_dir: bool = False,
|
||||||
|
manifests_dir: bool = False,
|
||||||
) -> argparse.ArgumentParser:
|
) -> argparse.ArgumentParser:
|
||||||
"""Add common CLI arguments to parser"""
|
"""Add common CLI arguments to parser"""
|
||||||
|
|
||||||
@@ -37,5 +42,26 @@ def common_arguments_parser(
|
|||||||
required=True,
|
required=True,
|
||||||
help="Variant tag prefix",
|
help="Variant tag prefix",
|
||||||
)
|
)
|
||||||
|
if tags_dir:
|
||||||
|
parser.add_argument(
|
||||||
|
"--tags-dir",
|
||||||
|
required=True,
|
||||||
|
type=Path,
|
||||||
|
help="Directory for tags file",
|
||||||
|
)
|
||||||
|
if hist_lines_dir:
|
||||||
|
parser.add_argument(
|
||||||
|
"--hist-lines-dir",
|
||||||
|
required=True,
|
||||||
|
type=Path,
|
||||||
|
help="Directory for hist_lines file",
|
||||||
|
)
|
||||||
|
if manifests_dir:
|
||||||
|
parser.add_argument(
|
||||||
|
"--manifests-dir",
|
||||||
|
required=True,
|
||||||
|
type=Path,
|
||||||
|
help="Directory for manifests file",
|
||||||
|
)
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
|
@@ -61,12 +61,8 @@ def merge_tags(
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
arg_parser = common_arguments_parser(registry=False, owner=False)
|
arg_parser = common_arguments_parser(
|
||||||
arg_parser.add_argument(
|
short_image_name=True, variant=True, tags_dir=True
|
||||||
"--tags-dir",
|
|
||||||
required=True,
|
|
||||||
type=Path,
|
|
||||||
help="Directory with saved tags file",
|
|
||||||
)
|
)
|
||||||
args = arg_parser.parse_args()
|
args = arg_parser.parse_args()
|
||||||
|
|
||||||
|
@@ -119,18 +119,13 @@ def write_manifest(
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
arg_parser = common_arguments_parser()
|
arg_parser = common_arguments_parser(
|
||||||
arg_parser.add_argument(
|
registry=True,
|
||||||
"--hist-lines-dir",
|
owner=True,
|
||||||
required=True,
|
short_image_name=True,
|
||||||
type=Path,
|
variant=True,
|
||||||
help="Directory to save history line",
|
hist_lines_dir=True,
|
||||||
)
|
manifests_dir=True,
|
||||||
arg_parser.add_argument(
|
|
||||||
"--manifests-dir",
|
|
||||||
required=True,
|
|
||||||
type=Path,
|
|
||||||
help="Directory to save manifest file",
|
|
||||||
)
|
)
|
||||||
args = arg_parser.parse_args()
|
args = arg_parser.parse_args()
|
||||||
|
|
||||||
|
@@ -51,12 +51,8 @@ def write_tags_file(
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
arg_parser = common_arguments_parser()
|
arg_parser = common_arguments_parser(
|
||||||
arg_parser.add_argument(
|
registry=True, owner=True, short_image_name=True, variant=True, tags_dir=True
|
||||||
"--tags-dir",
|
|
||||||
required=True,
|
|
||||||
type=Path,
|
|
||||||
help="Directory to save tags file",
|
|
||||||
)
|
)
|
||||||
args = arg_parser.parse_args()
|
args = arg_parser.parse_args()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user