6 Triple-use minimum working example for PyXMake. This script can be 7 executed in three different ways in varying levels of accessibility 9 @note: Compile a stand-alone application using PyInstaller 13 ---------------------------------------------------------------------------------------------- 18 - Requires PyCODAC in PYTHONPATH. 20 @author: garb_ma [DLR-FA,STM Braunschweig] 21 ---------------------------------------------------------------------------------------------- 30 sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
33 from PyXMake
import VTL
39 __pyc_src_path = PyCODAC.PyCODACPath
48 script=VTL.GetSourceCode(8),
50 source=__pyc_src_path,
51 include=VTL.GetIncludeDirectory(os.path.dirname(__pyc_src_path), 8),
52 dependency=VTL.GetLinkDependency(8),
54 output=os.path.join(__pyc_src_path,
"Plugin",
"JupyterLab",
"src",
".dist"),
56 encryption=
True, mode=
"onefile", scratch=VTL.Scratch, verbosity=2,
60 Main function to execute the script. 63 Py2App = pyx.PyInstaller(BuildID, script, scratch=scratch, verbose=verbosity)
65 Py2App.Encryption(encryption)
67 Py2App.SourcePath(source)
68 Py2App.AddIncludePath(include)
69 Py2App.AddDependencyPath(dependency)
71 Py2App.OutputPath(output)
73 Py2App.Preprocessing(kwargs.get(
"preprocessing",
""))
77 Py2App.create(**kwargs)
79 if __name__ ==
"__main__":
83 parser = argparse.ArgumentParser(description=
"Build a stand-alone python application")
84 parser.add_argument(
"entry", metavar=
"file.py", nargs=1, help=
"Main entry point of executable")
88 args, _ = parser.parse_known_args()
90 make_opt = args.make[0]
98 delimn =
" "; continuation =
"&&" 99 command = delimn.join([
100 sys.executable,os.path.join(__pyc_src_path,
"Plugin",
"DELiS",
"__install__.py"),continuation,
101 sys.executable,os.path.join(__pyc_src_path,
"Plugin",
"DELiS",
"__update__.py"),continuation,
102 sys.executable,os.path.join(__pyc_src_path,
"Plugin",
"Smetana",
"__install__.py"),continuation,
103 sys.executable,os.path.join(__pyc_src_path,
"Plugin",
"Smetana",
"__update__.py")
106 main(
"pycodac", mode=
"onedir", preprocessing=command)
109 print(
"==================================")
110 print(
"Finished building stand-alone application")
111 print(
"==================================")
def main(BuildID, script=VTL.GetSourceCode(8), source=__pyc_src_path, include=VTL.GetIncludeDirectory(os.path.dirname(__pyc_src_path), 8), dependency=VTL.GetLinkDependency(8), output=os.path.join(__pyc_src_path,"Plugin","JupyterLab","src",".dist"), encryption=True, mode="onefile", scratch=VTL.Scratch, verbosity=2, kwargs)
Module containing all relevant modules and scripts associated with the building process.