Skip to content

Commit 68824e5

Browse files
committed
replace pkg_resources for newer versions of Python
1 parent 4d6d9e2 commit 68824e5

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

explorer/dxt.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
import subprocess
3131
import webbrowser
3232
import pandas as pd
33-
import pkg_resources
3433
import pyranges as pr
3534
import logging.handlers
3635
import pyarrow.feather as feather
3736
# import darshan.backend.cffi_backend as darshanll
3837

38+
from importlib import resources
3939
from explorer import version as dxt_version
4040
from packaging import version
4141

@@ -730,7 +730,7 @@ def generate_plot(self, file, report):
730730
self.prefix, file_id, "snapshot", snapshot, "operation"
731731
)
732732
path = "plots/operation.py"
733-
script = pkg_resources.resource_filename(__name__, path)
733+
script = str(resources.files(__package__ or __name__).joinpath(path))
734734

735735
command = "python3 {} -f {}.{}.{}-{}.dxt -i {}.{}.{}-{}.io_phases {} {} -o {} -x {} -t {} -r {}".format(
736736
script,
@@ -792,7 +792,7 @@ def generate_plot(self, file, report):
792792
self.prefix, file_id, "operation"
793793
)
794794
path = "plots/operation.py"
795-
script = pkg_resources.resource_filename(__name__, path)
795+
script = str(resources.files(__package__ or __name__).joinpath(path))
796796

797797
command = "python3 {} -f {}.{}.dxt -i {}.{}.io_phases{} {} -o {} -x {}".format(
798798
script,
@@ -864,7 +864,7 @@ def generate_transfer_plot(self, file, report):
864864
output_file = "{}/{}-{}.html".format(self.prefix, file_id, "transfer")
865865

866866
path = "plots/transfer.py"
867-
script = pkg_resources.resource_filename(__name__, path)
867+
script = str(resources.files(__package__ or __name__).joinpath(path))
868868

869869
command = "python3 {} -f {}.{}.dxt {} -o {} -x {}".format(
870870
script, file, file_id, limits, output_file, file_name
@@ -912,7 +912,7 @@ def generate_spatiality_plot(self, file, report):
912912
output_file = "{}/{}-{}.html".format(self.prefix, file_id, "spatiality")
913913

914914
path = "plots/spatiality.py"
915-
script = pkg_resources.resource_filename(__name__, path)
915+
script = str(resources.files(__package__ or __name__).joinpath(path))
916916

917917
command = "python3 {} -f {}.{}.dxt -o {} -x {}".format(
918918
script, file, file_id, output_file, file_name
@@ -959,7 +959,7 @@ def generate_phase_plot(self, file, report):
959959
for file_id, file_name in file_ids.items():
960960
output_file = "{}/{}-{}.html".format(self.prefix, file_id, "io_phase")
961961
path = "plots/io_phase.py"
962-
script = pkg_resources.resource_filename(__name__, path)
962+
script = str(resources.files(__package__ or __name__).joinpath(path))
963963

964964
command = "python3 {} -f {}.{}.io_phases -o {} -x {}".format(
965965
script, file, file_id, output_file, file_name
@@ -1007,7 +1007,7 @@ def generate_ost_usage_operation_plot(self, file, report):
10071007
self.prefix, file_id, "ost_usage_operation"
10081008
)
10091009
path = "plots/ost_usage_operation.py"
1010-
script = pkg_resources.resource_filename(__name__, path)
1010+
script = str(resources.files(__package__ or __name__).joinpath(path))
10111011

10121012
command = "python3 {} -f {}.{}.dxt -o {} -x {}".format(
10131013
script, file, file_id, output_file, file_name
@@ -1057,7 +1057,7 @@ def generate_ost_usage_transfer_plot(self, file, report):
10571057
self.prefix, file_id, "ost_usage_transfer"
10581058
)
10591059
path = "plots/ost_usage_transfer.py"
1060-
script = pkg_resources.resource_filename(__name__, path)
1060+
script = str(resources.files(__package__ or __name__).joinpath(path))
10611061

10621062
command = "python3 {} -f {}.{}.dxt -o {} -x {}".format(
10631063
script, file, file_id, output_file, file_name

0 commit comments

Comments
 (0)