浏览代码

gcstruct json-Export optional -> bessere Perf.

gc-server6 1 年之前
父节点
当前提交
cb0aa99015

二进制
gcstruct/dist/gcstruct_uebersetzung.exe


+ 7 - 1
gcstruct/gcstruct.py

@@ -288,12 +288,14 @@ class GCStruct:
             self.json_result["struct_export"][s] = df_temp.to_dict(orient="records")
 
         # {'accounts': {}, 'tree': {}, 'flat': {}, 'struct_export': {}, 'skr51_vars': {}}
+        return self.json_result
+
+    def export_structure_and_tree(self):
         json.dump(
             self.json_result,
             open(f"{self.config['path2']}/{self.config['output']}", "w"),
             indent=2,
         )
-        return self.json_result
 
     def get_accounts(self, structure, id):
         return [
@@ -792,6 +794,8 @@ def gcstruct_uebersetzung(base_dir=None):
     # base_dir = 'P:/SKR51_GCStruct/'
     if base_dir is None:
         base_dir = Path(".").absolute()
+    else:
+        base_dir = Path(base_dir)
     import_dir = base_dir
     if base_dir.name == "scripts":
         if base_dir.parent.parent.name == "Portal":
@@ -831,6 +835,7 @@ def gcstruct_uebersetzung(base_dir=None):
 def dresen():
     struct = GCStruct("c:/projekte/GCHRStruct_Hyundai_Export")
     struct.get_structure_and_tree()
+    struct.export_structure_and_tree()
     struct.export()
 
 
@@ -840,6 +845,7 @@ def reisacher():
         base_dir = "/media/fileserver1/austausch/Robert/Planung Reisacher/GCStruct_neue_Struktur_Planung"
     struct = GCStruct(base_dir)
     struct.get_structure_and_tree()
+    struct.export_structure_and_tree()
     # json.dump(res['flat'], open(f"{self.config['path2']}/{self.config['output']}", 'w'), indent=2)
 
 

+ 9 - 0
gcstruct/gcstruct_profiler.py

@@ -0,0 +1,9 @@
+from gcstruct import gcstruct_uebersetzung
+import cProfile
+
+
+if __name__ == "__main__":
+    cProfile.run(
+        'gcstruct_uebersetzung("C:\\GlobalCube\\Tasks\\scripts")',
+        "gcstruct_profiler.prof",
+    )

+ 3 - 0
gcstruct/gcstruct_uebersetzung.bat

@@ -0,0 +1,3 @@
+cd /d %~dp0
+pyinstaller -F --path %~dp0 gcstruct_uebersetzung.py
+pause

+ 37 - 33
gcstruct/gcstruct_uebersetzung.spec

@@ -4,37 +4,41 @@
 block_cipher = None
 
 
-a = Analysis(['gcstruct_uebersetzung.py'],
-             pathex=['P:\\Python_Projekte\\Python\\gcstruct'],
-             binaries=[],
-             datas=[],
-             hiddenimports=[],
-             hookspath=[],
-             hooksconfig={},
-             runtime_hooks=[],
-             excludes=[],
-             win_no_prefer_redirects=False,
-             win_private_assemblies=False,
-             cipher=block_cipher,
-             noarchive=False)
-pyz = PYZ(a.pure, a.zipped_data,
-             cipher=block_cipher)
+a = Analysis(
+    ['gcstruct_uebersetzung.py'],
+    pathex=['C:\\Projekte\\Python\\gcstruct\\'],
+    binaries=[],
+    datas=[],
+    hiddenimports=[],
+    hookspath=[],
+    hooksconfig={},
+    runtime_hooks=[],
+    excludes=[],
+    win_no_prefer_redirects=False,
+    win_private_assemblies=False,
+    cipher=block_cipher,
+    noarchive=False,
+)
+pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
 
-exe = EXE(pyz,
-          a.scripts,
-          a.binaries,
-          a.zipfiles,
-          a.datas,  
-          [],
-          name='gcstruct_uebersetzung',
-          debug=False,
-          bootloader_ignore_signals=False,
-          strip=False,
-          upx=True,
-          upx_exclude=[],
-          runtime_tmpdir=None,
-          console=True,
-          disable_windowed_traceback=False,
-          target_arch=None,
-          codesign_identity=None,
-          entitlements_file=None , icon='P:\\Python_Projekte\\Python\\gcstruct\\cube.ico')
+exe = EXE(
+    pyz,
+    a.scripts,
+    a.binaries,
+    a.zipfiles,
+    a.datas,
+    [],
+    name='gcstruct_uebersetzung',
+    debug=False,
+    bootloader_ignore_signals=False,
+    strip=False,
+    upx=True,
+    upx_exclude=[],
+    runtime_tmpdir=None,
+    console=True,
+    disable_windowed_traceback=False,
+    argv_emulation=False,
+    target_arch=None,
+    codesign_identity=None,
+    entitlements_file=None,
+)