ScriptCollection 3.5.16__py3-none-any.whl → 4.0.78__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. ScriptCollection/AnionBuildPlatform.py +206 -0
  2. ScriptCollection/{UpdateCertificates.py → CertificateUpdater.py} +69 -46
  3. ScriptCollection/Executables.py +515 -18
  4. ScriptCollection/GeneralUtilities.py +1272 -873
  5. ScriptCollection/ImageUpdater.py +648 -0
  6. ScriptCollection/ProgramRunnerBase.py +10 -10
  7. ScriptCollection/ProgramRunnerMock.py +2 -0
  8. ScriptCollection/ProgramRunnerPopen.py +7 -1
  9. ScriptCollection/ProgramRunnerSudo.py +108 -0
  10. ScriptCollection/SCLog.py +115 -0
  11. ScriptCollection/ScriptCollectionCore.py +942 -266
  12. ScriptCollection/TFCPS/Docker/TFCPS_CodeUnitSpecific_Docker.py +95 -0
  13. ScriptCollection/TFCPS/Docker/__init__.py +0 -0
  14. ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationBase.py +8 -0
  15. ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationGenerate.py +6 -0
  16. ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationNoGenerate.py +7 -0
  17. ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py +485 -0
  18. ScriptCollection/TFCPS/DotNet/__init__.py +0 -0
  19. ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py +130 -0
  20. ScriptCollection/TFCPS/Flutter/__init__.py +0 -0
  21. ScriptCollection/TFCPS/Go/TFCPS_CodeUnitSpecific_Go.py +74 -0
  22. ScriptCollection/TFCPS/Go/__init__.py +0 -0
  23. ScriptCollection/TFCPS/NodeJS/TFCPS_CodeUnitSpecific_NodeJS.py +131 -0
  24. ScriptCollection/TFCPS/NodeJS/__init__.py +0 -0
  25. ScriptCollection/TFCPS/Python/TFCPS_CodeUnitSpecific_Python.py +227 -0
  26. ScriptCollection/TFCPS/Python/__init__.py +0 -0
  27. ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py +418 -0
  28. ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py +128 -0
  29. ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py +136 -0
  30. ScriptCollection/TFCPS/TFCPS_CreateRelease.py +95 -0
  31. ScriptCollection/TFCPS/TFCPS_Generic.py +43 -0
  32. ScriptCollection/TFCPS/TFCPS_MergeToMain.py +122 -0
  33. ScriptCollection/TFCPS/TFCPS_MergeToStable.py +350 -0
  34. ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py +47 -0
  35. ScriptCollection/TFCPS/TFCPS_Tools_General.py +1356 -0
  36. ScriptCollection/TFCPS/__init__.py +0 -0
  37. {ScriptCollection-3.5.16.dist-info → scriptcollection-4.0.78.dist-info}/METADATA +23 -22
  38. scriptcollection-4.0.78.dist-info/RECORD +43 -0
  39. {ScriptCollection-3.5.16.dist-info → scriptcollection-4.0.78.dist-info}/WHEEL +1 -1
  40. {ScriptCollection-3.5.16.dist-info → scriptcollection-4.0.78.dist-info}/entry_points.txt +32 -0
  41. ScriptCollection/ProgramRunnerEpew.py +0 -122
  42. ScriptCollection/RPStream.py +0 -42
  43. ScriptCollection/TasksForCommonProjectStructure.py +0 -2625
  44. ScriptCollection-3.5.16.dist-info/RECORD +0 -16
  45. {ScriptCollection-3.5.16.dist-info → scriptcollection-4.0.78.dist-info}/top_level.txt +0 -0
