Accepting request 1091713 from home:pgajdos:python
- version update to 3.0.0 * Fix munchify for tuples of lists * Require Python >=3.6 and upgrade syntax - thanks @EwoutH * Update __init__.py to work with non standard version - thanks @mboisson * Allow importing even when VERSION read fails - thanks @mdornseif and @dangillet * Add imports to README * replace pkg_resources with importlib.metadata - thanks @dhellmann * Added RecursiveMunch object - thanks @GuillaumeRochette - added patches fix https://github.com/Infinidat/munch/issues/96 + python-munch-no-six.patch - test package OBS-URL: https://build.opensuse.org/request/show/1091713 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-munch?expand=0&rev=11
This commit is contained in:
parent
564919b4f6
commit
bcc1583cd9
BIN
munch-2.5.0.tar.gz
(Stored with Git LFS)
BIN
munch-2.5.0.tar.gz
(Stored with Git LFS)
Binary file not shown.
3
munch-3.0.0.tar.gz
Normal file
3
munch-3.0.0.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5284603030c00906d9d64d8108728c004fbeb91fc1c1e4caca342bc48f2a6dfd
|
||||
size 19276
|
104
python-munch-no-six.patch
Normal file
104
python-munch-no-six.patch
Normal file
@ -0,0 +1,104 @@
|
||||
Index: munch-3.0.0/munch/__init__.py
|
||||
===================================================================
|
||||
--- munch-3.0.0.orig/munch/__init__.py
|
||||
+++ munch-3.0.0/munch/__init__.py
|
||||
@@ -21,8 +21,6 @@
|
||||
converted via Munch.to/fromDict().
|
||||
"""
|
||||
|
||||
-from .python3_compat import iterkeys, iteritems, Mapping, u
|
||||
-
|
||||
try:
|
||||
# For python 3.8 and later
|
||||
import importlib.metadata as importlib_metadata
|
||||
@@ -35,6 +33,7 @@ except importlib_metadata.PackageNotFoun
|
||||
# package is not installed
|
||||
__version__ = "0.0.0"
|
||||
|
||||
+from collections.abc import Mapping
|
||||
|
||||
try:
|
||||
VERSION = tuple(map(int, __version__.split('+')[0].split('.')[:3]))
|
||||
@@ -205,7 +204,7 @@ class Munch(dict):
|
||||
return f'{self.__class__.__name__}({dict.__repr__(self)})'
|
||||
|
||||
def __dir__(self):
|
||||
- return list(iterkeys(self))
|
||||
+ return list(self.keys())
|
||||
|
||||
def __getstate__(self):
|
||||
""" Implement a serializable interface used for pickling.
|
||||
@@ -244,7 +243,7 @@ class Munch(dict):
|
||||
Override built-in method to call custom __setitem__ method that may
|
||||
be defined in subclasses.
|
||||
"""
|
||||
- for k, v in iteritems(dict(*args, **kwargs)):
|
||||
+ for k, v in dict(*args, **kwargs).items():
|
||||
self[k] = v
|
||||
|
||||
def get(self, k, d=None):
|
||||
@@ -475,7 +474,7 @@ def munchify(x, factory=Munch):
|
||||
# Here we finish munchifying the parts of obj that were deferred by pre_munchify because they
|
||||
# might be involved in a cycle
|
||||
if isinstance(obj, Mapping):
|
||||
- partial.update((k, munchify_cycles(obj[k])) for k in iterkeys(obj))
|
||||
+ partial.update((k, munchify_cycles(obj[k])) for k in obj.keys())
|
||||
elif isinstance(obj, list):
|
||||
partial.extend(munchify_cycles(item) for item in obj)
|
||||
elif isinstance(obj, tuple):
|
||||
@@ -537,7 +536,7 @@ def unmunchify(x):
|
||||
# Here we finish unmunchifying the parts of obj that were deferred by pre_unmunchify because they
|
||||
# might be involved in a cycle
|
||||
if isinstance(obj, Mapping):
|
||||
- partial.update((k, unmunchify_cycles(obj[k])) for k in iterkeys(obj))
|
||||
+ partial.update((k, unmunchify_cycles(obj[k])) for k in obj.keys())
|
||||
elif isinstance(obj, list):
|
||||
partial.extend(unmunchify_cycles(v) for v in obj)
|
||||
elif isinstance(obj, tuple):
|
||||
@@ -626,15 +625,15 @@ try:
|
||||
>>> yaml.dump(b, default_flow_style=True)
|
||||
'!munch.Munch {foo: [bar, !munch.Munch {lol: true}], hello: 42}\\n'
|
||||
"""
|
||||
- return dumper.represent_mapping(u('!munch.Munch'), data)
|
||||
+ return dumper.represent_mapping('!munch.Munch', data)
|
||||
|
||||
for loader_name in ("BaseLoader", "FullLoader", "SafeLoader", "Loader", "UnsafeLoader", "DangerLoader"):
|
||||
LoaderCls = getattr(yaml, loader_name, None)
|
||||
if LoaderCls is None:
|
||||
# This code supports both PyYAML 4.x and 5.x versions
|
||||
continue
|
||||
- yaml.add_constructor(u('!munch'), from_yaml, Loader=LoaderCls)
|
||||
- yaml.add_constructor(u('!munch.Munch'), from_yaml, Loader=LoaderCls)
|
||||
+ yaml.add_constructor('!munch', from_yaml, Loader=LoaderCls)
|
||||
+ yaml.add_constructor('!munch.Munch', from_yaml, Loader=LoaderCls)
|
||||
|
||||
SafeRepresenter.add_representer(Munch, to_yaml_safe)
|
||||
SafeRepresenter.add_multi_representer(Munch, to_yaml_safe)
|
||||
Index: munch-3.0.0/munch/python3_compat.py
|
||||
===================================================================
|
||||
--- munch-3.0.0.orig/munch/python3_compat.py
|
||||
+++ /dev/null
|
||||
@@ -1,6 +0,0 @@
|
||||
-from six import u, iteritems, iterkeys # pylint: disable=unused-import
|
||||
-try:
|
||||
- from collections.abc import Mapping # pylint: disable=unused-import
|
||||
-except ImportError:
|
||||
- # Legacy Python
|
||||
- from collections.abc import Mapping # pylint: disable=unused-import
|
||||
Index: munch-3.0.0/munch.egg-info/requires.txt
|
||||
===================================================================
|
||||
--- munch-3.0.0.orig/munch.egg-info/requires.txt
|
||||
+++ munch-3.0.0/munch.egg-info/requires.txt
|
||||
@@ -1,5 +1,3 @@
|
||||
-six
|
||||
-
|
||||
[:(python_version<'3.8')]
|
||||
importlib_metadata>=1.7.0
|
||||
|
||||
Index: munch-3.0.0/requirements.txt
|
||||
===================================================================
|
||||
--- munch-3.0.0.orig/requirements.txt
|
||||
+++ munch-3.0.0/requirements.txt
|
||||
@@ -1,2 +1 @@
|
||||
-six
|
||||
importlib_metadata>=1.7.0;python_version<'3.8' # Apache-2.0
|
@ -1,3 +1,19 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Jun 8 14:12:23 UTC 2023 - pgajdos@suse.com
|
||||
|
||||
- version update to 3.0.0
|
||||
* Fix munchify for tuples of lists
|
||||
* Require Python >=3.6 and upgrade syntax - thanks @EwoutH
|
||||
* Update __init__.py to work with non standard version - thanks @mboisson
|
||||
* Allow importing even when VERSION read fails - thanks @mdornseif and @dangillet
|
||||
* Add imports to README
|
||||
* replace pkg_resources with importlib.metadata - thanks @dhellmann
|
||||
* Added RecursiveMunch object - thanks @GuillaumeRochette
|
||||
- added patches
|
||||
fix https://github.com/Infinidat/munch/issues/96
|
||||
+ python-munch-no-six.patch
|
||||
- test package
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 21 12:28:20 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
|
@ -16,24 +16,24 @@
|
||||
#
|
||||
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
%{?sle15_python_module_pythons}
|
||||
Name: python-munch
|
||||
Version: 2.5.0
|
||||
Version: 3.0.0
|
||||
Release: 0
|
||||
Summary: A dot-accessible dictionary
|
||||
License: MIT
|
||||
Group: Development/Languages/Python
|
||||
URL: http://github.com/Infinidat/munch
|
||||
URL: https://github.com/Infinidat/munch
|
||||
Source: https://files.pythonhosted.org/packages/source/m/munch/munch-%{version}.tar.gz
|
||||
# https://github.com/Infinidat/munch/issues/96
|
||||
Patch0: python-munch-no-six.patch
|
||||
BuildRequires: %{python_module pbr}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
Requires: python-six
|
||||
BuildArch: noarch
|
||||
# SECTION test requirements
|
||||
BuildRequires: %{python_module six}
|
||||
BuildRequires: %{python_module pytest}
|
||||
# /SECTION
|
||||
%python_subpackages
|
||||
|
||||
@ -41,7 +41,7 @@ BuildRequires: %{python_module six}
|
||||
A dot-accessible dictionary (a la JavaScript objects).
|
||||
|
||||
%prep
|
||||
%setup -q -n munch-%{version}
|
||||
%autosetup -p1 -n munch-%{version}
|
||||
|
||||
%build
|
||||
%python_build
|
||||
@ -50,9 +50,13 @@ A dot-accessible dictionary (a la JavaScript objects).
|
||||
%python_install
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
%pytest
|
||||
|
||||
%files %{python_files}
|
||||
%license LICENSE.txt
|
||||
%doc README.md
|
||||
%{python_sitelib}/*
|
||||
%{python_sitelib}/munch
|
||||
%{python_sitelib}/munch-*.egg-info
|
||||
|
||||
%changelog
|
||||
|
Loading…
Reference in New Issue
Block a user