[gentoo-commits] repo/gentoo:master commit in: dev-python/yapsy/files/, dev-python/yapsy/

2023-11-04 Thread Michał Górny
commit: 5ea488e55517f8e43b4d9a03a346d44b9e7e2bdd
Author: Michał Górny  gentoo  org>
AuthorDate: Sat Nov  4 15:04:10 2023 +
Commit: Michał Górny  gentoo  org>
CommitDate: Sat Nov  4 18:03:05 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5ea488e5

dev-python/yapsy: Backport py3.12 fixes

Signed-off-by: Michał Górny  gentoo.org>

 dev-python/yapsy/files/yapsy-1.12.2-py312.patch | 138 
 dev-python/yapsy/metadata.xml   |   2 +-
 dev-python/yapsy/yapsy-1.12.2-r2.ebuild |  34 ++
 3 files changed, 173 insertions(+), 1 deletion(-)

diff --git a/dev-python/yapsy/files/yapsy-1.12.2-py312.patch 
b/dev-python/yapsy/files/yapsy-1.12.2-py312.patch
new file mode 100644
index ..6842a495af2d
--- /dev/null
+++ b/dev-python/yapsy/files/yapsy-1.12.2-py312.patch
@@ -0,0 +1,138 @@
+From 29286320673f9e853559cf20aeb3456e541afbd4 Mon Sep 17 00:00:00 2001
+From: Ameya Vikram Singh 
+Date: Mon, 6 Feb 2023 13:31:23 +0530
+Subject: [PATCH] Remove Deprecated API's
+
+* Replaced packaging.version instead of distutils.version
+* Replaced imp module to importlib
+
+**Note:** Probably Deprecates Python 2.7 supports, and maybe some initial 
versions of Python 3.x.
+
+Signed-off-by: Ameya Vikram Singh 
+---
+ test/test_PluginInfo.py |  3 ++-
+ yapsy/PluginInfo.py |  6 +++---
+ yapsy/PluginManager.py  | 17 ++---
+ yapsy/VersionedPluginManager.py |  8 
+ 4 files changed, 19 insertions(+), 15 deletions(-)
+
+diff --git a/test/test_PluginInfo.py b/test/test_PluginInfo.py
+index 0863671..29c736a 100644
+--- a/test/test_PluginInfo.py
 b/test/test_PluginInfo.py
+@@ -6,6 +6,7 @@ import unittest
+ 
+ 
+ from yapsy.PluginInfo import PluginInfo
++from packaging.version import Version
+ 
+ 
+ class PluginInfoTest(unittest.TestCase):
+@@ -20,7 +21,7 @@ class PluginInfoTest(unittest.TestCase):
+   self.assertEqual(None,pi.plugin_object)
+   self.assertEqual([],pi.categories)
+   self.assertEqual(None,pi.error)
+-  self.assertEqual("0.0",pi.version)
++  self.assertEqual(Version("0.0"),pi.version)
+   self.assertEqual("Unknown",pi.author)
+   self.assertEqual("Unknown",pi.copyright)
+   self.assertEqual("None",pi.website)
+diff --git a/yapsy/PluginInfo.py b/yapsy/PluginInfo.py
+index 69d220e..700374e 100644
+--- a/yapsy/PluginInfo.py
 b/yapsy/PluginInfo.py
