mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-12 02:40:31 +08:00
pylibfdt: Use the correct Python for tests
By default, Meson will find the version of Python that it itself is using, i.e. the default one in Nixpkgs. However, when building libfdt for other Python package sets, we need to make sure we match the version of the Python used for tests – otherwise the interpreter will not find the compiled module. Tweak meson.build to always use the Python interpreter that was passed to the expression, rather than the default one.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
which,
|
||||
pythonSupport ? false,
|
||||
python ? null,
|
||||
replaceVars,
|
||||
swig,
|
||||
libyaml,
|
||||
}:
|
||||
@@ -38,7 +39,15 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
url = "https://github.com/dgibson/dtc/commit/ce1d8588880aecd7af264e422a16a8b33617cef7.patch";
|
||||
hash = "sha256-t1CxKnbCXUArtVcniAIdNvahOGXPbYhPCZiTynGLvfo=";
|
||||
})
|
||||
];
|
||||
]
|
||||
++
|
||||
lib.optional pythonSupport
|
||||
# Make Meson use our Python version, not the one it was built with itself
|
||||
(
|
||||
replaceVars ./python-path.patch {
|
||||
python_bin = lib.getExe python;
|
||||
}
|
||||
);
|
||||
|
||||
env.SETUPTOOLS_SCM_PRETEND_VERSION = finalAttrs.version;
|
||||
|
||||
|
||||
12
pkgs/by-name/dt/dtc/python-path.patch
Normal file
12
pkgs/by-name/dt/dtc/python-path.patch
Normal file
@@ -0,0 +1,12 @@
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 310699f..4e2b8a4 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -48,7 +48,7 @@ if not valgrind.found()
|
||||
endif
|
||||
|
||||
py = import('python')
|
||||
-py = py.find_installation(required: get_option('python'))
|
||||
+py = py.find_installation('@python_bin@', required: get_option('python'))
|
||||
swig = find_program('swig', required: get_option('python'))
|
||||
pylibfdt_enabled = not meson.is_cross_build() and py.found() and swig.found() ? true : false
|
||||
Reference in New Issue
Block a user