14
0

- update to 0.5.0:

* Support all documented options in requirements files #62
  * Library is now typed according to PEP561 (`0e1bb6a`)
  * Readthedocs config (`ac1e7fb`)
  * Added some typing (`169ff6e`)
  * Removed Python 2 code (`82f9473`)
  * Removed version from __init__ (`4e83b9d`)
- drop
  0001-Dont-fail-with-valid-options-in-requirements_txt-files.patch,
  remove-nose.patch: upstream
- add dont-install-readme.patch

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-requirements-parser?expand=0&rev=18
This commit is contained in:
2023-12-27 16:24:19 +00:00
committed by Git OBS Bridge
parent c32b4b0004
commit 874532bb50
7 changed files with 46 additions and 99 deletions

View File

@@ -1,39 +0,0 @@
From fd172ae6faf56f3d221666fb336e84df01d8b943 Mon Sep 17 00:00:00 2001
From: Antonio Larrosa <alarrosa@suse.com>
Date: Wed, 15 Apr 2020 11:40:47 +0200
Subject: [PATCH] Don't fail with valid options in requirements.txt files
When parsing requirements.txt files, a number of options can be used
that shouldn't make the parser fail. The list of options can
be seen at:
https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format
---
requirements/parser.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/requirements/parser.py b/requirements/parser.py
index 024c905..1bb66f5 100644
--- a/requirements/parser.py
+++ b/requirements/parser.py
@@ -46,5 +46,20 @@ def parse(reqstr):
elif line.startswith('-Z') or line.startswith('--always-unzip'):
warnings.warn('Unused option --always-unzip. Skipping.')
continue
+ elif line.startswith('-c') or line.startswith('--constraint'):
+ warnings.warn('--constraint option not supported. Skipping.')
+ continue
+ elif line.startswith('--no-binary') or line.startswith('--only-binary'):
+ warnings.warn('--no-binary and --only-binary options not supported. Skipping.')
+ continue
+ elif line.startswith('--require-hashes'):
+ warnings.warn('Unused option --require-hashes. Skipping.')
+ continue
+ elif line.startswith('--pre'):
+ warnings.warn('Unused option --pre. Skipping.')
+ continue
+ elif line.startswith('--trusted-host'):
+ warnings.warn('Unused option --trusted-host. Skipping.')
+ continue
else:
yield Requirement.parse(line)

16
dont-install-readme.patch Normal file
View File

@@ -0,0 +1,16 @@
Index: requirements-parser-0.5.0/pyproject.toml
===================================================================
--- requirements-parser-0.5.0.orig/pyproject.toml
+++ requirements-parser-0.5.0/pyproject.toml
@@ -21,11 +21,6 @@ repository = "https://github.com/madpah/
packages = [
{ include = "requirements" }
]
-include = [
- "AUTHORS.rst",
- "LICENSE",
- "README.md"
-]
classifiers = [
# Trove classifiers - https://packaging.python.org/specifications/core-metadata/#metadata-classifier
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers

View File

@@ -1,3 +1,18 @@
-------------------------------------------------------------------
Wed Dec 27 16:21:19 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 0.5.0:
* Support all documented options in requirements files #62
* Library is now typed according to PEP561 (`0e1bb6a`)
* Readthedocs config (`ac1e7fb`)
* Added some typing (`169ff6e`)
* Removed Python 2 code (`82f9473`)
* Removed version from __init__ (`4e83b9d`)
- drop
0001-Dont-fail-with-valid-options-in-requirements_txt-files.patch,
remove-nose.patch: upstream
- add dont-install-readme.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Fri May 5 11:15:29 UTC 2023 - Johannes Kastl <kastl@b1-systems.de> Fri May 5 11:15:29 UTC 2023 - Johannes Kastl <kastl@b1-systems.de>

View File

@@ -18,46 +18,45 @@
%{?sle15_python_module_pythons} %{?sle15_python_module_pythons}
Name: python-requirements-parser Name: python-requirements-parser
Version: 0.2.0 Version: 0.5.0
Release: 0 Release: 0
Summary: Pip requirement file parser Summary: Pip requirement file parser
License: BSD-2-Clause License: BSD-2-Clause
Group: Development/Languages/Python Group: Development/Languages/Python
URL: https://github.com/davidfischer/requirements-parser URL: https://github.com/davidfischer/requirements-parser
Source: https://github.com/davidfischer/requirements-parser/archive/v%{version}.tar.gz#/requirements-parser-%{version}.tar.gz Source: https://github.com/davidfischer/requirements-parser/archive/v%{version}.tar.gz#/requirements-parser-%{version}.tar.gz
# PATCH-FIX-UPSTREAM 0001-Dont-fail-with-valid-options-in-requirements_txt-files.patch alarrosa@suse.com -- https://github.com/davidfischer/requirements-parser/pull/47 Patch1: dont-install-readme.patch
Patch0: 0001-Dont-fail-with-valid-options-in-requirements_txt-files.patch BuildRequires: %{python_module pip}
Patch1: remove-nose.patch BuildRequires: %{python_module poetry-core}
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module wheel}
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
# SECTION test requirements # SECTION test requirements
BuildRequires: %{python_module pytest} BuildRequires: %{python_module pytest}
# /SECTION # /SECTION
BuildRequires: fdupes BuildRequires: fdupes
BuildArch: noarch BuildArch: noarch
%python_subpackages %python_subpackages
%description %description
A Pip requirement file parser. A Pip requirement file parser.
%prep %prep
%setup -q -n requirements-parser-%{version} %autosetup -p1 -n requirements-parser-%{version}
%autopatch -p1
%build %build
%python_build %pyproject_wheel
%install %install
%python_install %pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib} %python_expand %fdupes %{buildroot}%{$python_sitelib}
%check %check
%pytest %pytest
%files %{python_files} %files %{python_files}
%doc AUTHORS.rst README.rst docs/*.rst %license LICENSE
%license LICENSE.rst %doc AUTHORS.rst README.md
%{python_sitelib}/* %{python_sitelib}/requirements
%{python_sitelib}/requirements_parser-%{version}.dist-info
%changelog %changelog

View File

@@ -1,44 +0,0 @@
Index: requirements-parser-0.2.0/tests/test_parser.py
===================================================================
--- requirements-parser-0.2.0.orig/tests/test_parser.py
+++ requirements-parser-0.2.0/tests/test_parser.py
@@ -1,6 +1,6 @@
import os
import json
-from nose.tools import raises, assert_equal
+from pytest import raises
import warnings
from requirements import parse
@@ -32,17 +32,17 @@ def test_requirement_files():
return f
@fancy
- @raises(ValueError)
def check_fail(s):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
- list([dict(r) for r in parse(s)])
+ with raises(ValueError):
+ list([dict(r) for r in parse(s)])
@fancy
def check(s, expected):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
- assert_equal(listify(dict(r) for r in parse(s)), expected)
+ assert listify(dict(r) for r in parse(s)) == expected
fp = os.path.join(REQFILE_DIR, fn)
@@ -51,8 +51,8 @@ def test_requirement_files():
continue
if 'fail' in fn:
- yield check_fail, open(fp)
+ check_fail(open(fp))
else:
with open(fp[:-4] + '.expected', 'r') as f2:
expected = json.loads(f2.read())
- yield check, open(fp), expected
+ check(open(fp), expected)

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e2484f866684f732ac7ee829042ee8884835dec394acf6573d339fddb6f15ac7
size 20070

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:49dd8e415d7402eda2dffd31b73abee691de040470de1dbb2ebfb3ce16dd7c22
size 37457