Convert to pyproject macros

This commit is contained in:
Carl George 2022-05-06 15:44:29 -05:00
parent 4292e2da8c
commit f074ac9671
2 changed files with 70 additions and 38 deletions

View File

@ -0,0 +1,40 @@
From bf93b56a7bf0fc6c88508438b2c58452ef0775ef Mon Sep 17 00:00:00 2001
From: Carl George <carl@george.computer>
Date: Fri, 6 May 2022 15:02:17 -0500
Subject: [PATCH] Add docs and test extras
This makes it easier to install just documentation or test dependencies
without installing all dev dependencies.
---
pyproject.toml | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/pyproject.toml b/pyproject.toml
index a2ee476..0814537 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -11,6 +11,10 @@ documentation = "https://pyiso8601.readthedocs.io/en/latest/"
[tool.poetry.dependencies]
python = ">=3.6.2,<4.0"
+pytest = { version = "^6.2.2", optional = true }
+hypothesis = { version = "^6.1.1", optional = true }
+pytz = { version = "^2021.1", optional = true }
+Sphinx = { version = "^4.2.0", optional = true }
[tool.poetry.dev-dependencies]
mypy = "^0.910"
@@ -24,6 +28,10 @@ pre-commit = "^2.15.0"
nox = "^2021.10.1"
Sphinx = "^4.2.0"
+[tool.poetry.extras]
+docs = ["Sphinx"]
+test = ["pytest", "hypothesis", "pytz"]
+
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
--
2.35.1

View File

@ -1,68 +1,60 @@
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
%global srcname iso8601
%global pkgdesc \
This module parses the most common forms of ISO 8601 date strings \
(e.g. 2007-01-14T20:34:22+00:00) into datetime objects.
%bcond_without tests
Name: python-%{srcname}
Version: 1.0.2
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Simple module to parse ISO 8601 dates
License: MIT
URL: https://github.com/micktwomey/pyiso8601
Source0: %{pypi_source}
Source: %{pypi_source}
# https://github.com/micktwomey/pyiso8601/pull/19
Patch: 0001-Add-docs-and-test-extras.patch
BuildArch: noarch
%description %{pkgdesc}
%package -n python%{python3_pkgversion}-%{srcname}
%package -n python3-%{srcname}
Summary: %{summary}
BuildRequires: python3-devel
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
%description -n python%{python3_pkgversion}-%{srcname} %{pkgdesc}
%if 0%{?with_python3_other}
%package -n python%{python3_other_pkgversion}-%{srcname}
Summary: %{summary}
BuildRequires: python%{python3_other_pkgversion}-devel
BuildRequires: python%{python3_other_pkgversion}-setuptools
%{?python_provide:%python_provide python%{python3_other_pkgversion}-%{srcname}}
%description -n python%{python3_other_pkgversion}-%{srcname} %{pkgdesc}
%endif
%description -n python3-%{srcname} %{pkgdesc}
%prep
%autosetup -n %{srcname}-%{version}
%autosetup -p 1 -n %{srcname}-%{version}
# relax upper bounds on dependencies
sed -e 's/\^/>=/' -i pyproject.toml
%generate_buildrequires
%pyproject_buildrequires %{?with_tests:-x test}
%build
%py3_build
%if 0%{?with_python3_other}
%py3_other_build
%endif
%pyproject_wheel
%install
%py3_install
%if 0%{?with_python3_other}
%py3_other_install
%pyproject_install
%pyproject_save_files %{srcname}
%check
%if %{with tests}
%pytest
%else
%pyproject_check_import -e iso8601.test_iso8601
%endif
%files -n python%{python3_pkgversion}-%{srcname}
%doc LICENSE README.rst
%{python3_sitelib}/*
%if 0%{?with_python3_other}
%files -n python%{python3_other_pkgversion}-%{srcname}
%doc LICENSE README.rst
%{python3_other_sitelib}/*
%endif
%files -n python3-%{srcname} -f %{pyproject_files}
%license LICENSE
%doc README.rst
%changelog
* Fri May 06 2022 Carl George <carl@george.computer> - 1.0.2-2
- Convert to pyproject macros
* Thu Mar 24 2022 Fabian Affolter <mail@fabian-affolter.ch> - 1.0.2-1
- Update to latest upstream release 1.0.2