File without changes
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: ScriptCollection
3
- Version: 3.5.16
3
+ Version: 4.0.78
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,26 +22,27 @@ 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.1
26
- Requires-Dist: coverage >=7.6.0
27
- Requires-Dist: cyclonedx-bom >=4.5.0
28
- Requires-Dist: defusedxml >=0.7.1
29
- Requires-Dist: keyboard >=0.13.5
30
- Requires-Dist: lcov-cobertura >=2.0.2
31
- Requires-Dist: lxml >=5.2.2
32
- Requires-Dist: ntplib >=0.4.0
33
- Requires-Dist: Pillow >=10.4.0
34
- Requires-Dist: pycdlib >=1.14.0
35
- Requires-Dist: Pygments >=2.18.0
36
- Requires-Dist: pylint >=3.2.6
37
- Requires-Dist: pyOpenSSL >=24.2.1
38
- Requires-Dist: PyPDF2 >=3.0.1
39
- Requires-Dist: pytest >=8.3.2
40
- Requires-Dist: PyYAML >=6.0.1
41
- Requires-Dist: qrcode >=7.4.2
42
- Requires-Dist: send2trash >=1.8.3
43
- Requires-Dist: twine >=5.1.1
44
- Requires-Dist: xmlschema >=3.3.2
25
+ Requires-Dist: build>=1.3.0
26
+ Requires-Dist: coverage>=7.11.3
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.1.3
35
+ Requires-Dist: pycdlib>=1.14.0
36
+ Requires-Dist: Pygments>=2.19.2
37
+ Requires-Dist: pylint>=4.0.2
38
+ Requires-Dist: pyOpenSSL>=25.3.0
39
+ Requires-Dist: PyPDF>=6.2.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.2.0
45
46
 
46
47
  # ScriptCollection
47
48
 
@@ -0,0 +1,43 @@
1
+ ScriptCollection/AnionBuildPlatform.py,sha256=zTQ-2g2YKFw0_majaQVknslAnNUAotuQhHtB4W20ds4,12663
2
+ ScriptCollection/CertificateUpdater.py,sha256=GXPxmYaW-ufOqsiP9kUYdtI6eNg1-GzrrCqsZdwW_HY,9199
3
+ ScriptCollection/Executables.py,sha256=oAC4lr7V0DF3fHabk44cKVkEiIMt5761VPYYHeme0kQ,42066
4
+ ScriptCollection/GeneralUtilities.py,sha256=dYMtLShbN5FcNgdUHcnWRnlH0oxXntSzRp2WEVdXIKU,53512
5
+ ScriptCollection/ImageUpdater.py,sha256=0KPybKb_9IALhSTNflST-mewQVZ4kvXzNtfcN0-Ut8k,29215
6
+ ScriptCollection/ProcessesRunner.py,sha256=3mu4ZxzZleQo0Op6o9EYTCFiJfb6kx5ov2YfZfT89mU,1395
7
+ ScriptCollection/ProgramRunnerBase.py,sha256=4A2eQgSg_rRgQcgSi-LYtUlM-uSQEpS7qFWn0tWt4uo,2171
8
+ ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrRjAPIwT5Y,37
9
+ ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
10
+ ScriptCollection/ProgramRunnerSudo.py,sha256=_khC3xuTdrPoLluBJZWfldltmmuKltABJPcbjZSFW-4,4835
11
+ ScriptCollection/SCLog.py,sha256=fNi-7pcoXoYiAHUNvqeZQ-I-nW8vLuu4NHs3DP31I58,4529
12
+ ScriptCollection/ScriptCollectionCore.py,sha256=fPaBNaTzLyvG2PKjjpA5uJhV5ySpan_-7jNRlM_ZbMU,142599
13
+ ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=yi33pwy2bNvUAo5V6t5aIPAAWAKzFWBNps7yTOPXmNI,26253
15
+ ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=XTL6MO-LTytDBYz9zv3LcmeG2-IDDvyxbfrFctS5-0A,7458
16
+ ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=f9oGnopuzn3iDHC1AksU7Qr60LbDe0eLjYeXGiDPhAk,7526
17
+ ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=bcJlfI062Eoq7MOIhun-_iNG7SdO1ZIuC_cylaoLI1s,6332
18
+ ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=O-0guM_LJCcZmPZJhMgTvXD2RXUJEBWWv6Bt6hDFhvM,1943
19
+ ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=7F9cwFy-7bxN5mkK9V_n7ffMPvBxLwzQvrAe60fbEMM,7245
20
+ ScriptCollection/TFCPS/TFCPS_MergeToStable.py,sha256=nNS8NavE7MKUOkisH5h8RZa9dcHQd5r8yFZWO4RQSpY,21645
21
+ ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py,sha256=CxdwUklhZVuJGp0vcokoH_KMXFzmlUlZwj77xFYijho,2242
22
+ ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=F2L235oY-Da4zES8fEjgEYEhrSFVEWunrfCOHfBgms8,86042
23
+ ScriptCollection/TFCPS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
+ ScriptCollection/TFCPS/Docker/TFCPS_CodeUnitSpecific_Docker.py,sha256=-KanDRK2e-nXCJj10cotsZkBc9L8VuFRd1mfFhzLJ8o,5552
25
+ ScriptCollection/TFCPS/Docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
+ ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationBase.py,sha256=bT6Gd5pQpZCw4OQz6HWkPCSn5z__eUUEisABLDSxd0o,200
27
+ ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationGenerate.py,sha256=QyjOfMY22JWCvKjMelHiDWbJiWqotOfebpJpgDUaoO4,237
28
+ ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationNoGenerate.py,sha256=i0zEGehj0sttxjjZtoq2KFSKp_ulxVyWp_ZgAhIY_So,241
29
+ ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=Ubcr9WyDJkQCJOuiTj1pwUiUEKQY6l74mdXSx4N0sMA,31140
30
+ ScriptCollection/TFCPS/DotNet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
+ ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py,sha256=Va1DRur-AsU31ywy0-QbgCJs8oCTIf0iYPszEw-kXYs,7155
32
+ ScriptCollection/TFCPS/Flutter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
+ ScriptCollection/TFCPS/Go/TFCPS_CodeUnitSpecific_Go.py,sha256=vA33nDlFsDXhkt7SePVnOCYYlkDsNj94VZdCTtFV57w,3467
34
+ ScriptCollection/TFCPS/Go/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
+ ScriptCollection/TFCPS/NodeJS/TFCPS_CodeUnitSpecific_NodeJS.py,sha256=jOmWQDQdygAgS9QZYqsgiKC9zmmFY7TBjYoc3FVgMSY,6908
36
+ ScriptCollection/TFCPS/NodeJS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
+ ScriptCollection/TFCPS/Python/TFCPS_CodeUnitSpecific_Python.py,sha256=LoBL_CJe4uf-2ovXxj0f-lgW8sktegWoeuFxFrZgcFE,12798
38
+ ScriptCollection/TFCPS/Python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
+ scriptcollection-4.0.78.dist-info/METADATA,sha256=t_3ssziQg8pbebTwlit5W17RwvAwpH7s7m2-kIHOxi0,7690
40
+ scriptcollection-4.0.78.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
41
+ scriptcollection-4.0.78.dist-info/entry_points.txt,sha256=_izhaQEyHiyBIfM2zTYDaJ7qvgsP1WntkVChFnkWymE,4431
42
+ scriptcollection-4.0.78.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
43
+ scriptcollection-4.0.78.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,16 +1,30 @@
1
1
  [console_scripts]
