ScriptCollection 3.5.139__py3-none-any.whl → 3.5.140__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.
@@ -33,7 +33,7 @@ from .ProgramRunnerPopen import ProgramRunnerPopen
33
33
  from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
34
34
  from .SCLog import SCLog, LogLevel
35
35
 
36
- version = "3.5.139"
36
+ version = "3.5.140"
37
37
  __version__ = version
38
38
 
39
39
 
@@ -309,7 +309,7 @@ class ScriptCollectionCore:
309
309
 
310
310
  @GeneralUtilities.check_arguments
311
311
  def git_pull_with_retry(self, folder: str, remote: str, localbranchname: str, remotebranchname: str, force: bool = False, amount_of_attempts: int = 5) -> None:
312
- GeneralUtilities.retry_action(lambda: self.git_pull_with_retry(folder, remote, localbranchname, remotebranchname), amount_of_attempts)
312
+ GeneralUtilities.retry_action(lambda: self.git_pull(folder, remote, localbranchname, remotebranchname), amount_of_attempts)
313
313
 
314
314
  @GeneralUtilities.check_arguments
315
315
  def git_pull(self, folder: str, remote: str, localbranchname: str, remotebranchname: str, force: bool = False) -> None:
@@ -2380,10 +2380,18 @@ OCR-content:
2380
2380
  @GeneralUtilities.check_arguments
2381
2381
  def get_ocr_content_of_file(self, file: str, serviceaddress: str, languages: list[str]) -> str: # serviceaddress = None means local executable
2382
2382
  result: str = None
2383
+ extension = Path(file).suffix
2383
2384
  if serviceaddress is None:
2384
- result = "" # TODO call local executable
2385
+ program_result = self.run_program_argsasarray("simpleocr", ["--File", file, "--Languages", "+".join(languages)] + languages)
2386
+ result = program_result[1]
2385
2387
  else:
2386
- result = "" # TODO call remote service
2388
+ languages_for_url = '%2B'.join(languages)
2389
+ package_url: str = f"https://{serviceaddress}/GetOCRContent?languages={languages_for_url}&fileType={extension}"
2390
+ headers = {'Cache-Control': 'no-cache'}
2391
+ r = requests.put(package_url, timeout=5, headers=headers, data=GeneralUtilities.read_binary_from_file(file))
2392
+ if r.status_code != 200:
2393
+ raise ValueError(f"Checking for latest tor package resulted in HTTP-response-code {r.status_code}.")
2394
+ result = GeneralUtilities.bytes_to_string(r.content)
2387
2395
  return result
2388
2396
 
2389
2397
  @GeneralUtilities.check_arguments
@@ -2360,6 +2360,7 @@ class TasksForCommonProjectStructure:
2360
2360
  tasks.sort(key=lambda x: x["label"].split("/")[-1], reverse=False) # sort by the label of the task
2361
2361
  for task in tasks:
2362
2362
  if task["type"] == "shell":
2363
+
2363
2364
  description: str = task["label"]
2364
2365
  name: str = GeneralUtilities.to_pascal_case(description)
2365
2366
  command = task["command"]
@@ -2381,11 +2382,18 @@ class TasksForCommonProjectStructure:
2381
2382
  if len(args) > 1:
2382
2383
  command_with_args = f"{command_with_args} {' '.join(args)}"
2383
2384
 
2385
+ if "description" in task:
2386
+ additional_description = task["description"]
2387
+ description = f"{description} ({additional_description})"
2388
+
2384
2389
  if append_cli_args_at_end:
2385
2390
  command_with_args = f"{command_with_args} {{{{.CLI_ARGS}}}}"
2386
- cwd_literal = cwd.replace("\\", "\\\\")
2391
+
2392
+ cwd_literal = cwd.replace("\\", "\\\\").replace('"', '\\"') # escape backslashes and double quotes for YAML
2393
+ description_literal = description.replace("\\", "\\\\").replace('"', '\\"') # escape backslashes and double quotes for YAML
2394
+
2387
2395
  lines.append(f" {name}:")
2388
- lines.append(f' desc: "{description}"')
2396
+ lines.append(f' desc: "{description_literal}"')
2389
2397
  lines.append(' silent: true')
2390
2398
  lines.append(f' dir: "{cwd_literal}"')
2391
2399
  lines.append(" cmds:")
@@ -2397,6 +2405,7 @@ class TasksForCommonProjectStructure:
2397
2405
  for alias in aliases:
2398
2406
  lines.append(f' - {alias}')
2399
2407
  lines.append(GeneralUtilities.empty_string)
2408
+
2400
2409
  GeneralUtilities.write_lines_to_file(task_file, lines)
2401
2410
 
2402
2411
  @GeneralUtilities.check_arguments
@@ -2560,6 +2569,14 @@ class TasksForCommonProjectStructure:
2560
2569
  from_day = datetime(now.year, now.month, now.day, 0, 0, 0)
2561
2570
  self.mark_current_version_as_supported(repository_folder, project_version, from_day, until_day)
2562
2571
 
2572
+ package_json_file = os.path.join(repository_folder, "package.json")
2573
+ if os.path.isfile(package_json_file):
2574
+ with open(package_json_file, "r", encoding="utf-8") as f1:
2575
+ package_json_data = json.load(f1)
2576
+ package_json_data["version"] = project_version
2577
+ with open(package_json_file, "w", encoding="utf-8") as f2:
2578
+ json.dump(package_json_data, f2, indent=2)
2579
+
2563
2580
  project_resources_folder = os.path.join(repository_folder, "Other", "Scripts")
2564
2581
  PrepareBuildCodeunits_script_name = "PrepareBuildCodeunits.py"
2565
2582
  prepare_build_codeunits_scripts = os.path.join(project_resources_folder, PrepareBuildCodeunits_script_name)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ScriptCollection
3
- Version: 3.5.139
3
+ Version: 3.5.140
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
@@ -37,7 +37,7 @@ Requires-Dist: Pygments>=2.19.1
37
37
  Requires-Dist: pylint>=3.3.7
38
38
  Requires-Dist: pyOpenSSL>=25.1.0
39
39
  Requires-Dist: PyPDF>=5.6.0
40
- Requires-Dist: pytest>=8.4.0
40
+ Requires-Dist: pytest>=8.4.1
41
41
  Requires-Dist: PyYAML>=6.0.2
42
42
  Requires-Dist: qrcode>=8.2
43
43
  Requires-Dist: send2trash>=1.8.3
@@ -7,11 +7,11 @@ ScriptCollection/ProgramRunnerBase.py,sha256=2kMIAqdc65UjBAddOZkzy_aFx9h5roZ5a4b
7
7
  ScriptCollection/ProgramRunnerEpew.py,sha256=4pjEd0r9Fcz3TTDv0MdTSd5KkigYXcWUVI1X43regfU,6477
8
8
  ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
9
9
  ScriptCollection/SCLog.py,sha256=Dd2P8vH2PA830wAv6bchlMHHdGE_7At-F4WQY5w4XdA,4016
10
- ScriptCollection/ScriptCollectionCore.py,sha256=rX1wjbWTYkTVGaVzvgDYlCxSVhxfyoIr7Yn4oTJ8qy4,135815
11
- ScriptCollection/TasksForCommonProjectStructure.py,sha256=boOF-cOYdfUPRf5DOgL1yfeO7GYxAn6-W3fdUV84clE,235903
10
+ ScriptCollection/ScriptCollectionCore.py,sha256=RRwHiyjOKelBW0a52t4goDjm0Nm5yOz-r3grzkEPZRc,136482
11
+ ScriptCollection/TasksForCommonProjectStructure.py,sha256=Aln85JyVrspQmluNyNSFT4gPycVt42W_4dM21qys13c,236756
12
12
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- scriptcollection-3.5.139.dist-info/METADATA,sha256=9OcBLfJLHZo4Vtr9udrIBQSbqI50JA9oVS0DkjXUCdQ,7694
14
- scriptcollection-3.5.139.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
- scriptcollection-3.5.139.dist-info/entry_points.txt,sha256=AvmVO9iyWImExpvzL3YYQ9AOEiUIN9guPRRG_W_VNWY,4116
16
- scriptcollection-3.5.139.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
17
- scriptcollection-3.5.139.dist-info/RECORD,,
13
+ scriptcollection-3.5.140.dist-info/METADATA,sha256=h47YkJZXJr_B_LQt2qF2bEJnHxtoc6Us-cKkxiVxBts,7694
14
+ scriptcollection-3.5.140.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ scriptcollection-3.5.140.dist-info/entry_points.txt,sha256=AvmVO9iyWImExpvzL3YYQ9AOEiUIN9guPRRG_W_VNWY,4116
16
+ scriptcollection-3.5.140.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
17
+ scriptcollection-3.5.140.dist-info/RECORD,,