ScriptCollection 4.2.142__py3-none-any.whl → 4.2.143__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.
@@ -1148,6 +1148,17 @@ def RunCommandInFolder() -> int:
1148
1148
  return sc.run_command_in_folder(args.basefolder, args.command, args.arguments, args.actualfolder, args.excludedfolder)
1149
1149
 
1150
1150
 
1151
+ def RemoveTrailingLinebreak() -> int:
1152
+ parser = argparse.ArgumentParser(description="Removes the trailing linebreak from a file. If the last character is not a linebreak, the file is not modified.")
1153
+ parser.add_argument('-p', '--path', required=True, help="Path to the file.")
1154
+ args = parser.parse_args()
1155
+ if not os.path.isfile(args.path):
1156
+ GeneralUtilities.write_message_to_stderr(f"File '{args.path}' does not exist.")
1157
+ return 1
1158
+ ScriptCollectionCore().remove_trailing_linebreak(args.path)
1159
+ return 0
1160
+
1161
+
1151
1162
  def SyncXlfFiles()->int:
1152
1163
  parser = argparse.ArgumentParser(description="This function syncs the content of xlf-files in a folder. This is useful to keep the content of xlf-files in sync which are used for translations in software projects.")
1153
1164
  parser.add_argument('-p', '--prefix', required=True, help="File prefix. Example: 'message' when the files are named 'message.xlf', 'message.fr.xlf', etc.")
@@ -38,7 +38,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
38
38
  from .ProgramRunnerPopen import ProgramRunnerPopen
39
39
  from .SCLog import SCLog, LogLevel
40
40
 
41
- version = "4.2.142"
41
+ version = "4.2.143"
42
42
  __version__ = version
43
43
 
44
44
  class VSCodeWorkspaceShellTask:
@@ -2762,6 +2762,14 @@ TXDX
2762
2762
  if normalized_content != content:
2763
2763
  GeneralUtilities.write_binary_to_file(file, normalized_content)
2764
2764
 
2765
+ @GeneralUtilities.check_arguments
2766
+ def remove_trailing_linebreak(self, file: str) -> None:
2767
+ content = GeneralUtilities.read_binary_from_file(file)
2768
+ if content.endswith(b"\r\n"):
2769
+ GeneralUtilities.write_binary_to_file(file, content[:-2])
2770
+ elif content.endswith(b"\n") or content.endswith(b"\r"):
2771
+ GeneralUtilities.write_binary_to_file(file, content[:-1])
2772
+
2765
2773
  @GeneralUtilities.check_arguments
2766
2774
  def format_html_content(self, content: str, add_html_declaration: bool = False) -> str:
2767
2775
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptcollection
3
- Version: 4.2.142
3
+ Version: 4.2.143
4
4
  Summary: The ScriptCollection is the place for reusable scripts.
5
5
  Author-email: Marius Göcke <marius.goecke@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/anionDev/ScriptCollection
@@ -22,7 +22,7 @@ Classifier: Topic :: Utilities
22
22
  Requires-Python: >=3.11
23
23
  Description-Content-Type: text/markdown
24
24
  Requires-Dist: build>=1.5.0
25
- Requires-Dist: coverage>=7.14.1
25
+ Requires-Dist: coverage>=7.14.2
26
26
  Requires-Dist: cyclonedx-bom>=7.1.0
27
27
  Requires-Dist: defusedxml>=0.7.1
28
28
  Requires-Dist: keyboard>=0.13.5
@@ -35,7 +35,7 @@ Requires-Dist: pycdlib>=1.16.0
35
35
  Requires-Dist: Pygments>=2.20.0
36
36
  Requires-Dist: pylint>=4.0.6
37
37
  Requires-Dist: pyOpenSSL>=25.3.0
38
- Requires-Dist: PyPDF>=6.13.2
38
+ Requires-Dist: PyPDF>=6.13.3
39
39
  Requires-Dist: pytest>=8.4.2
40
40
  Requires-Dist: PyYAML>=6.0.3
41
41
  Requires-Dist: qrcode>=8.2.0
@@ -1,6 +1,6 @@
1
1
  ScriptCollection/AnionBuildPlatform.py,sha256=vg1lZ6D1nqq_mO7iYTDSktSImXd34scfPaXiIrbvrg0,11848
2
2
  ScriptCollection/CertificateUpdater.py,sha256=dR5JpJDlZdjD4_pgMz7zCrt1IM7VfatmK6pULSczxQw,9693
