From 9cf3ec553952bdccde4eea8fe25d4aaccb5e6809 Mon Sep 17 00:00:00 2001 From: Maria Fernanda Magallanes Zubillaga Date: Mon, 26 Aug 2024 16:06:57 -0500 Subject: [PATCH] refactor: improve the naming in enable_private_packages --- .../commands/enable_private_packages.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tutorpicasso/commands/enable_private_packages.py b/tutorpicasso/commands/enable_private_packages.py index 63ff042..b3d6348 100644 --- a/tutorpicasso/commands/enable_private_packages.py +++ b/tutorpicasso/commands/enable_private_packages.py @@ -23,11 +23,11 @@ def enable_private_packages() -> None: tutor_root = context.root tutor_conf = tutor_config.load(tutor_root) - private_requirements_root = f"{tutor_root}/env/build/openedx/private_requirements" + private_requirements_path = f"{tutor_root}/env/build/openedx/requirements" packages = get_picasso_packages(tutor_conf) - if not os.path.exists(private_requirements_root): - os.makedirs(private_requirements_root) + if not os.path.exists(private_requirements_path): + os.makedirs(private_requirements_path) for package, info in packages.items(): if not {"name", "repo", "version"}.issubset(info): @@ -35,17 +35,17 @@ def enable_private_packages() -> None: f"{package} is missing one of the required keys: 'name', 'repo', 'version'" ) - if os.path.isdir(f'{private_requirements_root}/{info["name"]}'): + if os.path.isdir(f'{private_requirements_path}/{info["name"]}'): subprocess.call( - ["rm", "-rf", f'{private_requirements_root}/{info["name"]}'] + ["rm", "-rf", f'{private_requirements_path}/{info["name"]}'] ) subprocess.call( ["git", "clone", "-b", info["version"], info["repo"]], - cwd=private_requirements_root, + cwd=private_requirements_path, ) - handle_private_requirements_by_tutor_version(info, private_requirements_root) + handle_private_requirements_by_tutor_version(info, private_requirements_path) def handle_private_requirements_by_tutor_version(info: Dict[str, str], private_requirements_path: str) -> None: @@ -61,12 +61,12 @@ def handle_private_requirements_by_tutor_version(info: Dict[str, str], private_r if tutor_version_obj < quince_version_obj: private_txt_path = f"{private_requirements_path}/private.txt" - _enable_private_packages_before_quince(info, private_txt_path) + _enable_private_requirements_before_quince(info, private_txt_path) else: - _enable_private_packages_latest(info, private_requirements_path) + _enable_private_requirements_latest(info, private_requirements_path) -def _enable_private_packages_before_quince( +def _enable_private_requirements_before_quince( info: Dict[str, str], private_requirements_txt: str ) -> None: """ @@ -84,7 +84,7 @@ def _enable_private_packages_before_quince( subprocess.call(echo_command, shell=True) -def _enable_private_packages_latest( +def _enable_private_requirements_latest( info: Dict[str, str], private_requirements_root: str ) -> None: """