ScriptCollection 4.4.38__py3-none-any.whl → 4.4.40__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.
@@ -1245,7 +1245,7 @@ def SearchForSecrets() -> int:
1245
1245
  def SearchForSecretsInImage() -> int:
1246
1246
  parser = argparse.ArgumentParser(description="Scans an OCI-image which is available in the local docker-instance for secrets. Exit-code 0: no secrets found. Exit-code 1: secrets found. Exit-code 2: an error occurred.")
1247
1247
  parser.add_argument('-i', '--image', required=True, help="Reference of the image which should be scanned, for example \"myimage:1.0.0\". The image must already be available in the local docker-instance.")
1248
- parser.add_argument('-r', '--repository', required=False, default=None, help="Optional path to a repository whose \".betterleaks.toml\" is used to allowlist known false positives.")
1248
+ parser.add_argument('-r', '--repository', required=False, default=None, help="Optional path to a repository whose \".ScriptCollection/SecretScanConfiguration.toml\" declares the findings which are known false positives and therefore get ignored.")
1249
1249
  verbosity_values = ", ".join(f"{lvl.value}={lvl.name}" for lvl in LogLevel)
1250
1250
  parser.add_argument('-v', '--verbosity', required=False, default=3, help=f"Sets the loglevel. Possible values: {verbosity_values}")
1251
1251
  args = parser.parse_args()
@@ -40,7 +40,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
40
40
  from .ProgramRunnerPopen import ProgramRunnerPopen
41
41
  from .SCLog import SCLog, LogLevel
42
42
 
43
- version = "4.4.38"
43
+ version = "4.4.40"
44
44
  __version__ = version
45
45
 
46
46
  class VSCodeWorkspaceShellTask:
@@ -608,7 +608,7 @@ class TFCPS_CodeUnit_BuildCodeUnits:
608
608
  if 0 < len(findings):
609
609
  for finding in findings:
610
610
  self.sc.log.log(finding, LogLevel.Error)
611
- raise ValueError(f"Found {len(findings)} secret-finding(s) in the built OCI-image(s). A secret which is part of an image is readable by everybody who is allowed to pull that image. See {os.path.join(self.repository, '.betterleaks.toml')} to ignore known false positives.")
611
+ raise ValueError(f"Found {len(findings)} secret-finding(s) in the built OCI-image(s). A secret which is part of an image is readable by everybody who is allowed to pull that image. See {os.path.join(self.repository, '.ScriptCollection', 'SecretScanConfiguration.toml')} to ignore known false positives.")
612
612
 
613
613
  @GeneralUtilities.check_arguments
614
614
  def __get_oci_images_of_repository(self) -> list[str]:
@@ -48,12 +48,12 @@ class TFCPS_OCIImageSecretScan:
48
48
  self.sc = sc
49
49
 
50
50
  @GeneralUtilities.check_arguments
