14
0

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
This commit is contained in:
Tomáš Chvátal
2020-04-15 11:00:59 +00:00
committed by Git OBS Bridge
parent 785debf4e8
commit f360a0a79c
3 changed files with 51 additions and 2 deletions

View File

@@ -0,0 +1,39 @@
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)

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Apr 15 08:39:06 UTC 2020 - Antonio Larrosa <alarrosa@suse.com>
- 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 <jayvdb@gmail.com> Thu Dec 12 02:47:24 UTC 2019 - John Vandenberg <jayvdb@gmail.com>

View File

@@ -1,7 +1,7 @@
# #
# spec file for package python-requirements-parser # 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 # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@@ -23,8 +23,10 @@ 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
Patch0: 0001-Dont-fail-with-valid-options-in-requirements_txt-files.patch
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
# SECTION test requirements # SECTION test requirements
@@ -40,6 +42,7 @@ A Pip requirement file parser.
%prep %prep
%setup -q -n requirements-parser-%{version} %setup -q -n requirements-parser-%{version}
%patch0 -p1
%build %build
%python_build %python_build