Replace deprecated code and add missing dependency
This commit is contained in:
parent
89bcde58aa
commit
99ac426e4b
|
@ -1,7 +1,7 @@
|
||||||
import lxml.etree as lxml
|
import lxml.etree as lxml
|
||||||
import re
|
import re
|
||||||
import pickle
|
import pickle
|
||||||
import importlib_resources as pkg_resources
|
from importlib_resources import files
|
||||||
|
|
||||||
from conversion_utils.utils import xpath_find, get_xml_id
|
from conversion_utils.utils import xpath_find, get_xml_id
|
||||||
|
|
||||||
|
@ -241,9 +241,10 @@ class Converter:
|
||||||
|
|
||||||
def __init__(self, xml_file_name=None):
|
def __init__(self, xml_file_name=None):
|
||||||
if (xml_file_name is None):
|
if (xml_file_name is None):
|
||||||
if (pkg_resources.is_resource('conversion_utils.resources', JOS_SPECIFICATIONS_PICKLE_RESOURCE)):
|
resource = files('conversion_utils.resources').joinpath(JOS_SPECIFICATIONS_PICKLE_RESOURCE)
|
||||||
|
if (resource.is_file()):
|
||||||
try:
|
try:
|
||||||
with pkg_resources.open_binary('conversion_utils.resources', JOS_SPECIFICATIONS_PICKLE_RESOURCE) as pickle_file:
|
with resource.open('rb') as pickle_file:
|
||||||
self.specifications = pickle.load(pickle_file)
|
self.specifications = pickle.load(pickle_file)
|
||||||
except:
|
except:
|
||||||
exit('Could not parse specifications pickle file installed.')
|
exit('Could not parse specifications pickle file installed.')
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -7,6 +7,6 @@ setup(name='conversion_utils',
|
||||||
author='Cyprian Laskowski',
|
author='Cyprian Laskowski',
|
||||||
author_email='cyp@cjvt.si',
|
author_email='cyp@cjvt.si',
|
||||||
packages=['conversion_utils', 'conversion_utils.resources', 'conversion_utils.tests'],
|
packages=['conversion_utils', 'conversion_utils.resources', 'conversion_utils.tests'],
|
||||||
install_requires=['importlib_resources'],
|
install_requires=['lxml', 'importlib_resources'],
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
zip_safe=True)
|
zip_safe=True)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user