ScriptCollection 4.3.57__py3-none-any.whl → 4.3.59__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.
@@ -21,11 +21,15 @@ from ..ScriptCollectionCore import ScriptCollectionCore,VSCodeWorkspaceShellTask
21
21
  from ..SCLog import LogLevel
22
22
  from ..OCIImages.AbstractImageHandler import AbstractImageHandler
23
23
  from ..OCIImages.OCIImageManager import OCIImageManager
24
+ from .PackageSource import PackageSource
24
25
 
25
26
  class TFCPS_Tools_General:
26
27
 
27
28
  __sc:ScriptCollectionCore=None
28
29
  oci_image_manager:OCIImageManager=None
30
+ # Kinds which are allowed in the configuration-file that defines where the values of the required environment-variables come from
31
+ # (see get_environment_variables_configuration_file).
32
+ __allowed_environment_variable_kinds:list[str]=["literal","hostenvvariable","file"]
29
33
  # Relative path (inside the source-repository and inside the ScriptCollection.Resources-package) of the
30
34
  # file that pins the OpenAPIGenerator-version used as default when no repository-specific version is given.
31
35
  __openapigenerator_version_resource_relative_path:str="Dependencies/OpenAPIGenerator/Version.txt"
@@ -459,43 +463,216 @@ class TFCPS_Tools_General:
459
463
  return str(root.xpath('/cps:productinformation/cps:producttitle/text()', namespaces={'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure'})[0])
460
464
 
461
465
  @GeneralUtilities.check_arguments