2
+ scappendlinetofile = ScriptCollection.Executables:AppendLineToFile
2
3
  scbuildcodeunit = ScriptCollection.Executables:BuildCodeUnit
3
4
  scbuildcodeunits = ScriptCollection.Executables:BuildCodeUnits
4
5
  scbuildcodeunitsc = ScriptCollection.Executables:BuildCodeUnitsC
5
6
  sccalculatebitcoinblockhash = ScriptCollection.Executables:CalculateBitcoinBlockHash
6
7
  scchangefileextension = ScriptCollection.Executables:ChangeFileExtensions
7
8
  scchangehashofprogram = ScriptCollection.Executables:ChangeHashOfProgram
9
+ sccleantoolscache = ScriptCollection.Executables:CleanToolsCache
10
+ scconvertgitrepositorytobarerepository = ScriptCollection.Executables:ConvertGitRepositoryToBareRepository
11
+ sccopy = ScriptCollection.Executables:Copy
12
+ sccreatechangelogentry = ScriptCollection.Executables:CreateChangelogEntry
8
13
  sccreateemptyfilewithspecificsize = ScriptCollection.Executables:CreateEmptyFileWithSpecificSize
14
+ sccreatefile = ScriptCollection.Executables:CreateFile
15
+ sccreatefolder = ScriptCollection.Executables:CreateFolder
9
16
  sccreatehashofallfiles = ScriptCollection.Executables:CreateHashOfAllFiles
