Skip to content

Commit ce12f39

Browse files
authored
Merge pull request #457 from desihub/pkgresource
replace pkg_resources with importlib.resources.files
2 parents ccdadb4 + aa34419 commit ce12f39

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

py/desisurveyops/status_html.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import textwrap
66
from datetime import datetime, timedelta
77
from time import time
8-
from pkg_resources import resource_filename
98

109
# AR scientifical
1110
import numpy as np
@@ -21,6 +20,7 @@
2120
get_programs_passparams,
2221
get_shutdowns,
2322
get_history_tiles_infos,
23+
get_history_tiles_dir,
2424
get_backup_minefftime,
2525
get_speed,
2626
)
@@ -63,7 +63,7 @@ def process_html(
6363

6464
# AR need to copy the css?
6565
git_cssfn = os.path.join(
66-
resource_filename("desisurveyops", "../../data"), os.path.basename(cssfn)
66+
get_history_tiles_dir(), os.path.basename(cssfn)
6767
)
6868
if os.path.isfile(cssfn):
6969
f = open(cssfn, "r").read()

py/desisurveyops/status_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
import os
88
from glob import glob
99
from datetime import datetime
10+
from importlib.resources import files
1011
import tempfile
1112
import multiprocessing
12-
from pkg_resources import resource_filename
1313
import subprocess
1414

1515
# AR scientifical
@@ -384,7 +384,7 @@ def get_history_tiles_dir():
384384
"""
385385
Returns the folder with the tiles-{survey}-YYYYMMDD-rev?????.ecsv files.
386386
"""
387-
return resource_filename("desisurveyops", "../../data")
387+
return os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "data"))
388388

389389

390390
def get_history_tilesfn(survey, opsnight=None):
@@ -581,7 +581,7 @@ def get_fns(
581581
"desi-14k-footprint",
582582
"desi-14k-footprint-dark.ecsv",
583583
),
584-
"desfoot": resource_filename("desiutil", "data/DES_footprint.txt"),
584+
"desfoot": str(files("desiutil").joinpath("data", "DES_footprint.txt")),
585585
}
586586

587587
# AR check?

0 commit comments

Comments
 (0)