PyXMake Developer Guide: D:/03_Workspaces/01_Eclipse/pyx_core/PyXMake/VTL/bundle.py Source File

| PyXMake Developer Guide 1.0 PyXMake

D:/03_Workspaces/01_Eclipse/pyx_core/PyXMake/VTL/bundle.py
1 # -*- coding: utf-8 -*-
2 # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 # % PyXMake - Build environment for PyXMake %
4 # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 """
6 Triple-use minimum working example for PyXMake. This script can be
7 executed in three different ways in varying levels of accessibility
8
9 @note: Create an installer from an application folder using NSIS
10 Created 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 """
23 import os, sys
24 import argparse
25
26 try:
27 import PyXMake as _ #@UnusedImport
28 except ImportError:
29 # Script is executed as a plug-in
30 sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
31 finally:
32 from PyXMake.Build import Make as pyx #@UnresolvedImport
33 from PyXMake import VTL #@UnresolvedImport
34
35 try:
36 # Import PyCODAC to build library locally during setup.
37 import PyCODAC
38 __pyc_src_path = PyCODAC.PyCODACPath
39 except 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 # Add whole source folder into the bundle
47 files="*.*",
48 # Resource path
49 source=os.path.join(__pyc_src_path,"Plugin","JupyterLab","src",".dist","pycodac"),
50 # Define output path
51 output=os.path.join(__pyc_src_path,"Plugin","JupyterLab","src",".dist"),
52 # Encryption, mode, verbose and scratch directory
53 scratch=VTL.Scratch, verbosity=2,
54 # Additional keyword arguments
55 **kwargs):
56 """
57 Main function to execute the script.
58 """
59 # Create a new class instance
60 Bundle = pyx.NSIS(BuildID, files, scratch=scratch, verbose=verbosity)
61 # Add source, module and library paths
62 Bundle.SourcePath(source)
63 # Define output directory
64 Bundle.OutputPath(output)
65 # Build application
66 Bundle.create(**kwargs)
67
68 if __name__ == "__main__":
69 # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70 # % Access command line inputs %
71 # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72 parser = argparse.ArgumentParser(description="Create a portable installer using NSIS")
73 parser.add_argument("files", metavar="file.py", nargs=1, help="List of files injected into the installation executable ")
74
75 try:
76 _ = sys.argv[1]
77 args, _ = parser.parse_known_args()
78 # Extract command line option to identify the requested make operation
79 make_opt = args.make[0]
80 except:
81 # This is the default build option
82 make_opt = -1
83 # Build all supported features
84 if make_opt == -1:
85
86 # Create PyCODAC installer
87 main("pycodac")
88
89 # Finish
90 print("==================================")
91 print("Finished building bundled installer")
92 print("==================================")
93 sys.exit()
PyXMake.VTL.bundle.main
def 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:55
PyXMake.Build
Module containing all relevant modules and scripts associated with the building process.
Definition: __init__.py:1