blob: e642eeacb5618e246f611f802383aeef92e1c474 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
%bcond_with tests
%bcond_with pytest_xdist
%bcond_with tox_tests
Name: pyproject-rpm-macros
Summary: RPM macros for PEP 517 Python packages
License: MIT
Version: 1.15.0
Release: 1
URL: https://src.fedoraproject.org/rpms/pyproject-rpm-macros
Source001: macros.pyproject
Source002: macros.aaa-pyproject-srpm
Source101: pyproject_buildrequires.py
Source102: pyproject_save_files.py
Source103: pyproject_convert.py
Source104: pyproject_preprocess_record.py
Source105: pyproject_construct_toxenv.py
Source106: pyproject_requirements_txt.py
Source107: pyproject_wheel.py
Source201: test_pyproject_buildrequires.py
Source202: test_pyproject_save_files.py
Source203: test_pyproject_requirements_txt.py
Source204: compare_mandata.py
Source301: pyproject_buildrequires_testcases.yaml
Source302: pyproject_save_files_test_data.yaml
Source901: README.md
Source902: LICENSE
BuildArch: noarch
%if %{with tests}
BuildRequires: python3-pytest
%if %{with pytest_xdist}
BuildRequires: python3dist(pytest-xdist)
%endif
BuildRequires: python3-pyyaml
BuildRequires: python3-packaging
BuildRequires: python3-pip
BuildRequires: python3-setuptools
%if %{with tox_tests}
BuildRequires: python3dist(tox-current-env) >= 0.0.6
%endif
BuildRequires: python3-wheel
BuildRequires: (python3dist(tomli) if python3 < 3.11)
%endif
BuildRequires: python-rpm-macros
BuildRequires: python-srpm-macros
BuildRequires: python3-rpm-macros
Requires: python-rpm-macros
Requires: python-srpm-macros
Requires: python3-rpm-macros
Requires: (pyproject-srpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} if pyproject-srpm-macros)
Requires: /usr/bin/find
Requires: /usr/bin/sed
Requires: ((rpm-build >= 4.14.90 with (rpm-build < 4.19.90 or rpm-build >= 4.19.91-8)) if rpm-build)
BuildRequires: rpm-build >= 4.14.90
%description
These macros allow projects that follow the Python packaging specifications
to be packaged as RPMs.
They work for:
* traditional Setuptools-based projects that use the setup.py file,
* newer Setuptools-based projects that have a setup.cfg file,
* general Python projects that use the PEP 517 pyproject.toml file
(which allows using any build system, such as setuptools, flit or poetry).
These macros replace %%py3_build and %%py3_install,
which only work with setup.py.
%package -n pyproject-srpm-macros
Summary: Minimal implementation of %%pyproject_buildrequires
Requires: (pyproject-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} if pyproject-rpm-macros)
Requires: (rpm-build >= 4.14.90 if rpm-build)
%description -n pyproject-srpm-macros
This package contains a minimal implementation of %%pyproject_buildrequires.
When used in %%generate_buildrequires, it will generate BuildRequires
for pyproject-rpm-macros. When both packages are installed, the full version
takes precedence.
%prep
# Not strictly necessary but allows working on file names instead
# of source numbers in install section
%setup -c -T
cp -p %{sources} .
#generate_buildrequires
# nothing to do, this is here just to assert we have that functionality
%build
# nothing to do, sources are not buildable
%install
mkdir -p %{buildroot}%{_rpmmacrodir}
mkdir -p %{buildroot}%{_rpmconfigdir}/openEuler
install -pm 644 macros.pyproject %{buildroot}%{_rpmmacrodir}/
install -pm 644 macros.aaa-pyproject-srpm %{buildroot}%{_rpmmacrodir}/
install -pm 644 pyproject_buildrequires.py %{buildroot}%{_rpmconfigdir}/openEuler/
install -pm 644 pyproject_convert.py %{buildroot}%{_rpmconfigdir}/openEuler/
install -pm 644 pyproject_save_files.py %{buildroot}%{_rpmconfigdir}/openEuler/
install -pm 644 pyproject_preprocess_record.py %{buildroot}%{_rpmconfigdir}/openEuler/
install -pm 644 pyproject_construct_toxenv.py %{buildroot}%{_rpmconfigdir}/openEuler/
install -pm 644 pyproject_requirements_txt.py %{buildroot}%{_rpmconfigdir}/openEuler/
install -pm 644 pyproject_wheel.py %{buildroot}%{_rpmconfigdir}/openEuler/
%check
# assert the two signatures of %%pyproject_buildrequires match exactly
signature1="$(grep '^%%pyproject_buildrequires' macros.pyproject | cut -d' ' -f1)"
signature2="$(grep '^%%pyproject_buildrequires' macros.aaa-pyproject-srpm | cut -d' ' -f1)"
test "$signature1" == "$signature2"
# but also assert we are not comparing empty strings
test "$signature1" != ""
%if %{with tests}
export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856356
pytest -vv --doctest-modules %{?with_pytest_xdist:-n auto} %{!?with_tox_tests:-k "not tox"}
# brp-compress is provided as an argument to get the right directory macro expansion
python3 compare_mandata.py -f %{_rpmconfigdir}/brp-compress
%endif
rm -rf %{buildroot}%{_rpmconfigdir}/openEuler/__pycache__
%files
%{_rpmmacrodir}/macros.pyproject
%{_rpmconfigdir}/openEuler/pyproject_buildrequires.py
%{_rpmconfigdir}/openEuler/pyproject_convert.py
%{_rpmconfigdir}/openEuler/pyproject_save_files.py
%{_rpmconfigdir}/openEuler/pyproject_preprocess_record.py
%{_rpmconfigdir}/openEuler/pyproject_construct_toxenv.py
%{_rpmconfigdir}/openEuler/pyproject_requirements_txt.py
%{_rpmconfigdir}/openEuler/pyproject_wheel.py
%doc README.md
%license LICENSE
%files -n pyproject-srpm-macros
%{_rpmmacrodir}/macros.aaa-pyproject-srpm
%license LICENSE
%changelog
* Fri Sep 20 2024 misaka00251 <liuxin@iscas.ac.cn> - 1.15.0-1
- Init package
|