SUSE/phoebe

meson - room for improvements

Closed this issue · 12 comments

  1. scripts - folder copied empty.
    Expected : needs to contain python script
  2. attempt to run scripts/collect_stats.py end up with Module not found "_phobe"
    Expected: meson script suppose to install need python module

I cannot reproduce this behavior:

$ meson -Dprint_advanced_messages=true -Dprint_table=true -Dcheck_initial_settings=true -Dcollector=enabled -Dbuildtype=debugoptimized -Db_sanitize=address,undefined build
$ meson compile -C build
$ DESTDIR=./destdir meson install -C build
$ tree build/destdir/
build/destdir/
└── usr
    ├── lib
    │   └── systemd
    │       └── system
    │           └── phoebe.service
    └── local
        ├── bin
        │   ├── data_tool
        │   └── phoebe
        ├── etc
        │   └── phoebe
        │       └── settings.json
        ├── lib64
        │   └── phoebe
        │       └── libnetwork_plugin.so
        └── share
            └── phoebe
                └── rates.csv

12 directories, 6 files

So in my case there is no directory scripts present. Also, if meson would automatically install the scripts folder, then the rpmbuild CI would be broken, because it does not list that directory in the %files section:

How did you install the scripts directory?

I was simply following instruction which project suggests to new-comer https://github.com/SUSE/phoebe/blob/main/BUILDING.md , which is just meson build . Can you try this ? So I would assume allocator is not set also I am not sure how -Dbuildtype=debugoptimized changing behavior

@dcermak also I found another difference from what you are doing and what is defined in project's build instruction , you defining different destination directory for compile while project suggesting to compile in build directory directly . So to reproduce first issue you need to simply follow build instructions defined for this project step by step :)

  1. scripts - folder copied empty.
    Expected : needs to contain python script
  2. attempt to run scripts/collect_stats.py end up with Module not found "_phobe"
    Expected: meson script suppose to install need python module

so I would say that first point is addressed with #42 . But second one is still there , @mvarlese please not close this issue I will try to come up with something later ...

  1. attempt to run scripts/collect_stats.py end up with Module not found "_phobe"
    Expected: meson script suppose to install need python module

The question here is: what does "install" mean here for you? Running meson build or meson install? Because those are two different things.

so I would say that first point is addressed with #42 . But second one is still there , @mvarlese please not close this issue I will try to come up with something later ...

  1. attempt to run scripts/collect_stats.py end up with Module not found "_phobe"

@shunghsiyu could you, please, have a look at this specific issue?

The question here is: what does "install" mean here for you? Running meson build or meson install? Because those are two different things.

I meant meson install

  1. attempt to run scripts/collect_stats.py end up with Module not found "_phobe"
    Expected: meson script suppose to install need python module

The missing module "_phoebe" refers to build/scripts/_phoebe.abi3.so. Right now it works in our CI because I set the PYTHON_PATH environment variable to build/scripts.

For install I think the correct way is to place it at /usr/lib64/python3.8/site-packages/_phoebe.abi3.so (for Python 3.8 on openSUSE Tumbleweed x86_64); that way the Python interpreter can successfully import the "_phoebe" module since /usr/lib64/python3.8/site-packages/ is in the default module search path, so there's no need for the PYTHON_PATH environment variable change.

  1. attempt to run scripts/collect_stats.py end up with Module not found "_phobe"
    Expected: meson script suppose to install need python module

The missing module "_phoebe" refers to build/scripts/_phoebe.abi3.so. Right now it works in our CI because I set the PYTHON_PATH environment variable to build/scripts.

For install I think the correct way is to place it at /usr/lib64/python3.8/site-packages/_phoebe.abi3.so (for Python 3.8 on openSUSE Tumbleweed x86_64); that way the Python interpreter can successfully import the "_phoebe" module since /usr/lib64/python3.8/site-packages/ is in the default module search path, so there's no need for the PYTHON_PATH environment variable change.

This sounds like a use case for the python extension module provided by meson: https://mesonbuild.com/Python-module.html#extension_module

@dcermak please check #45

with #45 and #46 I think all topics which I raised here are solved . @dcermak , @shunghsiyu - thanks I lot for your help 👍