+@@ -12,7 +12,7 @@ API
+ """
+ 
+ from yapsy.compat import ConfigParser
+-from distutils.version import StrictVersion
++from packaging.version import Version
+ 
+ 
+ class PluginInfo(object):
+@@ -105,7 +105,7 @@ class PluginInfo(object):
+ 
+   
+   def __getVersion(self):
+-  return 
StrictVersion(self.details.get("Documentation","Version"))
++  return Version(self.details.get("Documentation","Version"))
+   
+   def setVersion(self, vstring):
+   """
+@@ -114,7 +114,7 @@ class PluginInfo(object):
+   Used by subclasses to provide different handling of the
+   version number.
+   """
+-  if isinstance(vstring,StrictVersion):
++  if isinstance(vstring,Version):
+   vstring = str(vstring)
+   if not self.details.has_section("Documentation"):
+   self.details.add_section("Documentation")
+diff --git a/yapsy/PluginManager.py b/yapsy/PluginManager.py
+index 81a7c2b..b72de93 100644
+--- a/yapsy/PluginManager.py
 b/yapsy/PluginManager.py
+@@ -128,10 +128,7 @@ API
+ 
+ import sys
+ import os
+-try:
+-  import importlib.abc.Loader as imp
+-except ImportError:
+-  import imp
++import importlib
+ 
+ from yapsy import log
+ from yapsy import NormalizePluginNameForModuleName
+@@ -577,11 +574,17 @@ class PluginManager(object):
+   .. note:: Isolated and provided to be reused, but not to be 
reimplemented !
+   """
+   # use imp to correctly load the plugin as a module
++  candidate_module = None
+   if os.path.isdir(candidate_filepath):
+-  candidate_module = 
imp.load_module(plugin_module_name,None,candidate_filepath,("py","r",imp.PKG_DIRECTORY))
++  if (spec := 
importlib.util.spec_from_file_location(candidate_filepath.split('/')[-1], 
candidate_filepath + "/__init__.py")) is not None:
++  candidate_module = 
importlib.util.module_from_spec(spec)
++  sys.modules[plugin_module_name] = 
candidate_module
++  spec.loader.exec_module(candidate_module)
+   else:
+-  with open(candidate_filepath+".py","r") as plugin_file:
+-  candidate_module = 
imp.load_module(plugin_module_name,plugin_file,candidate_filepath+".py",("py","r",imp.PY_SOURCE))
++  

[gentoo-commits] repo/gentoo:master commit in: dev-python/yapsy/files/

2020-06-01 Thread Aaron Bauman
commit: d5a3d0f1a24ade39ac3c38a4a5f3f57dea2dbc50
Author: Michael Mair-Keimberger  gmail  com>
AuthorDate: Tue May 19 19:24:59 2020 +
Commit: Aaron Bauman  gentoo  org>
CommitDate: Tue Jun  2 04:28:03 2020 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d5a3d0f1

dev-python/yapsy: remove unused patch(es)

Signed-off-by: Michael Mair-Keimberger  gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/15883
Signed-off-by: Aaron Bauman  gentoo.org>

 .../files/yapsy-1.11.223-python36-tests.patch  | 22 --
 1 file changed, 22 deletions(-)

diff --git a/dev-python/yapsy/files/yapsy-1.11.223-python36-tests.patch 
b/dev-python/yapsy/files/yapsy-1.11.223-python36-tests.patch
deleted file mode 100644
index 55b6b00873b..000
--- a/dev-python/yapsy/files/yapsy-1.11.223-python36-tests.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-From b79ab28e430995cd64923bb93474b214bc38529b Mon Sep 17 00:00:00 2001
-From: Thibauld Nion 
-Date: Sun, 29 Jan 2017 18:31:06 +0100
-Subject: [PATCH] fix error on python 3.6
-

- test/test_ErrorInPlugin.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/test/test_ErrorInPlugin.py b/test/test_ErrorInPlugin.py
-index 171ce5d..9f22dcf 100644
 a/test/test_ErrorInPlugin.py
-+++ b/test/test_ErrorInPlugin.py
-@@ -50,7 +50,7 @@ def errorMock(*args,**kwargs):
-   self.assertEqual(len(callback_infos),1)
-   self.assertTrue(isinstance(callback_infos[0].error,tuple))
-   self.assertEqual(loadedPlugins[0],callback_infos[0])
--  self.assertEqual(callback_infos[0].error[0],ImportError)
-+  
self.assertTrue(issubclass(callback_infos[0].error[0],ImportError))
-   # check that the getCategories works
-   self.assertEqual(len(spm.getCategories()),1)
-   sole_category = spm.getCategories()[0]



