Open QDucasse opened 1 year ago
However, the raw unicorn in resources.files has to replace the name that was here before that referenced unicorn.unicorn. The exact same issue occurs in the capstone disassembler (which I can open an issue for) and the same fix is possible but since the package discovery occurs in the init.py file, it can keep resources.files(name) / "lib.
I'm confused by these lines about __name__
. How does it relate to your changes?
I just wanted to point out the change from __name__
(which resolved to unicorn.unicorn
and was fine for pkg_resources
, but is not anymore for resources
) to unicorn
. This change makes it work and not raise a TypeError: 'unicorn.unicorn' is not a package
. In capstone, the same issue occurs but since pkg_resources.resource_filename(__name__, 'lib')
is used in the __init__.py
file, __name__
resolves to capstone
directly and not capstone.capstone
!
Hello, I stumbled upon this issue by using Unicorn in my test framework and wanted to notify: a
DeprecationWarning
is raised forpkg_resources.resource_filename
with the 67.5.0 update of setuptools. I used exclusively unicorn 2.0.1.post1 and tried with setuptools 67.5.0.To test the behavior, running the following file with
pytest test.py
raises the warning:As a solution (I can propose a PR directly but would like to discuss some things), the
pkg_resources
usage should be replaced byimportlib resources
. Following the migration guide as well as this legacy API discussion, the following lines would need to be changed from unicorn.py:pkg_resources
from line 85:However, the raw
unicorn
inresources.files
has to replace the__name__
that was here before that referencedunicorn.unicorn
. The exact same issue occurs in the capstone disassembler (which I can open an issue for) and the same fix is possible but since the package discovery occurs in the__init__.py
file, it can keepresources.files(__name__) / "lib
.Before proposing a PR, is this solution acceptable (or even needed?) for you?