From f360a0a79c49bae2730b0bbdd54b457e76d871573a650438c86337233ac21591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Wed, 15 Apr 2020 11:00:59 +0000 Subject: [PATCH] Accepting request 794147 from home:alarrosa:branches:devel:languages:python - Add patch to not fail parsing requirements files with valid options like --only-binary or --trusted-host: * 0001-Dont-fail-with-valid-options-in-requirements_txt-files.patch OBS-URL: https://build.opensuse.org/request/show/794147 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-requirements-parser?expand=0&rev=13 --- ...id-options-in-requirements_txt-files.patch | 39 +++++++++++++++++++ python-requirements-parser.changes | 7 ++++ python-requirements-parser.spec | 7 +++- 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 0001-Dont-fail-with-valid-options-in-requirements_txt-files.patch diff --git a/0001-Dont-fail-with-valid-options-in-requirements_txt-files.patch b/0001-Dont-fail-with-valid-options-in-requirements_txt-files.patch new file mode 100644 index 0000000..21d97b6 --- /dev/null +++ b/0001-Dont-fail-with-valid-options-in-requirements_txt-files.patch @@ -0,0 +1,39 @@ +From fd172ae6faf56f3d221666fb336e84df01d8b943 Mon Sep 17 00:00:00 2001 +From: Antonio Larrosa +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) diff --git a/python-requirements-parser.changes b/python-requirements-parser.changes index f613845..c15dafa 100644 --- a/python-requirements-parser.changes +++ b/python-requirements-parser.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Apr 15 08:39:06 UTC 2020 - Antonio Larrosa + +- Add patch to not fail parsing requirements files with valid + options like --only-binary or --trusted-host: + * 0001-Dont-fail-with-valid-options-in-requirements_txt-files.patch + ------------------------------------------------------------------- Thu Dec 12 02:47:24 UTC 2019 - John Vandenberg diff --git a/python-requirements-parser.spec b/python-requirements-parser.spec index 0455492..70a8b87 100644 --- a/python-requirements-parser.spec +++ b/python-requirements-parser.spec @@ -1,7 +1,7 @@ # # spec file for package python-requirements-parser # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -23,8 +23,10 @@ Release: 0 Summary: Pip requirement file parser License: BSD-2-Clause 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 +# 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 +Patch0: 0001-Dont-fail-with-valid-options-in-requirements_txt-files.patch BuildRequires: %{python_module setuptools} BuildRequires: python-rpm-macros # SECTION test requirements @@ -40,6 +42,7 @@ A Pip requirement file parser. %prep %setup -q -n requirements-parser-%{version} +%patch0 -p1 %build %python_build