Skip to content

Commit

Permalink
Packaging modernization (#275)
Browse files Browse the repository at this point in the history
Packaging modernization

Fixes #273.
Related to packit/ogr#798.

Reviewed-by: Jiri Popelka
Reviewed-by: Matej Focko
Reviewed-by: Nikola Forró
  • Loading branch information
2 parents 46f93f0 + 7127971 commit f0795b5
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 103 deletions.
4 changes: 4 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true)$
ref-names: $Format:%D$
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Needed for setuptools-scm
.git_archival.txt export-subst
15 changes: 6 additions & 9 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ actions:
# LookupError: setuptools-scm was unable to detect version for '/builddir/build/BUILD/requre-0.11.1'.
# Make sure you're either building from a fully intact git repository or PyPI tarballs.
create-archive:
- python3 setup.py sdist --dist-dir ./fedora/
- python3 -m build --sdist --outdir ./fedora/
- bash -c "ls -1t ./fedora/*.tar.gz | head -n 1"
get-current-version: python3 setup.py --version
get-current-version:
- hatch version

srpm_build_deps:
- python3-pip # "python3 setup.py --version" needs it
- python3-setuptools_scm
- python3-build
- hatch
- python3-hatch-vcs

jobs:
- job: sync_from_downstream
Expand All @@ -39,15 +41,13 @@ jobs:
trigger: pull_request
targets:
- fedora-all
- epel-8
- epel-9
- job: copr_build
trigger: commit
branch: main
project: packit-dev
targets:
- fedora-all
- epel-8
- epel-9
list_on_homepage: True
preserve_project: True
Expand All @@ -56,7 +56,6 @@ jobs:
project: packit-releases
targets:
- fedora-all
- epel-8
- epel-9
list_on_homepage: True
preserve_project: True
Expand All @@ -67,13 +66,11 @@ jobs:
packit_instances: ["stg"]
dist_git_branches:
- fedora-all
- epel-8
- epel-9
- job: bodhi_update
trigger: commit
packit_instances: ["stg"]
dist_git_branches:
- fedora-latest # branched version, rawhide updates are created automatically
- fedora-stable
- epel-8
- epel-9
64 changes: 32 additions & 32 deletions fedora/python-requre.spec
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
%global srcname requre
%global desc %{expand:
REQUest REcordingRequre [rekure] - Is Library for storing output of various
function and methods to persistent storage and be able to replay the stored
output to functions.}


Name: python-%{srcname}
Name: python-requre
Version: 0.8.2
Release: 1%{?dist}
Summary: Python library what allows re/store output of various objects for testing
Summary: Python library that allows re/store output of various objects for testing

License: MIT
URL: https://github.com/packit/requre
Source0: %{pypi_source}
Source0: %{pypi_source requre}
BuildArch: noarch

BuildRequires: python3-devel
BuildRequires: python3dist(click)
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pyyaml)
BuildRequires: python3dist(requests)
BuildRequires: python3dist(setuptools)
BuildRequires: python3dist(setuptools-scm)
BuildRequires: python3dist(setuptools-scm-git-archive)
BuildRequires: python3dist(sphinx)


%description
REQUest REcordingRequre [rekure] - Is Library for storing output of various
function and methods to persistent storage and be able to replay the stored
output to functions.
%{desc}


%package -n python3-%{srcname}
%package -n python3-requre
Summary: %{summary}

# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_provides
%if 0%{?fedora} < 33
%{?python_provide:%python_provide python3-%{srcname}}
%endif

%description -n python3-%{srcname}
REQUest REcordingRequre [rekure] - Is Library for storing output of various
function and methods to persistent storage and be able to replay the stored
output to functions.
%description -n python3-requre
%{desc}


%prep
%autosetup -n %{srcname}-%{version}
# Remove bundled egg-info
rm -rf %{srcname}.egg-info
%autosetup -n requre-%{version}


%generate_buildrequires
# The -w flag is required for EPEL 9's older hatchling
%pyproject_buildrequires %{?el9:-w}


%build
%py3_build
%pyproject_wheel


%install
%py3_install
%pyproject_install
%pyproject_save_files requre


%files -n python3-%{srcname}
%files -n python3-requre -f %{pyproject_files}
# Epel9 does not tag the license file in pyproject_files as a license. Manually install it in this case
%if 0%{?el9}
%license LICENSE
%endif
%doc README.md
%{_bindir}/requre-patch
%{python3_sitelib}/%{srcname}
%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info


%changelog
* Wed Apr 13 2022 Frantisek Lachman <[email protected]> - 0.8.2-1
Expand Down
1 change: 0 additions & 1 deletion files/tasks/rpm-test-deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
- python3-setuptools
- git-core
- python3-setuptools_scm
- python3-setuptools_scm_git_archive
- python3-wheel # for bdist_wheel
- python3-pytest
state: present
Expand Down
58 changes: 58 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "requre"
authors = [
{ name = "Red Hat", email = "[email protected]" },
]
description = "Library for testing Python code that allows to store output of various objects and use the stored data for testing."
license = "MIT"
license-files = { paths = ["LICENSE"] }
requires-python = ">=3.6"
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Software Development",
"Topic :: Utilities",
]
dynamic = ["version"]
keywords = [
"testing",
"persistent_storage",
"session_storage",
]
dependencies = [
"click",
"GitPython",
"pytest",
"PyYAML",
"requests",
]

[project.urls]
Homepage = "https://github.com/packit/requre"

[project.optional-dependencies]
testing = ["pytest"]

[project.scripts]
requre-patch = "requre.requre_patch:requre_base"

[tool.hatch.version]
source = "vcs"
# we can't use pre-release-based version scheme because it generates versions
# that are sorted higher than the last stable release by RPM
# for example:
# - pre-release (guess-next-dev):
# 0.20.1.dev1+g0abcdef.d20230921 > 0.20.1
# - post-release (no-guess-dev):
# 0.20.0.post1.dev1+g0abcdef < 0.20.1
raw-options.version_scheme = "no-guess-dev"
53 changes: 0 additions & 53 deletions setup.cfg

This file was deleted.

8 changes: 0 additions & 8 deletions setup.py

This file was deleted.

0 comments on commit f0795b5

Please sign in to comment.