summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev-python/mergedict/files/mergedict-0.2.0-py34.patch60
-rw-r--r--dev-python/mergedict/mergedict-0.2.0-r1.ebuild24
2 files changed, 84 insertions, 0 deletions
diff --git a/dev-python/mergedict/files/mergedict-0.2.0-py34.patch b/dev-python/mergedict/files/mergedict-0.2.0-py34.patch
new file mode 100644
index 000000000000..454a41a4fc88
--- /dev/null
+++ b/dev-python/mergedict/files/mergedict-0.2.0-py34.patch
@@ -0,0 +1,60 @@
+From c3f6333298c86e5681af282c7210eb1047a991dd Mon Sep 17 00:00:00 2001
+From: schettino72 <schettino72@gmail.com>
+Date: Sat, 30 Aug 2014 10:51:26 +0800
+Subject: [PATCH] install sigledispatch only when required.
+
+---
+ mergedict.py | 7 +++++--
+ setup.py | 7 ++++++-
+ 2 files changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/mergedict.py b/mergedict.py
+index 5dcd994..ad80a16 100644
+--- a/mergedict.py
++++ b/mergedict.py
+@@ -26,8 +26,11 @@
+
+ import sys
+ import inspect
+-from singledispatch import singledispatch
+-
++try:
++ from functools import singledispatch
++# singledispatch was added on python 3.4
++except ImportError: # pragma: no cover
++ from singledispatch import singledispatch
+
+ class MergeDict(dict):
+ """Base class for a dict that implements a merge() method.
+diff --git a/setup.py b/setup.py
+index b37319e..1966b9a 100644
+--- a/setup.py
++++ b/setup.py
+@@ -1,6 +1,7 @@
+ #!/usr/bin/python
+ # -*- coding: utf-8 -*-
+
++import sys
+ import os
+ import codecs
+ from setuptools import setup
+@@ -11,6 +12,10 @@
+ long_description = ld_file.read()
+
+
++install_requires = []
++if sys.version_info[0] < 3 or sys.version_info[1] < 4:
++ install_requires.append('singledispatch')
++
+ setup (
+ name = 'mergedict',
+ version = '0.2.0',
+@@ -23,7 +28,7 @@
+ platforms = ['any'],
+ license = 'MIT',
+ py_modules = ['mergedict'],
+- install_requires = ['singledispatch'],
++ install_requires = install_requires,
+ classifiers = [
+ 'Development Status :: 4 - Beta',
+ 'Intended Audience :: Developers',
diff --git a/dev-python/mergedict/mergedict-0.2.0-r1.ebuild b/dev-python/mergedict/mergedict-0.2.0-r1.ebuild
new file mode 100644
index 000000000000..25b8d266ce93
--- /dev/null
+++ b/dev-python/mergedict/mergedict-0.2.0-r1.ebuild
@@ -0,0 +1,24 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python{2_7,3_{6,7,8}} )
+
+inherit distutils-r1
+
+DESCRIPTION="A Python 'dict' with a merge() method"
+HOMEPAGE="https://github.com/schettino72/mergedict/"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND="virtual/python-singledispatch[${PYTHON_USEDEP}]"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-py34.patch
+)