[ADD] poetry_update.py: dry option to execute without result

Signed-off-by: Mathieu Benoit <mathben@technolibre.ca>
This commit is contained in:
Mathieu Benoit 2021-09-28 00:44:05 -04:00
parent 02043d9467
commit e919a2725c

View file

@ -54,6 +54,11 @@ def get_config():
action="store_true",
help="More information in execution, show stats.",
)
parser.add_argument(
"--dry",
action="store_true",
help="Don't apply change, only show warning.",
)
args = parser.parse_args()
return args
@ -349,15 +354,17 @@ def main():
# repo = Repo(root_path)
# lst_repo = get_all_repo()
config = get_config()
pyproject_toml_filename = f"{config.dir}pyproject.toml"
delete_dependency_poetry(pyproject_toml_filename)
if not config.dry:
pyproject_toml_filename = f"{config.dir}pyproject.toml"
delete_dependency_poetry(pyproject_toml_filename)
combine_requirements(config)
if config.force and os.path.isfile("./poetry.lock"):
os.remove("./poetry.lock")
status = call_poetry_add_build_dependency()
if status:
sorted_dependency_poetry(pyproject_toml_filename)
if not config.dry:
if config.force and os.path.isfile("./poetry.lock"):
os.remove("./poetry.lock")
status = call_poetry_add_build_dependency()
if status:
sorted_dependency_poetry(pyproject_toml_filename)
if __name__ == "__main__":