scriptcollection 4.2.81__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. ScriptCollection/AnionBuildPlatform.py +199 -0
  2. ScriptCollection/CertificateUpdater.py +149 -0
  3. ScriptCollection/Executables.py +921 -0
  4. ScriptCollection/GeneralUtilities.py +1589 -0
  5. ScriptCollection/HTTPMaintenanceOverheadHelper.py +36 -0
  6. ScriptCollection/OCIImages/AbstractImageHandler.py +38 -0
  7. ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerDebian.py +20 -0
  8. ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerDebianSlim.py +20 -0
  9. ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerGeneric.py +20 -0
  10. ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerGenericV.py +20 -0
  11. ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerGitlabCE.py +20 -0
  12. ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerGitlabEE.py +20 -0
  13. ScriptCollection/OCIImages/ConcreteImageHandlers/__init__.py +0 -0
  14. ScriptCollection/OCIImages/OCIImageManager.py +190 -0
  15. ScriptCollection/OCIImages/__init__.py +0 -0
  16. ScriptCollection/ProcessesRunner.py +43 -0
  17. ScriptCollection/ProgramRunnerBase.py +47 -0
  18. ScriptCollection/ProgramRunnerMock.py +2 -0
  19. ScriptCollection/ProgramRunnerPopen.py +57 -0
  20. ScriptCollection/ProgramRunnerSudo.py +108 -0
  21. ScriptCollection/Resources/CultureChooser/CultureChooser.js +29 -0
  22. ScriptCollection/Resources/CultureChooser/index.html +15 -0
  23. ScriptCollection/Resources/MaintenanceSite/MaintenanceSite.html +15 -0
  24. ScriptCollection/SCLog.py +115 -0
  25. ScriptCollection/ScriptCollectionCore.py +3485 -0
  26. ScriptCollection/TFCPS/Docker/TFCPS_CodeUnitSpecific_Docker.py +192 -0
  27. ScriptCollection/TFCPS/Docker/__init__.py +0 -0
  28. ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationBase.py +8 -0
  29. ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationGenerate.py +6 -0
  30. ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationNoGenerate.py +7 -0
  31. ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py +547 -0
  32. ScriptCollection/TFCPS/DotNet/__init__.py +0 -0
  33. ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py +137 -0
  34. ScriptCollection/TFCPS/Flutter/__init__.py +0 -0
  35. ScriptCollection/TFCPS/Go/TFCPS_CodeUnitSpecific_Go.py +72 -0
  36. ScriptCollection/TFCPS/Go/__init__.py +0 -0
  37. ScriptCollection/TFCPS/Maven/TFCPS_CodeUnitSpecific_Maven.py +42 -0
  38. ScriptCollection/TFCPS/Maven/__init__.py +0 -0
  39. ScriptCollection/TFCPS/NodeJS/TFCPS_CodeUnitSpecific_NodeJS.py +232 -0
  40. ScriptCollection/TFCPS/NodeJS/__init__.py +0 -0
  41. ScriptCollection/TFCPS/Python/TFCPS_CodeUnitSpecific_Python.py +239 -0
  42. ScriptCollection/TFCPS/Python/__init__.py +0 -0
  43. ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py +42 -0
  44. ScriptCollection/TFCPS/Rust/__init__.py +0 -0
  45. ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py +433 -0
  46. ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py +135 -0
  47. ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py +301 -0
  48. ScriptCollection/TFCPS/TFCPS_CreateRelease.py +98 -0
  49. ScriptCollection/TFCPS/TFCPS_Generic.py +44 -0
  50. ScriptCollection/TFCPS/TFCPS_MergeToMain.py +128 -0
  51. ScriptCollection/TFCPS/TFCPS_MergeToStable.py +356 -0
  52. ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py +48 -0
  53. ScriptCollection/TFCPS/TFCPS_Tools_General.py +1565 -0
  54. ScriptCollection/TFCPS/__init__.py +0 -0
  55. ScriptCollection/__init__.py +0 -0
  56. ScriptCollection/__pycache__/GeneralUtilities.cpython-311.pyc +0 -0
  57. ScriptCollection/__pycache__/__init__.cpython-311.pyc +0 -0
  58. scriptcollection-4.2.81.dist-info/METADATA +169 -0
  59. scriptcollection-4.2.81.dist-info/RECORD +62 -0
  60. scriptcollection-4.2.81.dist-info/WHEEL +5 -0
  61. scriptcollection-4.2.81.dist-info/entry_points.txt +67 -0
  62. scriptcollection-4.2.81.dist-info/top_level.txt +1 -0
