From 96eeab350a40acea1f5eed435616597a43aa5758 Mon Sep 17 00:00:00 2001 From: Shawn Wang Date: Mon, 10 Apr 2023 15:42:36 +0800 Subject: [PATCH] Optimize the spec file Signed-off-by: Shawn Wang --- python-systemd.spec | 108 +++++++++++++---------- python-systemd-235.tar.gz => v235.tar.gz | Bin 2 files changed, 60 insertions(+), 48 deletions(-) rename python-systemd-235.tar.gz => v235.tar.gz (100%) diff --git a/python-systemd.spec b/python-systemd.spec index 4a6fb78..4cc8f90 100644 --- a/python-systemd.spec +++ b/python-systemd.spec @@ -1,80 +1,92 @@ -%define anolis_release 1 -Name: python-systemd +%define anolis_release 2 +%bcond_without tests +%global pypi_name systemd + +Name: python-%{pypi_name} Version: 235 Release: %{anolis_release}%{?dist} -Summary: Python module wrapping systemd functionality - +Summary: Python wrappers for systemd functionality License: LGPLv2+ -URL: https://github.com/systemd/python-systemd -Source0: https://github.com/systemd/python-systemd/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz - -BuildRequires: make -BuildRequires: gcc -BuildRequires: systemd-devel -BuildRequires: python3-devel -BuildRequires: python3-sphinx -BuildRequires: web-assets-devel -BuildRequires: python3-pytest - -%global _description %{expand: -Python module for native access to the systemd facilities. -Functionality includes sending of structured messages to the journal -and reading journal files, querying machine and boot identifiers and a -lists of message identifiers provided by systemd. Other functionality -provided by libsystemd is also wrapped.} - -%description %_description - -%package -n python3-systemd -Summary: %{summary} - -%{?python_provide:%python_provide python3-systemd} -Provides: systemd-python3 = %{version}-%{release} -Obsoletes: systemd-python3 < 230 +URL: https://github.com/%{pypi_name}/python-%{pypi_name} +Source0: https://github.com/%{pypi_name}/python-%{pypi_name}/archive/refs/tags/v%{version}.tar.gz + +BuildRequires: make gcc %{pypi_name}-devel web-assets-devel +BuildRequires: python%{python3_pkgversion}-devel python%{python3_pkgversion}-sphinx +%if %{with tests} +BuildRequires: python%{python3_pkgversion}-pytest +%endif + +%description +Python module for native access to the systemd facilities. Functionality is +separated into a number of modules: + +* systemd.journal supports sending of structured messages to the journal and +reading journal files, +* systemd.daemon wraps parts of libsystemd useful for writing daemons and +socket activation, +* systemd.id128 provides functions for querying machine and boot identifiers +and a lists of message identifiers provided by systemd, +* systemd.login wraps parts of libsystemd used to query logged in users and +available seats and machines. + +%package -n python%{python3_pkgversion}-%{pypi_name} +Summary: Python wrappers for systemd functionality +Provides: %{pypi_name}-python%{python3_pkgversion} = %{version}-%{release} +Obsoletes: %{pypi_name}-python%{python3_pkgversion} < 230 Recommends: %{name}-doc +%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}} + +%description -n python%{python3_pkgversion}-%{pypi_name} +Python module for native access to the systemd facilities. Functionality is +separated into a number of modules: -%description -n python3-systemd %_description +* systemd.journal supports sending of structured messages to the journal and +reading journal files, +* systemd.daemon wraps parts of libsystemd useful for writing daemons and +socket activation, +* systemd.id128 provides functions for querying machine and boot identifiers +and a lists of message identifiers provided by systemd, +* systemd.login wraps parts of libsystemd used to query logged in users and +available seats and machines. %package doc -Summary: HTML documentation for %{name} -Requires: js-jquery +Summary: Documentation files for %{name} %description doc -%{summary}. +The %{name}-doc package contains documentation files for %{name}. %prep -%autosetup -p1 -sed -i 's/py\.test/pytest/' Makefile +%autosetup -p1 -n %{name}-%{version} %build make PYTHON=%{__python3} build -make PYTHON=%{__python3} SPHINX_BUILD=sphinx-build-3 sphinx-html -rm -r build/html/.buildinfo build/html/.doctrees +make SPHINX_BUILD=sphinx-build-3 PYTHON=%{__python3} doc +rm -r build/html/.{buildinfo,doctrees} %install %make_install PYTHON=%{__python3} mkdir -p %{buildroot}%{_pkgdocdir} cp -rv build/html %{buildroot}%{_pkgdocdir}/ -ln -vsf %{_jsdir}/jquery/latest/jquery.min.js %{buildroot}%{_pkgdocdir}/html/_static/jquery.js cp -p README.md NEWS %{buildroot}%{_pkgdocdir}/ +%if %{with tests} %check -# if the socket is not there, skip doc tests -test -f /run/systemd/journal/stdout || \ - sed -i 's/--doctest[^ ]*//g' pytest.ini +test -f /run/%{pypi_name}/journal/stdout || sed -i 's/--doctest[^ ]*//g' pytest.ini make PYTHON=%{__python3} check +%endif -%files -n python3-systemd +%files -n python%{python3_pkgversion}-%{pypi_name} %license LICENSE.txt -%doc %{_pkgdocdir} -%exclude %{_pkgdocdir}/html -%{python3_sitearch}/systemd/ -%{python3_sitearch}/systemd_python*.egg-info +%{python3_sitearch}/%{pypi_name}/ +%{python3_sitearch}/%{pypi_name}_python-%{version}-*.egg-info %files doc -%doc %{_pkgdocdir}/html +%doc %{_pkgdocdir} %changelog +* Mon Apr 10 2023 Shawn Wang - 235-2 +- Optimize the spec file + * Mon Sep 26 2022 mgb01105731 - 235-1 - update to 235 diff --git a/python-systemd-235.tar.gz b/v235.tar.gz similarity index 100% rename from python-systemd-235.tar.gz rename to v235.tar.gz -- Gitee