|
10 | 10 | pkg-config, |
11 | 11 | python3, |
12 | 12 | replaceVars, |
| 13 | + writeShellScriptBin, |
13 | 14 | zlib, |
14 | 15 | }: |
15 | 16 |
|
@@ -66,12 +67,34 @@ python3.pkgs.buildPythonApplication rec { |
66 | 67 | ./007-freebsd-pkgconfig-path.patch |
67 | 68 | ]; |
68 | 69 |
|
| 70 | + postPatch = |
| 71 | + if python3.isPyPy then |
| 72 | + '' |
| 73 | + substituteInPlace mesonbuild/modules/python.py \ |
| 74 | + --replace-fail "PythonExternalProgram('python3', mesonlib.python_command)" \ |
| 75 | + "PythonExternalProgram('${python3.meta.mainProgram}', mesonlib.python_command)" |
| 76 | + substituteInPlace mesonbuild/modules/python3.py \ |
| 77 | + --replace-fail "state.environment.lookup_binary_entry(mesonlib.MachineChoice.HOST, 'python3')" \ |
| 78 | + "state.environment.lookup_binary_entry(mesonlib.MachineChoice.HOST, '${python3.meta.mainProgram}')" |
| 79 | + substituteInPlace "test cases"/*/*/*.py "test cases"/*/*/*/*.py \ |
| 80 | + --replace-quiet '#!/usr/bin/env python3' '#!/usr/bin/env pypy3' \ |
| 81 | + --replace-quiet '#! /usr/bin/env python3' '#!/usr/bin/env pypy3' |
| 82 | + chmod +x "test cases"/*/*/*.py "test cases"/*/*/*/*.py |
| 83 | + '' |
| 84 | + else |
| 85 | + null; |
| 86 | + |
69 | 87 | nativeBuildInputs = [ installShellFiles ]; |
70 | 88 |
|
71 | | - nativeCheckInputs = [ |
72 | | - ninja |
73 | | - pkg-config |
74 | | - ]; |
| 89 | + nativeCheckInputs = |
| 90 | + [ |
| 91 | + ninja |
| 92 | + pkg-config |
| 93 | + ] |
| 94 | + ++ lib.optionals python3.isPyPy [ |
| 95 | + # Several tests hardcode python3. |
| 96 | + (writeShellScriptBin "python3" ''exec pypy3 "$@"'') |
| 97 | + ]; |
75 | 98 |
|
76 | 99 | checkInputs = |
77 | 100 | [ |
@@ -116,9 +139,15 @@ python3.pkgs.buildPythonApplication rec { |
116 | 139 | # pch doesn't work quite right on FreeBSD, I think |
117 | 140 | ''test cases/common/13 pch'' |
118 | 141 | ] |
| 142 | + ++ lib.optionals python3.isPyPy [ |
| 143 | + # fails for unknown reason |
| 144 | + ''test cases/python/4 custom target depends extmodule'' |
| 145 | + ] |
119 | 146 | )) |
120 | 147 | ++ [ |
121 | | - ''HOME="$TMPDIR" python ./run_project_tests.py'' |
| 148 | + ''HOME="$TMPDIR" ${ |
| 149 | + if python3.isPyPy then python3.interpreter else "python" |
| 150 | + } ./run_project_tests.py'' |
122 | 151 | "runHook postCheck" |
123 | 152 | ] |
124 | 153 | ); |
|
0 commit comments