PyXMake Developer Guide 1.0
PyXMake
Loading...
Searching...
No Matches
bundle.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: Create an installer from an application folder using NSIS
10Created on 11.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 NSIS #@UnresolvedImport
32 from PyXMake import VTL #@UnresolvedImport
33
34try:
35 # Import PyCODAC to build library locally during setup.
36 import PyCODAC
37 __pyc_src_path = PyCODAC.PyCODACPath
38except ImportError:
39 # This script is not executed as plug-in for PyCODAC
40 __pyc_src_path = ""
41 pass
42
43def main(
44 BuildID,
45 # Add whole source folder into the bundle
46 files="*.*",
47 # Resource path
48 source=os.path.join(__pyc_src_path,"Plugin","JupyterLab","src",".dist","pycodac"),
49 # Define output path
50 output=os.path.join(__pyc_src_path,"Plugin","JupyterLab","src",".dist"),
51 # Encryption, mode, verbose and scratch directory
52 scratch=VTL.Scratch, verbosity=2,
53 # Additional keyword arguments
54 **kwargs):
55 """
56 Main function to execute the script.
57 """
58 # Create a new class instance
59 Bundle = NSIS(BuildID, files, scratch=scratch, verbose=verbosity)
60 # Add source, module and library paths
61 Bundle.SourcePath(source)
62 # Define output directory
63 Bundle.OutputPath(output)
64 # Build application
65 Bundle.create(**kwargs)
66
67if __name__ == "__main__":
68# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
69# % Access command line inputs %
70# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71 NSIS.run()
72 # Finish
73 print("==================================")
74 print("Finished building bundled installer")
75 print("==================================")
76 sys.exit()
Base class for all NSIS build events.
Create a make object to define the building environment.
Definition Make.py:1
main(BuildID, files="*.*", source=os.path.join(__pyc_src_path,"Plugin","JupyterLab","src",".dist","pycodac"), output=os.path.join(__pyc_src_path,"Plugin","JupyterLab","src",".dist"), scratch=VTL.Scratch, verbosity=2, **kwargs)
Definition bundle.py:54