3
- ScriptCollection/Executables.py,sha256=-xsbCfQEwGYBIkr6EKGe9qjFwDYDj7_BjFNXgUnIw4E,61402
3
+ ScriptCollection/Executables.py,sha256=TkAzd2_nfRdqiUR_QG2uGFcdbxOqpmslJBpOiBZcz0M,61938
4
4
  ScriptCollection/GeneralUtilities.py,sha256=cJK18rWzmVT3KyvjIAbPK4o4-jVPwYeuVpizbTHjBDc,68136
5
5
  ScriptCollection/HTTPMaintenanceOverheadHelper.py,sha256=TToNtyO1XzsMbBsTBf3o0xgOK0v4Jf03qw2Z0xb2nCk,2007
6
6
  ScriptCollection/ProcessesRunner.py,sha256=yYaC95h40uszuZPggn2kK3qXIN2ZjGMCavo-NQ53ElQ,1537
@@ -9,7 +9,7 @@ ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrR
9
9
  ScriptCollection/ProgramRunnerPopen.py,sha256=8tP0xWKeRYoGlaNB3iUh4o61O-tKtcxrS7IUqtU85C4,4091
10
10
  ScriptCollection/ProgramRunnerSudo.py,sha256=RXsiceQ8W6a8YDk_2BPscVbIAmDIpIxqe9WHBy2r4CM,5233
11
11
  ScriptCollection/SCLog.py,sha256=Z-HhC_CRtU3HdQflNsabFh9IJOucHcXmxMDcf58fli0,4671
12
- ScriptCollection/ScriptCollectionCore.py,sha256=SAGh9zm10KLbSSLC2XxAw-WmI-Wb-FvjPAD2pyFS7y8,217136
12
+ ScriptCollection/ScriptCollectionCore.py,sha256=IfOU4a2JEtpeUYrpv_nVGITK3IC6GQCT_2snKJ2lmS0,217549
13
13
  ScriptCollection/UnassignedVariablesCheck.py,sha256=v59qLQ5RRvx31ouuCW7NWZj3McWENvGBPkV5ZGBmqJE,4344
14
14
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  ScriptCollection/OCIImages/AbstractImageHandler.py,sha256=o129UYDtLymCRjMZBP9Puaj19ueMHoNt6UTLspfnaRc,1758
@@ -55,8 +55,8 @@ ScriptCollection/TFCPS/Python/TFCPS_CodeUnitSpecific_Python.py,sha256=fqGhXNx8tK
55
55
  ScriptCollection/TFCPS/Python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
56
  ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=WhOsMpJxNGqnQGA3nJ99ruyqymxBeJxCcpK98zJduTo,1680
57
57
  ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
- scriptcollection-4.2.142.dist-info/METADATA,sha256=2YPSeP8iem-PnABUVkTueuiNkxwzluO1-ncqfvbdpDs,7817
59
- scriptcollection-4.2.142.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
60
- scriptcollection-4.2.142.dist-info/entry_points.txt,sha256=kUHH9H7MmheMRWvygzYBAw76GwbBKKsSWLyWI-nnNKw,5292
61
- scriptcollection-4.2.142.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
62
- scriptcollection-4.2.142.dist-info/RECORD,,
58
+ scriptcollection-4.2.143.dist-info/METADATA,sha256=XiZBTRJ63csd7tY8dKo5WHKmMc-3OxdTDyhKhfBza08,7817
59
+ scriptcollection-4.2.143.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
60
+ scriptcollection-4.2.143.dist-info/entry_points.txt,sha256=IUIlg0se3DubH9yuMrFE0sl92BXPdCqCPt0N7uGASs4,5373
61
+ scriptcollection-4.2.143.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
62
+ scriptcollection-4.2.143.dist-info/RECORD,,
@@ -56,6 +56,7 @@ screclaimspacefromdocker = ScriptCollection.Executables:ReclaimSpaceFromDocker
56
56
  scregexreplaceinfile = ScriptCollection.Executables:RegexReplaceInFile
57
57
  scremovefile = ScriptCollection.Executables:RemoveFile
58
58
  scremovefolder = ScriptCollection.Executables:RemoveFolder
59
+ scremovetrailinglinebreak = ScriptCollection.Executables:RemoveTrailingLinebreak
59
60
  screname = ScriptCollection.Executables:Rename
60
61
  screplacesubstringsinfilenames = ScriptCollection.Executables:ReplaceSubstringsInFilenames
61
62
  scruncommandinfolder = ScriptCollection.Executables:RunCommandInFolder