PyXMake Developer Guide 1.0
PyXMake
Loading...
Searching...
No Matches
__init__.py
1# -*- coding: utf-8 -*-
2# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3# % PlugIn Module - Classes and Functions %
4# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5"""
6Imports all utility features provided by and for 3rd party packages.
7
8@note: PyXMake plug-in manager
9Created on 22.08.2022
10
11@version: 1.0
12----------------------------------------------------------------------------------------------
13@requires:
14 -
15
16@change:
17 -
18
19@author: garb_ma [DLR-FA,STM Braunschweig]
20----------------------------------------------------------------------------------------------
21"""
22import os, sys
23import signal
24import warnings
25
26## @package PyXMake.Plugin
27# Imports additional features provided by and for 3rd party packages.
28## @author
29# Marc Garbade
30## @date
31# 22.08.2022
32## @par Notes/Changes
33# - Added documentation // mg 22.08.2022
34
35try:
36 ## These imports are mandatory when using with poetry.
37 # It can be safely ignored in all other cases
38 from .__poetry import build as build
39 from .__poetry import Plugin as RuntimePlugin
40 from .__poetry import ApplicationPlugin as ApplicationPlugin
41
42 ## This block is only meaningful when poetry is installed and a
43 # custom build command is requested.
44 from .__build import build as bdist_wheel
45 from .__gitlab import check as check
46
47 ## Provide a custom error handler for the interruption event
48 # triggered by this wrapper to prevent multiple wheels from being
49 # created. Only affects exit codes when using CI runners
50 with warnings.catch_warnings(): #@UndefinedVariable
51 warnings.simplefilter("ignore") #@UndefinedVariable
52 if check(): signal.signal(signal.SIGINT, lambda *args: sys.exit(0))
53 if check(): signal.signal(signal.SIGTERM, lambda *args: sys.exit(0))
54
55 # Ignore import or module not found errors.
56except ImportError: pass
57
58## Added option to increase the default recursion limit through an environment variable.
59# The given default limit is never used in practice, but gives viewers an idea of the limit range.
60if os.getenv("pyx_recursion_limit",""): sys.setrecursionlimit(int(os.getenv("pyx_recursion_limit",5000)))
61
62def main():
63 """
64 This is the main entry point. Acts as a compatibility shim for poetry.
65 """
66 # Provide a shim to poetry
67 try: from poetry.console.application import main
68 except ImportError: from poetry.console import main
69 from packaging import version
70 # Print debugging info
71 if sys.argv[1] in ["debug"]:
72 # Print debugging information indicating that poetry executable has been modified.
73 print('==================================')
74 print('Running poetry with PyXMake plugin')
75 print('==================================')
76 # Execute build function when creating a platform python wheel. Only meaningful for legacy python versions.
77 if sys.argv[1] in ["build"] and version.parse(".".join([str(x) for x in sys.version_info[:2]])) < version.parse("3.7"): build()
78 # Return poetry application.
79 return main()
80
81if __name__ == '__main__':
82 main(); sys.exit()
83 pass
main()
Provide a custom error handler for the interruption event triggered by this wrapper to prevent multip...
Definition __init__.py:62