commit 70ffeede245e6b5b9d9e87335605810390374951911b95bc5a3feebc0521aa5f Author: Matej Cepl Date: Sat Feb 4 20:14:31 2023 +0000 Accepting request 1063201 from home:mcepl Required by papis. OBS-URL: https://build.opensuse.org/request/show/1063201 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-doi?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/mark-network-tests.patch b/mark-network-tests.patch new file mode 100644 index 0000000..ec9937b --- /dev/null +++ b/mark-network-tests.patch @@ -0,0 +1,45 @@ +--- + setup.cfg | 4 +++- + tests/test_doi.py | 4 ++++ + 2 files changed, 7 insertions(+), 1 deletion(-) + +--- a/setup.cfg ++++ b/setup.cfg +@@ -5,7 +5,9 @@ universal = 1 + exclude = docs + + [tool:pytest] +-collect_ignore = ['setup.py'] ++markers = ++ net: marks tests that call use the net (using the URL endpoint, deselect with '-k "not net"') ++ + + [mypy] + disallow_redefinition = True +--- a/tests/test_doi.py ++++ b/tests/test_doi.py +@@ -3,6 +3,8 @@ + import os + from pkg_resources import parse_version + ++import pytest ++ + from doi import ( + validate_doi, find_doi_in_text, __version__, pdf_to_doi, + get_real_url_from_doi +@@ -14,6 +16,7 @@ def test_valid_version() -> None: + assert parse_version(__version__) >= parse_version("0.1.0") + + ++@pytest.mark.net + def test_validate_doi() -> None: + data = [ + ('10.1063/1.5081715', +@@ -38,6 +41,7 @@ def test_validate_doi() -> None: + assert str(e) == 'HTTP 404: DOI not found' + + ++@pytest.mark.net + def test_get_real_url_from_doi() -> None: + data = [ + ('10.1016/S0009-2614(97)04014-1', diff --git a/python-doi-0.2.0.tar.gz b/python-doi-0.2.0.tar.gz new file mode 100644 index 0000000..bb93538 --- /dev/null +++ b/python-doi-0.2.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e01e56fb319bd219ea8586baa43a1fc794dfe45a83156ac70242c4ce961fd9a +size 245853 diff --git a/python-python-doi.changes b/python-python-doi.changes new file mode 100644 index 0000000..095efc6 --- /dev/null +++ b/python-python-doi.changes @@ -0,0 +1,6 @@ +------------------------------------------------------------------- +Sat Feb 4 18:13:23 UTC 2023 - Matej Cepl + +- Initial packaging effort for python-doi 0.2.0. +- Add mark-network-tests.patch isolating network-requiring tests + (gh#alejandrogallo/python-doi#1). diff --git a/python-python-doi.spec b/python-python-doi.spec new file mode 100644 index 0000000..858640f --- /dev/null +++ b/python-python-doi.spec @@ -0,0 +1,63 @@ +# +# spec file for package python-python-doi +# +# Copyright (c) 2023 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: python-python-doi +Version: 0.2.0 +Release: 0 +Summary: Python package to work with Document Object Identifier (doi) +License: GPL-3.0-only +URL: https://github.com/papis/python-doi +Source: https://files.pythonhosted.org/packages/source/p/python-doi/python-doi-%{version}.tar.gz +# PATCH-FIX-UPSTREAM mark-network-tests.patch gh#alejandrogallo/python-doi#1 mcepl@suse.com +# mark tests requiring network access for their exclusion +Patch0: mark-network-tests.patch +BuildRequires: %{python_module pip} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Suggests: python-sphinx +Suggests: python-sphinx-autobuild +Suggests: python-sphinx-autodoc-typehints +Suggests: python-sphinx_rtd_theme +BuildArch: noarch +%python_subpackages + +%description +Python package to work with Document Object Identifier (doi) + +%prep +%autosetup -p1 -n python-doi-%{version} + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%pytest -k 'not net' + +%files %{python_files} +%doc AUTHORS.rst README.rst +%license LICENSE +%{python_sitelib}/doi +%{python_sitelib}/python_doi-%{version}*-info + +%changelog