]> git.pld-linux.org Git - packages/systemd.git/commitdiff
Build python3 bindings too
authorJacek Konieczny <j.konieczny@eggsoft.pl>
Thu, 2 Jul 2015 13:11:18 +0000 (15:11 +0200)
committerJacek Konieczny <j.konieczny@eggsoft.pl>
Fri, 3 Jul 2015 05:56:07 +0000 (07:56 +0200)
systemd.spec

index 9621085cdcc98cd40d490e9aa9bdc796266b75bc..e25024af0f120647c758f1ca5476c99966336093 100644 (file)
@@ -15,6 +15,7 @@
 %bcond_without qrencode        # QRencode support
 %bcond_without selinux         # without SELinux support
 %bcond_with    efi             # EFI boot support [missing files in 220]
+%bcond_without python3         # Python 3.x support
 %bcond_with    tests           # "make check" (requires systemd already installed)
 
 Summary:       A System and Service Manager
@@ -104,6 +105,11 @@ BuildRequires:     pkgconfig >= 0.9.0
 BuildRequires: python-devel
 BuildRequires: python-lxml
 BuildRequires: python-modules
+%if %{with python3}
+BuildRequires: python3-devel
+BuildRequires: python3-lxml
+BuildRequires: python3-modules
+%endif
 %{?with_qrencode:BuildRequires:        qrencode-devel}
 BuildRequires: rpm-pythonprov
 BuildRequires: rpmbuild(macros) >= 1.628
@@ -450,17 +456,30 @@ Header files for systemd libraries.
 Pliki nagłówkowe bibliotek systemd.
 
 %package -n python-systemd
-Summary:       Systemd Python bindings
-Summary(pl.UTF-8):     Wiązania do Systemd dla Pythona
+Summary:       Systemd Python 2.x bindings
+Summary(pl.UTF-8):     Wiązania do Systemd dla Pythona 2.x
 Group:         Development/Languages/Python
 Requires:      %{name}-libs = %{epoch}:%{version}-%{release}
 Requires:      python
 
 %description -n python-systemd
-Systemd Python bindings.
+Systemd Python 2.x bindings.
+
+%description -n python-systemd -l pl.UTF-8
+Wiązania do Systemd dla Pythona 2.x.
+
+%package -n python3-systemd
+Summary:       Systemd Python 3.x bindings
+Summary(pl.UTF-8):     Wiązania do Systemd dla Pythona 3.x
+Group:         Development/Languages/Python
+Requires:      %{name}-libs = %{epoch}:%{version}-%{release}
+Requires:      python3
+
+%description -n python3-systemd
+Systemd Python 3.x bindings.
 
 %description -n python-systemd -l pl.UTF-8
-Wiązania do Systemd dla Pythona.
+Wiązania do Systemd dla Pythona 3.x.
 
 %package -n bash-completion-systemd
 Summary:       bash-completion for systemd
@@ -680,6 +699,9 @@ cp -p %{SOURCE2} src/systemd_booted.c
 %{__autoconf}
 %{__autoheader}
 %{__automake}
+
+for PYTHON in "%{__python}" %{?with_python3:"%{__python3}"} ; do
+
 %configure \
        QUOTAON=/sbin/quotaon \
        QUOTACHECK=/sbin/quotacheck \
@@ -687,6 +709,8 @@ cp -p %{SOURCE2} src/systemd_booted.c
        KILL=/bin/kill \
        KMOD=/sbin/kmod \
        KEXEC=/sbin/kexec \
+       PYTHON="$PYTHON" \
+       PYTHON_BINARY="$PYTHON" \
        %{?debug:--enable-debug} \
        %{__enable_disable audit} \
        %{__enable_disable cryptsetup libcryptsetup} \
@@ -708,7 +732,15 @@ cp -p %{SOURCE2} src/systemd_booted.c
        --with-rootprefix="" \
        --with-rootlibdir=/%{_lib}
 
+%{__make} clean-python
+
 %{__make}
+
+python_libs=.libs/$(basename $PYTHON)
+mkdir -p $python_libs
+cp -a .libs/{_daemon,_journal,_reader,id128,login}.so $python_libs
+done
+
 ./libtool --mode=link --tag=CC %{__cc} %{rpmcppflags} %{rpmcflags} -o systemd_booted %{rpmldflags} src/systemd_booted.c -L. -lsystemd-daemon
 
 %{?with_tests:%{__make} check}
@@ -851,9 +883,22 @@ install -d $RPM_BUILD_ROOT/var/log
 %{__rm} $RPM_BUILD_ROOT/%{_lib}/security/pam_systemd.la
 %{__rm} $RPM_BUILD_ROOT/%{_lib}/libnss_myhostname.la
 %{__rm} $RPM_BUILD_ROOT%{_libdir}/*.la
+
+%if %{with python3}
+%{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/systemd/*.la
+
+# install Python2 files, binaries built and saved earlier
+install -d $RPM_BUILD_ROOT%{py_sitedir}/systemd
+cp -a $RPM_BUILD_ROOT%{py3_sitedir}/systemd/*.py $RPM_BUILD_ROOT%{py_sitedir}/systemd
+install .libs/python/*.so $RPM_BUILD_ROOT%{py_sitedir}/systemd
+%py_comp $RPM_BUILD_ROOT%{py_sitedir}
+%py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
+%else
 %{__rm} $RPM_BUILD_ROOT%{py_sitedir}/systemd/*.la
+%endif
 %py_postclean
 
+
 %find_lang %{name}
 
 %clean
@@ -1832,6 +1877,20 @@ fi
 %attr(755,root,root) %{py_sitedir}/systemd/id128.so
 %attr(755,root,root) %{py_sitedir}/systemd/login.so
 
+%if %{with python3}
+%files -n python3-systemd
+%defattr(644,root,root,755)
+%dir %{py3_sitedir}/systemd
+%{py3_sitedir}/systemd/*.py
+%dir %{py3_sitedir}/systemd/__pycache__
+%{py3_sitedir}/systemd/__pycache__/*.py[co]
+%attr(755,root,root) %{py3_sitedir}/systemd/_daemon.so
+%attr(755,root,root) %{py3_sitedir}/systemd/_journal.so
+%attr(755,root,root) %{py3_sitedir}/systemd/_reader.so
+%attr(755,root,root) %{py3_sitedir}/systemd/id128.so
+%attr(755,root,root) %{py3_sitedir}/systemd/login.so
+%endif
+
 %files -n bash-completion-systemd
 %defattr(644,root,root,755)
 %{_datadir}/bash-completion/completions/bootctl
This page took 0.327437 seconds and 4 git commands to generate.