ScriptCollection 3.5.69__py3-none-any.whl → 3.5.71__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.
@@ -411,7 +411,7 @@ def FolderExists() -> int:
411
411
 
412
412
 
413
413
  def SetContentOfFile() -> int:
414
- GeneralUtilities.write_exception_to_stderr("This function is not implemented yet.")
414
+ GeneralUtilities.write_message_to_stderr("This function is not implemented yet.")
415
415
  # TODO implement function
416
416
  return 1
417
417
 
@@ -454,7 +454,7 @@ def CreateFolder() -> int:
454
454
 
455
455
 
456
456
  def AppendLineToFile() -> int:
457
- GeneralUtilities.write_exception_to_stderr("This function is not implemented yet.")
457
+ GeneralUtilities.write_message_to_stderr("This function is not implemented yet.")
458
458
  # TODO implement function
459
459
  # TODO add switch to set if adding new line at begin of line should be skipped if the file already ends with a new-line-character
460
460
  # TODO add switch to enable/disable appending another new-line-character at the end of the file
@@ -462,7 +462,7 @@ def AppendLineToFile() -> int:
462
462
 
463
463
 
464
464
  def RegexReplaceInFile() -> int:
465
- GeneralUtilities.write_exception_to_stderr("This function is not implemented yet.")
465
+ GeneralUtilities.write_message_to_stderr("This function is not implemented yet.")
466
466
  # TODO implement function
467
467
  return 1
468
468
 
@@ -482,7 +482,7 @@ def PrintFileSize() -> int:
482
482
 
483
483
 
484
484
  def FileContainsContent() -> int:
485
- GeneralUtilities.write_exception_to_stderr("This function is not implemented yet.")
485
+ GeneralUtilities.write_message_to_stderr("This function is not implemented yet.")
486
486
  # TODO implement function
487
487
  # TODO add switch to set if the input pattern should be treated as regex
488
488
  return 1
@@ -547,7 +547,6 @@ def Copy() -> int:
547
547
 
548
548
 
549
549
  def PrintOSName() -> int:
550
- GeneralUtilities.write_exception_to_stderr("This function is not implemented yet.")
551
550
  if GeneralUtilities.current_system_is_windows():
552
551
  GeneralUtilities.write_message_to_stdout("Windows")
553
552
  elif GeneralUtilities.current_system_is_linux():
@@ -565,7 +564,6 @@ def PrintCurrecntWorkingDirectory() -> int:
565
564
 
566
565
 
567
566
  def ListFolderContent() -> int:
568
- GeneralUtilities.write_exception_to_stderr("This function is not implemented yet.")
569
567
  parser = argparse.ArgumentParser(description="This function lists folder-content.")
570
568
  parser.add_argument('-p', '--path', required=True)
571
569
  parser.add_argument('-f', '--excludefiles', action='store_true', required=False,default=False)
@@ -593,7 +591,7 @@ def ListFolderContent() -> int:
593
591
 
594
592
 
595
593
  def ForEach() -> int:
596
- GeneralUtilities.write_exception_to_stderr("This function is not implemented yet.")
594
+ GeneralUtilities.write_message_to_stderr("This function is not implemented yet.")
597
595
  # TODO implement function
598
596
  return 1
599
597
 
@@ -32,7 +32,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
32
32
  from .ProgramRunnerPopen import ProgramRunnerPopen
33
33
  from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
34
34
 
35
- version = "3.5.69"
35
+ version = "3.5.71"
36
36
  __version__ = version
37
37
 
38
38
 
@@ -631,7 +631,7 @@ class ScriptCollectionCore:
631
631
  GeneralUtilities.assert_condition(self.is_git_repository(folder), f"'{folder}' is not a git-repository.")
632
632
 
633
633
  @GeneralUtilities.check_arguments
634
- def list_content(self, path: str,include_files:bool,include_folder:bool) -> list[str]:
634
+ def list_content(self, path: str,include_files:bool,include_folder:bool,printonlynamewithoutpath:bool) -> list[str]:
635
635
  """This function works platform-independent also for non-local-executions if the ScriptCollection commandline-commands are available as global command on the target-system."""
636
636
  if self.program_runner.will_be_executed_locally():
637
637
  result=[]
@@ -646,6 +646,8 @@ class ScriptCollectionCore:
646
646
  arguments=arguments+["--excludefiles"]
647
647
  if not include_folder:
648
648
  arguments=arguments+["--excludedirectories"]
649
+ if printonlynamewithoutpath:
650
+ arguments=arguments+["--printonlynamewithoutpath"]
649
651
  exit_code, stdout, stderr, _ = self.run_program_argsasarray("sclistfoldercontent", arguments)
650
652
  if exit_code == 0:
651
653
  result:list[str]=[]
