A big thank you Alexis. It works indeed. After make install I had to add
/home/sergiu/miniconda3/envs/ldg-build/lib
to ld.so.conf and I can run python ./python/demo.py
Welcome to the Ledger.Python demo!
Demo completed successfully.
Now, if I understand this correctly, the python module is in ledger.so and
whenever I want to "import ledger" I have to setup PYTHONPATH to the
location where ledger.so is. Am I rigth?
On Tuesday, December 19, 2023 at 3:32:30 PM UTC-5 Alexis wrote:
> Hi,
>
> quite frankly I'm not particularly fond of acprep and prefer to use
> the tools it wraps. Please find below the commands I use to cleanly
> build ledger with Python support on macOS with a build environment
> setup from nix flake and using cmake and make directly:
>
> % rm ledger{,.so}
> % rm -rf build
> % cmake -Bbuild -S. -DUSE_PYTHON:BOOL=ON -DPython_ROOT_DIR=$(which
> python)/../../
> % make -Cbuild -j8
> % ls -lsa ./build/ledger{,.so}
> 428 -rwxr-xr-x 1 $USER staff 435664 Dec 19 21:27 ./build/ledger
> 5684 -rwxr-xr-x 1 $USER staff 5819184 Dec 19 21:27 ./build/ledger.so
> % ./build/ledger --version | head -2
> Ledger 3.3.2-20230330, the command-line accounting tool
> without support for gpg encrypted journals and with Python support
> % env PYTHONPATH=/does/not/exist python -c 'import ledger;
> print(ledger.__version__)'
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> ModuleNotFoundError: No module named 'ledger'
> % env PYTHONPATH=$PWD/build python -c 'import ledger;
> print(ledger.__version__)'
> 3.3.2
>
> Not sure how helpful this is going to be yet the following works for me
> too:
>
> % ./acprep clean
> % ls -lsa ./ledger{,.so}
> ls: cannot access './ledger': No such file or directory
> ls: cannot access './ledger.so': No such file or directory
> % ./acprep configure --python -- -DPython_ROOT_DIR=$(which python)/../../
> % ./acprep make -j8
> % ls -lsa ./ledger{,.so}
> 928 -rwxr-xr-x 1 $USER staff 948368 Dec 19 21:19 ./ledger
> 8916 -rwxr-xr-x 1 $USER staff 9126192 Dec 19 21:19 ./ledger.so
> % ./ledger --version | head -2
> Ledger 3.3.2-20230330, the command-line accounting tool
> without support for gpg encrypted journals and with Python support
> % PYTHONPATH=. python -c 'import ledger; print(ledger.__version__)'
> 3.3.2
>
> 🤞
>
--
---
You received this message because you are subscribed to the Google Groups
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ledger-cli/4fea156c-1920-4051-ab93-7bfca574ba34n%40googlegroups.com.