diff --git a/.github/workflows/ccpp_win.yml b/.github/workflows/ccpp_win.yml index 7dd826715e..02469523c9 100644 --- a/.github/workflows/ccpp_win.yml +++ b/.github/workflows/ccpp_win.yml @@ -109,6 +109,11 @@ jobs: working-directory: ./build shell: cmd run: xcopy /RCYIE ..\resources package\resources + - name: copy profiles from registered github repositories + working-directory: ./build + shell: cmd + run: | + python ..\src\platform\download_vendor_bundles.py package/resources - name: copy dll & exe working-directory: ./build shell: cmd diff --git a/.github/workflows/ccpp_win_debug.yml b/.github/workflows/ccpp_win_debug.yml index c2189d2c54..b1f823208d 100644 --- a/.github/workflows/ccpp_win_debug.yml +++ b/.github/workflows/ccpp_win_debug.yml @@ -153,6 +153,11 @@ jobs: working-directory: ./build shell: cmd run: xcopy /RCYIE ..\resources package\resources + - name: copy profiles from registered github repositories + working-directory: ./build + shell: cmd + run: | + python ..\src\platform\download_vendor_bundles.py package/resources - name: copy dll & exe working-directory: ./build shell: cmd diff --git a/.github/workflows/ccpp_win_rc.yml b/.github/workflows/ccpp_win_rc.yml index 9398b5abbe..11ac8eaa9f 100644 --- a/.github/workflows/ccpp_win_rc.yml +++ b/.github/workflows/ccpp_win_rc.yml @@ -109,6 +109,11 @@ jobs: run: | xcopy /RCYIE ..\resources package\resources del /S /Q package\resources\localization\*.so + - name: copy profiles from registered github repositories + working-directory: ./build + shell: cmd + run: | + python ..\src\platform\download_vendor_bundles.py package/resources - name: copy dll & exe working-directory: ./build shell: cmd diff --git a/build_win.bat b/build_win.bat index 8b34a471b7..8296b1a08c 100644 --- a/build_win.bat +++ b/build_win.bat @@ -3,6 +3,7 @@ @REM /|/ @REM /|/ PrusaSlicer is released under the terms of the AGPLv3 or higher @REM /|/ +@ECHO WARNING: this script was made for PrusaSlicer but was never adapted to Slic3r/SuperSlicer. It may not work as expected. @setlocal disableDelayedExpansion enableExtensions @IF "%PS_ECHO_ON%" NEQ "" (echo on) ELSE (echo off) @GOTO :MAIN diff --git a/src/platform/download_vendor_bundles.py b/src/platform/download_vendor_bundles.py new file mode 100644 index 0000000000..2d1fe9e2dc --- /dev/null +++ b/src/platform/download_vendor_bundles.py @@ -0,0 +1,43 @@ +import subprocess +import configparser +import shutil +import os +import sys + +all_repositories= [ + "https://github.com/SuperSlicer-org/Voron-Profile.git", + "https://github.com/SuperSlicer-org/Creality-Profile.git", + "https://github.com/SuperSlicer-org/PrusaResearch-Profile.git", +] + +if len(sys.argv) < 2: + print("Usage: python download_vendor_bundles.py out_dir_name") + sys.exit(1) + +out_resources = "./"+sys.argv[1] +if not os.path.exists(out_resources): + print("error, the path "+out_resources+" doesn't exists") + sys.exit(1) + +for url in all_repositories: + print(f"Cloning {url}...") + try: + subprocess.run(["git", "clone", url], check=True) + except subprocess.CalledProcessError as e: + print(f"Failed to clone {url}: {e}") + repo_name_with_git = os.path.basename(url) + repo_name = repo_name_with_git.removesuffix('.git') + + # get id + config = configparser.ConfigParser() + with open(repo_name+"/description.ini", "r", encoding="utf-8") as f: + config.read_file(f) + vendor_id = config.get("vendor", "id") + print(f"Vendor ID: {vendor_id}") + # copy into our resources + shutil.copy(repo_name + "/profiles/"+vendor_id+".ini", out_resources+"/profiles/"+vendor_id+".ini"); + #copy the icon directory + if os.path.exists(out_resources+"/profiles/"+vendor_id): + shutil.rmtree(out_resources+"/profiles/"+vendor_id) + shutil.copytree(repo_name + "/profiles/"+vendor_id, out_resources+"/profiles/"+vendor_id) + \ No newline at end of file diff --git a/src/platform/osx/BuildMacOSImage.sh.in b/src/platform/osx/BuildMacOSImage.sh.in index 3ed45623c6..17fa346fe7 100644 --- a/src/platform/osx/BuildMacOSImage.sh.in +++ b/src/platform/osx/BuildMacOSImage.sh.in @@ -85,6 +85,9 @@ done find pack/@SLIC3R_APP_KEY@/@SLIC3R_APP_KEY@.app/Contents/Resources/localization -name "*.txt" -type f -delete find pack/@SLIC3R_APP_KEY@/@SLIC3R_APP_KEY@.app/Contents/Resources/localization -name "*database.mo" -type f -delete find pack/@SLIC3R_APP_KEY@/@SLIC3R_APP_KEY@.app/Contents/Resources/localization -name "Slic3r.mo" -type f -delete + + #copy distant profiles + python ../src/platform/download_vendor_bundles.py pack/@SLIC3R_APP_KEY@/@SLIC3R_APP_KEY@.app/Contents/Resources # copy bin and do not let it lower case cp -f bin/@SLIC3R_APP_CMD@ pack/@SLIC3R_APP_KEY@/@SLIC3R_APP_KEY@.app/Contents/MacOS/@SLIC3R_APP_KEY@ diff --git a/src/platform/unix/BuildLinuxImage.sh.in b/src/platform/unix/BuildLinuxImage.sh.in index 8fb231be8c..cdb00c4d6a 100644 --- a/src/platform/unix/BuildLinuxImage.sh.in +++ b/src/platform/unix/BuildLinuxImage.sh.in @@ -74,6 +74,9 @@ then find package/resources/localization -name "*.txt" -type f -delete find package/resources/localization -name "*database*" -type f -delete find package/resources/localization -name "Slic3r.mo" -type f -delete + + #copy distant profiles + python ../src/platform/download_vendor_bundles.py package/resources # copy occtwrapper cp src/OCCTWrapper.so package/bin/OCCTWrapper.so