ScriptCollection 3.5.21__py3-none-any.whl → 3.5.23__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.
@@ -30,7 +30,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
30
30
  from .ProgramRunnerPopen import ProgramRunnerPopen
31
31
  from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
32
32
 
33
- version = "3.5.21"
33
+ version = "3.5.23"
34
34
  __version__ = version
35
35
 
36
36
 
@@ -204,11 +204,11 @@ class ScriptCollectionCore:
204
204
 
205
205
  @GeneralUtilities.check_arguments
206
206
  def git_repository_has_unstaged_changes_of_tracked_files(self, repositoryFolder: str):
207
- return self.__git_changes_helper(repositoryFolder, ["diff"])
207
+ return self.__git_changes_helper(repositoryFolder, ["--no-pager", "diff"])
208
208
 
209
209
  @GeneralUtilities.check_arguments
210
210
  def git_repository_has_staged_changes(self, repositoryFolder: str):
211
- return self.__git_changes_helper(repositoryFolder, ["diff", "--cached"])
211
+ return self.__git_changes_helper(repositoryFolder, ["--no-pager", "diff", "--cached"])
212
212
 
213
213
  @GeneralUtilities.check_arguments
214
214
  def git_repository_has_uncommitted_changes(self, repositoryFolder: str) -> bool:
@@ -1071,15 +1071,15 @@ class ScriptCollectionCore:
1071
1071
 
1072
1072
  @GeneralUtilities.check_arguments
1073
1073
  def get_docker_debian_version(self, image_tag: str) -> str:
1074
- result = ScriptCollectionCore().run_program_argsasarray(
1075
- "docker", ['run', f'debian:{image_tag}', 'bash', '-c', 'apt-get -y update && apt-get -y install lsb-release && lsb_release -cs'])
1074
+ result = ScriptCollectionCore().run_program_argsasarray("docker", ['run', f'debian:{image_tag}', 'bash', '-c', 'apt-get -y update && apt-get -y install lsb-release && lsb_release -cs'])
1076
1075
  result_line = GeneralUtilities.string_to_lines(result[1])[-2]
1077
1076
  return result_line
1078
1077
 
1079
1078
  @GeneralUtilities.check_arguments
1080
1079
  def get_latest_tor_version_of_debian_repository(self, debian_version: str) -> str:
1081
1080
  package_url: str = f"https://deb.torproject.org/torproject.org/dists/{debian_version}/main/binary-amd64/Packages"
1082
- r = requests.get(package_url, timeout=5)
1081
+ headers = {'Cache-Control': 'no-cache'}
1082
+ r = requests.get(package_url, timeout=5, headers=headers)
1083
1083
  if r.status_code != 200:
1084
1084
  raise ValueError(f"Checking for latest tor package resulted in HTTP-response-code {r.status_code}.")
1085
1085
  lines = GeneralUtilities.string_to_lines(GeneralUtilities.bytes_to_string(r.content))
@@ -1095,7 +1095,7 @@ class ScriptCollectionCore:
1095
1095
  GeneralUtilities.ensure_directory_exists(os.path.join(repository_folder, "Other/TestCoverage"))
1096
1096
  coveragefile = os.path.join(repository_folder, "Other/TestCoverage/TestCoverage.xml")
1097
1097
  GeneralUtilities.ensure_file_does_not_exist(coveragefile)
1098
- os.rename(os.path.join(repository_folder, "coverage.xml"), coveragefile)
1098
+ os.rename(os.path.join(repository_folder, "coverage.xml"), coveragefile)
1099
1099
 
1100
1100
  @GeneralUtilities.check_arguments
1101
1101
  def get_file_permission(self, file: str) -> str:
@@ -1105,11 +1105,11 @@ class ScriptCollectionCore:
1105
1105
 
1106
1106
  @GeneralUtilities.check_arguments
1107
1107
  def __get_file_permission_helper(self, permissions: str) -> str:
1108
- return str(self.__to_octet(permissions[0:3]))+str(self.__to_octet(permissions[3:6]))+str(self.__to_octet(permissions[6:9]))
1108
+ return str(self.__to_octet(permissions[0:3])) + str(self.__to_octet(permissions[3:6]))+str(self.__to_octet(permissions[6:9]))
1109
1109
 
1110
1110
  @GeneralUtilities.check_arguments
1111
1111
  def __to_octet(self, string: str) -> int:
1112
- return int(self.__to_octet_helper(string[0])+self.__to_octet_helper(string[1])+self.__to_octet_helper(string[2]), 2)
1112
+ return int(self.__to_octet_helper(string[0]) + self.__to_octet_helper(string[1])+self.__to_octet_helper(string[2]), 2)
1113
1113
 