10
17
  sccreateisofilewithobfuscatedfiles = ScriptCollection.Executables:CreateISOFileWithObfuscatedFiles
18
+ sccreaterelease = ScriptCollection.Executables:CreateRelease
11
19
  sccreatesimplemergewithoutrelease = ScriptCollection.Executables:CreateSimpleMergeWithoutRelease
20
+ sccurrentuserhaselevatedprivileges = ScriptCollection.Executables:CurrentUserHasElevatedPrivileges
21
+ scespoc = ScriptCollection.Executables:Espoc
12
22
  scextractpdfpages = ScriptCollection.Executables:ExtractPDFPages
23
+ scfilecontainscontent = ScriptCollection.Executables:FileContainsContent
24
+ scfileexists = ScriptCollection.Executables:FileExists
13
25
  scfilenameobfuscator = ScriptCollection.Executables:FilenameObfuscator
26
+ scfolderexists = ScriptCollection.Executables:FolderExists
27
+ scforeach = ScriptCollection.Executables:ForEach
14
28
  scgeneratearc42referencetemplate = ScriptCollection.Executables:GenerateARC42ReferenceTemplate
15
29
  scgeneratecertificate = ScriptCollection.Executables:GenerateCertificate
16
30
  scgeneratecertificateauthority = ScriptCollection.Executables:GenerateCertificateAuthority
@@ -19,14 +33,32 @@ scgeneratesnkfiles = ScriptCollection.Executables:GenerateSnkFiles
19
33
  scgeneratethumbnail = ScriptCollection.Executables:GenerateThumbnail
20
34
  schealthcheck = ScriptCollection.Executables:Healthcheck
21
35
  sckeyboarddiagnosis = ScriptCollection.Executables:KeyboardDiagnosis
36
+ sclistfoldercontent = ScriptCollection.Executables:ListFolderContent
37
+ scloc = ScriptCollection.Executables:LOC
22
38
  scmergepdfs = ScriptCollection.Executables:MergePDFs
39
+ scnpmi = ScriptCollection.Executables:NpmI
23
40
  scobfuscatefilesfolder = ScriptCollection.Executables:ObfuscateFilesFolder
41
+ scocranalysisoffile = ScriptCollection.Executables:OCRAnalysisOfFile
42
+ scocranalysisoffolder = ScriptCollection.Executables:OCRAnalysisOfFolder
43
+ scocranalysisofrepository = ScriptCollection.Executables:OCRAnalysisOfRepository
24
44
  scorganizelinesinfile = ScriptCollection.Executables:OrganizeLinesInFile
25
45
  scpdftoimage = ScriptCollection.Executables:PDFToImage
46
+ scprintcurrentworkingdirectory = ScriptCollection.Executables:PrintCurrecntWorkingDirectory
47
+ scprintfilecontent = ScriptCollection.Executables:PrintFileContent
48
+ scprintfilesize = ScriptCollection.Executables:PrintFileSize
49
+ scprintosname = ScriptCollection.Executables:PrintOSName
50
+ scregexreplaceinfile = ScriptCollection.Executables:RegexReplaceInFile
51
+ scremovefile = ScriptCollection.Executables:RemoveFile
52
+ scremovefolder = ScriptCollection.Executables:RemoveFolder
53
+ screname = ScriptCollection.Executables:Rename
26
54
  screplacesubstringsinfilenames = ScriptCollection.Executables:ReplaceSubstringsInFilenames
27
55
  scsearchinfiles = ScriptCollection.Executables:SearchInFiles
56
+ scsetcontentoffile = ScriptCollection.Executables:SetContentOfFile
28
57
  scshow2faasqrcode = ScriptCollection.Executables:Show2FAAsQRCode
29
58
  scshowmissingfiles = ScriptCollection.Executables:ShowMissingFiles
30
59
  scsigncertificate = ScriptCollection.Executables:SignCertificate
60
+ scupdatedependencies = ScriptCollection.Executables:UpdateDependencies
61
+ scupdateimagesindockercomposefile = ScriptCollection.Executables:UpdateImagesInDockerComposeFile
31
62
  scupdatenugetpackagesincsharpproject = ScriptCollection.Executables:UpdateNugetpackagesInCsharpProject
