Skip to content

Commit eb0a3ad

Browse files
Bring back Python >= 3.6 and EL 8 support (#256)
Bring back Python >= 3.6 and EL 8 support Fixes #255. RELEASE NOTES BEGIN specfile now once again supports EPEL 8 and Python 3.6. RELEASE NOTES END Reviewed-by: Tomas Tomecek <[email protected]> Reviewed-by: Jiri Popelka Reviewed-by: František Lachman <[email protected]>
2 parents 8aae0b1 + ae67eb6 commit eb0a3ad

21 files changed

+319
-64
lines changed

.github/workflows/prepare-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
uses: packit/prepare-release@v1
2424
with:
2525
version: ${{ inputs.version }}
26-
specfiles: fedora/python-specfile.spec
26+
specfiles: fedora/python-specfile.spec,epel8/python-specfile.spec
2727
- name: Create Pull Request
2828
uses: peter-evans/create-pull-request@v4
2929
with:

.packit.yaml

Lines changed: 103 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,174 @@
11
---
2-
# We want to use both instances for all upstream jobs including the `propose-downstream` one.
3-
# For downstream, we need to pick just one instance (`stg` in our case)
4-
# and redefine it for the `koji_build` and `bodhi_update` jobs.
52
packit_instances: ["prod", "stg"]
63

7-
specfile_path: fedora/python-specfile.spec
8-
9-
# add or remove files that should be synced
10-
files_to_sync:
11-
- fedora/python-specfile.spec
12-
- .packit.yaml
13-
- src: plans/
14-
dest: plans/
15-
- src: .fmf/
16-
dest: .fmf/
17-
18-
# name in upstream package repository or registry (e.g. in PyPI)
194
upstream_package_name: specfile
20-
# downstream (Fedora) RPM package name
215
downstream_package_name: python-specfile
226

23-
copy_upstream_release_description: true
24-
257
upstream_project_url: https://github.com/packit/specfile
268
issue_repository: https://github.com/packit/specfile
279

10+
copy_upstream_release_description: true
11+
2812
actions:
29-
# we need this b/c `git archive` doesn't put all the metadata in the tarball:
30-
# LookupError: setuptools-scm was unable to detect version for '/builddir/build/BUILD/ogr-0.11.1'.
31-
# Make sure you're either building from a fully intact git repository or PyPI tarballs.
32-
create-archive:
33-
- python3 -m build --sdist --outdir ./fedora/
34-
- bash -c "ls -1t ./fedora/*.tar.gz | head -n 1"
35-
get-current-version: python3 -m setuptools_scm
3613
pre-sync:
37-
# FMF has to be installed on system where you are calling this tool.
3814
- python3 plans/git_reference.py
3915

40-
srpm_build_deps:
41-
- python3-build
42-
- python3-setuptools_scm
16+
packages:
17+
specfile:
18+
specfile_path: &specfile_path fedora/python-specfile.spec
19+
files_to_sync:
20+
- *specfile_path
21+
- .packit.yaml
22+
- src: plans/
23+
dest: plans/
24+
- src: .fmf/
25+
dest: .fmf/
26+
srpm_build_deps:
27+
- python3-build
28+
- python3-setuptools_scm
29+
actions:
30+
create-archive:
31+
- python3 -m build --sdist --outdir ./fedora/
32+
- bash -c "ls -1t ./fedora/*.tar.gz | head -n 1"
33+
get-current-version: python3 -m setuptools_scm
4334

44-
jobs:
45-
- job: propose_downstream
46-
trigger: release
47-
dist_git_branches:
48-
- fedora-all
49-
- epel-9
35+
specfile-epel8:
36+
specfile_path: &specfile_path_epel8 epel8/python-specfile.spec
37+
files_to_sync:
38+
- *specfile_path_epel8
39+
- .packit.yaml
40+
- src: plans/
41+
dest: plans/
42+
- src: .fmf/
43+
dest: .fmf/
44+
srpm_build_deps:
45+
- python3-setuptools_scm
46+
actions:
47+
create-archive:
48+
- python3 setup.py sdist --dist-dir ./epel8/
49+
- bash -c "ls -1t ./epel8/*.tar.gz | head -n 1"
50+
get-current-version: python3 setup.py --version
5051

52+
jobs:
5153
- job: copr_build
5254
trigger: pull_request
55+
packages: [specfile]
5356
targets:
5457
- fedora-all
5558
- epel-9
56-
57-
- job: tests
59+
- job: copr_build
5860
trigger: pull_request
61+
packages: [specfile-epel8]
5962
targets:
60-
- fedora-all
61-
- epel-9
63+
- epel-8
6264

6365
- job: copr_build
6466
trigger: commit
6567
branch: main
68+
packages: [specfile]
6669
targets:
6770
- fedora-all
6871
- epel-9
6972
project: packit-dev
7073
list_on_homepage: True
7174
preserve_project: True
75+
- job: copr_build
76+
trigger: commit
77+
branch: main
78+
packages: [specfile-epel8]
79+
targets:
80+
- epel-8
81+
project: packit-dev
82+
list_on_homepage: True
83+
preserve_project: True
7284

7385
- job: copr_build
7486
trigger: commit
7587
branch: stable
88+
packages: [specfile]
7689
targets:
7790
- fedora-stable
7891
- epel-9
7992
project: packit-stable
8093
list_on_homepage: True
8194
preserve_project: True
95+
- job: copr_build
96+
trigger: commit
97+
branch: stable
98+
packages: [specfile-epel8]
99+
targets:
100+
- epel-8
101+
project: packit-stable
102+
list_on_homepage: True
103+
preserve_project: True
82104

83105
- job: copr_build
84106
trigger: release
107+
packages: [specfile]
85108
targets:
86109
- fedora-all
87110
- epel-9
88111
project: packit-releases
89112
list_on_homepage: True
90113
preserve_project: True
114+
- job: copr_build
115+
trigger: release
116+
packages: [specfile-epel8]
117+
targets:
118+
- epel-8
119+
project: packit-releases
120+
list_on_homepage: True
121+
preserve_project: True
122+
123+
- job: tests
124+
trigger: pull_request
125+
packages: [specfile]
126+
targets:
127+
- fedora-all
128+
- epel-9
129+
- job: tests
130+
trigger: pull_request
131+
packages: [specfile-epel8]
132+
targets:
133+
- epel-8
134+
135+
- job: propose_downstream
136+
trigger: release
137+
packages: [specfile]
138+
dist_git_branches:
139+
- fedora-all
140+
- epel-9
141+
- job: propose_downstream
142+
trigger: release
143+
packages: [specfile-epel8]
144+
dist_git_branches:
145+
- epel-8
91146

92147
- job: pull_from_upstream
93148
trigger: release
149+
packages: [specfile]
94150
dist_git_branches:
95151
- fedora-all
96152
- epel-9
153+
- job: pull_from_upstream
154+
trigger: release
155+
packages: [specfile-epel8]
156+
dist_git_branches:
157+
- epel-8
97158

98-
# downstream automation:
99159
- job: koji_build
100160
trigger: commit
101161
packit_instances: ["stg"]
102162
allowed_pr_authors: ["packit-stg", "packit"]
103163
dist_git_branches:
104164
- fedora-all
105165
- epel-9
166+
- epel-8
167+
106168
- job: bodhi_update
107169
trigger: commit
108170
packit_instances: ["stg"]
109171
dist_git_branches:
110172
- fedora-branched # rawhide updates are created automatically
111173
- epel-9
174+
- epel-8

epel8/python-specfile.spec

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
%global desc %{expand:
2+
Python library for parsing and manipulating RPM spec files.
3+
Main focus is on modifying existing spec files, any change should result
4+
in a minimal diff.}
5+
6+
7+
Name: python-specfile
8+
Version: 0.7.0
9+
Release: 1%{?dist}
10+
11+
Summary: A library for parsing and manipulating RPM spec files
12+
License: MIT
13+
URL: https://github.com/packit/specfile
14+
15+
Source0: %{pypi_source specfile}
16+
17+
BuildArch: noarch
18+
19+
BuildRequires: python%{python3_pkgversion}-devel
20+
BuildRequires: %{py3_dist setuptools setuptools-scm setuptools-scm-git-archive}
21+
BuildRequires: %{py3_dist importlib-metadata dataclasses rpm typing-extensions}
22+
BuildRequires: %{py3_dist flexmock pytest}
23+
BuildRequires: git-core
24+
25+
26+
%description
27+
%{desc}
28+
29+
30+
%package -n python%{python3_pkgversion}-specfile
31+
Summary: %{summary}
32+
33+
34+
%description -n python%{python3_pkgversion}-specfile
35+
%{desc}
36+
37+
38+
%prep
39+
%autosetup -p1 -n specfile-%{version}
40+
# Use packaged RPM python bindings downstream
41+
sed -i 's/rpm-py-installer/rpm/' setup.cfg
42+
# Remove bundled egg-info
43+
rm -rf specfile.egg-info
44+
45+
46+
%build
47+
%py3_build
48+
49+
50+
%install
51+
%py3_install
52+
53+
54+
%check
55+
%pytest
56+
57+
58+
%files -n python%{python3_pkgversion}-specfile
59+
%license LICENSE
60+
%doc README.md
61+
%{python3_sitelib}/specfile
62+
%{python3_sitelib}/specfile-%{version}-py%{python3_version}.egg-info
63+
64+
65+
%changelog
66+
* Fri Oct 07 2022 Packit Team <[email protected]> - 0.7.0-1
67+
- New upstream release 0.7.0
68+
69+
* Thu Aug 25 2022 Nikola Forró <[email protected]> - 0.6.0-1
70+
- New upstream release 0.6.0
71+
72+
* Tue Aug 09 2022 Nikola Forró <[email protected]> - 0.5.1-1
73+
- New upstream release 0.5.1
74+
75+
* Thu Jul 21 2022 Nikola Forró <[email protected]> - 0.5.0-1
76+
- New upstream release 0.5.0
77+
78+
* Thu Jun 16 2022 Nikola Forró <[email protected]> - 0.4.0-1
79+
- New upstream release 0.4.0
80+
81+
* Tue May 10 2022 Nikola Forró <[email protected]> - 0.3.0-1
82+
- New upstream release 0.3.0
83+
84+
* Wed Mar 30 2022 Nikola Forró <[email protected]> - 0.2.0-1
85+
- New upstream release 0.2.0
86+
87+
* Mon Feb 21 2022 Nikola Forró <[email protected]> - 0.1.1-1
88+
- New upstream release 0.1.1
89+
90+
* Tue Feb 08 2022 Nikola Forró <[email protected]> - 0.1.0-1
91+
- Initial package

files/install-requirements-pip.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@
33
hosts: all
44
tasks:
55
- include_tasks: tasks/generic-dnf-requirements.yaml
6+
- name: Install deps from PyPI
7+
pip:
8+
name: "{{ item }}"
9+
with_items:
10+
- typing-extensions
11+
become: true

files/tasks/rpm-deps.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
# Placeholder
33
- name: Install runtime RPM dependencies
44
dnf:
5-
name: []
5+
name:
6+
- python3-typing-extensions
67
become: true

plans/packit-integration.fmf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@ adjust:
2525
package: python3-pip
2626
- how: shell
2727
script: pip3 install flexmock deepdiff
28+
29+
- when: "distro == rhel-8 or distro == centos-8 or distro == centos-stream-8"
30+
because: "packit doesn't support EL 8"
31+
enabled: false

setup.cfg

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ classifiers =
1818
Programming Language :: Python
1919
Programming Language :: Python :: 3
2020
Programming Language :: Python :: 3 :: Only
21+
Programming Language :: Python :: 3.6
22+
Programming Language :: Python :: 3.7
23+
Programming Language :: Python :: 3.8
2124
Programming Language :: Python :: 3.9
2225
Programming Language :: Python :: 3.10
2326
Programming Language :: Python :: 3.11
27+
Programming Language :: Python :: 3.12
2428
Topic :: Software Development
2529
Topic :: Utilities
2630
keywords =
@@ -32,8 +36,11 @@ keywords =
3236
[options]
3337
packages = find:
3438
install_requires =
39+
importlib-metadata;python_version<"3.8"
40+
dataclasses;python_version<"3.7"
3541
rpm
36-
python_requires = >=3.9
42+
typing-extensions
43+
python_requires = >=3.6
3744
include_package_data = True
3845

3946
[options.extras_require]

setup.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/python3
2+
3+
# Copyright Contributors to the Packit project.
4+
# SPDX-License-Identifier: MIT
5+
6+
from setuptools import setup
7+
8+
setup(use_scm_version={"version_scheme": "post-release"})

specfile/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
A library for parsing and manipulating RPM spec files
66
"""
77

8-
from importlib.metadata import PackageNotFoundError, distribution
9-
108
from specfile.specfile import Specfile
119

10+
try:
11+
from importlib.metadata import PackageNotFoundError, distribution
12+
except ImportError:
13+
from importlib_metadata import PackageNotFoundError # type: ignore[no-redef]
14+
from importlib_metadata import distribution # type: ignore[no-redef]
15+
1216
try:
1317
__version__ = distribution(__name__).version
1418
except PackageNotFoundError:

0 commit comments

Comments
 (0)