Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version discovery from git not working in tests #316

Open
sannant opened this issue Jun 10, 2023 · 4 comments
Open

Version discovery from git not working in tests #316

sannant opened this issue Jun 10, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@sannant
Copy link
Collaborator

sannant commented Jun 10, 2023

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

if not os.path.exists('.git'):

@pastewka pastewka added the bug Something isn't working label Oct 18, 2023
@pastewka
Copy link
Contributor

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

@sannant
Copy link
Collaborator Author

sannant commented Jul 25, 2024

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
Copy link
Contributor

pastewka commented Jul 25, 2024

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants