Skip to content

Commit 1c4a4fb

Browse files
committed
make-srpm.sh: build the python3-csdiff subpkg on Fedora 23+
1 parent d98728a commit 1c4a4fb

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ install(TARGETS
7070
# pycsdiff - python binding of csdiff
7171
option(BUILD_PYCSDIFF "Set to ON to enable python binding" ON)
7272
if (BUILD_PYCSDIFF)
73-
find_library(BOOST_PYTHON NAMES boost_python
73+
set(BOOST_PYTHON_LIB_NAME "boost_python"
74+
CACHE STRING "Name of the boost_python library")
75+
find_library(BOOST_PYTHON NAMES ${BOOST_PYTHON_LIB_NAME}
7476
boost_python-3.2
7577
boost_python-3.3
7678
boost_python-3.4)

make-srpm.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,20 @@ code scan defect lists to find out added or fixed defects.
106106
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
107107
%endif
108108
109+
# build the python3-csdiff package on Fedora 23+
110+
%global py3_support ((7 < 0%{?rhel}) || (22 < 0%{?fedora}))
111+
%if %{py3_support}
112+
%package -n python3-%{name}
113+
Summary: Python interface to csdiff for Python 3
114+
BuildRequires: boost-python3-devel
115+
BuildRequires: python3-devel
116+
%{?python_provide:%python_provide python3-%{name}}
117+
118+
%description -n python3-%{name}
119+
This package contains the Python 3 binding for the csdiff tool for comparing
120+
code scan defect lists to find out added or fixed defects.
121+
%endif
122+
109123
%prep
110124
%setup -q
111125
@@ -116,7 +130,19 @@ cd csdiff_build
116130
%cmake .. -DPYTHON_EXECUTABLE=%{__python2}
117131
make %{?_smp_mflags} VERBOSE=yes
118132
133+
# build the python3-csdiff package on Fedora 23+
134+
%if %{py3_support}
135+
mkdir ../csdiff_build_py3
136+
cd ../csdiff_build_py3
137+
%cmake .. -DPYTHON_EXECUTABLE=%{__python3} -DBOOST_PYTHON_LIB_NAME=boost_python3
138+
make %{?_smp_mflags} VERBOSE=yes pycsdiff
139+
%endif
140+
119141
%install
142+
%if %{py3_support}
143+
mkdir -vp %{buildroot}%{python3_sitearch}
144+
install -vm0644 csdiff_build_py3/pycsdiff.so %{buildroot}%{python3_sitearch}
145+
%endif
120146
cd csdiff_build
121147
make install DESTDIR="\$RPM_BUILD_ROOT"
122148
@@ -140,6 +166,12 @@ ctest %{?_smp_mflags} --output-on-failure
140166
%files -n python2-%{name}
141167
%{python2_sitearch}/pycsdiff.so
142168
%doc COPYING
169+
170+
%if %{py3_support}
171+
%files -n python3-%{name}
172+
%{python3_sitearch}/pycsdiff.so
173+
%doc COPYING
174+
%endif
143175
EOF
144176

145177
set -v

0 commit comments

Comments
 (0)