51
- def search_for_secrets_in_image(self, image: str, repository_for_allowlist: str = None) -> list[str]:
51
+ def search_for_secrets_in_image(self, image: str, repository_for_ignored_findings: str = None) -> list[str]:
52
52
  """Scans the given OCI-image for secrets and returns a human-readable description for every finding.
53
53
  'image' is the reference of an image which is already available in the local docker-instance (for example
54
54
  'myimage:1.0.0'); it is exported with 'docker save' and the resulting archive is scanned.
55
- 'repository_for_allowlist' is optional: if it is given, the '[[allowlists]]'-entries of its '.betterleaks.toml' are
56
- applied, so the same allowlist-file applies to the repository-scan and to the image-scan."""
55
+ 'repository_for_ignored_findings' is optional: if it is given, the findings which its
56
+ '.ScriptCollection/SecretScanConfiguration.toml' declares as ignored are removed from the result."""
57
57
  self.sc.log.log(f"Search for secrets in image \"{image}\"...", LogLevel.Debug)
58
58
  temporary_folder: str = tempfile.mkdtemp()
59
59
  try:
@@ -63,13 +63,13 @@ class TFCPS_OCIImageSecretScan:
63
63
  result = self.sc.run_program_argsasarray("docker", ["save", image, "-o", image_file], throw_exception_if_exitcode_is_not_zero=False, print_live_output=False)
64
64
  if result[0] != 0:
65
65
  raise ValueError(f"The image '{image}' could not be exported (exit-code {result[0]}: {result[2].strip()}). The image must be available in the local docker-instance to be scanned.")
66
- findings: list[str] = self.scan_image_artifact(image_file, repository_for_allowlist)
66
+ findings: list[str] = self.scan_image_artifact(image_file, repository_for_ignored_findings)
67
67
  finally:
68
68
  GeneralUtilities.ensure_directory_does_not_exist(temporary_folder)
69
69
  return [f"image \"{image}\": {finding}" for finding in findings]
70
70
 
71
71
  @GeneralUtilities.check_arguments
72
- def scan_image_artifact(self, image_file: str, repository_for_allowlist: str = None) -> list[str]:
72
+ def scan_image_artifact(self, image_file: str, repository_for_ignored_findings: str = None) -> list[str]:
73
73
  """Scans a single image-artifact (a tar-file as produced by 'docker save' or 'docker buildx build --output type=docker')."""
74
74
  findings: list[str] = []
75
75
  with tarfile.open(image_file, "r") as image_archive:
@@ -77,10 +77,10 @@ class TFCPS_OCIImageSecretScan:
77
77
  if not member.isfile() or member.size == 0:
78
78
  continue
79
79
  findings = findings+self.__scan_member_of_image_archive(image_archive, member)
80
- if repository_for_allowlist is None:
80
+ if repository_for_ignored_findings is None:
81
81
  return findings
82
- allowlist_patterns: list[re.Pattern] = self.__get_allowlist_patterns(repository_for_allowlist)
83
- return [finding for finding in findings if not self.__is_allowlisted(finding, allowlist_patterns)]
82
+ ignore_patterns: list[re.Pattern] = self.__get_ignore_patterns(repository_for_ignored_findings)
83
+ return [finding for finding in findings if not self.__finding_is_ignored(finding, ignore_patterns)]
84
84
 
85
85
  @GeneralUtilities.check_arguments
86
86
  def __scan_member_of_image_archive(self, image_archive: tarfile.TarFile, member: tarfile.TarInfo) -> list[str]:
@@ -196,35 +196,33 @@ class TFCPS_OCIImageSecretScan:
196
196
  return True
197
197
 
198
198
  @GeneralUtilities.check_arguments
199
- def __get_allowlist_patterns(self, repository: str) -> list[re.Pattern]:
200
- """Reads the allowlisted paths and regexes from '<repository>/.betterleaks.toml' so the image-scan honours the same
201
- allowlist as the repository-scan instead of requiring a second configuration-file."""
202
- configuration_file: str = os.path.join(repository, ".betterleaks.toml")
199
+ def __get_ignore_patterns(self, repository: str) -> list[re.Pattern]:
200
+ """Reads the regular expressions of the findings which the repository declares as known false positives from
201
+ '<repository>/.ScriptCollection/SecretScanConfiguration.toml'. Every expression is matched against the
202
+ finding-description (see the return-value of scan_image_artifact), not against a file-path, because a finding names the
203
+ path a file has inside the image as well as the kind of the finding: that way an entry can be scoped to exactly one kind
204
+ of finding in one file instead of hiding everything an image contains at that path.
205
+ The file is optional: a repository which does not have any known false positive does not need it."""
206
+ configuration_file: str = os.path.join(repository, ".ScriptCollection", "SecretScanConfiguration.toml")
203
207
  if not os.path.isfile(configuration_file):
204
208
  return []
205
209
  try:
206
210
  with open(configuration_file, "rb") as file_handle:
207
211
  configuration = tomllib.load(file_handle)
208
212
  except tomllib.TOMLDecodeError as exception:
209
- self.sc.log.log_exception(f"'{configuration_file}' could not be parsed, so no allowlist is applied to the image-scan:", exception, LogLevel.Warning)
213
+ self.sc.log.log_exception(f"'{configuration_file}' could not be parsed, so no finding is ignored:", exception, LogLevel.Warning)
210
214
  return []
211
- allowlists: list = []
212
- for key in ("allowlist", "allowlists"):
213
- value = configuration.get(key)
214
- if isinstance(value, dict):
215
- allowlists.append(value)
216
- elif isinstance(value, list):
217
- allowlists = allowlists+[entry for entry in value if isinstance(entry, dict)]
218
215
  result: list[re.Pattern] = []
219
- for allowlist in allowlists:
220
- for key in ("paths", "regexes"):
221
- for pattern in allowlist.get(key) or []:
222
- try:
223
- result.append(re.compile(str(pattern)))
224
- except re.error as exception:
225
- self.sc.log.log_exception(f"The allowlist-entry '{pattern}' of '{configuration_file}' is not a valid regular expression and is therefore ignored:", exception, LogLevel.Warning)
216
+ for ignored_finding in configuration.get("ignoredfindings") or []:
217
+ if not isinstance(ignored_finding, dict):
218
+ continue
219
+ for pattern in ignored_finding.get("regexes") or []:
220
+ try:
221
+ result.append(re.compile(str(pattern)))
222
+ except re.error as exception:
223
+ self.sc.log.log_exception(f"The entry '{pattern}' of '{configuration_file}' is not a valid regular expression and is therefore ignored:", exception, LogLevel.Warning)
226
224
  return result
227
225
 
228
226
  @GeneralUtilities.check_arguments
229
- def __is_allowlisted(self, finding: str, allowlist_patterns: list[re.Pattern]) -> bool:
230
- return any(pattern.search(finding) is not None for pattern in allowlist_patterns)
227
+ def __finding_is_ignored(self, finding: str, ignore_patterns: list[re.Pattern]) -> bool:
228
+ return any(pattern.search(finding) is not None for pattern in ignore_patterns)
@@ -1,169 +1,169 @@
1
- Metadata-Version: 2.4
2
- Name: scriptcollection
3
- Version: 4.4.38
4
- Summary: The ScriptCollection is the place for reusable scripts.
5
- Author-email: Marius Göcke <marius.goecke@gmail.com>
6
- License-Expression: GPL-3.0-only
7
- Project-URL: Homepage, https://github.com/anionDev/ScriptCollection
8
- Project-URL: Documentation, https://aniondev.github.io/ScriptCollectionReference/index.html
9
- Project-URL: Changelog, https://github.com/anionDev/ScriptCollection/tree/main/Other/Resources/Changelog
10
- Keywords: package,release,build,management
11
- Classifier: Intended Audience :: Developers
12
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Operating System :: POSIX :: Linux
15
- Classifier: Operating System :: Microsoft :: Windows :: Windows 10
16
- Classifier: Topic :: System :: Logging
17
- Classifier: Topic :: System :: Monitoring
18
- Classifier: Topic :: System :: Archiving :: Packaging
19
- Classifier: Topic :: System :: Systems Administration
20
- Classifier: Topic :: Terminals
21
- Classifier: Topic :: Utilities
22
- Requires-Python: >=3.11
23
- Description-Content-Type: text/markdown
24
- Requires-Dist: build>=1.6.1
25
- Requires-Dist: CountryInformation>=1.0.12
26
- Requires-Dist: coverage>=7.16.1
27
- Requires-Dist: cyclonedx-bom>=7.1.0
28
- Requires-Dist: defusedxml>=0.7.1
29
- Requires-Dist: keyboard>=0.13.5
30
- Requires-Dist: lcov-cobertura>=2.1.1
31
- Requires-Dist: lxml>=6.0.1
32
- Requires-Dist: ntplib>=0.4.0
33
- Requires-Dist: Pillow>=11.3.0
34
- Requires-Dist: psutil>=7.2.2
35
- Requires-Dist: pycdlib>=1.20.0
36
- Requires-Dist: Pygments>=2.21.0
37
- Requires-Dist: pylint>=4.0.9
38
- Requires-Dist: pyOpenSSL>=25.3.0
39
- Requires-Dist: PyPDF>=6.19.0
40
- Requires-Dist: pytest>=8.4.2
41
- Requires-Dist: PyYAML>=6.0.3
42
- Requires-Dist: qrcode>=8.2.0
43
- Requires-Dist: send2trash>=1.8.3
44
- Requires-Dist: twine>=6.2.0
45
- Requires-Dist: xmlschema>=4.3.2
46
-
47
- # ScriptCollection
48
-
49
- ## General
50
-
51
- [![Supported Python versions](https://img.shields.io/pypi/pyversions/ScriptCollection.svg)](https://pypi.org/project/ScriptCollection/)
52
- ![PyPI](https://img.shields.io/pypi/v/ScriptCollection)
53
- ![Dependencies](https://img.shields.io/librariesio/github/anionDevevlopment/ScriptCollection)
54
-
55
- [![CodeFactor](https://www.codefactor.io/repository/github/anionDevevlopment/scriptcollection/badge/main)](https://www.codefactor.io/repository/github/anionDevevlopment/scriptcollection/overview/main)
56
- [![Downloads](https://pepy.tech/badge/scriptcollection)](https://pepy.tech/project/scriptcollection)
57
- ![Coverage](https://raw.githubusercontent.com/anionDevevlopment/ScriptCollection/main/ScriptCollection/Other/Resources/TestCoverageBadges/badge_shieldsio_linecoverage_blue.svg)
58
-
59
- The ScriptCollection is the place for reusable scripts.
60
-
61
- ## Reference
62
-
63
- The reference can be found [here](https://aniondev.github.io/ScriptCollectionReference/index.html).
64
-
65
- ## Hints
66
-
67
- Most of the scripts are written in [python](https://www.python.org) 3.
68
-
69
- Caution: Before executing **any** script of this repository read the sourcecode of the script (and the sourcecode of all functions called by this function directly or transitively) carefully and verify that the script does exactly what you want to do and nothing else.
70
-
71
- Some functions are not entirely available on windows or require common third-party tools. See the [Runtime dependencies](#runtime-dependencies)-section for more information.
72
-
73
- When using ScriptCollection it is not required but recommended for better usability to have [epew](https://github.com/anionDev/Epew) installed.
74
-
75
- ## Get ScriptCollection
76
-
77
- ### Installation via pip
78
-
79
- `pip3 install ScriptCollection`
80
-
81
- See the [PyPI-site for ScriptCollection](https://pypi.org/project/ScriptCollection)
82
-
83
- ### Download sourcecode using git
84
-
85
- You can simply git-clone the ScriptCollection and then use the scripts under the provided license.
86
-
87
- `git clone https://github.com/anionDevevlopment/ScriptCollection.git`
88
-
89
- It may be more easy to pip-install the ScriptCollection but technically pip is not required. Actually you need to git-clone (or download as zip-file from [GitHub](https://github.com/anionDevevlopment/ScriptCollection) the ScriptCollection to use the scripts in this repository which are not written in python.
90
-
91
- ## Troubleshooting
92
-
93
- It is recommended to always use only the newest version of the ScriptCollection. If you have an older version: Update it (e. g. using `pip3 install ScriptCollection --upgrade` if you installed the ScriptCollection via pip). If you still have problems, then feel free to create an [issue](https://github.com/anionDevevlopment/ScriptCollection/issues).
94
-
95
- If you have installed the ScriptCollection as pip-package you can simply check the version using Python with the following commands:
96
-
97
- ```lang-bash
98
- from ScriptCollection.ScriptCollectionCore import ScriptCollectionCore
99
- ScriptCollectionCore.get_scriptcollection_version()
100
- ```
101
-
102
- Or you can simply run `pip3 freeze` folder to get information about (all) currently installed pip-packages.
103
-
104
- ## Development
105
-
106
- ### Branching-system
107
-
108
- This repository applies the [GitFlowSimplified](https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/blob/main/Conventions/BranchingSystem/GitFlowSimplified/GitFlowSimplified.md)-branching-system.
109
-
110
- ### Repository-structure
111
-
112
- This repository applies the [CommonProjectStructure](https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/blob/main/Conventions/RepositoryStructure/CommonProjectStructure/CommonProjectStructure.md)-branching-system.
113
-
114
- ### Install dependencies
115
-
116
- ScriptCollection requires [Python](https://www.python.org) 3.10.
117
-
118
- To develop ScriptCollection it is obviously required that the following commandline-commands are available on your system:
119
-
120
- - `python` (on some systems `python3`)
121
- - `pip3`
122
-
123
- The pip-packages which are required for developing on this project are defined in `requirements.txt`.
124
-
125
- ### IDE
126
-
127
- The recommended IDE for developing ScriptCollection is Visual Studio Code.
128
- The recommended addons for developing ScriptCollection with Visual Studio Code are:
129
-
130
- - [Pylance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance)
131
- - [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
132
- - [Spell Right](https://marketplace.visualstudio.com/items?itemName=ban.spellright)
133
- - [docs-markdown](https://marketplace.visualstudio.com/items?itemName=docsmsft.docs-markdown)
134
-
135
- ### Build
136
-
137
- To create and install an ScriptCollection locally simply do the following commands:
138
-
139
- ```bash
140
- python ./ScriptCollection/Other/Build/Build.py
141
- pip3 install --force-reinstall ./ScriptCollection/Other/Artifacts/Wheel/ScriptCollection-x.x.x-py3-none-any.whl
142
- ```
143
-
144
- (Note: `x.x.x` must be replaced by the appropriate version-number.)
145
-
146
- ### Coding style
147
-
148
- In this repository [pylint](https://pylint.org/) will be used to report linting-issues.
149
- If you change code in this repository please ensure pylint does not find any issues before creating a pull-request.
150
-
151
- If linting-issues exist in the current code-base can be checked by running `python ./ScriptCollection/Other/QualityCheck/Linting.py`.
152
-
153
- ## Runtime dependencies
154
-
155
- ScriptCollection requires [Python](https://www.python.org) 3.10.
156
-
157
- The usual Python-dependencies will be installed automagically by `pip`.
158
-
159
- For functions to to read or change the permissions or the owner of a file the ScriptCollection relies on the functionality of the following tools:
160
-
161
- - chmod
162
- - chown
163
- - ls
164
-
165
- This tools must be available on the system where the functions should be executed. Meanwhile this tools are also available on Windows but may have a slightly limited functionality.
166
-
167
- ## License
168
-
169
- See [License.txt](https://raw.githubusercontent.com/anionDevevlopment/ScriptCollection/main/License.txt) for license-information.
1
+ Metadata-Version: 2.4
2
+ Name: scriptcollection
3
+ Version: 4.4.40
4
+ Summary: The ScriptCollection is the place for reusable scripts.
5
+ Author-email: Marius Göcke <marius.goecke@gmail.com>
6
+ License-Expression: GPL-3.0-only
7
+ Project-URL: Homepage, https://github.com/anionDev/ScriptCollection
8
+ Project-URL: Documentation, https://aniondev.github.io/ScriptCollectionReference/index.html
9
+ Project-URL: Changelog, https://github.com/anionDev/ScriptCollection/tree/main/Other/Resources/Changelog
10
+ Keywords: package,release,build,management
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Operating System :: Microsoft :: Windows :: Windows 10
16
+ Classifier: Topic :: System :: Logging
17
+ Classifier: Topic :: System :: Monitoring
18
+ Classifier: Topic :: System :: Archiving :: Packaging
19
+ Classifier: Topic :: System :: Systems Administration
20
+ Classifier: Topic :: Terminals
21
+ Classifier: Topic :: Utilities
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/markdown
24
+ Requires-Dist: build>=1.6.1
25
+ Requires-Dist: CountryInformation>=1.0.12
26
+ Requires-Dist: coverage>=7.16.1
27
+ Requires-Dist: cyclonedx-bom>=7.1.0
28
+ Requires-Dist: defusedxml>=0.7.1
29
+ Requires-Dist: keyboard>=0.13.5
30
+ Requires-Dist: lcov-cobertura>=2.1.1
31
+ Requires-Dist: lxml>=6.0.1
32
+ Requires-Dist: ntplib>=0.4.0
33
+ Requires-Dist: Pillow>=11.3.0
34
+ Requires-Dist: psutil>=7.2.2
35
+ Requires-Dist: pycdlib>=1.20.0
36
+ Requires-Dist: Pygments>=2.21.0
37
+ Requires-Dist: pylint>=4.0.9
38
+ Requires-Dist: pyOpenSSL>=25.3.0
39
+ Requires-Dist: PyPDF>=6.19.0
40
+ Requires-Dist: pytest>=8.4.2
41
+ Requires-Dist: PyYAML>=6.0.3
42
+ Requires-Dist: qrcode>=8.2.0
43
+ Requires-Dist: send2trash>=1.8.3
44
+ Requires-Dist: twine>=6.2.0
45
+ Requires-Dist: xmlschema>=4.3.2
46
+
47
+ # ScriptCollection
48
+
49
+ ## General
50
+
51
+ [![Supported Python versions](https://img.shields.io/pypi/pyversions/ScriptCollection.svg)](https://pypi.org/project/ScriptCollection/)
52
+ ![PyPI](https://img.shields.io/pypi/v/ScriptCollection)
53
+ ![Dependencies](https://img.shields.io/librariesio/github/anionDevevlopment/ScriptCollection)
54
+
55
+ [![CodeFactor](https://www.codefactor.io/repository/github/anionDevevlopment/scriptcollection/badge/main)](https://www.codefactor.io/repository/github/anionDevevlopment/scriptcollection/overview/main)
56
+ [![Downloads](https://pepy.tech/badge/scriptcollection)](https://pepy.tech/project/scriptcollection)
57
+ ![Coverage](https://raw.githubusercontent.com/anionDevevlopment/ScriptCollection/main/ScriptCollection/Other/Resources/TestCoverageBadges/badge_shieldsio_linecoverage_blue.svg)
58
+
59
+ The ScriptCollection is the place for reusable scripts.
60
+
61
+ ## Reference
62
+
63
+ The reference can be found [here](https://aniondev.github.io/ScriptCollectionReference/index.html).
64
+
65
+ ## Hints
66
+
67
+ Most of the scripts are written in [python](https://www.python.org) 3.
68
+
69
+ Caution: Before executing **any** script of this repository read the sourcecode of the script (and the sourcecode of all functions called by this function directly or transitively) carefully and verify that the script does exactly what you want to do and nothing else.
70
+
71
+ Some functions are not entirely available on windows or require common third-party tools. See the [Runtime dependencies](#runtime-dependencies)-section for more information.
72
+
73
+ When using ScriptCollection it is not required but recommended for better usability to have [epew](https://github.com/anionDev/Epew) installed.
74
+
75
+ ## Get ScriptCollection
76
+
77
+ ### Installation via pip
78
+
79
+ `pip3 install ScriptCollection`
80
+
81
+ See the [PyPI-site for ScriptCollection](https://pypi.org/project/ScriptCollection)
82
+
83
+ ### Download sourcecode using git
84
+
85
+ You can simply git-clone the ScriptCollection and then use the scripts under the provided license.
86
+
87
+ `git clone https://github.com/anionDevevlopment/ScriptCollection.git`
88
+
89
+ It may be more easy to pip-install the ScriptCollection but technically pip is not required. Actually you need to git-clone (or download as zip-file from [GitHub](https://github.com/anionDevevlopment/ScriptCollection) the ScriptCollection to use the scripts in this repository which are not written in python.
90
+
91
+ ## Troubleshooting
92
+
93
+ It is recommended to always use only the newest version of the ScriptCollection. If you have an older version: Update it (e. g. using `pip3 install ScriptCollection --upgrade` if you installed the ScriptCollection via pip). If you still have problems, then feel free to create an [issue](https://github.com/anionDevevlopment/ScriptCollection/issues).
94
+
95
+ If you have installed the ScriptCollection as pip-package you can simply check the version using Python with the following commands:
96
+
97
+ ```lang-bash
98
+ from ScriptCollection.ScriptCollectionCore import ScriptCollectionCore
99
+ ScriptCollectionCore.get_scriptcollection_version()
100
+ ```
101
+
102
+ Or you can simply run `pip3 freeze` folder to get information about (all) currently installed pip-packages.
103
+
104
+ ## Development
105
+
106
+ ### Branching-system
107
+
108
+ This repository applies the [GitFlowSimplified](https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/blob/main/Conventions/BranchingSystem/GitFlowSimplified/GitFlowSimplified.md)-branching-system.
109
+
110
+ ### Repository-structure
111
+
112
+ This repository applies the [CommonProjectStructure](https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/blob/main/Conventions/RepositoryStructure/CommonProjectStructure/CommonProjectStructure.md)-branching-system.
113
+
114
+ ### Install dependencies
115
+
116
+ ScriptCollection requires [Python](https://www.python.org) 3.10.
117
+
118
+ To develop ScriptCollection it is obviously required that the following commandline-commands are available on your system:
119
+
120
+ - `python` (on some systems `python3`)
121
+ - `pip3`
122
+
123
+ The pip-packages which are required for developing on this project are defined in `requirements.txt`.
124
+
125
+ ### IDE
126
+
127
+ The recommended IDE for developing ScriptCollection is Visual Studio Code.
128
+ The recommended addons for developing ScriptCollection with Visual Studio Code are:
129
+
130
+ - [Pylance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance)
131
+ - [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
132
+ - [Spell Right](https://marketplace.visualstudio.com/items?itemName=ban.spellright)
133
+ - [docs-markdown](https://marketplace.visualstudio.com/items?itemName=docsmsft.docs-markdown)
134
+
135
+ ### Build
136
+
137
+ To create and install an ScriptCollection locally simply do the following commands:
138
+
139
+ ```bash
140
+ python ./ScriptCollection/Other/Build/Build.py
141
+ pip3 install --force-reinstall ./ScriptCollection/Other/Artifacts/Wheel/ScriptCollection-x.x.x-py3-none-any.whl
142
+ ```
143
+
144
+ (Note: `x.x.x` must be replaced by the appropriate version-number.)
145
+
146
+ ### Coding style
147
+
148
+ In this repository [pylint](https://pylint.org/) will be used to report linting-issues.
149
+ If you change code in this repository please ensure pylint does not find any issues before creating a pull-request.
150
+
151
+ If linting-issues exist in the current code-base can be checked by running `python ./ScriptCollection/Other/QualityCheck/Linting.py`.
152
+
153
+ ## Runtime dependencies
154
+
155
+ ScriptCollection requires [Python](https://www.python.org) 3.10.
156
+
157
+ The usual Python-dependencies will be installed automagically by `pip`.
158
+
159
+ For functions to to read or change the permissions or the owner of a file the ScriptCollection relies on the functionality of the following tools:
160
+
161
+ - chmod
162
+ - chown
163
+ - ls
164
+
165
+ This tools must be available on the system where the functions should be executed. Meanwhile this tools are also available on Windows but may have a slightly limited functionality.
166
+
167
+ ## License
168
+
169
+ See [License.txt](https://raw.githubusercontent.com/anionDevevlopment/ScriptCollection/main/License.txt) for license-information.
@@ -1,7 +1,6 @@
1
- ScriptCollection/AnionBuildPlatform.py,sha256=LF9b4f4iqgsjgXZjS0RHiEBw73tQANfu0O1dYGWNjy8,11948
2
1
  ScriptCollection/ArbTranslationsOrganizer.py,sha256=FLJcNP6qFTQOkxL7es0Sq3O7kb_TgoRreqH-uogR4xA,12201
3
2
  ScriptCollection/CertificateUpdater.py,sha256=bD0VhKQsD2cNRTG1kzMkhgpd0BZw7igbG30goKw5p1A,9749
4
- ScriptCollection/Executables.py,sha256=Ovq6LVhtP6mqCPmBxch9WgTmePBk7F8MLyZUBkQloAE,74171
3
+ ScriptCollection/Executables.py,sha256=Ab1EAKxW4ibdAeZY08VRhoR6nJ2CmG4P5KMgj9x-B2A,74237
5
4
  ScriptCollection/GeneralUtilities.py,sha256=znIrHp9wV3yPwLHb5300LjxQ2MTj0NJC6Z0my3LY0Mk,72759
6
5
  ScriptCollection/HTTPMaintenanceOverheadHelper.py,sha256=TToNtyO1XzsMbBsTBf3o0xgOK0v4Jf03qw2Z0xb2nCk,2007
7
6
  ScriptCollection/ProcessesRunner.py,sha256=Va9O-ohWoRfe4pO2gPBzc940gkM5BpP4Txcu1CmLOvg,1494
@@ -12,7 +11,7 @@ ScriptCollection/ProgramRunnerSudo.py,sha256=ot9Ib-plQ8wejR9M2XXfnx6GR-va9k8SH1g
12
11
  ScriptCollection/RepositoryDiagramGenerator.py,sha256=K_u2NW_p4ozdWD50irJEkkcDVa70TcUJpZN63TeXSLw,7092
13
12
  ScriptCollection/RepositoryHistoryAnalyzer.py,sha256=rD8eC5lMUe5MHmCBHfYft_G-N9IbvtsFGkU7EMwPjrY,5779
14
13
  ScriptCollection/SCLog.py,sha256=Fjf8Pdi63cXHGMxL_aI6A0dwGm7QIfrv3czjvpSUlaM,4705
15
- ScriptCollection/ScriptCollectionCore.py,sha256=4sZqrMAYWjux5TWaUUniqF6bNmNceDbVjIeXOjpGkVE,305107
14
+ ScriptCollection/ScriptCollectionCore.py,sha256=NunnhI_OV2EOEeaCfpIr1cdXAuKusqiN0UwhXcVR2l4,305107
16
15
  ScriptCollection/TestKind.py,sha256=jqLJwNvQeyea7SZf-UFzMC9pM0znv4do7FIC1xq8u9M,1672
17
16
  ScriptCollection/UnassignedVariablesCheck.py,sha256=8xNcp1D5HeOLO1a1NEerq2TsnpFhw7yzYPkaay-oisY,3804
18
17
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -39,12 +38,12 @@ ScriptCollection/TFCPS/SCTaskRunnerServer.py,sha256=tub8_1QBu0nWAaGnBWp2nErOW-SO
39
38
  ScriptCollection/TFCPS/TFCPS_BuildCodeUnitsHook.py,sha256=67_DQwoH5bhxxSmwtuAeoW1NOCMiLMzOy48OqlJX-KY,1744
40
39
  ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=umUfQDErp7xFLkDnSbQMxzUWnKtcGlrZnIvFcTpfGJs,40499
41
40
  ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=Mj9t1SyRpkYZE74cLsGWYv4xB89gXL2ld-RX3xvvGdw,9835
42
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=DOD4U0TrlUc5uqhr7VTajmuLE6C7cj_gjty8i6px_yg,50626
41
+ ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=AZj6xmD5bO9KMxxarOM0X6IYjHYoBm-8xuDy1lzrT9I,50658
43
42
  ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=kpEmSnfzfgB4OjcCuS_X6jgW_ftcphxEnjjoLoAHTLY,6582
44
43
  ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=mRBcf7XuNWOSXbZYc3NuJow18AMZ30D6Z-BtyNYfNcM,2072
45
44
  ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=Krt5oyGNcRAN3szsgU7LoTh8yVTOdHW-Kq7R9MDDV-Q,7673
46
45
  ScriptCollection/TFCPS/TFCPS_MergeToStable.py,sha256=oYEhz5ZWMnbu97_CcYEqdDxakUFVppyOVQiJzADq59c,22434
47
- ScriptCollection/TFCPS/TFCPS_OCIImageSecretScan.py,sha256=rhw0glr4gZ5enG9faOD51xE4MMK1cIdNjUdaswiMsrY,14622
46
+ ScriptCollection/TFCPS/TFCPS_OCIImageSecretScan.py,sha256=Jb7AaMcJDW-gYEYBUVZAG3QLTTNWmXlvVEW-lZsykws,14821
48
47
  ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py,sha256=XLVsFTA1jvfDbZ7wYJgIdEByZhF_bYVbA5jkisuvK4k,2322
49
48
  ScriptCollection/TFCPS/TFCPS_RemoteBuild.py,sha256=2Tx5HLk1ZftBWDCTiGZdP2QiiGNyWsEuTCSt33dNQjc,23891
50
49
  ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=d_gCL3ExRoNgerQwEzc2qoY6wG3ZEUqw-ZT6Xb6C_xs,157127
@@ -73,8 +72,8 @@ ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=yyjWPMHQjPLkML
73
72
  ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
73
  ScriptCollection/TFCPS/TypeScript/TFCPS_CodeUnitSpecific_TypeScript.py,sha256=ILVhJHvwG5TvPBBqSvyACYb7W9QnWrJpxKgHu8IQu4g,9249
75
74
  ScriptCollection/TFCPS/TypeScript/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
- scriptcollection-4.4.38.dist-info/METADATA,sha256=4XDPfDtKEPzPKGljWrd0zqJGHTbZDHK0K7K1nXagJ-4,7646
77
- scriptcollection-4.4.38.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
78
- scriptcollection-4.4.38.dist-info/entry_points.txt,sha256=GNma7tN0J59EvK71su-G1w22RnZ05bXcPrELyLx3AL0,6151
79
- scriptcollection-4.4.38.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
80
- scriptcollection-4.4.38.dist-info/RECORD,,
75
+ scriptcollection-4.4.40.dist-info/METADATA,sha256=ngPgUcHIP4FtrbRR45zfB2F8_5H6RcpJdS949HwwJ7Y,7815
76
+ scriptcollection-4.4.40.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
77
+ scriptcollection-4.4.40.dist-info/entry_points.txt,sha256=GNma7tN0J59EvK71su-G1w22RnZ05bXcPrELyLx3AL0,6151
78
+ scriptcollection-4.4.40.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
79
+ scriptcollection-4.4.40.dist-info/RECORD,,
@@ -1,205 +0,0 @@
1
- import argparse
2
- import os
3
- from .TFCPS.TFCPS_CodeUnit_BuildCodeUnits import TFCPS_CodeUnit_BuildCodeUnits
4
- from .SCLog import LogLevel
5
- from .GeneralUtilities import GeneralUtilities
6
- from .ScriptCollectionCore import ScriptCollectionCore
7
-
8
- @GeneralUtilities.deprecated()
9
- class AnionBuildPlatformConfiguration:
10
- build_repositories_folder:str = None
11
- additional_arguments_file:str = None
12
- verbosity:LogLevel = None
13
- source_branch:str = None #other/next-release
14
- common_remote_name:str = None
15
- update_dependencies:bool = None
16
- lazy_mode:bool = None
17
-
18
- def __init__(self,
19
- build_repositories_folder:str,
20
- additional_arguments_file:str,
21
- verbosity:LogLevel,
22
- source_branch:str,
23
- common_remote_name:str,
24
- update_dependencies:bool,
25
- lazy_mode:bool):
26
- self.build_repositories_folder=build_repositories_folder
27
- self.additional_arguments_file=additional_arguments_file
28
- self.verbosity=verbosity
29
- self.source_branch=source_branch
30
- self.common_remote_name=common_remote_name
31
- self.update_dependencies=update_dependencies
32
- self.lazy_mode=lazy_mode
33
-
34
- @GeneralUtilities.deprecated()
35
- class AnionBuildPlatform:
36
-
37
- __configuration: AnionBuildPlatformConfiguration = None
38
- __sc:ScriptCollectionCore = None
39
-
40
- def __init__(self, configuration: AnionBuildPlatformConfiguration):
41
- self.__configuration = configuration
42
- self.__sc = ScriptCollectionCore()
43
- self.__sc.log.loglevel=configuration.verbosity
44
-
45
- @GeneralUtilities.check_arguments
46
- def run(self) -> None:
47
- #TODO refactor this
48
- # ensure that if
49
- # - main is up to date and
50
- # - all dependencies are up to date and
51
- # - other/next-release==main and
52
- # - main is buildable and
53
- # - the latest main is already merged in stable
54
- # then this function does nothing
55
-
56
- # Checkout source branch
57
- build_repo_folder:str=self.__configuration.build_repositories_folder
58
- GeneralUtilities.assert_condition(build_repo_folder.endswith("Build"),f"buildrepositoriesfolder {build_repo_folder} must end with 'Build'")
59
- self.__sc.assert_is_git_repository(build_repo_folder)
60
- product_name = os.path.basename(build_repo_folder)[:-len("Build")]
61
- repository:str=os.path.join(build_repo_folder, "Submodules", product_name)
62
- self.__sc.assert_is_git_repository(repository)
63
- reference_repo:str=os.path.join(build_repo_folder, "Submodules", product_name+"Reference")
64
- self.__sc.assert_is_git_repository(reference_repo)
65
- self.__sc.git_commit(reference_repo,"Updated changes")
66
- self.__sc.git_checkout(repository,self.__configuration.source_branch)
67
- self.__sc.git_commit(build_repo_folder,"Updated changes")
68
- self.__sc.git_fetch(build_repo_folder)
69
- for remote in self.__sc.git_get_all_remote_names(build_repo_folder):
70
- self.__sc.git_merge(build_repo_folder,remote+"/main","main")
71
-
72
- # Pull changes from remote
73
- self.__sc.git_fetch(repository)
74
- self.__sc.git_merge(repository,self.__configuration.common_remote_name+"/"+self.__configuration.source_branch,self.__configuration.source_branch,fastforward=True)#TODO check if is anchestor and throw exception if nor
75
- self.__sc.git_commit(build_repo_folder,"Updated changes")
76
-
77
- # Added changelog entry and build to verify buildability and to update versions etc.
78
- if self.__configuration.lazy_mode:
79
- self.__sc.run_program("sccreatechangelogentry", "-m Update.", repository)
80
- arguments:str="bb --"
81
- if self.__configuration.verbosity == LogLevel.Debug:
82
- arguments+=f" --verbosity {self.__configuration.verbosity.value}"
83
- self.__sc.run_program("task", arguments, repository)
84
- self.__sc.git_commit(repository, "update")
85
-
86
- # Update dependencies
87
- if self.__configuration.update_dependencies:
88
- self.__update_dependencies(product_name)
89
-
90
- # Do release
91
- scripts_folder:str=os.path.join(build_repo_folder,"Scripts","CreateRelease")
92
-
93
- merge_to_main_arguments=""
94
- #if self.__configuration.project_to_build is not None:
95
- # merge_to_main_arguments+=f" --productname {self.__configuration.project_to_build}"
96
- if self.__configuration.source_branch is not None:
97
- merge_to_main_arguments+=f" --mergesourcebranch {self.__configuration.source_branch}"
98
- #if self.__configuration.additional_arguments_file is not None:
99
- # merge_to_main_arguments+=f" --additionalargumentsfile {self.__configuration.additional_arguments_file}"
100
- #if self.__configuration.main_branch is not None:
101
- # merge_to_main_arguments+=f" --mainbranch {self.__configuration.main_branch}"
102
- #if self.__configuration.common_remote_name is not None:
103
- # merge_to_main_arguments+=f" --commonremotename {self.__configuration.common_remote_name}"
104
- if self.__configuration.verbosity is not None:
105
- merge_to_main_arguments+=f" --verbosity {self.__configuration.verbosity.value}"
106
- self.__sc.run_program(GeneralUtilities.get_python_executable(),f"MergeToMain.py{merge_to_main_arguments}",scripts_folder,print_live_output=True)
107
-
108
- merge_to_stable_arguments=""
109
- #if self.__configuration.project_to_build is not None:
110
- # merge_to_stable_arguments+=f" --productname {self.__configuration.project_to_build}"
111
- #if self.__configuration.additional_arguments_file is not None:
112
- # merge_to_stable_arguments+=f" --additionalargumentsfile {self.__configuration.additional_arguments_file}"
113
- #if self.__configuration.source_branch is not None:
114
- # merge_to_stable_arguments+=f" --sourcebranch {self.__configuration.source_branch}"
115
- #if self.__configuration.main_branch is not None:
116
- # merge_to_stable_arguments+=f" --targetbranch {self.__configuration.main_branch}"
117
- #if self.__configuration.reference_repo is not None:
118
- # merge_to_stable_arguments+=f" --referencerepo {self.__configuration.referencerepo}"
119
- #if self.__configuration.common_remote_name is not None:
120
- # merge_to_stable_arguments+=f" --commonremotename {self.__configuration.common_remote_name}"
121
- #if self.__configuration.build_repo_main_branch_name is not None:
122
- # merge_to_stable_arguments+=f" --buildrepomainbranchname {self.__configuration.build_repo_main_branch_name}"
123
- #if self.__configuration.reference_repo_main_branch_name is not None:
124
- # merge_to_stable_arguments+=f" --referencerepomainbranchname {self.__configuration.reference_repo_main_branch_name}"
125
- #if self.__configuration.reference_remote_name is not None:
126
- # merge_to_stable_arguments+=f" --referenceremotename {self.__configuration.reference_remote_name}"
127
- #if self.__configuration.build_repo_remote_name is not None:
128
- # merge_to_stable_arguments+=f" --buildreporemotename {self.__configuration.build_repo_remote_name}"
129
- #if self.__configuration.artifacts_target_folder is not None:
130
- # merge_to_stable_arguments+=f" --artifactstargetfolder {self.__configuration.artifacts_target_folder}"
131
- #if self.__configuration.common_remote_url is not None:
132
- # merge_to_stable_arguments+=f" --commonremoteurl {self.__configuration.common_remote_url}"
133
- if self.__configuration.verbosity == LogLevel.Debug:
134
- merge_to_stable_arguments+=f" --verbosity {self.__configuration.verbosity.value}"
135
- self.__sc.run_program(GeneralUtilities.get_python_executable(),f"MergeToStable.py{merge_to_stable_arguments}",scripts_folder,print_live_output=True)
136
-
137
- #prepare for next-release
138
- self.__sc.git_checkout(repository,self.__configuration.source_branch)
139
-
140
- @GeneralUtilities.check_arguments
141
- def __update_dependencies(self,product_name:str) -> None:
142
- self.__sc.log.log("Update dependencies...")
143
- repository:str=os.path.join(self.__configuration.build_repositories_folder,"Submodules",product_name)
144
- t:TFCPS_CodeUnit_BuildCodeUnits=TFCPS_CodeUnit_BuildCodeUnits(repository,self.__sc.log.loglevel,"QualityCheck",None,True,False,False)
145
- t.update_dependencies()
146
-
147
-
148
-
149
- @GeneralUtilities.deprecated()
150
- class TFCPS_AnionBuildPlatform_CLI:
151
-
152
- @staticmethod
153
- @GeneralUtilities.check_arguments
154
- def get_with_overwritable_defaults(default_project_to_build:str=None,default_loglevel:LogLevel=None,default_additionalargumentsfile:str=None,default_build_repositories_folder:str=None,default_source_branch:str=None,default_main_branch:str=None,default_remote_name:str=None)->AnionBuildPlatform:
155
- parser = argparse.ArgumentParser()
156
- verbosity_values = ", ".join(f"{lvl.value}={lvl.name}" for lvl in LogLevel)
157
- parser.add_argument('-b', '--buildrepositoriesfolder', required=False,default=None)
158
- parser.add_argument('-p', '--projecttobuild', required=False, default=None)
159
- parser.add_argument('-a', '--additionalargumentsfile', required=False, default=None)
160
- parser.add_argument('-v', '--verbosity', required=False, help=f"Sets the loglevel. Possible values: {verbosity_values}")
161
- parser.add_argument('-s', '--sourcebranch', required=False)#other/next-release
162
- parser.add_argument('-m', '--mainbranch', required=False)#main
163
- parser.add_argument('-r', '--defaultremotename', required=False)#origin
164
- parser.add_argument('-u', '--updatedependencies', required=False, action='store_true', default=False)
165
- parser.add_argument('-l', '--lazymode', required=False, action='store_true', default=False)
166
- args=parser.parse_args()
167
-
168
- if args.projecttobuild is not None:
169
- default_project_to_build=args.projecttobuild
170
-
171
- if args.buildrepositoriesfolder is not None:
172
- default_build_repositories_folder=args.buildrepositoriesfolder
173
-
174
- scripts_folder=os.getcwd()
175
-
176
- if default_build_repositories_folder is None:
177
- parent_parent_folder=GeneralUtilities.resolve_relative_path("../..",scripts_folder)
178
- if os.path.basename(parent_parent_folder).endswith("Build"):
179
- default_build_repositories_folder=os.path.dirname(parent_parent_folder)
180
- GeneralUtilities.assert_not_null(default_build_repositories_folder,"buildrepositoriesfolder is not set")
181
-
182
- if default_project_to_build is None:
183
- parent_parent_folder=GeneralUtilities.resolve_relative_path("../..",scripts_folder)
184
- if os.path.basename(parent_parent_folder).endswith("Build"):
185
- default_project_to_build=os.path.basename(parent_parent_folder)[:-len("Build")]
186
- GeneralUtilities.assert_not_null(default_project_to_build,"projecttobuild is not set")
187
-
188
- if args.verbosity is not None:
189
- default_loglevel=LogLevel(int( args.verbosity))
190
- GeneralUtilities.assert_not_null(default_loglevel,"verbosity is not set")
191
-
192
- if args.additionalargumentsfile is not None:
193
- default_additionalargumentsfile=args.additionalargumentsfile
194
-
195
- if args.sourcebranch is not None:
196
- default_source_branch=args.sourcebranch
197
- GeneralUtilities.assert_not_null(default_source_branch,"sourcebranch is not set")
198
-
199
- if args.defaultremotename is not None:
200
- default_remote_name=args.defaultremotename
201
- GeneralUtilities.assert_not_null(default_remote_name,"defaultremotename is not set")
202
-
203
- config:AnionBuildPlatformConfiguration=AnionBuildPlatformConfiguration(default_build_repositories_folder,default_additionalargumentsfile,default_loglevel,default_source_branch,default_remote_name,args.updatedependencies,args.lazymode)
204
- tFCPS_MergeToMain:AnionBuildPlatform=AnionBuildPlatform(config)
205
- return tFCPS_MergeToMain