Commit 01f518d8 authored by Mickaël Desfrênes's avatar Mickaël Desfrênes
Browse files

fix max distro path

parent 3feb6ccd
Loading
Loading
Loading
Loading
+62 −16
Changes for src/climax/__main__.py: 62 added lines, 16 removed lines.
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ SAXON_DISTRO = (
    "https://repo1.maven.org/maven2/net/sf/saxon/Saxon-HE/10.8/Saxon-HE-10.8.jar"
)
MAX_DISTRO = "https://git.unicaen.fr/pdn-certic/max-v2/-/archive/0.0.1-alpha/max-v2-0.0.1-alpha.zip"
CURRENT_MAX_DISTRO_DIR = "max-v2-0.0.1-alpha"
JAVA_DISTROS = {
    "darwin/arm64": "https://download.java.net/java/GA/jdk22.0.2/c9ecb94cd31b495da20a27d4581645e8/9/GPL/openjdk-22.0.2_macos-aarch64_bin.tar.gz",
    "linux/x86_64": "https://download.java.net/java/GA/jdk22.0.2/c9ecb94cd31b495da20a27d4581645e8/9/GPL/openjdk-22.0.2_linux-x64_bin.tar.gz",
@@ -333,29 +334,53 @@ def _install_new_max_instance(root_directory: Path):

    os.makedirs(Path(dot_max_dir, "basex", "repo", "max"), exist_ok=True)
    shutil.copytree(
        Path(USER_DIR, "max", "src", "main", "webapp"),
        Path(USER_DIR, "max", CURRENT_MAX_DISTRO_DIR, "src", "main", "webapp"),
        Path(dot_max_dir, "basex", "webapp", "max"),
    )
    shutil.copy(
        Path(USER_DIR, "max", "expath-pkg.xml"),
        Path(USER_DIR, "max", CURRENT_MAX_DISTRO_DIR, "expath-pkg.xml"),
        Path(dot_max_dir, "basex", "repo", "max", "expath-pkg.xml"),
    )
    shutil.copytree(
        Path(USER_DIR, "max", "src", "main", "core"),
        Path(USER_DIR, "max", CURRENT_MAX_DISTRO_DIR, "src", "main", "core"),
        Path(dot_max_dir, "basex", "repo", "max", "max"),
    )
    shutil.copytree(
        Path(USER_DIR, "max", "src", "main", "bundles", "max-content-html-bundle"),
        Path(
            USER_DIR,
            "max",
            CURRENT_MAX_DISTRO_DIR,
            "src",
            "main",
            "bundles",
            "max-content-html-bundle",
        ),
        Path(dot_max_dir, "basex", "repo", "max-content-html-bundle"),
    )
    shutil.copytree(
        Path(USER_DIR, "max", "src", "main", "bundles", "max-autoroute-bundle"),
        Path(
            USER_DIR,
            "max",
            CURRENT_MAX_DISTRO_DIR,
            "src",
            "main",
            "bundles",
            "max-autoroute-bundle",
        ),
        Path(dot_max_dir, "basex", "repo", "max-autoroute-bundle"),
    )

    # TODO: assuming TEI, but shouldn't we ask first ? Or make this a mandatory argument ?
    shutil.copytree(
        Path(USER_DIR, "max", "src", "main", "bundles", "max-tei-bundle"),
        Path(
            USER_DIR,
            "max",
            CURRENT_MAX_DISTRO_DIR,
            "src",
            "main",
            "bundles",
            "max-tei-bundle",
        ),
        Path(dot_max_dir, "basex", "repo", "max-tei-bundle"),
    )
    new_max_config = MaXProjectConfig(config_file_path)
@@ -393,23 +418,39 @@ def _sync_max_instance(root_directory: Path):
    cached_download(SAXON_DISTRO, saxon_zip_destination)
    os.makedirs(Path(dot_max_dir, "basex", "repo", "max"), exist_ok=True)
    shutil.copytree(
        Path(USER_DIR, "max", "src", "main", "webapp"),
        Path(USER_DIR, "max", CURRENT_MAX_DISTRO_DIR, "src", "main", "webapp"),
        Path(dot_max_dir, "basex", "webapp", "max"),
    )
    shutil.copy(
        Path(USER_DIR, "max", "expath-pkg.xml"),
        Path(USER_DIR, "max", CURRENT_MAX_DISTRO_DIR, "expath-pkg.xml"),
        Path(dot_max_dir, "basex", "repo", "max", "expath-pkg.xml"),
    )
    shutil.copytree(
        Path(USER_DIR, "max", "src", "main", "core"),
        Path(USER_DIR, "max", CURRENT_MAX_DISTRO_DIR, "src", "main", "core"),
        Path(dot_max_dir, "basex", "repo", "max", "max"),
    )
    shutil.copytree(
        Path(USER_DIR, "max", "src", "main", "bundles", "max-content-html-bundle"),
        Path(
            USER_DIR,
            "max",
            CURRENT_MAX_DISTRO_DIR,
            "src",
            "main",
            "bundles",
            "max-content-html-bundle",
        ),
        Path(dot_max_dir, "basex", "repo", "max-content-html-bundle"),
    )
    shutil.copytree(
        Path(USER_DIR, "max", "src", "main", "bundles", "max-autoroute-bundle"),
        Path(
            USER_DIR,
            "max",
            CURRENT_MAX_DISTRO_DIR,
            "src",
            "main",
            "bundles",
            "max-autoroute-bundle",
        ),
        Path(dot_max_dir, "basex", "repo", "max-autoroute-bundle"),
    )

@@ -452,28 +493,32 @@ def demo():
        cur_dir = os.getcwd()

        shutil.copytree(  ## BaseX databases
            Path(USER_DIR, "max", "fixtures", "max"),
            Path(USER_DIR, "max", CURRENT_MAX_DISTRO_DIR, "fixtures", "max"),
            Path(cur_dir, ".max", "basex", "data", "max"),
        )
        shutil.copytree(
            Path(USER_DIR, "max", "fixtures", "content_html"),
            Path(USER_DIR, "max", CURRENT_MAX_DISTRO_DIR, "fixtures", "content_html"),
            Path(cur_dir, "content_html"),
        )
        shutil.copytree(
            Path(USER_DIR, "max", "fixtures", "templates"), Path(cur_dir, "templates")
            Path(USER_DIR, "max", CURRENT_MAX_DISTRO_DIR, "fixtures", "templates"),
            Path(cur_dir, "templates"),
        )
        shutil.copytree(
            Path(USER_DIR, "max", "fixtures", "autoroute"), Path(cur_dir, "autoroute")
            Path(USER_DIR, "max", CURRENT_MAX_DISTRO_DIR, "fixtures", "autoroute"),
            Path(cur_dir, "autoroute"),
        )

        shutil.copy(
            Path(USER_DIR, "max", "fixtures", "config.xml"), Path(cur_dir, "config.xml")
            Path(USER_DIR, "max", CURRENT_MAX_DISTRO_DIR, "fixtures", "config.xml"),
            Path(cur_dir, "config.xml"),
        )

        shutil.copy(
            Path(
                USER_DIR,
                "max",
                CURRENT_MAX_DISTRO_DIR,
                "src",
                "main",
                "bundles",
@@ -489,6 +534,7 @@ def demo():
            Path(
                USER_DIR,
                "max",
                CURRENT_MAX_DISTRO_DIR,
                "src",
                "main",
                "bundles",