@@ -704,6 +706,24 @@ class ScriptCollectionCore:
704
706
  if exit_code != 0:
705
707
  raise ValueError(f"Fatal error occurrs while removing folder '{path}'. StdErr: '{stderr}'")
706
708
 
709
+ @GeneralUtilities.check_arguments
710
+ def copy(self, path: str,source:str,target:str) ->None:
711
+ """This function works platform-independent also for non-local-executions if the ScriptCollection commandline-commands are available as global command on the target-system."""
712
+ if self.program_runner.will_be_executed_locally(): # works only locally, but much more performant than always running an external program
713
+ if os.path.isfile(target) or os.path.isdir(target):
714
+ raise ValueError(f"Can not copy to '{target}' because the target already exists.")
715
+ if os.path.isfile(source):
716
+ shutil.copyfile(source, target)
717
+ elif os.path.isdir(source):
718
+ GeneralUtilities.ensure_directory_exists(target)
719
+ GeneralUtilities.copy_content_of_folder(source,target)
720
+ else:
721
+ raise ValueError(f"'{source}' can not be copied because the path does not exist.")
722
+ else:
723
+ exit_code, _, stderr, _ = self.run_program_argsasarray("sccopy", ["--source", source,"--target", target], throw_exception_if_exitcode_is_not_zero=False) # works platform-indepent
724
+ if exit_code != 0:
725
+ raise ValueError(f"Fatal error occurrs while removing file '{path}'. StdErr: '{stderr}'")
726
+
707
727
  @GeneralUtilities.check_arguments
708
728
  def __sort_fmd(self, line: str):
709
729
  splitted: list = line.split(";")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ScriptCollection
3
- Version: 3.5.69
3
+ Version: 3.5.71
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
@@ -1,16 +1,16 @@
1
- ScriptCollection/Executables.py,sha256=dyToDh4vd0k0Ox9TE4E_4-jY46XU6A6rguOL5R6Moj4,29977
1
+ ScriptCollection/Executables.py,sha256=fKPbcz_4mRVmadMicNE4jqXMi6v1YZDB9Swjh63OGO4,29791
2
2
  ScriptCollection/GeneralUtilities.py,sha256=WSBawT958x_0H-hnPg3S3DGzP3KOQTADtZtP145I-M4,39473
3
3
  ScriptCollection/ProcessesRunner.py,sha256=3mu4ZxzZleQo0Op6o9EYTCFiJfb6kx5ov2YfZfT89mU,1395
4
4
  ScriptCollection/ProgramRunnerBase.py,sha256=2kMIAqdc65UjBAddOZkzy_aFx9h5roZ5a4bQNM6RV6Y,2480
5
5
  ScriptCollection/ProgramRunnerEpew.py,sha256=4pjEd0r9Fcz3TTDv0MdTSd5KkigYXcWUVI1X43regfU,6477
6
6
  ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
7
7
  ScriptCollection/RPStream.py,sha256=NRRHL3YSP3D9MuAV2jB_--0KUKCsvJGxeKnxgrRZ9kY,1545
8
- ScriptCollection/ScriptCollectionCore.py,sha256=qrFos1Od9o4paGQwKAKbeFZd72CwMbctYwVr2PI5SqU,116344
8
+ ScriptCollection/ScriptCollectionCore.py,sha256=8neAuchXguRDPoWFXLaGU8gsSOQ2Ywa5gaLmjhEDZuU,117798
9
9
  ScriptCollection/TasksForCommonProjectStructure.py,sha256=MtbaO3Sgew-cSSapf5XJ_7-ui2w3QGYwpvacX-l2K_w,215356
10
10
  ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
11
11
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- ScriptCollection-3.5.69.dist-info/METADATA,sha256=K88GUkBl1Hf3WB0WQ67vdgCEzR4Pn6z3wkkPd5uH0eA,7664
13
- ScriptCollection-3.5.69.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
- ScriptCollection-3.5.69.dist-info/entry_points.txt,sha256=psYFu5te0W8zF5k444Qi21IZN4UwwGbw-XR22nvKTYE,3545
15
- ScriptCollection-3.5.69.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
- ScriptCollection-3.5.69.dist-info/RECORD,,
12
+ ScriptCollection-3.5.71.dist-info/METADATA,sha256=5Y_vynhH25g0cH8eIoAJ-Az-UfZuXM-WLCNjiL_f6I0,7664
13
+ ScriptCollection-3.5.71.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
+ ScriptCollection-3.5.71.dist-info/entry_points.txt,sha256=psYFu5te0W8zF5k444Qi21IZN4UwwGbw-XR22nvKTYE,3545
15
+ ScriptCollection-3.5.71.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
+ ScriptCollection-3.5.71.dist-info/RECORD,,