I am developing a Flask application using Babel. Thanks to Distutils / Setuptools Integration, all the parameters of the compile / extract / ... functions are stored in setup.cfg , and compiling i18n files is as easy as
./setup.py compile_catalog
Great. Now I would like this to be done automatically at startup
./setup.py install
In the words make that allowed the install target to depend on compile_catalog target.
Context
We only save translation files ( .po ) in the code repository. .gitignore excludes monitored .mo and .pot .
When a developer pulls out a new version of code, he runs
pip install -r requirements.txt
to update dependencies and install the project in development mode. Then, using the command line above, it compiles the binary translation files ( .mo ).
Is there a simple and recommended way to modify setup.py to perform both operations in one step? Or am I trying to use setuptools incorrectly?
Using a script, how this will work for development purposes:
but I would like to get a solution that also works when the package is installed with the usual installation.py installation instructions, for example, if it is installed from PyPi.
Do I have to understand that setuptools not intended to be used in this way, and people who distribute the software will compile their translation files manually or using their own scripts when creating their archives, instead of relying on setup.py to compile them during installation time ?
I have not found many posts on the Internet about this. I found that I used the pybabel command line pybabel from the function in setup.py , which seems like a shame as it skips the setuptools integration point.