diff --git a/artman/cli/main.py b/artman/cli/main.py index 8d2248b5..1ccc6b86 100644 --- a/artman/cli/main.py +++ b/artman/cli/main.py @@ -29,6 +29,7 @@ import pprint import subprocess import sys +import tempfile import traceback import pkg_resources @@ -46,7 +47,7 @@ VERSION = pkg_resources.get_distribution('googleapis-artman').version ARTMAN_DOCKER_IMAGE = 'googleapis/artman:%s' % VERSION RUNNING_IN_ARTMAN_DOCKER_TOKEN = 'RUNNING_IN_ARTMAN_DOCKER' - +DEFAULT_OUTPUT_DIR = './artman-genfiles' def main(*args): """Main method of artman.""" @@ -124,9 +125,9 @@ def parse_args(*args): parser.add_argument( '--output-dir', type=str, - default='./artman-genfiles', + default=DEFAULT_OUTPUT_DIR, help='[Optional] Directory to store output generated by artman. ' - 'Default to `./artman-genfiles`', ) + 'Default to `' + DEFAULT_OUTPUT_DIR + '`', ) parser.add_argument( '--root-dir', type=str, @@ -273,6 +274,10 @@ def normalize_flags(flags, user_config): elif artifact_type == Artifact.DISCOGAPIC_CONFIG: pipeline_name = 'DiscoGapicConfigPipeline' pipeline_args['discovery_doc'] = artifact_config.discovery_doc + if os.path.abspath(flags.output_dir) != os.path.abspath(DEFAULT_OUTPUT_DIR): + logger.warning("`output_dir` is ignored in DiscoGapicConfigGen. " + + "Yamls are saved at the path specified by `gapic_yaml`.") + pipeline_args['output_dir'] = tempfile.mkdtemp() elif artifact_type == Artifact.PROTOBUF: pipeline_name = 'ProtoClientPipeline' pipeline_args['language'] = language