Skip to content

Commit

Permalink
reduce usage of deprecated pkg_resources APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Oct 12, 2023
1 parent f64af8e commit ee13c81
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions cwl_utils/sandboxjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
cast,
)

from pkg_resources import resource_stream
from importlib_resources import files
from schema_salad.utils import json_dumps

from cwl_utils.errors import JavascriptException, WorkflowException
Expand Down Expand Up @@ -196,8 +196,7 @@ def exec_js_process(
nodejs = self.localdata.procs.get(js_engine)

if nodejs is None or nodejs.poll() is not None:
res = resource_stream(__name__, js_engine)
js_engine_code = res.read().decode("utf-8")
js_engine_code = files("cwl_utils").joinpath(js_engine).read_text("utf-8")

created_new_process = True

Expand Down
12 changes: 6 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@

# -- Path setup --------------------------------------------------------------

import importlib.metadata

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
import time
from datetime import datetime

from pkg_resources import get_distribution
from datetime import UTC, datetime

sys.path.insert(0, os.path.abspath(".."))


# -- Project information -----------------------------------------------------

build_date = datetime.utcfromtimestamp(
int(os.environ.get("SOURCE_DATE_EPOCH", time.time()))
build_date = datetime.fromtimestamp(
int(os.environ.get("SOURCE_DATE_EPOCH", time.time())), UTC
)
project = "cwl-utils: Python utilities Common Workflow Language documents"
copyright = f"2019 — {build_date.year} CWL Community"
Expand Down Expand Up @@ -82,7 +82,7 @@
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

release = get_distribution("cwl-utils").version
release = importlib.metadata.version("cwl_utils")
version = ".".join(release.split(".")[:2])

autoapi_dirs = ["../cwl_utils"]
Expand Down

0 comments on commit ee13c81

Please sign in to comment.