462
- def get_required_env_variables(self, repository: str) -> dict[str, str]:
463
- """Reads '<repository>/.ScriptCollection/RequiredEnvVariables.csv' and resolves the value of each environment-variable
464
- defined in it. The file is optional; if it does not exist an empty dict is returned. Columns: EnvVariableName;Kind;Value.
465
- 'Kind' is one of 'literal' (Value is used as-is), 'hostenvvariable' (Value is the name of an environment-variable which
466
- must be set on the host-system) or 'file' (Value is a path - resolved relative to the repository if not absolute - to a
467
- text-file whose content, without a trailing linebreak, is used). This function centralizes that resolution so every
468
- caller which needs these environment-variables (for example to pass them into a build-container) obtains identical
469
- values instead of re-implementing the resolution-logic."""
466
+ def get_required_environment_variable_names(self, repository: str) -> list[str]:
467
+ """Returns the names of the environment-variables the product needs for its build. They are declared (name-only, without
468
+ any value) in '<repository>/.ScriptCollection/ProductInformation.xml' below 'requiredenvironmentvariables'. The values are
469
+ deliberately not part of the repository: they are resolved per machine from the user-configuration-file returned by
470
+ get_environment_variables_configuration_file().
471
+ The 'requiredenvironmentvariables'-element itself is required and must be declared even when the product does not need any
472
+ environment-variable (it stays empty then), so that it is always visible which environment-variables a product depends on
473
+ instead of that information being absent by accident.
474
+ The names declared for this machine (see get_additional_required_environment_variable_names_for_this_machine) are always
475
+ appended, because they are required by machine-local tooling instead of by the repository itself and must therefore not be
476
+ declared by (and are not specific to) any particular repository."""
477
+ product_information_file = os.path.join(repository, ".ScriptCollection", "ProductInformation.xml")
478
+ GeneralUtilities.assert_file_exists(product_information_file)
479
+ root: etree._ElementTree = etree.parse(product_information_file)
480
+ namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure'}
481
+ declaration_elements = root.xpath('/cps:productinformation/cps:requiredenvironmentvariables', namespaces=namespaces)
482
+ GeneralUtilities.assert_condition(1 == len(declaration_elements), f"'{product_information_file}' must contain exactly one 'requiredenvironmentvariables'-element but it contains {len(declaration_elements)}. Add '<cps:requiredenvironmentvariables></cps:requiredenvironmentvariables>' (empty if the build of this product does not need any environment-variable) to that file.")
483
+ result: list[str] = []
484
+ #the elements are iterated (instead of their text-nodes) because an element without any content does not have a text-node at all
485
+ #and would therefore be skipped silently instead of being reported as the mistake it is.
486
+ for declared_variable in declaration_elements[0].xpath('cps:requiredenvironmentvariable', namespaces=namespaces):
487
+ name: str = GeneralUtilities.empty_string if declared_variable.text is None else str(declared_variable.text).strip()
488
+ GeneralUtilities.assert_condition(GeneralUtilities.string_has_content(name), f"'{product_information_file}' contains a 'requiredenvironmentvariable'-element without a name. Every declared environment-variable must have a name.")
489
+ GeneralUtilities.assert_condition(name not in result, f"'{product_information_file}' declares the environment-variable '{name}' more than once.")
490
+ result.append(name)
491
+ for name in self.get_additional_required_environment_variable_names_for_this_machine():
492
+ if name not in result:
493
+ result.append(name)
494
+ return result
495
+
496
+ @GeneralUtilities.check_arguments
497
+ def get_additional_required_environment_variable_names_for_this_machine(self) -> list[str]:
498
+ """Returns the names of environment-variables which are additionally required for every codeunit-build which runs on this
499
+ machine, regardless of what a repository declares in its ProductInformation.xml. They are declared (name-only, one per line,
500
+ lines starting with '#' are treated as comments) in '<configuration-folder>/TFCPS/AdditionalRequiredEnvironmentVariables.txt'.
501
+ This file is deliberately kept outside of any repository: it exists so that tooling which is specific to one developer's machine
502
+ (for example a custom pre-codeunit-build-script, see run_custom_script_if_available) can declare the environment-variables it
503
+ needs without forcing every repository which happens to be built on that machine to declare them too - a repository must not
504
+ have to know about a specific developer's machine-local tooling.
505
+ The file is optional; if it does not exist nothing is additionally required."""
506
+ file = os.path.join(GeneralUtilities.get_scriptcollection_configuration_folder(), "TFCPS", "AdditionalRequiredEnvironmentVariables.txt")
507
+ result: list[str] = []
508
+ if not os.path.isfile(file):
509
+ return result
510
+ for line in GeneralUtilities.read_lines_from_file(file):
511
+ name = line.strip()
512
+ if not GeneralUtilities.string_has_content(name) or name.startswith("#"):
513
+ continue
514
+ if name not in result:
515
+ result.append(name)
516
+ return result
517
+
518
+ @GeneralUtilities.check_arguments
519
+ def get_environment_variables_configuration_file(self) -> str:
520
+ """Returns the path of the user-specific file which defines where the values of the required environment-variables come from.
521
+ The file is looked up in the configuration-folder, so a build-container which gets that folder mounted (which is the recommended
522
+ setup for a self-hosted build-runner) resolves the values exactly like a build on a host does."""
523
+ return os.path.join(GeneralUtilities.get_scriptcollection_configuration_folder(), "TFCPS", "EnvironmentVariables.csv")
524
+
525
+ @GeneralUtilities.check_arguments
526
+ def get_required_environment_variables(self, repository: str) -> dict[str, str]:
527
+ """Resolves the value of every environment-variable which is declared as required by the repository (see
528
+ get_required_environment_variable_names). A value comes from one of two sources:
529
+ - the configuration-file returned by get_environment_variables_configuration_file(), if the variable is defined there.
530
+ - the environment of the current process otherwise. This is how a build-pipeline provides a value from its own secret-store.
531
+ The configuration-file has precedence, so a resolved value does not depend on what happens to be set in the environment of the
532
+ caller. If a value can not be determined in either way the resolution fails with a message which names both possibilities.
533
+ This function centralizes the resolution so every caller (for example the code which passes the variables into the
534
+ build-container) obtains identical values instead of re-implementing the resolution-logic."""
535
+ required_names: list[str] = self.get_required_environment_variable_names(repository)
536
+ if len(required_names) == 0:
537
+ return {}
538
+ return self.resolve_environment_variables(required_names, f"the product '{self.get_product_name(repository)}' (declared in '{os.path.join(repository, '.ScriptCollection', 'ProductInformation.xml')}')")
539
+
540
+ @GeneralUtilities.check_arguments
541
+ def resolve_environment_variables(self, environment_variable_names: list[str], required_by: str) -> dict[str, str]:
542
+ """Resolves the values of the given environment-variables (see get_required_environment_variables for the sources and their
543
+ precedence). This is the same mechanism a codeunit-build uses for the variables a repository declares as required; it is available
544
+ separately so a tool which needs a value without having such a declaration (for example something which runs inside the
545
+ build-container) does not have to read the configuration or the environment on its own.
546
+ 'required_by' names the thing which needs the values and is used in the error-message when a value can not be determined."""
470
547
  result: dict[str, str] = {}
471
- files=[
472
- os.path.join(repository, ".ScriptCollection", "RequiredEnvVariables.local.csv"),
473
- os.path.join(repository, ".ScriptCollection", "RequiredEnvVariables.csv")
474
- ]
475
- for file in files:
476
- if not os.path.isfile(file):
477
- return result
478
- allowed_kinds = ["literal", "hostenvvariable", "file"]
479
- for entry in GeneralUtilities.read_csv_file(file, True):
480
- env_variable_name = entry[0]
481
- kind = entry[1]
482
- value = entry[2]
483
- GeneralUtilities.assert_condition(kind in allowed_kinds, f"Unknown kind '{kind}' for required environment-variable '{env_variable_name}' defined in '{file}'. Allowed values are: {', '.join(allowed_kinds)}.")
484
- if kind == "literal":
485
- resolved_value = value
486
- elif kind == "hostenvvariable":
487
- resolved_value = os.environ.get(value)
488
- GeneralUtilities.assert_condition(resolved_value is not None, f"The environment-variable '{env_variable_name}' defined in '{file}' is supposed to be taken from the host-environment-variable '{value}', but that environment-variable is not set.")
489
- elif kind == "file":
490
- value = os.path.expanduser(value)
491
- value_file = GeneralUtilities.resolve_relative_path(value, repository)
492
- GeneralUtilities.assert_file_exists(value_file, f"The environment-variable '{env_variable_name}' defined in '{file}' is supposed to be taken from the file '{value_file}', but that file does not exist.")
493
- resolved_value = GeneralUtilities.read_text_from_file(value_file).strip()
494
- else:
495
- raise ValueError(f"Unknown kind '{kind}' for required environment-variable '{env_variable_name}' defined in '{file}'. Allowed values are: {', '.join(allowed_kinds)}.")
496
- result[env_variable_name] = resolved_value
548
+ configuration_file: str = self.get_environment_variables_configuration_file()
549
+ entries: dict[str, tuple[str, str]] = self.__read_environment_variables_configuration_file(configuration_file)
550
+ for environment_variable_name in environment_variable_names:
551
+ if environment_variable_name in entries:
552
+ result[environment_variable_name] = self.__resolve_environment_variable_value(environment_variable_name, entries[environment_variable_name], configuration_file)
553
+ else:
554
+ value_from_environment: str = os.environ.get(environment_variable_name)
555
+ GeneralUtilities.assert_condition(GeneralUtilities.string_has_content(value_from_environment), f"The value of the environment-variable '{environment_variable_name}' which is required by {required_by} is unknown: it is not defined in '{configuration_file}' and it is not set in the environment. Add a line '{environment_variable_name};<kind>;<value>' to that file (allowed kinds are: {', '.join(TFCPS_Tools_General.__allowed_environment_variable_kinds)}) or provide the value as an environment-variable, which is how a build-pipeline usually provides it.")
556
+ result[environment_variable_name] = value_from_environment
557
+ return result
558
+
559
+ @GeneralUtilities.check_arguments
560
+ def resolve_environment_variable(self, environment_variable_name: str, required_by: str) -> str:
561
+ """Resolves the value of a single environment-variable, see resolve_environment_variables."""
562
+ return self.resolve_environment_variables([environment_variable_name], required_by)[environment_variable_name]
563
+
564
+ @GeneralUtilities.check_arguments
565
+ def __read_environment_variables_configuration_file(self, configuration_file: str) -> dict[str, tuple[str, str]]:
566
+ """Reads the configuration-file which defines where the values of environment-variables come from (columns
567
+ 'EnvVariableName;Kind;Value') and returns a mapping of the name of the variable to its kind and its value.
568
+ The file is optional: if it does not exist, nothing is defined by it and all values have to come from the environment."""
569
+ result: dict[str, tuple[str, str]] = {}
570
+ if not os.path.isfile(configuration_file):
571
+ return result
572
+ for entry in GeneralUtilities.read_csv_file(configuration_file, True):
573
+ GeneralUtilities.assert_condition(2 < len(entry), f"Invalid line in '{configuration_file}': every line must have the 3 columns 'EnvVariableName;Kind;Value' but '{';'.join(entry)}' has {len(entry)}.")
574
+ #the value itself may contain the separator-character (for example in a literal value), so everything behind the second column belongs to the value.
575
+ result[entry[0]] = (entry[1], ";".join(entry[2:]))
576
+ return result
577
+
578
+ @GeneralUtilities.check_arguments
579
+ def __resolve_environment_variable_value(self, env_variable_name: str, entry: tuple[str, str], configuration_file: str) -> str:
580
+ """Resolves the value of an entry of the configuration-file. 'Kind' is one of 'literal' (the value is used as-is),
581
+ 'hostenvvariable' (the value is the name of an environment-variable which must be set on the current system) or 'file' (the value
582
+ is a path - '~' is expanded, a relative path is resolved against the configuration-folder - to a text-file whose content, without
583
+ surrounding whitespace, is used). A relative path is the recommended form for a secret-file, because it also resolves correctly
584
+ when the configuration-folder is mounted into a build-container."""
585
+ kind, value = entry
586
+ GeneralUtilities.assert_condition(kind in TFCPS_Tools_General.__allowed_environment_variable_kinds, f"Unknown kind '{kind}' for environment-variable '{env_variable_name}' defined in '{configuration_file}'. Allowed values are: {', '.join(TFCPS_Tools_General.__allowed_environment_variable_kinds)}.")
587
+ if kind == "literal":
588
+ return value
589
+ if kind == "hostenvvariable":
590
+ resolved_value = os.environ.get(value)
591
+ GeneralUtilities.assert_condition(resolved_value is not None, f"The environment-variable '{env_variable_name}' defined in '{configuration_file}' is supposed to be taken from the environment-variable '{value}', but that environment-variable is not set.")
592
+ return resolved_value
593
+ value_file = GeneralUtilities.resolve_relative_path(os.path.expanduser(value), os.path.dirname(configuration_file))
594
+ GeneralUtilities.assert_file_exists(value_file, f"The environment-variable '{env_variable_name}' defined in '{configuration_file}' is supposed to be taken from the file '{value_file}', but that file does not exist.")
595
+ return GeneralUtilities.read_text_from_file(value_file).strip()
596
+
597
+ @GeneralUtilities.check_arguments
598
+ def ensure_required_environment_variables_are_set(self, repository: str) -> None:
599
+ """Ensures that the environment-variables which the repository declares as required (see get_required_environment_variable_names)
600
+ are set in the environment of the current process, so every part of the build - including the sub-processes started for the
601
+ single codeunits - can rely on them without the caller having to specify them on every call.
602
+ This works the same way on a host, inside a build-container which gets the configuration-folder mounted and in a build-pipeline
603
+ which provides the values as environment-variables (see get_required_environment_variables)."""
604
+ required_environment_variable_names: list[str] = self.get_required_environment_variable_names(repository)
605
+ if len(required_environment_variable_names) == 0:
606
+ return
607
+ for environment_variable_name, environment_variable_value in self.get_required_environment_variables(repository).items():
608
+ os.environ[environment_variable_name] = environment_variable_value
609
+ self.__sc.log.log(f"Set the required environment-variables: {', '.join(required_environment_variable_names)}", LogLevel.Debug)
610
+
611
+ @GeneralUtilities.check_arguments
612
+ def get_declared_package_sources(self, technology: str) -> list[PackageSource]:
613
+ """Returns the package-sources which are declared for the given technology (for example 'CSharp') in the environment of the
614
+ current process. A source named '<sourcename>' is declared by the environment-variables 'Dependency_<technology>_<sourcename>_URL'
615
+ and - if the source requires authentication - 'Dependency_<technology>_<sourcename>_Username' and
616
+ 'Dependency_<technology>_<sourcename>_Password'.
617
+ Environment-variables are used because a package-source (and especially its credentials) must not be part of a repository. Which
618
+ values a machine uses is typically declared as required environment-variables of the product (see
619
+ get_required_environment_variable_names), so that the values are resolved from the user-specific configuration-file and are
620
+ available on the host as well as inside the build-container.
621
+ The names of environment-variables are treated case-insensitively because they are not case-sensitive on all operating-systems.
622
+ For the same reason the name of the source is normalized to lowercase: the case of the name of an environment-variable can not be
623
+ preserved on all operating-systems (on Windows they are always read in uppercase), and a source-name which differs depending on
624
+ the operating-system the build runs on would be registered twice in a configuration which is used by both."""
625
+ url_variable_pattern = re.compile(f"^Dependency_{re.escape(technology)}_(.+)_URL$", re.IGNORECASE)
626
+ environment_variables: dict[str, str] = {name.lower(): value for name, value in os.environ.items()}
627
+ result: list[PackageSource] = []
628
+ for environment_variable_name, environment_variable_value in os.environ.items():
629
+ match = url_variable_pattern.match(environment_variable_name)
630
+ if match is None:
631
+ continue
632
+ source_name: str = match.group(1).lower()
633
+ if not GeneralUtilities.string_has_content(environment_variable_value):
634
+ continue
635
+ username: str = environment_variables.get(f"dependency_{technology}_{source_name}_username".lower())
636
+ password: str = environment_variables.get(f"dependency_{technology}_{source_name}_password".lower())
637
+ result.append(PackageSource(source_name, environment_variable_value.strip(), username, password))
638
+ result.sort(key=lambda package_source: package_source.name)#sorted so the order (and therefore the log-output) is deterministic
497
639
  return result