1114
1114
  @GeneralUtilities.check_arguments
1115
1115
  def __to_octet_helper(self, string: str) -> str:
@@ -1568,7 +1568,8 @@ DNS = {domain}
1568
1568
  # (something like "cyclonedx-bom>=2.11.0" for example)
1569
1569
  package = line.split(">")[0]
1570
1570
  operator = ">=" if ">=" in line else ">"
1571
- response = requests.get(f'https://pypi.org/pypi/{package}/json', timeout=5)
1571
+ headers = {'Cache-Control': 'no-cache'}
1572
+ response = requests.get(f'https://pypi.org/pypi/{package}/json', timeout=5, headers=headers)
1572
1573
  latest_version = response.json()['info']['version']
1573
1574
  # TODO update only minor- and patch-version
1574
1575
  # TODO print info if there is a new major-version
@@ -1723,7 +1724,8 @@ chmod {permission} {link_file}
1723
1724
  proxies = None
1724
1725
  if GeneralUtilities.string_has_content(proxy):
1725
1726
  proxies = {"http": proxy}
1726
- response = requests.get('https://ipinfo.io', proxies=proxies, timeout=5)
1727
+ headers = {'Cache-Control': 'no-cache'}
1728
+ response = requests.get('https://ipinfo.io', proxies=proxies, timeout=5, headers=headers)
1727
1729
  network_information_as_json_string = GeneralUtilities.bytes_to_string(
1728
1730
  response.content)
1729
1731
  return network_information_as_json_string
@@ -458,6 +458,7 @@ class TasksForCommonProjectStructure:
458
458
  GeneralUtilities.ensure_directory_does_not_exist(obj_folder)
459
459
  GeneralUtilities.ensure_directory_exists(obj_folder)
460
460
  self.__sc.run_program("docfx", "docfx.json", folder_of_current_file, verbosity=verbosity)
461
+ # TODO generate also a darkmode-variant (darkFX for example, see https://dotnet.github.io/docfx/extensions/templates.html )
461
462
  GeneralUtilities.ensure_directory_does_not_exist(obj_folder)
462
463
 
463
464
  def standardized_task_verify_standard_format_csproj_files(self, codeunit_folder: str) -> bool:
@@ -1276,6 +1277,10 @@ class TasksForCommonProjectStructure:
1276
1277
 
1277
1278
  @GeneralUtilities.check_arguments
1278
1279
  def standardized_tasks_build_for_docker_project(self, build_script_file: str, target_environment_type: str, verbosity: int, commandline_arguments: list[str]) -> None:
1280
+ self.standardized_tasks_build_for_docker_project_with_additional_build_arguments(build_script_file, target_environment_type, verbosity, commandline_arguments, dict[str, str]())
1281
+
1282
+ @GeneralUtilities.check_arguments
1283
+ def standardized_tasks_build_for_docker_project_with_additional_build_arguments(self, build_script_file: str, target_environment_type: str, verbosity: int, commandline_arguments: list[str], custom_arguments: dict[str, str]) -> None:
1279
1284
  use_cache: bool = False
1280
1285
  verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
1281
1286
  sc: ScriptCollectionCore = ScriptCollectionCore()
@@ -1283,7 +1288,11 @@ class TasksForCommonProjectStructure:
1283
1288
  codeunit_folder = GeneralUtilities.resolve_relative_path("../..", str(os.path.dirname(build_script_file)))
1284
1289
  codeunitname_lower = codeunitname.lower()
1285
1290
  codeunitversion = self.get_version_of_codeunit(os.path.join(codeunit_folder, f"{codeunitname}.codeunit.xml"))
1286
- args = ["image", "build", "--pull", "--force-rm", "--progress=plain", "--build-arg", f"TargetEnvironmentType={target_environment_type}", "--build-arg", f"Version={codeunitversion}", "--tag", f"{codeunitname_lower}:latest", "--tag", f"{codeunitname_lower}:{codeunitversion}", "--file", f"{codeunitname}/Dockerfile"]
1291
+ args = ["image", "build", "--pull", "--force-rm", "--progress=plain", "--build-arg", f"TargetEnvironmentType={target_environment_type}", "--build-arg", f"Version={codeunitversion}"]
1292
+ for custom_argument_key, custom_argument_value in custom_arguments.items():
1293
+ args.append("--build-arg")
1294
+ args.append(f"{custom_argument_key}={custom_argument_value}")
1295
+ args = args+["--tag", f"{codeunitname_lower}:latest", "--tag", f"{codeunitname_lower}:{codeunitversion}", "--file", f"{codeunitname}/Dockerfile"]
1287
1296
  if not use_cache:
1288
1297
  args.append("--no-cache")
1289
1298
  args.append(".")
@@ -1509,7 +1518,8 @@ class TasksForCommonProjectStructure:
1509
1518
  target_folder = GeneralUtilities.resolve_relative_path("Other/Artifacts/DiffReport", codeunit_folder)
1510
1519
  GeneralUtilities.ensure_directory_does_not_exist(target_folder)
1511
1520
  GeneralUtilities.ensure_directory_exists(target_folder)
1512
- target_file = os.path.join(target_folder, "DiffReport.html").replace("\\", "/")
1521
+ target_file_light = os.path.join(target_folder, "DiffReport.html").replace("\\", "/")
1522
+ target_file_dark = os.path.join(target_folder, "DiffReportDark.html").replace("\\", "/")
1513
1523
  src = "4b825dc642cb6eb9a060e54bf8d69288fbee4904" # hash/id of empty git-tree
1514
1524
  src_prefix = "Begin"
1515
1525
  if self.__sc.get_current_git_branch_has_tag(repository_folder):
@@ -1518,7 +1528,15 @@ class TasksForCommonProjectStructure:
1518
1528
  src_prefix = latest_tag
1519
1529
  dst = "HEAD"
1520
1530
  dst_prefix = f"v{current_version}"
1521
- self.__sc.run_program_argsasarray("sh", ['-c', f'git diff --src-prefix={src_prefix}/ --dst-prefix={dst_prefix}/ {src} {dst} -- {codeunit_name} | pygmentize -l diff -f html -O full -o {target_file} -P style=github-dark'], repository_folder)
1531
+
1532
+ temp_file = os.path.join(tempfile.gettempdir(), str(uuid.uuid4()))
1533
+ try:
1534
+ GeneralUtilities.ensure_file_does_not_exist(temp_file)
1535
+ GeneralUtilities.write_text_to_file(temp_file, self.__sc.run_program("git", f'--no-pager diff --src-prefix={src_prefix}/ --dst-prefix={dst_prefix}/ {src} {dst} -- {codeunit_name}', repository_folder)[1])
1536
+ self.__sc.run_program("pygmentize", f'-l diff -f html -O full -o {target_file_light} -P style=default {temp_file}', repository_folder)
1537
+ self.__sc.run_program("pygmentize", f'-l diff -f html -O full -o {target_file_dark} -P style=github-dark {temp_file}', repository_folder)
1538
+ finally:
1539
+ GeneralUtilities.ensure_file_does_not_exist(temp_file)
1522
1540
 
1523
1541
  @GeneralUtilities.check_arguments
1524
1542
  def get_version_of_project(self, repository_folder: str) -> str:
@@ -2337,7 +2355,8 @@ class TasksForCommonProjectStructure:
2337
2355
  if internet_connection_is_available: # Load/Update
2338
2356
  GeneralUtilities.ensure_directory_does_not_exist(resource_folder)
2339
2357
  GeneralUtilities.ensure_directory_exists(resource_folder)
2340
- response = requests.get(f"https://api.github.com/repos/{githubuser}/{githubprojectname}/releases/latest", timeout=5)
2358
+ headers = {'Cache-Control': 'no-cache'}
2359
+ response = requests.get(f"https://api.github.com/repos/{githubuser}/{githubprojectname}/releases/latest", timeout=5, headers=headers)
2341
2360
  latest_version = response.json()["name"]
2342
2361
  filename_on_github = get_filename_on_github(latest_version)
2343
2362
  jar_link = f"https://github.com/{githubuser}/{githubprojectname}/releases/download/{latest_version}/{filename_on_github}"
@@ -2503,7 +2522,11 @@ class TasksForCommonProjectStructure:
2503
2522
 
2504
2523
  GeneralUtilities.write_message_to_stdout('Run "Build.py"...')
2505
2524
  self.__sc.run_program("python", f"Build.py{additional_arguments_b}{general_argument}", build_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True)
2506
- self.verify_artifact_exists(codeunit_folder, dict[str, bool]({"BuildResult_.+": True, "BOM": False, "CodeAnalysisResult": False, "SourceCode": True}))
2525
+
2526
+ artifacts = {"BuildResult_.+": True, "BOM": False, "SourceCode": True}
2527
+ if self.codeunit_has_testable_sourcecode(codeunit_file):
2528
+ artifacts["CodeAnalysisResult"] = False
2529
+ self.verify_artifact_exists(codeunit_folder, dict[str, bool](artifacts))
2507
2530
 
