Skip to content

Commit

Permalink
Switch to pyproject.toml and hatchling and get rid of setuptools_scm_…
Browse files Browse the repository at this point in the history
…git_archive (#808)

Switch to pyproject.toml and hatchling and get rid of setuptools_scm_git_archive

Fixes #798.
Fixes #805.

Reviewed-by: Jiri Popelka
  • Loading branch information
2 parents b6666b1 + 70fa3a6 commit 69de9bd
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 93 deletions.
3 changes: 3 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true)$
ref-names: $Format:%D$
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Needed for setuptools-scm-git-archive
# Needed for setuptools-scm
.git_archival.txt export-subst
10 changes: 6 additions & 4 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ actions:
# 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 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 -W ignore setup.py --version # TODO: remove -W ignore when setup process is updated
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 Down
38 changes: 17 additions & 21 deletions fedora/python-ogr.spec
Original file line number Diff line number Diff line change
@@ -1,54 +1,50 @@
%global srcname ogr

Name: python-%{srcname}
Name: python-ogr
Version: 0.46.0
Release: 1%{?dist}
Summary: One API for multiple git forges

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

BuildRequires: python3-devel
BuildRequires: python3dist(setuptools)
BuildRequires: python3dist(setuptools-scm)
BuildRequires: python3dist(setuptools-scm-git-archive)

%description
One Git library to Rule!

%package -n python3-%{srcname}
%package -n python3-ogr
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}
%description -n python3-ogr
One Git library to Rule!


%prep
%autosetup -n %{srcname}-%{version}
# Remove bundled egg-info
rm -rf %{srcname}.egg-info
%autosetup -n ogr-%{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 ogr


%files -n python3-%{srcname}
%files -n python3-ogr -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
%{python3_sitelib}/%{srcname}
%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info


%changelog
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 @@ -6,7 +6,6 @@
- python3-setuptools
- git-core
- python3-setuptools_scm
- python3-setuptools_scm_git_archive
- python3-wheel # for bdist_wheel
- python3-pytest
- python3-tox
Expand Down
66 changes: 66 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "ogr"
authors = [
{ name = "Red Hat", email = "user-cont-team@redhat.com" },
]
description = "One API for multiple git forges."
license = "MIT"
license-files = { paths = ["LICENSE"] }
requires-python = ">=3.9"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Software Development",
"Topic :: Utilities",
]
dynamic = ["version"]
keywords = [
"git",
"api",
"github",
"gitlab",
"pagure",
]
dependencies = [
"cryptography",
"Deprecated",
"GitPython",
"PyGithub",
"python-gitlab",
"PyYAML",
"requests",
"urllib3",
]

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

[project.optional-dependencies]
testing = [
"pytest",
"pytest-cov",
"flexmock",
]

[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"
1 change: 0 additions & 1 deletion recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
- python3-setuptools
- git-core
- python3-setuptools_scm
- python3-setuptools_scm_git_archive
- python3-wheel # for bdist_wheel
- python3-pytest
- python3-tox
Expand Down
60 changes: 0 additions & 60 deletions setup.cfg

This file was deleted.

5 changes: 0 additions & 5 deletions setup.py

This file was deleted.

0 comments on commit 69de9bd

Please sign in to comment.