Skip to content

Commit

Permalink
rejig more things
Browse files Browse the repository at this point in the history
  • Loading branch information
cheahjs committed Feb 3, 2024
1 parent 370ea9f commit 7fde4e4
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 28 deletions.
14 changes: 14 additions & 0 deletions hatch.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[version]
source = "vcs"

[build.targets.sdist]
exclude = ["/.github", "/convenience_tools"]

[build.targets.wheel]
packages = ["palworld_save_tools"]

[envs.test]
dependencies = ["parameterized"]

[envs.test.scripts]
run = "python -m unittest -v"
Empty file.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
# This scripts takes a .sav file as input, and runs through the sav > JSON > sav process to ensure that the output is the same as the input.
import sys

from palworld_save_tools.commands.convert import (
convert_json_to_sav,
convert_sav_to_json,
)
from palworld_save_tools.palsav import decompress_sav_to_gvas
from palworld_save_tools.scripts.convert import convert_json_to_sav, convert_sav_to_json


def main():
Expand Down
2 changes: 1 addition & 1 deletion palworld_save_tools/rawdata/base_camp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Any, Sequence

from lib.archive import *
from palworld_save_tools.archive import *


def decode(
Expand Down
14 changes: 1 addition & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,5 @@ dynamic = ["version"]
Homepage = "https://github.com/cheahjs/palworld-save-tools"
Issues = "https://github.com/cheahjs/palworld-save-tools/issues"

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.targets.sdist]
exclude = [
"/.github",
"/convenience_tools",
]

[tool.hatch.build.targets.wheel]
packages = ["palworld_save_tools"]

[project.scripts]
cli-name = "palworld_save_tools.scripts.convert:main"
palworld-save-tools = "palworld_save_tools.commands.convert:main"
12 changes: 8 additions & 4 deletions tests/test_cli_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def test_sav_roundtrip(self, file_name):
run = subprocess.run(
[
"python3",
"convert.py",
"-m",
"palworld_save_tools.commands.convert",
f"tests/testdata/{dir_name}/{base_name}",
]
)
Expand All @@ -49,7 +50,8 @@ def test_sav_roundtrip(self, file_name):
run = subprocess.run(
[
"python3",
"convert.py",
"-m",
"palworld_save_tools.commands.convert",
f"tests/testdata/{dir_name}/1-{base_name}.json",
]
)
Expand All @@ -63,7 +65,8 @@ def test_sav_roundtrip(self, file_name):
run = subprocess.run(
[
"python3",
"convert.py",
"-m",
"palworld_save_tools.commands.convert",
f"tests/testdata/{dir_name}/2-{base_name}",
]
)
Expand All @@ -79,7 +82,8 @@ def test_sav_roundtrip(self, file_name):
run = subprocess.run(
[
"python3",
"convert.py",
"-m",
"palworld_save_tools.commands.convert",
f"tests/testdata/{dir_name}/3-{base_name}.json",
]
)
Expand Down
11 changes: 5 additions & 6 deletions tests/test_gvas.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import base64
import json
import unittest
import uuid

from parameterized import parameterized

from .archive import UUID, FArchiveReader, FArchiveWriter
from .gvas import GvasFile, GvasHeader
from .json_tools import CustomEncoder
from .palsav import decompress_sav_to_gvas
from .paltypes import PALWORLD_CUSTOM_PROPERTIES, PALWORLD_TYPE_HINTS
from palworld_save_tools.archive import UUID, FArchiveReader, FArchiveWriter
from palworld_save_tools.gvas import GvasFile, GvasHeader
from palworld_save_tools.json_tools import CustomEncoder
from palworld_save_tools.palsav import decompress_sav_to_gvas
from palworld_save_tools.paltypes import PALWORLD_CUSTOM_PROPERTIES, PALWORLD_TYPE_HINTS


class TestGvas(unittest.TestCase):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_rawdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

from parameterized import parameterized

from .archive import FArchiveReader
from .json_tools import CustomEncoder
from .rawdata import character, foliage_model_instance, group
from palworld_save_tools.archive import FArchiveReader
from palworld_save_tools.json_tools import CustomEncoder
from palworld_save_tools.rawdata import character, foliage_model_instance, group


class TestRawData(unittest.TestCase):
Expand Down

0 comments on commit 7fde4e4

Please sign in to comment.