Skip to content

Commit

Permalink
Bring back Python >= 3.6 and EL 8 support (#256)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
softwarefactory-project-zuul[bot] authored Jul 28, 2023
2 parents 8aae0b1 + ae67eb6 commit eb0a3ad
Show file tree
Hide file tree
Showing 21 changed files with 319 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: packit/prepare-release@v1
with:
version: ${{ inputs.version }}
specfiles: fedora/python-specfile.spec
specfiles: fedora/python-specfile.spec,epel8/python-specfile.spec
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
Expand Down
143 changes: 103 additions & 40 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -1,111 +1,174 @@
---
# We want to use both instances for all upstream jobs including the `propose-downstream` one.
# For downstream, we need to pick just one instance (`stg` in our case)
# and redefine it for the `koji_build` and `bodhi_update` jobs.
packit_instances: ["prod", "stg"]

specfile_path: fedora/python-specfile.spec

# add or remove files that should be synced
files_to_sync:
- fedora/python-specfile.spec
- .packit.yaml
- src: plans/
dest: plans/
- src: .fmf/
dest: .fmf/

# name in upstream package repository or registry (e.g. in PyPI)
upstream_package_name: specfile
# downstream (Fedora) RPM package name
downstream_package_name: python-specfile

copy_upstream_release_description: true

upstream_project_url: https://github.com/packit/specfile
issue_repository: https://github.com/packit/specfile

copy_upstream_release_description: true

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

srpm_build_deps:
- python3-build
- python3-setuptools_scm
packages:
specfile:
specfile_path: &specfile_path fedora/python-specfile.spec
files_to_sync:
- *specfile_path
- .packit.yaml
- src: plans/
dest: plans/
- src: .fmf/
dest: .fmf/
srpm_build_deps:
- python3-build
- python3-setuptools_scm
actions:
create-archive:
- python3 -m build --sdist --outdir ./fedora/
- bash -c "ls -1t ./fedora/*.tar.gz | head -n 1"
get-current-version: python3 -m setuptools_scm

jobs:
- job: propose_downstream
trigger: release
dist_git_branches:
- fedora-all
- epel-9
specfile-epel8:
specfile_path: &specfile_path_epel8 epel8/python-specfile.spec
files_to_sync:
- *specfile_path_epel8
- .packit.yaml
- src: plans/
dest: plans/
- src: .fmf/
dest: .fmf/
srpm_build_deps:
- python3-setuptools_scm
actions:
create-archive:
- python3 setup.py sdist --dist-dir ./epel8/
- bash -c "ls -1t ./epel8/*.tar.gz | head -n 1"
get-current-version: python3 setup.py --version

jobs:
- job: copr_build
trigger: pull_request
packages: [specfile]
targets:
- fedora-all
- epel-9

- job: tests
- job: copr_build
trigger: pull_request
packages: [specfile-epel8]
targets:
- fedora-all
- epel-9
- epel-8

- job: copr_build
trigger: commit
branch: main
packages: [specfile]
targets:
- fedora-all
- epel-9
project: packit-dev
list_on_homepage: True
preserve_project: True
- job: copr_build
trigger: commit
branch: main
packages: [specfile-epel8]
targets:
- epel-8
project: packit-dev
list_on_homepage: True
preserve_project: True

- job: copr_build
trigger: commit
branch: stable
packages: [specfile]
targets:
- fedora-stable
- epel-9
project: packit-stable
list_on_homepage: True
preserve_project: True
- job: copr_build
trigger: commit
branch: stable
packages: [specfile-epel8]
targets:
- epel-8
project: packit-stable
list_on_homepage: True
preserve_project: True

- job: copr_build
trigger: release
packages: [specfile]
targets:
- fedora-all
- epel-9
project: packit-releases
list_on_homepage: True
preserve_project: True
- job: copr_build
trigger: release
packages: [specfile-epel8]
targets:
- epel-8
project: packit-releases
list_on_homepage: True
preserve_project: True

- job: tests
trigger: pull_request
packages: [specfile]
targets:
- fedora-all
- epel-9
- job: tests
trigger: pull_request
packages: [specfile-epel8]
targets:
- epel-8

- job: propose_downstream
trigger: release
packages: [specfile]
dist_git_branches:
- fedora-all
- epel-9
- job: propose_downstream
trigger: release
packages: [specfile-epel8]
dist_git_branches:
- epel-8

- job: pull_from_upstream
trigger: release
packages: [specfile]
dist_git_branches:
- fedora-all
- epel-9
- job: pull_from_upstream
trigger: release
packages: [specfile-epel8]
dist_git_branches:
- epel-8

# downstream automation:
- job: koji_build
trigger: commit
packit_instances: ["stg"]
allowed_pr_authors: ["packit-stg", "packit"]
dist_git_branches:
- fedora-all
- epel-9
- epel-8

- job: bodhi_update
trigger: commit
packit_instances: ["stg"]
dist_git_branches:
- fedora-branched # rawhide updates are created automatically
- epel-9
- epel-8
91 changes: 91 additions & 0 deletions epel8/python-specfile.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
%global desc %{expand:
Python library for parsing and manipulating RPM spec files.
Main focus is on modifying existing spec files, any change should result
in a minimal diff.}


Name: python-specfile
Version: 0.7.0
Release: 1%{?dist}

Summary: A library for parsing and manipulating RPM spec files
License: MIT
URL: https://github.com/packit/specfile

Source0: %{pypi_source specfile}

BuildArch: noarch

BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: %{py3_dist setuptools setuptools-scm setuptools-scm-git-archive}
BuildRequires: %{py3_dist importlib-metadata dataclasses rpm typing-extensions}
BuildRequires: %{py3_dist flexmock pytest}
BuildRequires: git-core


%description
%{desc}


%package -n python%{python3_pkgversion}-specfile
Summary: %{summary}


%description -n python%{python3_pkgversion}-specfile
%{desc}


%prep
%autosetup -p1 -n specfile-%{version}
# Use packaged RPM python bindings downstream
sed -i 's/rpm-py-installer/rpm/' setup.cfg
# Remove bundled egg-info
rm -rf specfile.egg-info


%build
%py3_build


%install
%py3_install


%check
%pytest


%files -n python%{python3_pkgversion}-specfile
%license LICENSE
%doc README.md
%{python3_sitelib}/specfile
%{python3_sitelib}/specfile-%{version}-py%{python3_version}.egg-info


%changelog
* Fri Oct 07 2022 Packit Team <[email protected]> - 0.7.0-1
- New upstream release 0.7.0

* Thu Aug 25 2022 Nikola Forró <[email protected]> - 0.6.0-1
- New upstream release 0.6.0

* Tue Aug 09 2022 Nikola Forró <[email protected]> - 0.5.1-1
- New upstream release 0.5.1

* Thu Jul 21 2022 Nikola Forró <[email protected]> - 0.5.0-1
- New upstream release 0.5.0

* Thu Jun 16 2022 Nikola Forró <[email protected]> - 0.4.0-1
- New upstream release 0.4.0

* Tue May 10 2022 Nikola Forró <[email protected]> - 0.3.0-1
- New upstream release 0.3.0

* Wed Mar 30 2022 Nikola Forró <[email protected]> - 0.2.0-1
- New upstream release 0.2.0

* Mon Feb 21 2022 Nikola Forró <[email protected]> - 0.1.1-1
- New upstream release 0.1.1

* Tue Feb 08 2022 Nikola Forró <[email protected]> - 0.1.0-1
- Initial package
6 changes: 6 additions & 0 deletions files/install-requirements-pip.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
hosts: all
tasks:
- include_tasks: tasks/generic-dnf-requirements.yaml
- name: Install deps from PyPI
pip:
name: "{{ item }}"
with_items:
- typing-extensions
become: true
3 changes: 2 additions & 1 deletion files/tasks/rpm-deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
# Placeholder
- name: Install runtime RPM dependencies
dnf:
name: []
name:
- python3-typing-extensions
become: true
4 changes: 4 additions & 0 deletions plans/packit-integration.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ adjust:
package: python3-pip
- how: shell
script: pip3 install flexmock deepdiff

- when: "distro == rhel-8 or distro == centos-8 or distro == centos-stream-8"
because: "packit doesn't support EL 8"
enabled: false
9 changes: 8 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ classifiers =
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Topic :: Software Development
Topic :: Utilities
keywords =
Expand All @@ -32,8 +36,11 @@ keywords =
[options]
packages = find:
install_requires =
importlib-metadata;python_version<"3.8"
dataclasses;python_version<"3.7"
rpm
python_requires = >=3.9
typing-extensions
python_requires = >=3.6
include_package_data = True

[options.extras_require]
Expand Down
8 changes: 8 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/python3

# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT

from setuptools import setup

setup(use_scm_version={"version_scheme": "post-release"})
8 changes: 6 additions & 2 deletions specfile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
A library for parsing and manipulating RPM spec files
"""

from importlib.metadata import PackageNotFoundError, distribution

from specfile.specfile import Specfile

try:
from importlib.metadata import PackageNotFoundError, distribution
except ImportError:
from importlib_metadata import PackageNotFoundError # type: ignore[no-redef]
from importlib_metadata import distribution # type: ignore[no-redef]

try:
__version__ = distribution(__name__).version
except PackageNotFoundError:
Expand Down
Loading

0 comments on commit eb0a3ad

Please sign in to comment.