PyXMake Developer Guide: src/PyXMake/VTL/app.py Source File

| PyXMake Developer Guide 1.0 PyXMake

Loading...
Searching...
No Matches
app.py
1# -*- coding: utf-8 -*-
2# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3# % PyXMake - Build environment for PyXMake %
4# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5"""
6Triple-use minimum working example for PyXMake. This script can be
7executed in three different ways in varying levels of accessibility
8
9@note: Compile a stand-alone application using PyInstaller
10Created on 02.05.2020
11
12@version: 1.0
13----------------------------------------------------------------------------------------------
14@requires:
15 - PyXMake
16
17@change:
18 - Requires PyCODAC in PYTHONPATH.
19
20@author: garb_ma [DLR-FA,STM Braunschweig]
21----------------------------------------------------------------------------------------------
22"""
23import os, sys
24
25try:
26 import PyXMake as _ #@UnusedImport
27except ImportError:
28 # Script is executed as a plug-in
29 sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
30finally:
31 from PyXMake.Build.Make import PyInstaller #@UnresolvedImport
32 from PyXMake import VTL #@UnresolvedImport
33
34try:
35 # Import PyCODAC to build library locally during setup.
36 import PyCODAC
37 # Get absolute package paths
38 __pyc_src_path = PyCODAC.PyCODACPath
39except ImportError:
40 # This script is not executed as plug-in for PyCODAC
41 __pyc_src_path = ""
42 pass
43
44 def main(
45 BuildID,
46 # Build stand-alone application of PyCODAC
47 script=VTL.GetSourceCode(8),
48 # Resource paths
49 source=__pyc_src_path,
50 include=VTL.GetIncludeDirectory(os.path.dirname(__pyc_src_path), 8),
51 dependency=VTL.GetLinkDependency(8),
52 # Define output path
53 output=os.path.join(__pyc_src_path,"Plugin","JupyterLab","src",".dist"),
54 # Encryption, mode, verbose and scratch directory
55 encryption=True, mode="onefile", scratch=VTL.Scratch, verbosity=2,
56 # Additional keyword arguments
57 **kwargs):
58 """
59 Main function to execute the script.
60 """
61 # Create a new class instance
62 Py2App = PyInstaller(BuildID, script, scratch=scratch, verbose=verbosity)
63 # Activate or deactivate encryption. Defaults to True.
64 Py2App.Encryption(encryption)
65 # Add source, module and library paths
66 Py2App.SourcePath(source)
67 Py2App.AddIncludePath(include)
68 Py2App.AddDependencyPath(dependency)
69 # Define output directory
70 Py2App.OutputPath(output)
71 # Set pre-processing command
72 Py2App.Preprocessing(kwargs.get("preprocessing",""))
73 # Modify build mode
74 Py2App.Build(mode)
75 # Build application
76 Py2App.create(**kwargs)
77
78if __name__ == "__main__":
79# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
80# % Access command line inputs %
81# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82 PyInstaller.run()
83 # Finish
84 print("==================================")
85 print("Finished building stand-alone application")
86 print("==================================")
87 sys.exit()
PyXMake.Build.Make.PyInstaller
Base class for all PyInstaller build events.
PyXMake.Build.Make
Create a make object to define the building environment.
Definition Make.py:1
PyXMake.VTL.app.main
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)
Definition app.py:57