ScriptCollection 3.5.71__py3-none-any.whl → 3.5.73__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.
@@ -534,15 +534,24 @@ def Copy() -> int:
534
534
  parser.add_argument('-s', '--source', required=True)
535
535
  parser.add_argument('-t', '--target', required=True)
536
536
  args = parser.parse_args()
537
- if os.path.isfile(args.target) or os.path.isdir(args.target):
537
+
538
+ if not (os.path.isfile(args.target) or os.path.isdir(args.target)):
538
539
  raise ValueError(f"Can not copy to '{args.target}' because the target already exists.")
539
- if os.path.isfile(args.source):
540
- shutil.copyfile(args.source, args.target)
541
- elif os.path.isdir(args.source):
542
- GeneralUtilities.ensure_directory_exists(args.target)
543
- GeneralUtilities.copy_content_of_folder(args.source,args.target)
540
+
541
+ source=args.source
542
+ if not os.path.isabs(source):
543
+ source=GeneralUtilities.resolve_relative_path(source,os.getcwd())
544
+ target=args.target
545
+ if not os.path.isabs(target):
546
+ target=GeneralUtilities.resolve_relative_path(target,os.getcwd())
547
+
548
+ if os.path.isfile(source):
549
+ shutil.copyfile(source, target)
550
+ elif os.path.isdir(source):
551
+ GeneralUtilities.ensure_directory_exists(target)
552
+ GeneralUtilities.copy_content_of_folder(source,target)
544
553
  else:
545
- raise ValueError(f"'{args.source}' can not be copied because the path does not exist.")
554
+ raise ValueError(f"'{source}' can not be copied because the path does not exist.")
546
555
  return 0
547
556
 
548
557
 
@@ -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.71"
35
+ version = "3.5.73"
36
36
  __version__ = version
37
37
 
38
38
 
@@ -707,10 +707,20 @@ class ScriptCollectionCore:
707
707
  raise ValueError(f"Fatal error occurrs while removing folder '{path}'. StdErr: '{stderr}'")
708
708
 
709
709
  @GeneralUtilities.check_arguments
710
- def copy(self, path: str,source:str,target:str) ->None:
710
+ def rename(self, source:str,target:str) ->None:
711
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
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):
713
+ os.rename(source, target)
714
+ else:
715
+ exit_code, _, stderr, _ = self.run_program_argsasarray("screname", ["--source", source,"--target",target], throw_exception_if_exitcode_is_not_zero=False) # works platform-indepent
716
+ if exit_code != 0:
717
+ raise ValueError(f"Fatal error occurrs while renaming '{source}' to '{target}'. StdErr: '{stderr}'")
718
+
719
+ @GeneralUtilities.check_arguments
720
+ def copy(self, source:str,target:str) ->None:
721
+ """This function works platform-independent also for non-local-executions if the ScriptCollection commandline-commands are available as global command on the target-system."""
722
+ if self.program_runner.will_be_executed_locally(): # works only locally, but much more performant than always running an external program
723
+ if not (os.path.isfile(target) or os.path.isdir(target)):
714
724
  raise ValueError(f"Can not copy to '{target}' because the target already exists.")
715
725
  if os.path.isfile(source):
716
726
  shutil.copyfile(source, target)
@@ -722,7 +732,7 @@ class ScriptCollectionCore:
722
732
  else:
723
733
  exit_code, _, stderr, _ = self.run_program_argsasarray("sccopy", ["--source", source,"--target", target], throw_exception_if_exitcode_is_not_zero=False) # works platform-indepent
724
734
  if exit_code != 0:
725
- raise ValueError(f"Fatal error occurrs while removing file '{path}'. StdErr: '{stderr}'")
735
+ raise ValueError(f"Fatal error occurrs while copying '{source}' to '{target}'. StdErr: '{stderr}'")
726
736
 
727
737
  @GeneralUtilities.check_arguments
728
738
  def __sort_fmd(self, line: str):
@@ -298,8 +298,7 @@ class TasksForCommonProjectStructure:
298
298
  verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
299
299
  codeunit_folder = str(Path(os.path.dirname(buildscript_file)).parent.parent.absolute())
300
300
  repository_folder: str = str(Path(os.path.dirname(buildscript_file)).parent.parent.parent.absolute())
301
- target_directory = GeneralUtilities.resolve_relative_path(
302
- "../Artifacts/BuildResult_Wheel", os.path.join(self.get_artifacts_folder(repository_folder, codeunitname)))
301
+ target_directory = GeneralUtilities.resolve_relative_path("../Artifacts/BuildResult_Wheel", os.path.join(self.get_artifacts_folder(repository_folder, codeunitname)))
303
302
  GeneralUtilities.ensure_directory_exists(target_directory)
304
303
  self.__sc.run_program("python", f"-m build --wheel --outdir {target_directory}", codeunit_folder, verbosity=verbosity)
305
304
  self.generate_bom_for_python_project(verbosity, codeunit_folder, codeunitname, commandline_arguments)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ScriptCollection
3
- Version: 3.5.71
3
+ Version: 3.5.73
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=fKPbcz_4mRVmadMicNE4jqXMi6v1YZDB9Swjh63OGO4,29791
1
+ ScriptCollection/Executables.py,sha256=r9dcUehrHVd7gQ2yEOy6QqDz8yOO8Qjp8vzszSUqBls,30022
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=8neAuchXguRDPoWFXLaGU8gsSOQ2Ywa5gaLmjhEDZuU,117798
9
- ScriptCollection/TasksForCommonProjectStructure.py,sha256=MtbaO3Sgew-cSSapf5XJ_7-ui2w3QGYwpvacX-l2K_w,215356
8
+ ScriptCollection/ScriptCollectionCore.py,sha256=IXyCZCXadGz-g-m2FqKUJBOziJE-YYxxrqTRwN8u5X8,118620
9
+ ScriptCollection/TasksForCommonProjectStructure.py,sha256=MGkpPFaFwEuADbgHWu_0nQBKhHYnarret895LgbGTeI,215343
10
10
  ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
11
11
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
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,,
12
+ ScriptCollection-3.5.73.dist-info/METADATA,sha256=MX0B33z4eIktZBU1HIE-L4oJJF3vVqME4yO269dtT0o,7664
13
+ ScriptCollection-3.5.73.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
+ ScriptCollection-3.5.73.dist-info/entry_points.txt,sha256=1jAL5AuB8mvdw2v-6E7wCZFThurQxchiQynL8DCi-Yg,3545
15
+ ScriptCollection-3.5.73.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
+ ScriptCollection-3.5.73.dist-info/RECORD,,
@@ -39,8 +39,8 @@ scprintfilecontent = ScriptCollection.Executables:PrintFileContent
39
39
  scprintfilesize = ScriptCollection.Executables:PrintFileSize
40
40
  scprintosname = ScriptCollection.Executables:PrintOSName
41
41
  scregexreplaceinfile = ScriptCollection.Executables:RegexReplaceInFile
42
- scremoveFolder = ScriptCollection.Executables:RemoveFolder
43
42
  scremovefile = ScriptCollection.Executables:RemoveFile
43
+ scremovefolder = ScriptCollection.Executables:RemoveFolder
44
44
  screname = ScriptCollection.Executables:Rename
45
45
  screplacesubstringsinfilenames = ScriptCollection.Executables:ReplaceSubstringsInFilenames
46
46
  scsearchinfiles = ScriptCollection.Executables:SearchInFiles