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

| PyXMake Developer Guide 1.0 PyXMake

Loading...
Searching...
No Matches
pyreq.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 PyReq #@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 # Resource paths
47 source=__pyc_src_path,
48 # Define output path
49 output=__pyc_src_path,
50 # Encryption, mode, verbose and scratch directory
51 scratch=VTL.Scratch, verbosity=2,
52 # Additional keyword arguments
53 **kwargs):
54 """
55 Main function to execute the script.
56 """
57 # Create a new class instance
58 Py2Req = PyReq(BuildID, os.path.join(source,"__init__.py"), scratch=scratch, verbose=verbosity)
59 # Add source
60 Py2Req.SourcePath(source)
61 # Define output directory
62 Py2Req.OutputPath(output)
63 # Set pre-processing command
64 Py2Req.Preprocessing(kwargs.get("preprocessing",""))
65 # Modify build mode
66 Py2Req.Build(kwargs.get("compargs","--no-pin"))
67 # Create markdown file of dependencies
68 Py2Req.create(**kwargs)
69
70if __name__ == "__main__":
71# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72# % Access command line inputs %
73# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74 # Execute CLI command
75 PyReq.run()
76 # Finish
77 print("==================================")
78 print("Finished building requirements files")
79 print("==================================")
80 sys.exit()
PyXMake.Build.Make.PyReq
Base class for all PyReq build events.
PyXMake.Build.Make
Create a make object to define the building environment.
Definition Make.py:1
PyXMake.VTL.pyreq.main
main(BuildID, source=__pyc_src_path, output=__pyc_src_path, scratch=VTL.Scratch, verbosity=2, **kwargs)
Definition pyreq.py:53