From 44b871647e6e4ac7fce1b36c1ca7110bec92e4a5 Mon Sep 17 00:00:00 2001 From: Mc-muffin <8714476+Mc-muffin@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:41:57 -0500 Subject: [PATCH] switch to dulwich --- pythonlib/games/ToolsTOR.py | 15 +++++++-------- requirements.txt | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/pythonlib/games/ToolsTOR.py b/pythonlib/games/ToolsTOR.py index 1ac45bb..887e010 100644 --- a/pythonlib/games/ToolsTOR.py +++ b/pythonlib/games/ToolsTOR.py @@ -11,7 +11,7 @@ from pathlib import Path import lxml.etree as etree import pycdlib import pyjson5 as json -from git import Repo +from dulwich import porcelain from tqdm import tqdm import pythonlib.formats.pak2 as pak2lib @@ -77,8 +77,7 @@ class ToolsTOR(ToolsTales): self.list_status_insertion: list[str] = ['Done'] self.list_status_insertion.extend(insert_mask) self.changed_only = changed_only - self.repo = Repo(base_path) - self.base_path = base_path + self.repo_path = str(base_path) # Extract the story files @@ -473,8 +472,8 @@ class ToolsTOR(ToolsTales): in_list = [] if self.changed_only: - for item in self.repo.index.diff(None): - item_path = Path(item.a_path) + for item in porcelain.status(self.repo_path).unstaged: + item_path = Path(item.decode("utf-8")) if item_path.parent.name == "skits": in_list.append(pak2_path / item_path.with_suffix(".3.pak2").name) if len(in_list) == 0: @@ -715,7 +714,7 @@ class ToolsTOR(ToolsTales): # Get the xml with open(xml_path / (p_file["friendly_name"] + ".xml"), "r", encoding='utf-8') as xmlFile: root = etree.fromstring(xmlFile.read(), parser=etree.XMLParser(recover=True)) - + with FileIO(pak[f_index].data, "rb") as f: self.pack_menu_file(root, pools, base_offset, f) @@ -939,8 +938,8 @@ class ToolsTOR(ToolsTales): in_list = [] if self.changed_only: - for item in self.repo.index.diff(None): - item_path = Path(item.a_path) + for item in porcelain.status(self.repo_path).unstaged: + item_path = Path(item.decode("utf-8")) if item_path.parent.name == "story": in_list.append(scpk_path / item_path.with_suffix(".scpk").name) if len(in_list) == 0: diff --git a/requirements.txt b/requirements.txt index 9c844d3..6804762 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,4 +8,4 @@ pygsheets==2.0.6 requests==2.30.0 tqdm==4.65.0 pyjson5==1.6.3 -GitPython==3.1.34 +dulwich==0.21.6