ScriptCollection 3.5.134__py3-none-any.whl → 3.5.135__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.
@@ -653,3 +653,11 @@ def Espoc() -> int:
653
653
  else:
654
654
  GeneralUtilities.write_message_to_stdout(f"File '{process_list_file}' does not exist. No processes to terminate.")
655
655
  return 0
656
+
657
+ def ConvertGitRepositoryToBareRepository()->int:
658
+ parser = argparse.ArgumentParser(description="Converts a local git-repository to a bare repository.")
659
+ parser.add_argument('-f', '--folder', required=True, help='Git-repository-folder which should be converted.')
660
+ args = parser.parse_args()
661
+ sc=ScriptCollectionCore()
662
+ sc.convert_git_repository_to_bare_repository(args.folder)
663
+ return 0
@@ -33,7 +33,7 @@ from .ProgramRunnerPopen import ProgramRunnerPopen
33
33
  from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
34
34
  from .SCLog import SCLog, LogLevel
35
35
 
36
- version = "3.5.134"
36
+ version = "3.5.135"
37
37
  __version__ = version
38
38
 
39
39
 
@@ -682,15 +682,41 @@ class ScriptCollectionCore:
682
682
  @GeneralUtilities.check_arguments
683
683
  def is_git_repository(self, folder: str) -> bool:
684
684
  """This function works platform-independent also for non-local-executions if the ScriptCollection commandline-commands are available as global command on the target-system."""
685
- combined = f"{folder}/.git"
686
- # TODO consider check for bare-repositories
687
- return self.is_folder(combined) or self.is_file(combined)
685
+ if folder.endswith("/") or folder.endswith("\\"):
686
+ folder = folder[:-1]
687
+ if not self.is_folder(folder):
688
+ raise ValueError(f"Folder '{folder}' does not exist.")
689
+ git_folder_path = f"{folder}/.git"
690
+ return self.is_folder(git_folder_path) or self.is_file(git_folder_path)
691
+
692
+ @GeneralUtilities.check_arguments
693
+ def is_git_or_bare_git_repository(self, folder: str) -> bool:
694
+ """This function works platform-independent also for non-local-executions if the ScriptCollection commandline-commands are available as global command on the target-system."""
695
+ if folder.endswith("/") or folder.endswith("\\"):
696
+ folder = folder[:-1]
697
+ if not self.is_folder(folder):
698
+ raise ValueError(f"Folder '{folder}' does not exist.")
699
+ return self.is_git_repository(folder) or self.is_folder(folder + ".git")
688
700
 
689
701
  @GeneralUtilities.check_arguments
690
702
  def assert_is_git_repository(self, folder: str) -> str:
691
703
  """This function works platform-independent also for non-local-executions if the ScriptCollection commandline-commands are available as global command on the target-system."""
692
704
  GeneralUtilities.assert_condition(self.is_git_repository(folder), f"'{folder}' is not a git-repository.")
693
705
 
706
+
707
+ @GeneralUtilities.check_arguments
708
+ def convert_git_repository_to_bare_repository(self,repository_folder:str):
709
+ repository_folder=repository_folder.replace("\\", "/")
710
+ self.assert_is_git_repository(repository_folder)
711
+ git_folder=repository_folder+ "/.git"
712
+ if not self.is_folder(git_folder):
713
+ raise ValueError(f"Converting '{repository_folder}' to a bare repository not possible. The folder '{git_folder}' does not exist. Converting is currently only supported when the git-folder is a direct folder in a repository and not a reference to another location.")
714
+ target_folder:str = repository_folder + ".git"
715
+ GeneralUtilities.ensure_directory_exists(target_folder)
716
+ GeneralUtilities.move_content_of_folder(git_folder, target_folder)
717
+ #GeneralUtilities.ensure_directory_does_not_exist(git_folder)
718
+ self.run_program_argsasarray("git", ["config", "--bool", "core.bare", "true"], target_folder)
719
+
694
720
  @GeneralUtilities.check_arguments
695
721
  def list_content(self, path: str, include_files: bool, include_folder: bool, printonlynamewithoutpath: bool) -> list[str]:
696
722
  """This function works platform-independent also for non-local-executions if the ScriptCollection commandline-commands are available as global command on the target-system."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ScriptCollection
3
- Version: 3.5.134
3
+ Version: 3.5.135
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
@@ -36,8 +36,8 @@ Requires-Dist: pycdlib>=1.14.0
36
36
  Requires-Dist: Pygments>=2.19.1
37
37
  Requires-Dist: pylint>=3.3.7
38
38
  Requires-Dist: pyOpenSSL>=25.1.0
39
- Requires-Dist: PyPDF>=5.5.0
40
- Requires-Dist: pytest>=8.3.5
39
+ Requires-Dist: PyPDF>=5.6.0
40
+ Requires-Dist: pytest>=8.4.0
41
41
  Requires-Dist: PyYAML>=6.0.2
42
42
  Requires-Dist: qrcode>=8.2
43
43
  Requires-Dist: send2trash>=1.8.3
@@ -1,5 +1,5 @@
1
1
  ScriptCollection/CertificateUpdater.py,sha256=OAxrG21k_o3W3niOOGNSZzUPJlvolOWc1lRB2dMhc3g,9212
2
- ScriptCollection/Executables.py,sha256=ht-RZFu4g34Sr09b_L0c2QpKcjLWX-wFtKSMDMZYqsw,32266
2
+ ScriptCollection/Executables.py,sha256=Sbi0cuHnd8PYROA9HcHQ00KJV805LtFhyiEl5PgHoIQ,32672
3
3
  ScriptCollection/GeneralUtilities.py,sha256=PKdzq382RYVSWeSG_6z6FiHu-SiTOi2BavJKvP-0slU,47308
4
4
  ScriptCollection/ImageUpdater.py,sha256=lel1nevTN7fgdoCDE6Xg8YY6XPsZaOQiCIyWXbmVnh0,20882
5
5
  ScriptCollection/ProcessesRunner.py,sha256=3mu4ZxzZleQo0Op6o9EYTCFiJfb6kx5ov2YfZfT89mU,1395
@@ -7,11 +7,11 @@ ScriptCollection/ProgramRunnerBase.py,sha256=2kMIAqdc65UjBAddOZkzy_aFx9h5roZ5a4b
7
7
  ScriptCollection/ProgramRunnerEpew.py,sha256=4pjEd0r9Fcz3TTDv0MdTSd5KkigYXcWUVI1X43regfU,6477
8
8
  ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
9
9
  ScriptCollection/SCLog.py,sha256=Dd2P8vH2PA830wAv6bchlMHHdGE_7At-F4WQY5w4XdA,4016
10
- ScriptCollection/ScriptCollectionCore.py,sha256=Q-Pww8KRGxQ53nx0eBuB5K6QbKpKez6PHdMioJBsawg,128945
10
+ ScriptCollection/ScriptCollectionCore.py,sha256=fRd_XYxY4Ly71H-cl7Vk0vMoQhnqL3z0g0mtEOeJYIk,130655
11
11
  ScriptCollection/TasksForCommonProjectStructure.py,sha256=b3bb3kSHSce3HgaitDyuZdQ82KroU1HFryANBycKo0I,235854
12
12
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- scriptcollection-3.5.134.dist-info/METADATA,sha256=PoP2X3FAK5g6nyNdRuUXw9yXWnKE3qnRPJtwFGk8Onc,7694
14
- scriptcollection-3.5.134.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
- scriptcollection-3.5.134.dist-info/entry_points.txt,sha256=3qMbfZEMhc_VTJj-bcLwB8AWcn9iXSB3l0AWpuu52Bs,3689
16
- scriptcollection-3.5.134.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
17
- scriptcollection-3.5.134.dist-info/RECORD,,
13
+ scriptcollection-3.5.135.dist-info/METADATA,sha256=O6I0hx9ir7iPCiyR8RK2xxVVrAeTtSN5-O2-0yiTqFI,7694
14
+ scriptcollection-3.5.135.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ scriptcollection-3.5.135.dist-info/entry_points.txt,sha256=AhXNaa8RMBRFO_4TzKi9jc32C-ZNIiU12mRGu6wEpBk,3796
16
+ scriptcollection-3.5.135.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
17
+ scriptcollection-3.5.135.dist-info/RECORD,,
@@ -6,6 +6,7 @@ scbuildcodeunitsc = ScriptCollection.Executables:BuildCodeUnitsC
6
6
  sccalculatebitcoinblockhash = ScriptCollection.Executables:CalculateBitcoinBlockHash
7
7
  scchangefileextension = ScriptCollection.Executables:ChangeFileExtensions
8
8
  scchangehashofprogram = ScriptCollection.Executables:ChangeHashOfProgram
9
+ scconvertgitrepositorytobarerepository = ScriptCollection.Executables:ConvertGitRepositoryToBareRepository
9
10
  sccopy = ScriptCollection.Executables:Copy
10
11
  sccreatechangelogentry = ScriptCollection.Executables:CreateChangelogEntry
11
12
  sccreateemptyfilewithspecificsize = ScriptCollection.Executables:CreateEmptyFileWithSpecificSize