@@ -0,0 +1,29 @@
1
+ function getBrowserCulture() {
2
+ //returns a culture in the format "en", "fr" and "fr-FR".
3
+ let lang = navigator.language || navigator.userLanguage || "en";
4
+ const match = lang.match(/^[a-zA-Z]{2}(?:-[a-zA-Z]{2})?/);
5
+ return match ? match[0] : "en";
6
+ }
7
+
8
+ function getCultureToRedirect() {
9
+ const supportedCultures = [/*__supportedCultures__*/];//contains values like "en", "fr" and "fr-FR".
10
+ let culture = getBrowserCulture();
11
+ if (supportedCultures.includes(culture)) {
12
+ window.location.replace(`/${culture}/index.html`);
13
+ } else {
14
+ if (0 < culture.indexOf('-')) {
15
+ languageOnly = culture.split('-')[0];
16
+ if (supportedCultures.includes(languageOnly)) {
17
+ return languageOnly;
18
+ }
19
+ }
20
+ }
21
+ return "en";
22
+ }
23
+
24
+ function redirectToCulture() {
25
+ const culture = getCultureToRedirect();
26
+ window.location.replace(`/${culture}/index.html`);
27
+ }
28
+
29
+ redirectToCulture();
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <title><!--__title__--></title>
7
+ </head>
8
+
9
+ <body>
10
+ <h1><!--__title__--></h1>
11
+ <script src="./CultureChooser.js"></script>
12
+ If you are not redirected, click <a href="/en/index.html">here</a>.
13
+ </body>
14
+
15
+ </html>
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <title><!--__title__--></title>
7
+ </head>
8
+
9
+ <body>
10
+ <h1><!--__title__--></h1>
11
+ <h2>Maintenance-mode</h2>
12
+ <!--__title__--> will be back again soon.
13
+ </body>
14
+
15
+ </html>
@@ -0,0 +1,115 @@
1
+ import traceback
2
+ from enum import Enum
3
+ from datetime import datetime
4
+ from .GeneralUtilities import GeneralUtilities
5
+
6
+
7
+ class LogLevel(Enum):
8
+ Quiet = 0
9
+ Error = 1
10
+ Warning = 2
11
+ Information = 3
12
+ Debug = 4
13
+ Diagnostic = 5
14
+
15
+ def __int__(self):
16
+ return self.value
17
+
18
+
19
+ class SCLog:
20
+ loglevel: LogLevel#minimum loglevel
21
+ log_file: str
22
+ add_overhead_to_console: bool
23
+ add_overhead_to_logfile: bool
24
+ print_as_color: bool
25
+ add_milliseconds_to_logfile_entry: bool
26
+
27
+ def __init__(self, log_file: str = None, loglevel: LogLevel = None, print_as_color: bool = True):
28
+ self.log_file = log_file
29
+ if loglevel is None:
30
+ self.loglevel = LogLevel.Information
31
+ else:
32
+ self.loglevel = loglevel
33
+ self.add_overhead_to_console = False
34
+ self.add_overhead_to_logfile = False
35
+ self.add_milliseconds_to_logfile_entry = False
36
+ self.print_as_color = print_as_color
37
+
38
+ @GeneralUtilities.check_arguments
39
+ def log_exception(self, message: str, ex: Exception,loglevel:LogLevel = LogLevel.Error):
40
+ self.log(f"Exception: {message}; Exception-details: {str(ex)}; Traceback: {traceback.format_exc()}", loglevel)
41
+
42
+ @GeneralUtilities.check_arguments
43
+ def log(self, message: str, loglevel: LogLevel = None):
44
+ for line in GeneralUtilities.string_to_lines(message, True, False):
45
+ self.__log_line(line, loglevel)
46
+
47
+ @GeneralUtilities.check_arguments
48
+ def __log_line(self, message: str, loglevel: LogLevel = None):
49
+
50
+ print_to_console: bool = True
51
+ print_to_logfile: bool = self.log_file is not None
52
+
53
+ if loglevel is None:
54
+ loglevel = LogLevel.Information
55
+
56
+ if int(self.loglevel)<int(loglevel):
57
+ return
58
+
59
+ if message.endswith("\n"):
60
+ GeneralUtilities.write_message_to_stderr(f"invalid line: '{message}'") # TODO remove this
61
+
62
+ part1: str = GeneralUtilities.empty_string
63
+ part2: str = GeneralUtilities.empty_string
64
+ part3: str = "] "
65
+ part4: str = message
66
+
67
+ if loglevel == LogLevel.Warning and not message.startswith("Warning: "):
68
+ part4 = f"Warning: {message}"
69
+ if loglevel == LogLevel.Debug and not message.startswith("Debug: "):
70
+ part4 = f"Debug: {message}"
71
+ if loglevel == LogLevel.Diagnostic and not message.startswith("Diagnostic: "):
72
+ part4 = f"Diagnostic: {message}"
73
+
74
+ moment: datetime = datetime.now(datetime.now().astimezone().tzinfo)
75
+
76
+ part1 = f"[{GeneralUtilities.datetime_to_string_for_logfile_entry(moment, self.add_milliseconds_to_logfile_entry)}] ["
77
+ if loglevel == LogLevel.Information:
78
+ part2 = f"Information"
79
+ elif loglevel == LogLevel.Error:
80
+ part2 = f"Error"
81
+ elif loglevel == LogLevel.Warning:
82
+ part2 = f"Warning"
83
+ elif loglevel == LogLevel.Debug:
84
+ part2 = f"Debug"
85
+ elif loglevel == LogLevel.Diagnostic:
86
+ part2 = f"Diagnostic"
87
+ else:
88
+ raise ValueError("Unknown loglevel.")
89
+
90
+ if print_to_console:
91
+ print_to_std_out: bool = loglevel in (LogLevel.Debug, LogLevel.Information)
92
+ if self.add_overhead_to_console:
93
+ GeneralUtilities.print_text(part1, print_to_std_out)
94
+ if loglevel == LogLevel.Information:
95
+ GeneralUtilities.print_text_in_green(part2, print_to_std_out, self.print_as_color)
96
+ elif loglevel == LogLevel.Error:
97
+ GeneralUtilities.print_text_in_red(part2, print_to_std_out, self.print_as_color)
98
+ elif loglevel == LogLevel.Warning:
99
+ GeneralUtilities.print_text_in_yellow(part2, print_to_std_out, self.print_as_color)
100
+ elif loglevel == LogLevel.Debug:
101
+ GeneralUtilities.print_text_in_cyan(part2, print_to_std_out, self.print_as_color)
102
+ elif loglevel == LogLevel.Diagnostic:
103
+ GeneralUtilities.print_text_in_cyan(part2, print_to_std_out, self.print_as_color)
104
+ else:
105
+ raise ValueError("Unknown loglevel.")
106
+ GeneralUtilities.print_text(part3+part4+"\n", print_to_std_out)
107
+ else:
108
+ GeneralUtilities.print_text(part4+"\n", print_to_std_out)
109
+
110
+ if print_to_logfile:
111
+ GeneralUtilities.ensure_file_exists(self.log_file)
112
+ if self.add_overhead_to_logfile:
113
+ GeneralUtilities.append_line_to_file(self.log_file, part1+part2+part3+part4)
114
+ else:
115
+ GeneralUtilities.append_line_to_file(self.log_file, part4)