-
-
Notifications
You must be signed in to change notification settings - Fork 169
Cleanup Texture2DConverter and fix typos in pyproject.toml #324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6660d27 to
3517281
Compare
K0lb3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry that I'm only replying now.
I will be blunt, I don't really see the point of this PR.
The typo fixes, doc string adjustments and the BC format collapsing are okay, but that's it.
TextureSwizzler.get_corrected_texture_format is basically a one-time use function,
which only adds a layer of indirection without any benefit, as at one of the two places where it's being used, the same check has to be done again anyway.
TextureSwizzler.PlatformBlobType is also not really useful.
The usage of bytes from before was actually wrong, as the platformblob type is defined by the Texture2D field of it, so just List[int] is enough.
The platform type also doesn't have to be narrowed down to BuildTarget,
as the only use of platform is in an equality check, which works just fine with an int as well.
3517281 to
9178ed7
Compare
|
Apologies - I didn’t fully considered the current needs, so I’ve decided to go ahead and revert the 3 changes you mentioned, to narrow the PR to only typo fixes. My initial intention with these changes was to centralize the logic and make the code more readable in the long run. But I understand that, the added abstraction doesn’t bring enough value and instead introduces unnecessary complexity. Thanks again for your constructive feedback - it’s much appreciated. |
|
This PR now contains:
with some new changes:
|
pyproject.toml
Outdated
| description = "A Unity extraction and patching package" | ||
| readme = "README.md" | ||
| license = "MIT" | ||
| license = { text = "MIT" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Directly writing a SPDX license expression is the new expected value for the license field, see Writing your pyproject.toml - Python Packaging User Guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, PEP 639 adopted SPDX format, and toml-table based format is deprecating. But sadly for Python<=3.8/setuptools<=v75.3.2 , build will fail.
I have reverted this line of change, and you can decide how to deal with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying that.
I guess that I will simply have to set the min version to 3.9.
3.7 is already broken due to typing_extensions used in some dependency, so might as well remove 3.8 support as well.
As there are already breaking commits up, this can come with the next minor update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As indicated in that issue, I will simply drop the commit that changed the version, while adding a new one for the setuptools max version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imo, we might consider delaying the restriction on the maximum version of setuptools, as some projects that currently rely on the latest version of setuptools may encounter dependency resolution errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will simply set to to a possible future version, going by the current release cadence for now, as I would probably forget about it otherwise.
You have a pretty good point there that I didn't even think about.
This makes the whole issue very tricky.
I prefer to support old versions as long as it doesn't take too much effort to support them,
and there are certainly options to work around the issue, just that they are a bit too hacky imo.
9178ed7 to
17f581b
Compare
|
Thanks for the changes and the effort. My handling of OOP and abstraction in UnityPy, and well, overall, is probably pretty non-standard, and might appear a bit arbitrary, which I'm sorry for. Anyway, |
17f581b to
b09ac75
Compare
75cd5ba to
f74797f
Compare
Summary
This PR does some minor changes to Texture2DConverter.
platform_blobcan beList[int]in newer version of Unity, instead of onlybytes.platform_blobtype hint still usesbytes, now corrected toList[int].if TYPE_CHECKING: assert xxx is not Noneseems redundant, now removedif.Pre-convertsplatformtoBuildTargetenum.Wraps swizzle texture_format conversion into TextureSwizzler.image_to_texture2d.Along with two typo fixes in the
pyproject.toml:Fixes the invalid license field inpyproject.tomlwhich causes CodeQL failing.data-miniginpyproject.toml.