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

Better langNames default #107

Open sushain97 opened 6 years ago

sushain97 commented 6 years ago

Right now, we get a default of langNames.db. However, a pip install or Debian install as well now will put it inside /usr/local/share/apertium-apy. We should use pkg_resources to guess the correct path (and continue supporting running directly from source). Until then, users will just have to feed it the correct path.

cc @TinoDidriksen

TinoDidriksen commented 6 years ago

From .deb and .rpm, that would be /usr/share/apertium-apy without local/

sushain97 commented 6 years ago

Hopefully pkg_resources is smart enough to give me the right path. It claims to be.

ayushjainrksh commented 5 years ago

whatsapp image 2019-03-04 at 9 48 18 pm What I need to do is write a script that runs this code and put langNames in the correct path? Would that solve the issue or I need to do something else?

sushain97 commented 5 years ago

This issue is about simply choosing a better default here: https://github.com/apertium/apertium-apy/blob/master/apertium_apy/apy.py#L185. (only if the pkg_resources library is available).

ayushjainrksh commented 5 years ago

So when a user does pip install on linux, it should automatically feed path to langNames.db?

sushain97 commented 5 years ago

Ideally, yes. I think there's a function in pkg_resources that purports to take an installed file and give you the system's actual path.

ayushjainrksh commented 5 years ago

So what I need to do is set 'default' to some other path instead of langNames.db

ayushjainrksh commented 5 years ago

What is the function of parse_argument()? How does it work

sushain97 commented 5 years ago

The Python docs cover that.

ayushjainrksh commented 5 years ago

Okay I will go through them