gtg icon indicating copy to clipboard operation
gtg copied to clipboard

Verify/reimplement the --local-liblarch parameter?

Open nekohayo opened this issue 4 years ago • 4 comments

The "docs/gtg.1" file has this mention that intrigued me:

--local-liblarch
Use local liblarch. Look for the liblarch python library in ../liblarch.
This is mainly useful for testing purpose.

The related code was introduced by @izidormatusov in commit 6be1ec24b in 2012. In commit a043f92121d, the "run-tests" script was made to use that parameter too.

However, nowadays, there are no traces of that code in:

  • gtg.sh
  • scripts/debug.sh
  • GTG/gtg
  • run_tests (even that file seems to be completely gone these days)

The feature seems to have been removed without explanation in commit 5131f6fae6 in 2014.

That's unfortunate, because I thought it was really cool and would come in handy especially in a world without pip3 (or in the context of weird things like #320).

So I'm wondering if there's a particular reason why this was removed in @izidormatusov's commit 5131f6fae6, or if there is a better way with @leio's meson work these days, or if there is no way this can work anymore and the only thing left to do is to remove that from the manpage...

nekohayo avatar May 25 '20 04:05 nekohayo

The original solution had made a lots of assumptions: that the liblarch is in ../liblarch and such. The proper pythonic solution is to use virtualenvs: https://docs.python.org/3/tutorial/venv.html

GTG code does not need to set the expectation where the liblarch is present and such. Virtualenv makes the regular imports to work.

As I do not actively contribute, I do not have a strong feeling about this. Feel free to revert the change if you want to.

izidormatusov avatar May 25 '20 10:05 izidormatusov

Would virtualenvs already work out of the box or something needs to be done here other than documenting this for contributors (and removing references to the unavailable --local-liblarch parameter)?

nekohayo avatar May 27 '20 00:05 nekohayo

Virtualenvs should work out of the box:

Initial setup:

python3 -m venv --prompt gtg --system-site-packages .venv
source .venv/bin/activate
pip3 install -r requirements.txt

When working on GTG (e.g. opening a new shell):

source .venv/bin/activate
./scripts/debug.sh

If you want to install your local liblarch copy (relative paths should work fine):

pip install git+file:///path/to/your/liblarch#egg=liblarch

izidormatusov avatar May 27 '20 10:05 izidormatusov