Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-oscrypto for openSUSE:Factory
checked in at 2024-04-08 17:40:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-oscrypto (Old)
and /work/SRC/openSUSE:Factory/.python-oscrypto.new.1905 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-oscrypto"
Mon Apr 8 17:40:05 2024 rev:4 rq:1166134 version:1.3.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-oscrypto/python-oscrypto.changes
2022-10-06 07:42:42.768755257 +0200
+++
/work/SRC/openSUSE:Factory/.python-oscrypto.new.1905/python-oscrypto.changes
2024-04-08 17:52:20.253830660 +0200
@@ -1,0 +2,6 @@
+Mon Apr 8 09:53:55 UTC 2024 - Daniel Garcia <[email protected]>
+
+- Add python312.patch from upstream to make it compatible with python
+ 3.12. gh#wbond/oscrypto#77
+
+-------------------------------------------------------------------
New:
----
python312.patch
BETA DEBUG BEGIN:
New:
- Add python312.patch from upstream to make it compatible with python
3.12. gh#wbond/oscrypto#77
BETA DEBUG END:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-oscrypto.spec ++++++
--- /var/tmp/diff_new_pack.gEmK2U/_old 2024-04-08 17:52:20.717847785 +0200
+++ /var/tmp/diff_new_pack.gEmK2U/_new 2024-04-08 17:52:20.721847934 +0200
@@ -1,7 +1,7 @@
#
-# spec file
+# spec file for package python-oscrypto
#
-# Copyright (c) 2022 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
@@ -16,8 +16,6 @@
#
-%{?!python_module:%define python_module() python-%{**} python3-%{**}}
-
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
@@ -35,6 +33,8 @@
Group: Development/Languages/Python
URL: https://github.com/wbond/oscrypto
Source:
https://github.com/wbond/oscrypto/archive/%{version}.tar.gz#/oscrypto-%{version}.tar.gz
+# PATCH-FIX-UPSTREAM python312.patch gh#wbond/oscrypto#77
+Patch0: python312.patch
BuildRequires: %{python_module asn1crypto >= 1.0.0}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
@@ -54,7 +54,7 @@
on the OS for patching. Works on Windows, OS X and Linux/BSD.
%prep
-%setup -q -n oscrypto-%{version}
+%autosetup -p1 -n oscrypto-%{version}
# /docs has a different readme.md file - should not overwrite main readme.md
mv docs/readme.md docs/docs_readme.md
@@ -75,6 +75,7 @@
%files %{python_files}
%license LICENSE
%doc readme.md changelog.md docs/*
-%{python_sitelib}/*
+%{python_sitelib}/oscrypto
+%{python_sitelib}/oscrypto-%{version}*-info
%endif
++++++ python312.patch ++++++
>From 3be536e4a61ac5fbd403ee80cdb54cb666f34679 Mon Sep 17 00:00:00 2001
From: Dominik 'Rathann' Mierzejewski <[email protected]>
Date: Thu, 17 Aug 2023 09:05:29 +0200
Subject: [PATCH 01/13] use `importlib` instead of deprecated `imp` module
This fixes tests with python 3.12 where the `imp` module was
[removed](https://docs.python.org/3.12/whatsnew/3.12.html#removed).
This should fix issue #74.
---
tests/__init__.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Index: oscrypto-1.3.0/tests/__init__.py
===================================================================
--- oscrypto-1.3.0.orig/tests/__init__.py
+++ oscrypto-1.3.0/tests/__init__.py
@@ -1,10 +1,17 @@
# coding: utf-8
from __future__ import unicode_literals, division, absolute_import,
print_function
-import imp
import os
+import sys
import unittest
+if sys.version_info < (3, 5):
+ import imp
+else:
+ import importlib
+ import importlib.abc
+ import importlib.util
+
__version__ = '1.3.0'
__version_info__ = (1, 3, 0)
@@ -66,6 +73,47 @@ def local_oscrypto():
return (_asn1crypto_module, _oscrypto_module)
+if sys.version_info >= (3, 5):
+ class ModCryptoMetaFinder(importlib.abc.MetaPathFinder):
+ def setup(self):
+ self.modules = {}
+ sys.meta_path.insert(0, self)
+
+ def add_module(self, package_name, package_path):
+ if package_name not in self.modules:
+ self.modules[package_name] = package_path
+
+ def find_spec(self, fullname, path, target=None):
+ name_parts = fullname.split('.')
+ if name_parts[0] not in self.modules:
+ return None
+
+ package = name_parts[0]
+ package_path = self.modules[package]
+
+ fullpath = os.path.join(package_path, *name_parts[1:])
+
+ if os.path.isdir(fullpath):
+ filename = os.path.join(fullpath, "__init__.py")
+ submodule_locations = [fullpath]
+ else:
+ filename = fullpath + ".py"
+ submodule_locations = None
+
+ if not os.path.exists(filename):
+ return None
+
+ return importlib.util.spec_from_file_location(
+ fullname,
+ filename,
+ loader=None,
+ submodule_search_locations=submodule_locations
+ )
+
+ CUSTOM_FINDER = ModCryptoMetaFinder()
+ CUSTOM_FINDER.setup()
+
+
def _import_from(mod, path, mod_dir=None):
"""
Imports a module from a specific path
@@ -84,18 +132,44 @@ def _import_from(mod, path, mod_dir=None
None if not loaded, otherwise the module
"""
+ if mod in sys.modules:
+ return sys.modules[mod]
+
if mod_dir is None:
- mod_dir = mod
+ full_mod = mod
+ else:
+ full_mod = mod_dir.replace(os.sep, '.')
+
+ if mod_dir is None:
+ mod_dir = mod.replace('.', os.sep)
if not os.path.exists(path):
return None
- if not os.path.exists(os.path.join(path, mod_dir)):
+ source_path = os.path.join(path, mod_dir, '__init__.py')
+ if not os.path.exists(source_path):
+ source_path = os.path.join(path, mod_dir + '.py')
+
+ if not os.path.exists(source_path):
return None
+ if os.sep in mod_dir:
+ append, mod_dir = mod_dir.rsplit(os.sep, 1)
+ path = os.path.join(path, append)
+
try:
- mod_info = imp.find_module(mod_dir, [path])
- return imp.load_module(mod, *mod_info)
+ if sys.version_info < (3, 5):
+ mod_info = imp.find_module(mod_dir, [path])
+ return imp.load_module(mod, *mod_info)
+
+ else:
+ package = mod.split('.', 1)[0]
+ package_dir = full_mod.split('.', 1)[0]
+ package_path = os.path.join(path, package_dir)
+ CUSTOM_FINDER.add_module(package, package_path)
+
+ return importlib.import_module(mod)
+
except ImportError:
return None
Index: oscrypto-1.3.0/dev/_import.py
===================================================================
--- oscrypto-1.3.0.orig/dev/_import.py
+++ oscrypto-1.3.0/dev/_import.py
@@ -1,17 +1,64 @@
# coding: utf-8
from __future__ import unicode_literals, division, absolute_import,
print_function
-import imp
import sys
import os
from . import build_root, package_name, package_root
+if sys.version_info < (3, 5):
+ import imp
+else:
+ import importlib
+ import importlib.abc
+ import importlib.util
+
+
if sys.version_info < (3,):
getcwd = os.getcwdu
else:
getcwd = os.getcwd
+if sys.version_info >= (3, 5):
+ class ModCryptoMetaFinder(importlib.abc.MetaPathFinder):
+ def setup(self):
+ self.modules = {}
+ sys.meta_path.insert(0, self)
+
+ def add_module(self, package_name, package_path):
+ if package_name not in self.modules:
+ self.modules[package_name] = package_path
+
+ def find_spec(self, fullname, path, target=None):
+ name_parts = fullname.split('.')
+ if name_parts[0] not in self.modules:
+ return None
+
+ package = name_parts[0]
+ package_path = self.modules[package]
+
+ fullpath = os.path.join(package_path, *name_parts[1:])
+
+ if os.path.isdir(fullpath):
+ filename = os.path.join(fullpath, "__init__.py")
+ submodule_locations = [fullpath]
+ else:
+ filename = fullpath + ".py"
+ submodule_locations = None
+
+ if not os.path.exists(filename):
+ return None
+
+ return importlib.util.spec_from_file_location(
+ fullname,
+ filename,
+ loader=None,
+ submodule_search_locations=submodule_locations
+ )
+
+ CUSTOM_FINDER = ModCryptoMetaFinder()
+ CUSTOM_FINDER.setup()
+
def _import_from(mod, path, mod_dir=None, allow_error=False):
"""
@@ -34,14 +81,25 @@ def _import_from(mod, path, mod_dir=None
None if not loaded, otherwise the module
"""
+ if mod in sys.modules:
+ return sys.modules[mod]
+
+ if mod_dir is None:
+ full_mod = mod
+ else:
+ full_mod = mod_dir.replace(os.sep, '.')
+
if mod_dir is None:
mod_dir = mod.replace('.', os.sep)
if not os.path.exists(path):
return None
- if not os.path.exists(os.path.join(path, mod_dir)) \
- and not os.path.exists(os.path.join(path, mod_dir + '.py')):
+ source_path = os.path.join(path, mod_dir, '__init__.py')
+ if not os.path.exists(source_path):
+ source_path = os.path.join(path, mod_dir + '.py')
+
+ if not os.path.exists(source_path):
return None
if os.sep in mod_dir:
@@ -49,8 +107,18 @@ def _import_from(mod, path, mod_dir=None
path = os.path.join(path, append)
try:
- mod_info = imp.find_module(mod_dir, [path])
- return imp.load_module(mod, *mod_info)
+ if sys.version_info < (3, 5):
+ mod_info = imp.find_module(mod_dir, [path])
+ return imp.load_module(mod, *mod_info)
+
+ else:
+ package = mod.split('.', 1)[0]
+ package_dir = full_mod.split('.', 1)[0]
+ package_path = os.path.join(path, package_dir)
+ CUSTOM_FINDER.add_module(package, package_path)
+
+ return importlib.import_module(mod)
+
except ImportError:
if allow_error:
raise
Index: oscrypto-1.3.0/dev/coverage.py
===================================================================
--- oscrypto-1.3.0.orig/dev/coverage.py
+++ oscrypto-1.3.0/dev/coverage.py
@@ -4,7 +4,6 @@ from __future__ import unicode_literals,
import cgi
import codecs
import coverage
-import imp
import json
import os
import unittest
@@ -17,6 +16,7 @@ import subprocess
from fnmatch import fnmatch
from . import package_name, package_root, other_packages
+from ._import import _import_from
if sys.version_info < (3,):
str_cls = unicode # noqa
@@ -103,9 +103,7 @@ def _load_package_tests(name):
if not os.path.exists(package_dir):
return []
- tests_module_info = imp.find_module('tests', [package_dir])
- tests_module = imp.load_module('%s.tests' % name, *tests_module_info)
- return tests_module.test_classes()
+ return _import_from('%s_tests' % name, package_dir, 'tests').test_classes()
def _env_info():
Index: oscrypto-1.3.0/dev/build.py
===================================================================
--- oscrypto-1.3.0.orig/dev/build.py
+++ oscrypto-1.3.0/dev/build.py
@@ -1,7 +1,6 @@
# coding: utf-8
from __future__ import unicode_literals, division, absolute_import,
print_function
-import imp
import os
import tarfile
import zipfile
@@ -9,6 +8,7 @@ import zipfile
import setuptools.sandbox
from . import package_root, package_name, has_tests_package
+from ._import import _import_from
def _list_zip(filename):
@@ -45,8 +45,8 @@ def run():
# Trying to call setuptools.sandbox.run_setup(setup, ['--version'])
# resulted in a segfault, so we do this instead
- module_info = imp.find_module('version', [os.path.join(package_root,
package_name)])
- version_mod = imp.load_module('%s.version' % package_name, *module_info)
+ package_dir = os.path.join(package_root, package_name)
+ version_mod = _import_from('%s.version' % package_name, package_dir,
'version')
pkg_name_info = (package_name, version_mod.__version__)
print('Building %s-%s' % pkg_name_info)