From 3213e8a21f2f8b696d6b50218b821a75a0ec7f06 Mon Sep 17 00:00:00 2001 From: Hazel Noack Date: Tue, 29 Jul 2025 12:22:41 +0200 Subject: [PATCH] added option for local compile --- python_mommy_venv/__main__.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/python_mommy_venv/__main__.py b/python_mommy_venv/__main__.py index 2734a35..4f663f4 100644 --- a/python_mommy_venv/__main__.py +++ b/python_mommy_venv/__main__.py @@ -152,25 +152,30 @@ def mommify_venv(): parser.add_argument( "-v", "--verbose", action="store_true", - help="enable verbose output" + help="enable verbose and serious output" + ) + + parser.add_argument( + "-l", "--local", + action="store_true", + help="compile the config only for the current virtual environment" ) args = parser.parse_args() config_logging(args.verbose) - assert_venv() - compile_local = False - compiled_base_dir = VENV_DIRECTORY if compile_local else CONFIG_DIRECTORY + compiled_base_dir = VENV_DIRECTORY if args.local else CONFIG_DIRECTORY compiled_config_file = compiled_base_dir / COMPILED_CONFIG_FILE_NAME - compiled = compile_config() mommy_logger.info("mommy writes its moods in %s", compiled_config_file) serious_logger.info("writing compiled config file to %s", compiled_config_file) compiled_base_dir.mkdir(parents=True, exist_ok=True) with compiled_config_file.open("w") as f: json.dump(compiled, f, indent=4) + if not args.local: + (VENV_DIRECTORY / COMPILED_CONFIG_FILE_NAME).unlink(missing_ok=True) mommy_logger.info("")