2508
2531
  codeunit_hast_testable_sourcecode = self.codeunit_has_testable_sourcecode(codeunit_file)
2509
2532
  if codeunit_hast_testable_sourcecode:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ScriptCollection
3
- Version: 3.5.21
3
+ Version: 3.5.23
4
4
  Summary: The ScriptCollection is the place for reusable scripts.
5
5
  Home-page: https://github.com/anionDev/ScriptCollection
6
6
  Author: Marius Göcke
@@ -22,15 +22,15 @@ Classifier: Topic :: Terminals
22
22
  Classifier: Topic :: Utilities
23
23
  Requires-Python: >=3.10
24
24
  Description-Content-Type: text/markdown
25
- Requires-Dist: build >=1.2.2
26
- Requires-Dist: coverage >=7.6.1
27
- Requires-Dist: cyclonedx-bom >=4.6.1
25
+ Requires-Dist: build >=1.2.2.post1
26
+ Requires-Dist: coverage >=7.6.3
27
+ Requires-Dist: cyclonedx-bom >=5.0.0
28
28
  Requires-Dist: defusedxml >=0.7.1
29
29
  Requires-Dist: keyboard >=0.13.5
30
30
  Requires-Dist: lcov-cobertura >=2.0.2
31
31
  Requires-Dist: lxml >=5.3.0
32
32
  Requires-Dist: ntplib >=0.4.0
33
- Requires-Dist: Pillow >=10.4.0
33
+ Requires-Dist: Pillow >=11.0.0
34
34
  Requires-Dist: pycdlib >=1.14.0
35
35
  Requires-Dist: Pygments >=2.18.0
36
36
  Requires-Dist: pylint >=3.3.1
@@ -5,12 +5,12 @@ ScriptCollection/ProgramRunnerBase.py,sha256=7QAjoqOz6XPmJH19F2k-Z1fFQB_uZnPFvn-
5
5
  ScriptCollection/ProgramRunnerEpew.py,sha256=C2Rs3YWOWWWJct7XmKphp5CF1tf0j4Fp-ljV2drLTfs,6349
6
6
  ScriptCollection/ProgramRunnerPopen.py,sha256=G3LgQUVCfaq7XjBsGzalElH31Hbr0etttGR2_H87YzA,3512
7
7
  ScriptCollection/RPStream.py,sha256=NRRHL3YSP3D9MuAV2jB_--0KUKCsvJGxeKnxgrRZ9kY,1545
8
- ScriptCollection/ScriptCollectionCore.py,sha256=kqV46fmxYIpD7YgI-qNaRKHICwAIj3rFLTlwoUa6Xlw,100364
9
- ScriptCollection/TasksForCommonProjectStructure.py,sha256=U9OldjgT1BIyvrMkc-TtvswHdRjtkGU2JVZSN7odbJg,190621
8
+ ScriptCollection/ScriptCollectionCore.py,sha256=vuneqSCSk2_JGarQYnkQaxRoiCVWC4MImq48CQlD3ac,100571
9
+ ScriptCollection/TasksForCommonProjectStructure.py,sha256=KHg2a4VmK43t4rvu5co31eCs-erlx7CAyB-__pXnr_Q,192228
10
10
  ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
11
11
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- ScriptCollection-3.5.21.dist-info/METADATA,sha256=jpt0hQnIPc51QjYhbbABwhCys1ZS7g6Q6OlyDzjNoUA,7678
13
- ScriptCollection-3.5.21.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
14
- ScriptCollection-3.5.21.dist-info/entry_points.txt,sha256=yASwR6hWZ_b5d4W49YeX1htD8ngfWbwgjpfQiJdtUAU,2322
15
- ScriptCollection-3.5.21.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
- ScriptCollection-3.5.21.dist-info/RECORD,,
12
+ ScriptCollection-3.5.23.dist-info/METADATA,sha256=hJ0_J1rkQlKy4E0_dXpH5oqbBlqinQ0zDmtaxdCmMz0,7684
13
+ ScriptCollection-3.5.23.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
14
+ ScriptCollection-3.5.23.dist-info/entry_points.txt,sha256=yASwR6hWZ_b5d4W49YeX1htD8ngfWbwgjpfQiJdtUAU,2322
15
+ ScriptCollection-3.5.23.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
+ ScriptCollection-3.5.23.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5