[gentoo-commits] repo/gentoo:master commit in: dev-python/yapsy/files/, dev-python/yapsy/

2018-03-09 Thread Sebastian Pipping
commit: 7ec7fd8d98a4b9ec3c9575bbcb902a79aa2522fb
Author: Sebastian Pipping  gentoo  org>
AuthorDate: Fri Mar  9 23:06:40 2018 +
Commit: Sebastian Pipping  gentoo  org>
CommitDate: Fri Mar  9 23:42:56 2018 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7ec7fd8d

dev-python/yapsy: Python 3.6

Bug: https://bugs.gentoo.org/643732
Package-Manager: Portage-2.3.24, Repoman-2.3.6

 .../files/yapsy-1.11.223-python36-tests.patch  | 22 ++
 dev-python/yapsy/yapsy-1.11.223-r2.ebuild  | 47 ++
 2 files changed, 69 insertions(+)

diff --git a/dev-python/yapsy/files/yapsy-1.11.223-python36-tests.patch 
b/dev-python/yapsy/files/yapsy-1.11.223-python36-tests.patch
new file mode 100644
index 000..55b6b00873b
--- /dev/null
+++ b/dev-python/yapsy/files/yapsy-1.11.223-python36-tests.patch
@@ -0,0 +1,22 @@
+From b79ab28e430995cd64923bb93474b214bc38529b Mon Sep 17 00:00:00 2001
+From: Thibauld Nion 
+Date: Sun, 29 Jan 2017 18:31:06 +0100
+Subject: [PATCH] fix error on python 3.6
+
+---
+ test/test_ErrorInPlugin.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/test_ErrorInPlugin.py b/test/test_ErrorInPlugin.py
+index 171ce5d..9f22dcf 100644
+--- a/test/test_ErrorInPlugin.py
 b/test/test_ErrorInPlugin.py
+@@ -50,7 +50,7 @@ def errorMock(*args,**kwargs):
+   self.assertEqual(len(callback_infos),1)
+   self.assertTrue(isinstance(callback_infos[0].error,tuple))
+   self.assertEqual(loadedPlugins[0],callback_infos[0])
+-  self.assertEqual(callback_infos[0].error[0],ImportError)
++  
self.assertTrue(issubclass(callback_infos[0].error[0],ImportError))
+   # check that the getCategories works
+   self.assertEqual(len(spm.getCategories()),1)
+   sole_category = spm.getCategories()[0]

diff --git a/dev-python/yapsy/yapsy-1.11.223-r2.ebuild 
b/dev-python/yapsy/yapsy-1.11.223-r2.ebuild
new file mode 100644
index 000..62cd725684e
--- /dev/null
+++ b/dev-python/yapsy/yapsy-1.11.223-r2.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+MY_P="Yapsy-${PV}"
+PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
+
+inherit distutils-r1
+
+DESCRIPTION="A fat-free DIY Python plugin management toolkit"
+HOMEPAGE="http://yapsy.sourceforge.net/;
+SRC_URI="mirror://sourceforge/yapsy/${MY_P}/${MY_P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc"
+
+DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
+   doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )"
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=(
+   "${FILESDIR}"/${P}-python36-tests.patch
+)
+
+python_prepare_all() {
+   # Disable erroneous test
+   sed -e 's:test_default_plugins_place_is_parent_dir:_&:' \
+   -i test/test_PluginFileLocator.py || die
+   distutils-r1_python_prepare_all
+}
+
+python_compile_all() {
+   use doc && emake -C doc html
+}
+
+python_test() {
+   esetup.py test
+}
+
+python_install_all() {
+   use doc && local HTML_DOCS=( doc/_build/html/. )
+   distutils-r1_python_install_all
+}