rhasspy/phonemes2ids

Exclude tests in setuptools.find_packages

Opened this issue · 1 comments

31KM commented

I'm currently packaging larynx + deps for Arch Linux and I encountered an issue with phonemes2ids: setuptools includes the tests in the package, which does not play well with Arch Linux packaging:

error: failed to commit transaction (conflicting files)
python-phonemes2ids: /usr/lib/python3.9/site-packages/tests/__init__.py exists in filesystem (owned by python-gruut-ipa)
python-phonemes2ids: /usr/lib/python3.9/site-packages/tests/__pycache__/__init__.cpython-39.opt-1.pyc exists in filesystem (owned by python-gruut-ipa)
python-phonemes2ids: /usr/lib/python3.9/site-packages/tests/__pycache__/__init__.cpython-39.pyc exists in filesystem (owned by python-gruut-ipa)
Errors occurred, no packages were upgraded.

(I packaged and installed gruut-ipa first - I will create the same issue for it as well)

I patched the setup.py file like this:

--- a/setup.py  2021-11-12 20:30:32.000000000 +0100                                                                                                                                                               
+++ b/setup.py  2022-01-11 00:59:29.372786663 +0100
@@ -28,7 +28,7 @@
     author="Michael Hansen",
     author_email="mike@rhasspy.org",
     url="https://github.com/rhasspy/phonemes2ids",
-    packages=setuptools.find_packages(),
+    packages=setuptools.find_packages(exclude=['tests']),
     package_data={"phonemes2ids": ["VERSION", "py.typed"]},
     entry_points={"console_scripts": ["phonemes2ids = phonemes2ids.__main__:main",]},
     classifiers=[

and now it is working.

kevr commented

Just to shed some light on this: The tests package being installed is problematic in that, if other packages include their own tests package, these packages end up conflicting. This is the fault of both packages which conflict with each other, however, if all Arch packages followed this guideline of including their packages, and not blanket tests, the issue would not occur.