From 39fa9d4372563f499f7ada120c4ad98fe6509a8c Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Wed, 2 Jul 2025 17:39:23 +0200 Subject: [PATCH 1/3] pyproject: use a more correct requires-python Nowadays it is not very clear if "2.7" is really valid, and at least uv flags it as an error. Now ">=2.7" is not strictly correct as it includes the 3.0-3.5 range, but finding a way to express that (if there is one) is likely not worth it. Signed-off-by: Yann Dirson --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index aab8c76..3e7db8e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "XSConsole" dynamic = ["version"] description = "Xenserver Status Report" -requires-python = "2.7" +requires-python = ">=2.7, <3.12" license = "GPL-2.0-or-later" keywords = ["xenserver", "xen-project"] authors = [ From 1f6b7aae968d9b2d330e13757ee3fb99ed48a63c Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Wed, 2 Jul 2025 17:47:23 +0200 Subject: [PATCH 2/3] pyproject: drop superseded license classifiers There is an equivalent License tag already, and uv plainly errors out too on this one. Signed-off-by: Yann Dirson --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3e7db8e..064d47f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,6 @@ readme = "README.md" classifiers = [ "Environment :: Console", "Development Status :: 5 - Production/Stable", - "License :: OSI Approved :: GNU General Public License v2 (GPLv2) or later", "Operating System :: POSIX :: Linux :: XenServer/XCP-ng Dom0", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.6", From 2d11f4a60391d08b58d7c97af05a6ba4ff2c67dc Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Wed, 2 Jul 2025 18:30:59 +0200 Subject: [PATCH 3/3] XSConsoleImported: switch from imp to importlib for python 3.12 support This switches away from deprecated `imp`, and breaks support for python 2.7, but I expect this branch to really support only python3 now, so we likely don't care about adding backward compatibility here. Signed-off-by: Yann Dirson --- XSConsoleImporter.py | 8 +++++--- pyproject.toml | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/XSConsoleImporter.py b/XSConsoleImporter.py index 2475435..0674104 100644 --- a/XSConsoleImporter.py +++ b/XSConsoleImporter.py @@ -15,7 +15,7 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -import imp, os, re, sys, traceback +import importlib.util, os, re, sys, traceback from XSConsoleLog import * from XSConsoleMenus import * @@ -46,8 +46,10 @@ def ImportAbsDir(cls, inDir): try: try: # Import using variable as module name - (fileObj, pathName, description) = imp.find_module(importName, [root]) - imp.load_module(importName, fileObj, pathName, description) + spec = importlib.util.spec_from_file_location( + importName, os.path.join(root, filename)) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) except Exception as e: try: XSLogError(*traceback.format_tb(sys.exc_info()[2])) except: pass diff --git a/pyproject.toml b/pyproject.toml index 064d47f..dbad651 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "XSConsole" dynamic = ["version"] description = "Xenserver Status Report" -requires-python = ">=2.7, <3.12" +requires-python = ">=3.6" license = "GPL-2.0-or-later" keywords = ["xenserver", "xen-project"] authors = [ @@ -20,13 +20,13 @@ classifiers = [ "Environment :: Console", "Development Status :: 5 - Production/Stable", "Operating System :: POSIX :: Linux :: XenServer/XCP-ng Dom0", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Topic :: System :: Logging", "Topic :: System :: Monitoring",