From 90a94eda5b6a26895be449806506d00c3e450004 Mon Sep 17 00:00:00 2001 From: "Charles K. Neimog" Date: Tue, 12 Nov 2024 20:23:09 -0300 Subject: [PATCH] dont remove WebPatch --- .gitignore | 1 - Sources/pd4web/Builder.py | 9 ++++----- Sources/pd4web/Pd4Web.py | 14 +++++++------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index c520aedf..02757ff9 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,6 @@ Tests/Libraries/**/WebPatch/ Tests/Libraries/**/build/ Tests/**/CMakeLists.txt -Tests/Libraries/else/else/else-000-010 Tests/Basic/gui/Pd4Web Tests/Basic/gui/WebPatch Tests/Basic/gui/.gitignore diff --git a/Sources/pd4web/Builder.py b/Sources/pd4web/Builder.py index efd08198..9a2d81f3 100644 --- a/Sources/pd4web/Builder.py +++ b/Sources/pd4web/Builder.py @@ -189,11 +189,9 @@ def searchCFunction(self, patchLine: PatchLine, root, file): if "." in functionName: functionName = functionName.replace(".", "0x2e") self.regexSearch(patchLine, functionName, os.path.join(root, file)) - def getObjectsSourceCode(self): for patchLine in self.Patch.patchLinesProcessed: - #print(patchLine, patchLine.isExternal) if patchLine.isExternal: foundLibrary = self.Libraries.GetLibrarySourceCode(patchLine.library) if foundLibrary: @@ -226,7 +224,7 @@ def BuildExternalsObjects(self): continue libraryPath = self.Pd4Web.PROJECT_ROOT + "/Pd4Web/Externals/" + library for pdobject in objects: - + if pdobject not in self.Pd4Web.externalsLinkLibraries: self.Pd4Web.externalsLinkLibraries.append(pdobject) if libraryPath + "/build" not in self.Pd4Web.externalsLinkLibrariesFolders: @@ -459,8 +457,9 @@ def CopyExtraJsFiles(self): f.write(" \n") f.write(" \n") f.write("\n") - + if self.Pd4Web.TEMPLATE != 0: + print(self.Pd4Web.TEMPLATE) root = os.path.join(self.Pd4Web.PD4WEB_ROOT, "..", f"Templates/{self.Pd4Web.TEMPLATE}") if not os.path.exists(root): raise Exception(f"Error: Could not find template {self.Pd4Web.TEMPLATE}") @@ -468,7 +467,7 @@ def CopyExtraJsFiles(self): # copy all files inside the template folder to self.Pd4Web.PROJECT_ROOT for file in files: shutil.copy(os.path.join(root, file), self.Pd4Web.PROJECT_ROOT + "/WebPatch/") - + os.chdir(cwd) def __repr__(self) -> str: diff --git a/Sources/pd4web/Pd4Web.py b/Sources/pd4web/Pd4Web.py index 358e3dcb..9c1b1840 100644 --- a/Sources/pd4web/Pd4Web.py +++ b/Sources/pd4web/Pd4Web.py @@ -20,10 +20,10 @@ class Pd4Web: # Paths PD4WEB_LIBRARIES: str = "" PD_EXTERNAL: bool = False - + # User TEMPLATE: int = 0 - + # Dev BYPASS_UNSUPPORTED: bool = False SILENCE: bool = False @@ -237,8 +237,8 @@ def do_actions(self, parser): if parser.clear: shutil.rmtree(os.path.join(self.PROJECT_ROOT, "build"), ignore_errors=True) shutil.rmtree(os.path.join(self.PROJECT_ROOT, "Pd4Web"), ignore_errors=True) - #shutil.rmtree(os.path.join(self.PROJECT_ROOT, "WebPatch"), ignore_errors=True) - + # shutil.rmtree(os.path.join(self.PROJECT_ROOT, "WebPatch"), ignore_errors=True) + if parser.add_lib_cmake: newLibCmake = parser.add_lib_cmake if not os.path.exists(newLibCmake): @@ -268,7 +268,7 @@ def action_flags(self, parser): default=False, help="Use Emscripten to run the Browser", ) - + parser.add_argument( "--add-lib-cmake", required=False, @@ -340,12 +340,12 @@ def options_flags(self, parser): action="store_true", help="If is it pd4web external", ) - + ## User parser.add_argument( "--template", required=False, - default=1, + default=0, type=int, help="Number of the template to use, check https://charlesneimog.github.io/pd4web/en/patch/templates", )