Use pkg_resources to keep the package zip-safe #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This resolves a bug in the packaging of this package, which I encountered after Faker started depending on it recently.
When text_unidecode is installed manually from a source distribution, in a
PYTHONDONTWRITEBYTECODE=1
environment, it ends up in the shape of a zipfile egg in site-packages, as it is not marked zip-unsafe. This means that importing it will result in an error, because this instruction will try to open a file in what it thinks is a directory, when it is actually a zipfile. The package could be marked as zip-unsafe, but there is an even better way to solve the problem:pkg_resources (which is part of setuptools) will take care of unzipping and caching the data file, returning a valid filename which can be consumed.
This changeset also removes two redundant lines from
Manifest.in
:README.rst
as it is part of the default README filessrc/text_unicode/data.bin
because it refers to an non-existent file (the package name has a typo in it), but would be redundant anyway asdata.bin
is specified as part ofpackage_data
insetup.py
EDIT: Corrected code quote as I pasted the wrong line.