diff --git a/tutorpicasso/commands/enable_private_packages.py b/tutorpicasso/commands/enable_private_packages.py index 30aedaa..a70fd9d 100644 --- a/tutorpicasso/commands/enable_private_packages.py +++ b/tutorpicasso/commands/enable_private_packages.py @@ -1,11 +1,11 @@ import os import subprocess - from typing import Any, Dict -from packaging.version import Version import click +from packaging.version import Version from tutor import config as tutor_config +from tutor.__about__ import __version__ as tutor_version @click.command(name="enable-private-packages", help="Enable picasso private packages") @@ -24,9 +24,6 @@ def enable_private_packages() -> None: .decode("utf-8") .strip() ) - tutor_version = ( - subprocess.check_output("tutor --version", shell=True).decode("utf-8").strip() - ).split()[-1] tutor_version_obj = Version(tutor_version) # Define Quince version as the method for installing private packages changes from this version quince_version_obj = Version("v17.0.0") diff --git a/tutorpicasso/plugin.py b/tutorpicasso/plugin.py index f50889a..cce504a 100644 --- a/tutorpicasso/plugin.py +++ b/tutorpicasso/plugin.py @@ -5,7 +5,9 @@ import click import importlib_resources +from packaging.version import Version from tutor import hooks +from tutor.__about__ import __version__ as tutor_version from tutorpicasso.commands.cli import picasso @@ -14,11 +16,16 @@ ######################################## # CONFIGURATION ######################################## -hooks.Filters.MOUNTED_DIRECTORIES.add_items( - [ - ("openedx", r"eox-.*"), - ] -) + +# In the latest Palm version, Tutor introduces the MOUNTED_DIRECTORIES. +latest_palm_version = "16.1.8" +if Version(tutor_version) > Version(latest_palm_version): + hooks.Filters.MOUNTED_DIRECTORIES.add_items( + [ + ("openedx", r"eox-.*"), + ] + ) + hooks.Filters.CONFIG_DEFAULTS.add_items( [ # Add your new settings that have default values here.