Description: Use importlib.resources module instead of pkg_resources
 Use of pkg_resources is deprecated in favor of importlib.resources,
 which is available in Python since version 3.9.
Author: Rafael Laboissière <rafael@debian.org>
Bug-Debian: https://bugs.debian.org/1083992
Forwarded: https://sourceforge.net/p/xmds/mailman/message/58827683/
Last-Update: 2024-10-12

--- xmds2-3.1.0+dfsg2.orig/xpdeint/Configuration.py
+++ xmds2-3.1.0+dfsg2/xpdeint/Configuration.py
@@ -23,7 +23,7 @@ along with this program.  If not, see <h
 """
 import os, sys, shutil
 
-from pkg_resources import resource_filename
+from importlib import resources
 from xpdeint.Preferences import xpdeintUserDataPath
 from xpdeint.Utilities import unique
 
@@ -31,7 +31,7 @@ import pickle, tempfile, shutil, logging
 
 config_arg_cache_filename = os.path.join(xpdeintUserDataPath, 'xpdeint_config_arg_cache')
 
-wafdir = os.path.normpath(resource_filename(__name__, 'waf'))
+wafdir = os.path.normpath(resources.files(__name__) / 'waf')
 sys.path.insert(0, wafdir)
 
 from waflib import Context, Options, Configure, Utils, Logs, Errors
@@ -47,7 +47,7 @@ def initialise_waf():
     Context.top_dir = Context.run_dir = xpdeintUserDataPath
     Context.out_dir = os.path.join(xpdeintUserDataPath, 'waf_configure')
     
-    wscript_path = resource_filename(__name__, 'support/wscript')
+    wscript_path = resources.files(__name__) / 'support/wscript'
     Context.g_module = Context.load_module(wscript_path)
     Context.g_module.root_path = wscript_path
     Context.g_module.out = Context.out_dir
@@ -124,7 +124,7 @@ def run_config(includePaths = None, libP
 
     
     # Copy wscript file to indicate what we configured with
-    wscript_path = resource_filename(__name__, 'support/wscript')
+    wscript_path = resources.files(__name__) / 'support/wscript'
     wscript_userdata_path = os.path.join(xpdeintUserDataPath, 'wscript')
     
     shutil.copyfile(wscript_path, wscript_userdata_path)
--- xmds2-3.1.0+dfsg2.orig/xpdeint/parser2.py
+++ xmds2-3.1.0+dfsg2/xpdeint/parser2.py
@@ -30,7 +30,7 @@ import xml
 from xml.dom import minidom
 import xpdeint.minidom_extras
 import subprocess
-from pkg_resources import resource_filename
+from importlib import resources
 import hashlib
 import shutil
 
@@ -229,7 +229,7 @@ def main(argv=None):
     sys.stderr.write("\nFor help use \"xmds2 --help\"\n")
     return 2
   
-  wscript_path = resource_filename(__name__, 'support/wscript')
+  wscript_path = resources.files(__name__) / 'support/wscript'
   wscript_userdata_path = os.path.join(xpdeintUserDataPath, 'wscript')
   waf_build_cache_path = os.path.join(xpdeintUserDataPath, 'waf_configure/c4che/_cache.py')
   
@@ -284,7 +284,7 @@ def main(argv=None):
     pass
   else:
     # Parse the schema
-    relaxng_doc = etree.parse(resource_filename(__name__, 'support/xpdeint.rng'))
+    relaxng_doc = etree.parse(resources.files(__name__) / 'support/xpdeint.rng')
     relaxng = etree.RelaxNG(relaxng_doc)
     # Parse the script
     script_doc = etree.fromstring(globalNameSpace['inputScript'].encode('ascii'))
@@ -462,7 +462,7 @@ def main(argv=None):
     globalNameSpace['simulationUselib'].add('optimise')
   
   buildKWs = {
-    'includes': [resource_filename(__name__, 'includes').replace(' ', r'\ ')],
+    'includes': [str(resources.files(__name__) / 'includes').replace(' ', r'\ ')],
     'uselib': list(globalNameSpace['simulationUselib']),
   }
   
