Skip to content

Commit 3676460

Browse files
committed
nix: Drop back to ctypes-1.0.2 instead of master
Better for consistency with non-nix build.
1 parent 169fd2d commit 3676460

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

flake.lock

+4-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+18-12
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"A stream processing framework for high-throughput applications.";
44

55
inputs.ctypesgen = {
6-
url = "github:ctypesgen/ctypesgen";
6+
url = "github:ctypesgen/ctypesgen/ctypesgen-1.0.2";
77
flake = false;
88
};
99

@@ -114,9 +114,8 @@
114114
]);
115115
preBuild = lib.optionalString enablePython ''
116116
make -C python bifrost/libbifrost_generated.py
117-
sed -i \
118-
-e "s:^add_library_search_dirs(\[:&'$out/lib':" \
119-
python/bifrost/libbifrost_generated.py
117+
sed "s:\(load_library\)(\"bifrost\"):\1('$out/lib/libbifrost.so'):"\
118+
-i python/bifrost/libbifrost_generated.py
120119
'';
121120
makeFlags =
122121
lib.optionals enableCuda [ "CUDA_LIBDIR64=$(CUDA_HOME)/lib" ];
@@ -135,30 +134,37 @@
135134
SETUPTOOLS_SCM_PRETEND_VERSION = version;
136135
src = inputs.ctypesgen;
137136
buildInputs = [ setuptools-scm toml ];
138-
patchPhase =
137+
postPatch =
139138
# Version detection in the absence of ‘git describe’ is broken,
140139
# even with an explicit VERSION file.
141140
''
142-
sed -i \
143-
-e 's/\(VERSION = \).*$/\1"${pname}-${version}"/' \
141+
sed -e 's/\(VERSION = \).*$/\1"${pname}-${version}"/' \
144142
-e 's/\(VERSION_NUMBER = \).*$/\1"${version}"/' \
145-
ctypesgen/version.py
143+
-i ctypesgen/version.py
144+
'' +
145+
# Test suite invokes ‘run.py’, replace that with actual script.
146+
''
147+
sed -e "s:\(script = \).*:\1'${
148+
placeholder "out"
149+
}/bin/ctypesgen':" \
150+
-e "s:run\.py:ctypesgen:" \
151+
-i ctypesgen/test/testsuite.py
146152
'' +
147153
# At runtime, ctypesgen invokes ‘gcc -E’. It won’t be available in
148154
# the darwin stdenv so let's explicitly patch full path to gcc in
149155
# nix store, making gcc a true prerequisite, which it is. There
150156
# are also runs of gcc specified in test suite.
151157
''
152158
sed -i 's:gcc -E:${gcc}/bin/gcc -E:' ctypesgen/options.py
153-
sed -i 's:"gcc":"${gcc}/bin/gcc":' tests/ctypesgentest.py
154159
'' +
155160
# Some tests explicitly load ‘libm’ and ‘libc’. They won’t be
156161
# found on NixOS unless we patch in the ‘glibc’ path.
157162
lib.optionalString stdenv.isLinux ''
158-
sed -i 's:libm.so.6:${glibc}/lib/libm.so.6:' tests/testsuite.py
159-
sed -i 's:libc.so.6:${glibc}/lib/libc.so.6:' tests/testsuite.py
163+
sed -e 's:libm.so.6:${glibc}/lib/&:' \
164+
-e 's:libc.so.6:${glibc}/lib/&:' \
165+
-i ctypesgen/test/testsuite.py
160166
'';
161-
checkPhase = "python -m unittest -v tests/testsuite.py";
167+
checkPhase = "python ctypesgen/test/testsuite.py";
162168
};
163169

164170
pyOverlay = self: _: {

0 commit comments

Comments
 (0)