Conform to new Python packaging guidelines

This commit is contained in:
Kai A. Hiller 2022-01-20 16:26:04 +01:00
parent 18ba380922
commit e7c61e994b

View file

@ -3,8 +3,6 @@
# Version suffix in URL when building release candidates # Version suffix in URL when building release candidates
%global rcx %{nil} %global rcx %{nil}
%{?python_enable_dependency_generator}
Name: matrix-%{srcname} Name: matrix-%{srcname}
Version: 1.57.0 Version: 1.57.0
Release: 1%{?dist} Release: 1%{?dist}
@ -18,56 +16,8 @@ Source3: matrix-synapse.sysusers
BuildArch: noarch BuildArch: noarch
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python3-setuptools
# Test dependencies
BuildRequires: python3-parameterized >= 0.7.0
BuildRequires: /usr/bin/openssl BuildRequires: /usr/bin/openssl
BuildRequires: systemd-rpm-macros
# Package dependencies
#BuildRequires: python3-txacme >= 0.9.2
BuildRequires: (python3-attrs >= 19.2.0 without python3-attrs = 21.1.0)
BuildRequires: python3-authlib
BuildRequires: python3-bcrypt >= 3.1.0
BuildRequires: python3-bleach >= 1.4.3
BuildRequires: python3-canonicaljson >= 1.4.0
BuildRequires: python3-cryptography >= 3.4.7
BuildRequires: (python3-frozendict without python3-frozendict = 2.1.2)
BuildRequires: python3-idna >= 2.5
BuildRequires: python3-ijson
BuildRequires: python3-jinja2
BuildRequires: python3-jsonschema
BuildRequires: python3-jwt
BuildRequires: python3-lxml
BuildRequires: python3-matrix-common
BuildRequires: python3-matrix-synapse-ldap3 >= 0.1
BuildRequires: python3-msgpack >= 0.5.2
BuildRequires: python3-netaddr >= 0.7.18
BuildRequires: python3-packaging >= 16.1
BuildRequires: python3-phonenumbers >= 8.2.0
BuildRequires: python3-pillow
BuildRequires: python3-prometheus_client
BuildRequires: python3-pyOpenSSL >= 16.0.0
BuildRequires: python3-pyasn1 >= 0.1.9
BuildRequires: python3-pyasn1-modules >= 0.0.7
BuildRequires: python3-pymacaroons-pynacl >= 0.13.0
BuildRequires: python3-pynacl >= 1.2.1
BuildRequires: python3-pysaml2 >= 4.5.0
BuildRequires: python3-pyyaml >= 3.11
BuildRequires: python3-service-identity >= 18.1.0
BuildRequires: python3-signedjson >= 1.1.0
BuildRequires: python3-sortedcontainers >= 1.4.4
BuildRequires: python3-systemd >= 231
BuildRequires: python3-treq >= 15.1
BuildRequires: python3-twisted >= 18.9.0
BuildRequires: python3-typing-extensions
BuildRequires: python3-unpaddedbase64 >= 1.1.0
BuildRequires: systemd
BuildRequires: xmlsec1
Requires(pre): shadow-utils
Requires: systemd
%{?systemd_requires}
%description %description
Matrix is an ambitious new ecosystem for open federated Instant Messaging and Matrix is an ambitious new ecosystem for open federated Instant Messaging and
@ -85,12 +35,17 @@ the ecosystem.
rm -rf synapse/static rm -rf synapse/static
%generate_buildrequires
%pyproject_buildrequires -x test,systemd
%build %build
%py3_build %pyproject_wheel
%install %install
%py3_install %pyproject_install
%pyproject_save_files %{srcname}
# Synapse includes some benchmarks in a separate Python package named "synmark" # Synapse includes some benchmarks in a separate Python package named "synmark"
# which is installed by default. Remove it to avoid shipping it in the Fedora # which is installed by default. Remove it to avoid shipping it in the Fedora
@ -111,22 +66,23 @@ PYTHONPATH=. trial-3 tests
%pre %pre
%sysusers_create_compat %{SOURCE3} %sysusers_create_compat %{SOURCE3}
%post %post
%systemd_post synapse.service %systemd_post synapse.service
%preun %preun
%systemd_preun synapse.service %systemd_preun synapse.service
%postun %postun
%systemd_postun_with_restart synapse.service %systemd_postun_with_restart synapse.service
%files %files -f %{pyproject_files}
%license LICENSE %license LICENSE
%doc *.rst %doc *.rst
%config(noreplace) %{_sysconfdir}/sysconfig/synapse %config(noreplace) %{_sysconfdir}/sysconfig/synapse
%{python3_sitelib}/synapse/
%{python3_sitelib}/matrix_synapse*.egg-info/
%{_bindir}/* %{_bindir}/*
%{_unitdir}/synapse.service %{_unitdir}/synapse.service
%attr(755,synapse,synapse) %dir %{_sharedstatedir}/synapse %attr(755,synapse,synapse) %dir %{_sharedstatedir}/synapse