switch to dulwich

This commit is contained in:
Mc-muffin
2023-09-06 14:41:57 -05:00
parent cd1ecc7286
commit 44b871647e
2 changed files with 8 additions and 9 deletions

View File

@@ -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:

View File

@@ -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