Skip to content

Commit 19e045f

Browse files
committed
Problem: CFFI RPM builds with both python 2 and 3 broken
Solution: do common steps only once
1 parent d4bce6c commit 19e045f

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

zproject_redhat.gsl

+7-16
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ sh autogen.sh
279279

280280
make %{_smp_mflags}
281281
.if python_cffi ?= 1
282-
%if %{with python_cffi}
282+
%if %{with python_cffi} || %{with python3_cffi}
283283
# Problem: we need pkg-config points to built and not yet installed copy of $(project.name)
284284
# Solution: chicken-egg problem - let's make "fake" pkg-config file
285285
sed -e "s@^libdir.*@libdir=.libs/@" \\
@@ -290,20 +290,11 @@ cd bindings/python_cffi
290290
ln -sfr ../../include/ .
291291
ln -sfr ../../src/.libs/ .
292292
export PKG_CONFIG_PATH=`pwd`
293+
%endif
294+
%if %{with python_cffi}
293295
python2 setup.py build
294296
%endif
295-
296297
%if %{with python3_cffi}
297-
# Problem: we need pkg-config points to built and not yet installed copy of $(project.name)
298-
# Solution: chicken-egg problem - let's make "fake" pkg-config file
299-
sed -e "s@^libdir.*@libdir=.libs/@" \\
300-
-e "s@^includedir.*@includedir=include/@" \\
301-
src/$(project.libname).pc > bindings/python_cffi/$(project.libname).pc
302-
cd bindings/python_cffi
303-
# This avoids problem with "weird" character quoting between shell and python3
304-
ln -sfr ../../include/ .
305-
ln -sfr ../../src/.libs/ .
306-
export PKG_CONFIG_PATH=`pwd`
307298
python3 setup.py build
308299
%endif
309300
.endif
@@ -316,17 +307,17 @@ find %{buildroot} -name '*.a' | xargs rm -f
316307
find %{buildroot} -name '*.la' | xargs rm -f
317308

318309
.if python_cffi ?= 1
319-
%if %{with python_cffi}
310+
%if %{with python_cffi} || %{with python3_cffi}
320311
cd bindings/python_cffi
321312
export PKG_CONFIG_PATH=`pwd`
313+
%endif
314+
%if %{with python_cffi}
322315
python2 setup.py install --root=%{buildroot} --skip-build --prefix %{_prefix}
323316
%endif
324-
325317
%if %{with python3_cffi}
326-
cd bindings/python_cffi
327-
export PKG_CONFIG_PATH=`pwd`
328318
python3 setup.py install --root=%{buildroot} --skip-build --prefix %{_prefix}
329319
%endif
320+
330321
.endif
331322
.if has_main | project.has_bin
332323
%files

0 commit comments

Comments
 (0)