498
640
 
641
+ @GeneralUtilities.check_arguments
642
+ def get_custom_script_file(self, filename: str) -> str:
643
+ """Returns the path of an optional user-specific script in '~/.ScriptCollection/TFCPS'. These scripts are located outside of any
644
+ repository on purpose: they contain machine-specific preparation-steps which must not be part of a product's sourcecode."""
645
+ return os.path.join(GeneralUtilities.get_scriptcollection_configuration_folder(), "TFCPS", filename)
646
+
647
+ @GeneralUtilities.check_arguments
648
+ def get_custom_scripts_folder_for_container(self) -> str:
649
+ """Returns the folder (on the host) whose content is mounted as a whole into a locally started build-container by
650
+ build_codeunits_in_container, so it is the counterpart of get_folder_of_custom_scripts_in_container on the host-side. The mount is
651
+ writable (not read-only) because the scripts in that folder may also use it as their own download-cache-folder. It is a dedicated
652
+ subfolder of the configuration-folder - not the configuration-folder itself and not the same folder as get_custom_script_file uses
653
+ - so that mounting it into a container never exposes anything else from the configuration-folder (in particular not
654
+ EnvironmentVariables.csv or Secrets, which contain credentials).
655
+ Mounting the whole folder (instead of only the pre-codeunit-build-hook itself, "CustomPreCodeUnitBuildScriptInContainer.py") means
656
+ that hook can start a sibling script placed next to it in this same folder (see run_custom_script_if_available), which is what
657
+ lets the hook itself stay independent of a package it only installs, while the actual preparation-logic (which needs that package)
658
+ lives in the sibling script."""
659
+ return os.path.join(GeneralUtilities.get_scriptcollection_configuration_folder(), "TFCPS", "CustomScriptsForContainer")
660
+
661
+ @GeneralUtilities.check_arguments
662
+ def get_folder_of_custom_scripts_in_container(self) -> str:
663
+ """Returns the folder inside the build-container into which the custom scripts of the host are mounted. It is an own folder
664
+ (and not the configuration-folder of the container-user) because the home-folder inside the container depends on the user the
665
+ image runs as, while this path is defined by the mount and is therefore identical for both sides."""
666
+ return "/Workspace/CustomScripts"
667
+
668
+ @GeneralUtilities.check_arguments
669
+ def run_custom_script_if_available(self, script_file: str, arguments: list[str]) -> None:
670
+ """Runs the given optional script if it exists. The script is run in its own folder so it can use files located next to it."""
671
+ if not os.path.isfile(script_file):
672
+ return
673
+ self.__sc.log.log(f"Run custom script \"{script_file}\"...")
674
+ self.__sc.run_program_argsasarray(GeneralUtilities.get_python_executable(), [os.path.basename(script_file)]+arguments, os.path.dirname(script_file), print_live_output=True)
675
+
499
676
  @GeneralUtilities.check_arguments