63
+ scupdatetimestampinfile = ScriptCollection.Executables:UpdateTimestampInFile
32
64
  scuploadfile = ScriptCollection.Executables:UploadFile
@@ -1,122 +0,0 @@
1
- import os
2
- import base64
3
- import tempfile
4
- from subprocess import Popen
5
- from uuid import uuid4
6
-
7
- from .GeneralUtilities import GeneralUtilities
8
- from .ProgramRunnerBase import ProgramRunnerBase
9
- from .ProgramRunnerPopen import ProgramRunnerPopen
10
-
11
-
12
- class CustomEpewArgument:
13
-
14
- print_errors_as_information: bool
15
- log_file: str
16
- timeoutInSeconds: int
17
- addLogOverhead: bool
18
- title: str
19
- log_namespace: str
20
- verbosity: int
21
- arguments_for_log: list[str]
22
- tempdir = os.path.join(tempfile.gettempdir(), str(uuid4()))
23
- stdoutfile = tempdir + ".epew.stdout.txt"
24
- stderrfile = tempdir + ".epew.stderr.txt"
25
- exitcodefile = tempdir + ".epew.exitcode.txt"
26
- pidfile = tempdir + ".epew.pid.txt"
27
-
28
- def __init__(self, print_errors_as_information: bool, log_file: str, timeoutInSeconds: int, addLogOverhead: bool, title: str, log_namespace: str, verbosity: int, arguments_for_log: list[str]):
29
- self.print_errors_as_information = print_errors_as_information
30
- self.log_file = log_file
31
- self.timeoutInSeconds = timeoutInSeconds
32
- self.addLogOverhead = addLogOverhead
33
- self.title = title
34
- self.log_namespace = log_namespace
35
- self.verbosity = verbosity
36
- self.arguments_for_log = arguments_for_log
37
-
38
-
39
- class ProgramRunnerEpew(ProgramRunnerBase):
40
-
41
- @GeneralUtilities.check_arguments
42
- def run_program_argsasarray_async_helper(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive:bool=False) -> Popen:
43
- if GeneralUtilities.epew_is_available():
44
- custom_argument: CustomEpewArgument = custom_argument
45
- args = []
46
-
47
- base64argument = base64.b64encode(' '.join(arguments_as_array).encode('utf-8')).decode('utf-8')
48
- args.append(f'-p "{program}"')
49
- args.append(f'-a {base64argument}')
50
- args.append('-b')
51
- args.append(f'-w "{working_directory}"')
52
- if custom_argument.stdoutfile is not None:
53
- args.append(f'-o {custom_argument.stdoutfile}')
54
- if custom_argument.stderrfile is not None:
55
- args.append(f'-e {custom_argument.stderrfile}')
56
- if custom_argument.exitcodefile is not None:
57
- args.append(f'-x {custom_argument.exitcodefile}')
58
- if custom_argument.pidfile is not None:
59
- args.append(f'-r {custom_argument.pidfile}')
60
- args.append(f'-d {str(custom_argument.timeoutInSeconds*1000)}')
61
- args.append(f'-t "{custom_argument.title}"')
62
- args.append(f'-l "{custom_argument.log_namespace}"')
63
- if not GeneralUtilities.string_is_none_or_whitespace(custom_argument.log_file):
64
- args.append(f'-f "{custom_argument.log_file}"')
65
- if custom_argument.print_errors_as_information:
66
- args.append("-i")
67
- if custom_argument.addLogOverhead:
68
- args.append("-g")
69
- args.append("-v "+str(custom_argument.verbosity))
70
- return ProgramRunnerPopen().run_program_argsasarray_async_helper("epew", args, working_directory,custom_argument,interactive)
71
- else:
72
- raise ValueError("Epew is not available.")
73
-
74
- # Return-values program_runner: Exitcode, StdOut, StdErr, Pid
75
- @GeneralUtilities.check_arguments
76
- def wait(self, process: Popen, custom_argument: object = None) -> tuple[int, str, str, int]:
77
- process.wait()
78
- custom_argument: CustomEpewArgument = custom_argument
79
- stdout = self.__load_text(custom_argument.output_file_for_stdout)
80
- stderr = self.__load_text(custom_argument.output_file_for_stderr)
81
- exit_code = self.__get_number_from_filecontent(self.__load_text(custom_argument.output_file_for_exit_code))
82
- pid = self.__get_number_from_filecontent(self.__load_text(custom_argument.output_file_for_pid))
83
- GeneralUtilities.ensure_directory_does_not_exist(custom_argument.tempdir)
84
- result = (exit_code, stdout, stderr, pid)
85
- return result
86
-
87
- @GeneralUtilities.check_arguments
88
- def run_program_argsasarray(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive:bool=False) -> tuple[int, str, str, int]:
89
- process: Popen = self.run_program_argsasarray_async_helper(program, arguments_as_array, working_directory, custom_argument,interactive)
90
- return self.wait(process, custom_argument)
91
-
92
- @GeneralUtilities.check_arguments
93
- def run_program(self, program: str, arguments: str = "", working_directory: str = None, custom_argument: object = None, interactive:bool=False) -> tuple[int, str, str, int]:
94
- return self.run_program_argsasarray(program, GeneralUtilities.arguments_to_array(arguments), working_directory, custom_argument,interactive)
95
-
96
- @GeneralUtilities.check_arguments
97
- def run_program_argsasarray_async(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive:bool=False) -> int:
98
- return self.run_program_argsasarray_async_helper(program, arguments_as_array, working_directory, custom_argument,interactive).pid
99
-
100
- @GeneralUtilities.check_arguments
101
- def run_program_async(self, program: str, arguments: str = "", working_directory: str = None, custom_argument: object = None, interactive:bool=False) -> int:
102
- return self.run_program_argsasarray_async(program, GeneralUtilities.arguments_to_array(arguments), working_directory, custom_argument,interactive)
103
-
104
- @GeneralUtilities.check_arguments
105
- def __get_number_from_filecontent(self, filecontent: str) -> int:
106
- for line in filecontent.splitlines():
107
- try:
108
- striped_line = GeneralUtilities.strip_new_line_character(line)
109
- result = int(striped_line)
110
- return result
111
- except:
112
- pass
113
- raise ValueError(f"'{filecontent}' does not containe an int-line")
114
-
115
- @GeneralUtilities.check_arguments
116
- def __load_text(self, file: str) -> str:
117
- if os.path.isfile(file):
118
- content = GeneralUtilities.read_text_from_file(file).replace('\r', '')
119
- os.remove(file)
120
- return content
121
- else:
122
- raise ValueError(f"File '{file}' does not exist")
@@ -1,42 +0,0 @@
1
- import os
2
- import psutil
3
- from .GeneralUtilities import GeneralUtilities
4
- from .ProcessesRunner import ProcessStartInformation, ProcessesRunner
5
- # streams the local libcam-vid-stream to a rtsp-server
6
-
7
-
8
- class RPStream:
9
-
10
- __working_directory: str = None
11
- __pid_file: str = None
12
-
13
- def __init__(self, working_directory: str):
14
- self.__working_directory = working_directory
15
- self.__pid_file = os.path.join(self.__working_directory, "pid.txt")
16
-
17
- def __get_pid(self) -> str:
18
- GeneralUtilities.ensure_file_exists(self.__pid_file)
19
- return GeneralUtilities.read_text_from_file(self.__pid_file)
20
-
21
- def __set_pid(self, pid: str):
22
- GeneralUtilities.ensure_file_exists(self.__pid_file)
23
- GeneralUtilities.write_text_to_file(self.__pid_file, pid)
24
-
25
- def __ensure_previous_process_is_not_running(self):
26
- pid = self.__get_pid()
27
- if GeneralUtilities.string_has_content(pid):
28
- for proc in psutil.process_iter():
29
- if proc.pid == pid and proc.name() == "python":
30
- proc.kill()
31
-
32
- def __start_stream(self):
33
- prinfo: list[ProcessStartInformation] = list[ProcessStartInformation]()
34
- prinfo.append(ProcessStartInformation(None, "", ""))
35
- prinfo.append(ProcessStartInformation(None, "", ""))
36
- processesRunner: ProcessesRunner = ProcessesRunner(prinfo)
37
- self.__set_pid(str(os.getpid()))
38
- processesRunner.run()
39
-
40
- def start(self):
41
- self.__ensure_previous_process_is_not_running()
42
- self.__start_stream()