15
0
forked from pool/python-dparse

Accepting request 1138750 from devel:languages:python

- Switch to autosetup and pyproject macros.
- Stop using greedy globs in %files.
- Add patch fix-configparser-parsing.patch:
  * Use non-deprecated/removed functions from ConfigParser.

OBS-URL: https://build.opensuse.org/request/show/1138750
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-dparse?expand=0&rev=7
This commit is contained in:
2024-01-15 21:20:02 +00:00
committed by Git OBS Bridge
3 changed files with 60 additions and 6 deletions

View File

@@ -0,0 +1,42 @@
From a3d83e8bdfd694e873b5775881ab5aa62fdbb674 Mon Sep 17 00:00:00 2001
From: Mathieu Dupuy <deronnax@gmail.com>
Date: Fri, 8 Sep 2023 11:49:00 +0200
Subject: [PATCH] replace ConfigParser's 'readfp' by 'read_string'
fixes "DeprecationWarning: This method will be removed in Python 3.12. Use
parser.read_file instead", and will marginally improve performance
---
dparse/parser.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/dparse/parser.py b/dparse/parser.py
index f200607..923b362 100644
--- a/dparse/parser.py
+++ b/dparse/parser.py
@@ -3,8 +3,6 @@
import re
import sys
-from io import StringIO
-
from configparser import ConfigParser, NoOptionError
from pathlib import PurePath
@@ -305,7 +303,7 @@ def parse(self):
:return:
"""
parser = ConfigParser()
- parser.readfp(StringIO(self.obj.content))
+ parser.read_string(self.obj.content)
for section in parser.sections():
try:
content = parser.get(section=section, option="deps")
@@ -413,7 +411,7 @@ def parse(self):
class SetupCfgParser(Parser):
def parse(self):
parser = ConfigParser()
- parser.readfp(StringIO(self.obj.content))
+ parser.read_string(self.obj.content)
for section in parser.values():
if section.name == 'options':
options = 'install_requires', 'setup_requires', 'test_require'

View File

@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Jan 15 05:33:37 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Switch to autosetup and pyproject macros.
- Stop using greedy globs in %files.
- Add patch fix-configparser-parsing.patch:
* Use non-deprecated/removed functions from ConfigParser.
-------------------------------------------------------------------
Sat Jul 1 20:47:20 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-dparse
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -22,10 +22,13 @@ Version: 0.6.3
Release: 0
Summary: Python dependency file parser
License: MIT
Group: Development/Languages/Python
URL: https://github.com/jayfk/dparse
Source: https://files.pythonhosted.org/packages/source/d/dparse/dparse-%{version}.tar.gz
# PATCH-FIX-UPSTREAM gh#pyupio/dparse#a3d83e8bdfd694e873b5775881ab5aa62fdbb674
Patch0: fix-configparser-parsing.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-PyYAML
@@ -44,14 +47,14 @@ BuildRequires: %{python_module pytest}
A parser for Python dependency files.
%prep
%setup -q -n dparse-%{version}
%autosetup -p1 -n dparse-%{version}
# Note vendor/toml.py could be unvendored
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%if %{with test}
@@ -65,6 +68,7 @@ A parser for Python dependency files.
%files %{python_files}
%license LICENSE
%doc README.rst HISTORY.rst
%{python_sitelib}/*
%{python_sitelib}/dparse
%{python_sitelib}/dparse-%{version}.dist-info
%changelog