500
677
  def set_constant(self, codeunit_folder: str, constantname: str, constant_value: str, documentationsummary: str = None, constants_valuefile: str = None) -> None:
501
678
  self.assert_is_codeunit_folder(codeunit_folder)
@@ -1,168 +1,168 @@
1
- Metadata-Version: 2.4
2
- Name: scriptcollection
3
- Version: 4.3.57
4
- Summary: The ScriptCollection is the place for reusable scripts.
5
- Author-email: Marius Göcke <marius.goecke@gmail.com>
6
- Project-URL: Homepage, https://github.com/anionDev/ScriptCollection
7
- Project-URL: Documentation, https://aniondev.github.io/ScriptCollectionReference/index.html
8
- Project-URL: Changelog, https://github.com/anionDev/ScriptCollection/tree/main/Other/Resources/Changelog
9
- Keywords: package,release,build,management
10
- Classifier: Intended Audience :: Developers
11
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
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.5.0
25
- Requires-Dist: coverage>=7.15.2
26
- Requires-Dist: cyclonedx-bom>=7.1.0
27
- Requires-Dist: defusedxml>=0.7.1
28
- Requires-Dist: keyboard>=0.13.5
29
- Requires-Dist: lcov-cobertura>=2.1.1
30
- Requires-Dist: lxml>=6.0.1
31
- Requires-Dist: ntplib>=0.4.0
32
- Requires-Dist: Pillow>=11.3.0
33
- Requires-Dist: psutil>=7.2.2
34
- Requires-Dist: pycdlib>=1.16.0
35
- Requires-Dist: Pygments>=2.20.0
36
- Requires-Dist: pylint>=4.0.6
37
- Requires-Dist: pyOpenSSL>=25.3.0
38
- Requires-Dist: PyPDF>=6.14.2
39
- Requires-Dist: pytest>=8.4.2
40
- Requires-Dist: PyYAML>=6.0.3
41
- Requires-Dist: qrcode>=8.2.0
42
- Requires-Dist: send2trash>=1.8.3
43
- Requires-Dist: twine>=6.2.0
44
- Requires-Dist: xmlschema>=4.3.2
45
-
46
- # ScriptCollection
47
-
48
- ## General
49
-
50
- [![Supported Python versions](https://img.shields.io/pypi/pyversions/ScriptCollection.svg)](https://pypi.org/project/ScriptCollection/)
51
- ![PyPI](https://img.shields.io/pypi/v/ScriptCollection)
52
- ![Dependencies](https://img.shields.io/librariesio/github/anionDevevlopment/ScriptCollection)
53
-
54
- [![CodeFactor](https://www.codefactor.io/repository/github/anionDevevlopment/scriptcollection/badge/main)](https://www.codefactor.io/repository/github/anionDevevlopment/scriptcollection/overview/main)
55
- [![Downloads](https://pepy.tech/badge/scriptcollection)](https://pepy.tech/project/scriptcollection)
56
- ![Coverage](https://raw.githubusercontent.com/anionDevevlopment/ScriptCollection/main/ScriptCollection/Other/Resources/TestCoverageBadges/badge_shieldsio_linecoverage_blue.svg)
57
-
58
- The ScriptCollection is the place for reusable scripts.
59
-
60
- ## Reference
61
-
62
- The reference can be found [here](https://aniondev.github.io/ScriptCollectionReference/index.html).
63
-
64
- ## Hints
65
-
66
- Most of the scripts are written in [python](https://www.python.org) 3.
67
-
68
- 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.
69
-
70
- Some functions are not entirely available on windows or require common third-party tools. See the [Runtime dependencies](#runtime-dependencies)-section for more information.
71
-
72
- When using ScriptCollection it is not required but recommended for better usability to have [epew](https://github.com/anionDev/Epew) installed.
73
-
74
- ## Get ScriptCollection
75
-
76
- ### Installation via pip
77
-
78
- `pip3 install ScriptCollection`
79
-
80
- See the [PyPI-site for ScriptCollection](https://pypi.org/project/ScriptCollection)
81
-
82
- ### Download sourcecode using git
83
-
84
- You can simply git-clone the ScriptCollection and then use the scripts under the provided license.
85
-
86
- `git clone https://github.com/anionDevevlopment/ScriptCollection.git`
87
-
88
- 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.
89
-
90
- ## Troubleshooting
91
-
92
- 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).
93
-
94
- If you have installed the ScriptCollection as pip-package you can simply check the version using Python with the following commands:
95
-
96
- ```lang-bash
97
- from ScriptCollection.ScriptCollectionCore import ScriptCollectionCore
98
- ScriptCollectionCore.get_scriptcollection_version()
99
- ```
100
-
101
- Or you can simply run `pip3 freeze` folder to get information about (all) currently installed pip-packages.
102
-
103
- ## Development
104
-
105
- ### Branching-system
106
-
107
- This repository applies the [GitFlowSimplified](https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/blob/main/Conventions/BranchingSystem/GitFlowSimplified/GitFlowSimplified.md)-branching-system.
108
-
109
- ### Repository-structure
110
-
111
- This repository applies the [CommonProjectStructure](https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/blob/main/Conventions/RepositoryStructure/CommonProjectStructure/CommonProjectStructure.md)-branching-system.
112
-
113
- ### Install dependencies
114
-
115
- ScriptCollection requires [Python](https://www.python.org) 3.10.
116
-
117
- To develop ScriptCollection it is obviously required that the following commandline-commands are available on your system:
118
-
119
- - `python` (on some systems `python3`)
120
- - `pip3`
121
-
122
- The pip-packages which are required for developing on this project are defined in `requirements.txt`.
123
-
124
- ### IDE
125
-
126
- The recommended IDE for developing ScriptCollection is Visual Studio Code.
127
- The recommended addons for developing ScriptCollection with Visual Studio Code are:
128
-
129
- - [Pylance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance)
130
- - [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
131
- - [Spell Right](https://marketplace.visualstudio.com/items?itemName=ban.spellright)
132
- - [docs-markdown](https://marketplace.visualstudio.com/items?itemName=docsmsft.docs-markdown)
133
-
134
- ### Build
135
-
136
- To create and install an ScriptCollection locally simply do the following commands:
137
-
138
- ```bash
139
- python ./ScriptCollection/Other/Build/Build.py
140
- pip3 install --force-reinstall ./ScriptCollection/Other/Artifacts/Wheel/ScriptCollection-x.x.x-py3-none-any.whl
141
- ```
142
-
143
- (Note: `x.x.x` must be replaced by the appropriate version-number.)
144
-
145
- ### Coding style
146
-
147
- In this repository [pylint](https://pylint.org/) will be used to report linting-issues.
148
- If you change code in this repository please ensure pylint does not find any issues before creating a pull-request.
149
-
150
- If linting-issues exist in the current code-base can be checked by running `python ./ScriptCollection/Other/QualityCheck/Linting.py`.
151
-
152
- ## Runtime dependencies
153
-
154
- ScriptCollection requires [Python](https://www.python.org) 3.10.
155
-
156
- The usual Python-dependencies will be installed automagically by `pip`.
157
-
158
- 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:
159
-
160
- - chmod
161
- - chown
162
- - ls
163
-
164
- 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.
165
-
166
- ## License
167
-
168
- 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.3.59
4
+ Summary: The ScriptCollection is the place for reusable scripts.
5
+ Author-email: Marius Göcke <marius.goecke@gmail.com>
6
+ Project-URL: Homepage, https://github.com/anionDev/ScriptCollection
7
+ Project-URL: Documentation, https://aniondev.github.io/ScriptCollectionReference/index.html
8
+ Project-URL: Changelog, https://github.com/anionDev/ScriptCollection/tree/main/Other/Resources/Changelog
9
+ Keywords: package,release,build,management
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
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.5.0
25
+ Requires-Dist: coverage>=7.15.2
26
+ Requires-Dist: cyclonedx-bom>=7.1.0
27
+ Requires-Dist: defusedxml>=0.7.1
28
+ Requires-Dist: keyboard>=0.13.5
29
+ Requires-Dist: lcov-cobertura>=2.1.1
30
+ Requires-Dist: lxml>=6.0.1
31
+ Requires-Dist: ntplib>=0.4.0
32
+ Requires-Dist: Pillow>=11.3.0
33
+ Requires-Dist: psutil>=7.2.2
34
+ Requires-Dist: pycdlib>=1.16.0
35
+ Requires-Dist: Pygments>=2.20.0
36
+ Requires-Dist: pylint>=4.0.6
37
+ Requires-Dist: pyOpenSSL>=25.3.0
38
+ Requires-Dist: PyPDF>=6.14.2
39
+ Requires-Dist: pytest>=8.4.2
40
+ Requires-Dist: PyYAML>=6.0.3
41
+ Requires-Dist: qrcode>=8.2.0
42
+ Requires-Dist: send2trash>=1.8.3
43
+ Requires-Dist: twine>=6.2.0
44
+ Requires-Dist: xmlschema>=4.3.2
45
+
46
+ # ScriptCollection
47
+
48
+ ## General
49
+
50
+ [![Supported Python versions](https://img.shields.io/pypi/pyversions/ScriptCollection.svg)](https://pypi.org/project/ScriptCollection/)
51
+ ![PyPI](https://img.shields.io/pypi/v/ScriptCollection)
52
+ ![Dependencies](https://img.shields.io/librariesio/github/anionDevevlopment/ScriptCollection)
53
+
54
+ [![CodeFactor](https://www.codefactor.io/repository/github/anionDevevlopment/scriptcollection/badge/main)](https://www.codefactor.io/repository/github/anionDevevlopment/scriptcollection/overview/main)
55
+ [![Downloads](https://pepy.tech/badge/scriptcollection)](https://pepy.tech/project/scriptcollection)
56
+ ![Coverage](https://raw.githubusercontent.com/anionDevevlopment/ScriptCollection/main/ScriptCollection/Other/Resources/TestCoverageBadges/badge_shieldsio_linecoverage_blue.svg)
57
+
58
+ The ScriptCollection is the place for reusable scripts.
59
+
60
+ ## Reference
61
+
62
+ The reference can be found [here](https://aniondev.github.io/ScriptCollectionReference/index.html).
63
+
64
+ ## Hints
65
+
66
+ Most of the scripts are written in [python](https://www.python.org) 3.
67
+
68
+ 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.
69
+
70
+ Some functions are not entirely available on windows or require common third-party tools. See the [Runtime dependencies](#runtime-dependencies)-section for more information.
71
+
72
+ When using ScriptCollection it is not required but recommended for better usability to have [epew](https://github.com/anionDev/Epew) installed.
73
+
74
+ ## Get ScriptCollection
75
+
76
+ ### Installation via pip
77
+
78
+ `pip3 install ScriptCollection`
79
+
80
+ See the [PyPI-site for ScriptCollection](https://pypi.org/project/ScriptCollection)
81
+
82
+ ### Download sourcecode using git
83
+
84
+ You can simply git-clone the ScriptCollection and then use the scripts under the provided license.
85
+
86
+ `git clone https://github.com/anionDevevlopment/ScriptCollection.git`
87
+
88
+ 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.
89
+
90
+ ## Troubleshooting
91
+
92
+ 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).
93
+
94
+ If you have installed the ScriptCollection as pip-package you can simply check the version using Python with the following commands:
95
+
96
+ ```lang-bash
97
+ from ScriptCollection.ScriptCollectionCore import ScriptCollectionCore
98
+ ScriptCollectionCore.get_scriptcollection_version()
99
+ ```
100
+
101
+ Or you can simply run `pip3 freeze` folder to get information about (all) currently installed pip-packages.
102
+
103
+ ## Development
104
+
105
+ ### Branching-system
106
+
107
+ This repository applies the [GitFlowSimplified](https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/blob/main/Conventions/BranchingSystem/GitFlowSimplified/GitFlowSimplified.md)-branching-system.
108
+
109
+ ### Repository-structure
110
+
111
+ This repository applies the [CommonProjectStructure](https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/blob/main/Conventions/RepositoryStructure/CommonProjectStructure/CommonProjectStructure.md)-branching-system.
112
+
113
+ ### Install dependencies
114
+
115
+ ScriptCollection requires [Python](https://www.python.org) 3.10.
116
+
117
+ To develop ScriptCollection it is obviously required that the following commandline-commands are available on your system:
118
+
119
+ - `python` (on some systems `python3`)
120
+ - `pip3`
121
+
122
+ The pip-packages which are required for developing on this project are defined in `requirements.txt`.
123
+
124
+ ### IDE
125
+
126
+ The recommended IDE for developing ScriptCollection is Visual Studio Code.
127
+ The recommended addons for developing ScriptCollection with Visual Studio Code are:
128
+
129
+ - [Pylance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance)
130
+ - [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
131
+ - [Spell Right](https://marketplace.visualstudio.com/items?itemName=ban.spellright)
132
+ - [docs-markdown](https://marketplace.visualstudio.com/items?itemName=docsmsft.docs-markdown)
133
+
134
+ ### Build
135
+
136
+ To create and install an ScriptCollection locally simply do the following commands:
137
+
138
+ ```bash
139
+ python ./ScriptCollection/Other/Build/Build.py
140
+ pip3 install --force-reinstall ./ScriptCollection/Other/Artifacts/Wheel/ScriptCollection-x.x.x-py3-none-any.whl
141
+ ```
142
+
143
+ (Note: `x.x.x` must be replaced by the appropriate version-number.)
144
+
145
+ ### Coding style
146
+
147
+ In this repository [pylint](https://pylint.org/) will be used to report linting-issues.
148
+ If you change code in this repository please ensure pylint does not find any issues before creating a pull-request.
149
+
150
+ If linting-issues exist in the current code-base can be checked by running `python ./ScriptCollection/Other/QualityCheck/Linting.py`.
151
+
152
+ ## Runtime dependencies
153
+
154
+ ScriptCollection requires [Python](https://www.python.org) 3.10.
155
+
156
+ The usual Python-dependencies will be installed automagically by `pip`.
157
+
158
+ 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:
159
+
160
+ - chmod
161
+ - chown
162
+ - ls
163
+
164
+ 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.
165
+
166
+ ## License
167
+
168
+ See [License.txt](https://raw.githubusercontent.com/anionDevevlopment/ScriptCollection/main/License.txt) for license-information.