Skip to content

Commit c20ad4a

Browse files
authored
Update pyinstaller.spec
1 parent 63335d9 commit c20ad4a

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

pyinstaller.spec

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
# -*- mode: python ; coding: utf-8 -*-
2+
3+
# Apply patch
4+
from openpectus.lang.exec import units
5+
before = """cache_folder = os.path.join(os.path.dirname(__file__), "pint-cache")
6+
ureg = UnitRegistry(cache_folder=cache_folder)"""
7+
after = "ureg = UnitRegistry()"
8+
with open(units.__file__, "r") as f:
9+
original_contents = f.read()
10+
with open(units.__file__, "w") as f:
11+
f.write(original_contents.replace(before, after))
12+
213
from PyInstaller.utils.hooks import collect_all
314

415
datas, binaries, hiddenimports = collect_all('openpectus')
@@ -43,3 +54,7 @@ exe = EXE(
4354
entitlements_file=None,
4455
icon=['openpectus_engine_manager_gui/icon.ico'],
4556
)
57+
58+
# Undo patch
59+
with open(units.__file__, "w") as f:
60+
f.write(original_contents)

0 commit comments

Comments
 (0)