apertium / apertium-apy

📦 Apertium HTTP Server in Python
https://wiki.apertium.org/wiki/Apertium-apy
GNU General Public License v3.0
32 stars 42 forks source link

WIP issue #84 #104

Closed TinoDidriksen closed 6 years ago

TinoDidriksen commented 6 years ago

Install step install_data puts the extra files into /usr/apertium_apy instead of /usr/lib/python3.6/dist-packages/apertium_apy or /usr/share/apertium-apy

It's a known bug https://github.com/pypa/setuptools/issues/130 , and it's even marked wontfix with this comment https://github.com/pypa/setuptools/issues/130#issuecomment-345522681 :

the plan to deprecate easy_install and setuptools' mechanisms for installing packages

As per https://setuptools.readthedocs.io/en/latest/setuptools.html#including-data-files if one uses

    package_data={
        'apertium_apy': ['README.md', 'COPYING', 'langNames.db'],
    },

then those files are included, but they must first exist in the apertium_apy folder (which the make step can make sure they do).

How to include tools/ is left as an exercise to the reader - meaning, I don't see why they make sense in the Python folder, and I don't want to fight this absurdity of a tool.

coveralls commented 6 years ago

Pull Request Test Coverage Report for Build 817


Totals Coverage Status
Change from base Build 816: 0.0%
Covered Lines: 1006
Relevant Lines: 2086

💛 - Coveralls
sushain97 commented 6 years ago

I'm not sure I understand what the problem is with them going into /usr/apertium_apy? No matter where they go, if someone uses the new apertium-apy console script, they'll have to give it the full path and putting it in dist_packages means the path is now dependent on your Python version which sounds awful. We can give it an absolute path so it installs to /usr/share/apertium_apy, that's easy.

TinoDidriksen commented 6 years ago

A package is absolutely not allowed to create folders directly under /usr. And if created under /usr/share, it must be dash apertium-apy instead of underscore apertium_apy. If that's what you prefer, sure make that happen.

I thought langNames.db was automatically searched for in the script paths? If not, that should be done.

Also, README.md and COPYING will be included as part of the packaging itself - they don't even need to be installed by the source. A whole folder for a single file feels excessive, and it's against the setuptools ethos to install anything outside the Python folder (asides from bin).

sushain97 commented 6 years ago

I thought langNames.db was automatically searched for in the script paths? If not, that should be done.

It's not. A new issue for that makes sense.

A package is absolutely not allowed to create folders directly under /usr. And if created under /usr/share, it must be dash apertium-apy instead of underscore apertium_apy. If that's what you prefer, sure make that happen.

Yeah, let's do this. I prefer it instead of a bunch of hacks. Working on it.

sushain97 commented 6 years ago

Sigh: https://github.com/pypa/wheel/issues/92 ... makes absolute paths a mess.

sushain97 commented 6 years ago

Hmm, it never installs directly to /usr for me:

$ ls -R /usr/local/apertium*
/usr/local/apertium_apy:
COPYING      README.md    langNames.db tools

/usr/local/apertium_apy/tools:
apertium-recaptcha-test.html serverlist-example           sysvinit
apertium-viewer.html         systemd                      upstart

/usr/local/apertium_apy/tools/systemd:
README      apy.service

/usr/local/apertium_apy/tools/sysvinit:
apy.sh

/usr/local/apertium_apy/tools/upstart:
apertium                  apertium-all.conf         apertium-apy-gateway.conf apertium-apy.conf         apertium-html-tools.conf
sushain97 commented 6 years ago

I'm not entirely opposed to the solution in this PR but I don't want to regress to not including tools. Can we just cp -r it and then include the stuff in the package_data list using * (well, four entries since there's no globstar)?

sushain97 commented 6 years ago

Since people seem to use /usr/local/share, I'm fine just making it share/apertium-apy and then if it gets installed to /usr/local/share/apertium-apy or /usr/share/apertium-apy, whatever. Let me know if you're okay with this and I'll send the PR.

TinoDidriksen commented 6 years ago

Superseded by https://github.com/apertium/apertium-apy/pull/106