From 73a90158010c311f23843d7ce1397e1be0739afc Mon Sep 17 00:00:00 2001 From: Long <931924+htlcnn@users.noreply.github.com> Date: Sat, 13 Feb 2021 16:23:59 +0700 Subject: [PATCH] ifcpatch make.py (#1319) --- src/ifcpatch/__init__.py | 2 +- src/ifcpatch/make.py | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/ifcpatch/make.py diff --git a/src/ifcpatch/__init__.py b/src/ifcpatch/__init__.py index 0632f90775..1af72f9bf0 100644 --- a/src/ifcpatch/__init__.py +++ b/src/ifcpatch/__init__.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# This can be packaged with `pyinstaller --onefile --clean --icon=icon.ico ifcpatch.py` +# This can be packaged into one executable with ./make.py import ifcopenshell import logging diff --git a/src/ifcpatch/make.py b/src/ifcpatch/make.py new file mode 100644 index 0000000000..a2a9da0b9a --- /dev/null +++ b/src/ifcpatch/make.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +import os +import subprocess + +# add hidden imports in recipes here +HIDDEN_IMPORTS = [ + "ifcopenshell.util.selector", + "ifcopenshell.util.element", + "ifcopenshell.util.schema", + "toposort", +] + + +def main(): + hiddenimport_args = " ".join('--hiddenimport "{}"'.format(imp) for imp in HIDDEN_IMPORTS) + cmd = 'pyinstaller ./__init__.py --onefile --clean --add-data ".{}ifcpatch" {}'.format( + os.pathsep, hiddenimport_args + ) + subprocess.check_output(cmd, shell=True) + + +if __name__ == "__main__": + main()