ContactEngineering / SurfaceTopography

Read and analyze surface topographies
https://contactengineering.github.io/SurfaceTopography/
MIT License
15 stars 9 forks source link

Version discovery from git not working in tests #316

Open sannant opened 1 year ago

sannant commented 1 year ago

Not sure this is relevant once SurfaceTopography is installed properly in devel version, but the following line will raise an error if the tests are run in the test subdirectory.

I think a better option would be to call git and check that the package name is SurfaceTopography

https://github.com/ContactEngineering/SurfaceTopography/blob/6808a71bfbdb76d7b3eee855705c4b1b554b16cd/SurfaceTopography/DiscoverVersion.py#L37

pastewka commented 1 month ago

Hi @sannant - can you check whether this is still the case in master. Version discovery now explicitly checks for those directories to exist.

sannant commented 1 month ago

I saw changes in Discoverversion that address this.

However I have issues testing this because I have errors when building with meson.

meson setup build
cd build
meson compile
meson install
Version: 1.5.0
Source dir: /home/asanner/Repositories/SurfaceTopography
Build dir: /home/asanner/Repositories/SurfaceTopography/build
Build type: native build
Project name: SurfaceTopography
Project version: 1.14.2.dev23+g578d0ed1
C compiler for the host machine: ccache cc (gcc 11.4.0 "cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0")
C linker for the host machine: cc ld.bfd 2.38
C++ compiler for the host machine: ccache c++ (gcc 11.4.0 "c++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0")
C++ linker for the host machine: c++ ld.bfd 2.38
Host machine cpu family: x86_64
Host machine cpu: x86_64
Program python3 found: YES (/home/asanner/Repositories/SurfaceTopography/.venv/bin/python3)
Found pkg-config: YES (/usr/bin/pkg-config) 0.29.2
Run-time dependency eigen3 found: YES 3.4.0
pybind11-config found: NO
Found CMake: /home/asanner/.local/bin/cmake (3.27.5)
Run-time dependency pybind11 found: NO (tried pkgconfig, config-tool and cmake)
Looking for a fallback subproject for the dependency pybind11
Downloading pybind11 source from https://github.com/pybind/pybind11/archive/refs/tags/v2.11.1.tar.gz
Download size: 756445
Downloading: ..........
Downloading pybind11 patch from https://wrapdb.mesonbuild.com/v2/pybind11_2.11.1-1/get_patch
Download size: 1157
Downloading: ..........

Executing subproject pybind11 

pybind11| Project name: pybind11
pybind11| Project version: 2.11.1
pybind11| C++ compiler for the host machine: ccache c++ (gcc 11.4.0 "c++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0")
pybind11| C++ linker for the host machine: c++ ld.bfd 2.38
pybind11| Build targets in project: 0
pybind11| Subproject pybind11 finished.

Dependency pybind11 from subproject subprojects/pybind11-2.11.1 found: YES 2.11.1
Run-time dependency python found: YES 3.10

c/meson.build:10:16: ERROR: Tried to form an absolute path to a dir in the source tree.
You should not do that but use relative paths instead, for
directories that are part of your project.

To get include path to any directory relative to the current dir do

incdir = include_directories(dirname)

After this incdir will contain both the current source dir as well as the
corresponding build dir. It can then be used in any subdirectory and
Meson will take care of all the busywork to make paths work.

Dirname can even be '.' to mark the current directory. Though you should
remember that the current source and build directories are always
put in the include directories by default so you only need to do
include_directories('.') if you intend to use the result in a
different subdirectory.

Note that this error message can also be triggered by
external dependencies being installed within your source
tree - it's not recommended to do this.

A full log can be found at /home/asanner/Repositories/SurfaceTopography/build/meson-logs/meson-log.txt
pastewka commented 1 month ago

Hi @sannant - place your venv outside the source folder and this works.

The c-extension module is including numpy's headers. If you have a venv in the source directory those headers are in the source directory and Meson does not like this.

pastewka commented 1 month ago

PS: I am planning to move to the whole codebase to pybind11 which fixes this, but this won't happen within the next weeks.