From ee34eb4b064f8ad7c750149ccbf665154fd5f009 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Thu, 26 Oct 2023 11:32:47 -0700 Subject: [PATCH] Switch to using importlib.resources --- python/cuproj/cuproj/_version.py | 7 ++++--- python/cuspatial/cuspatial/_version.py | 10 +++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/python/cuproj/cuproj/_version.py b/python/cuproj/cuproj/_version.py index 2a5beedaa..e7bd99791 100644 --- a/python/cuproj/cuproj/_version.py +++ b/python/cuproj/cuproj/_version.py @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os.path +import importlib.resources -with open(os.path.join(os.path.dirname(__file__), 'VERSION')) as version_file: - __version__ = version_file.read().strip() +__version__ = ( + importlib.resources.files("cuproj").joinpath("VERSION").read_text().strip() +) __git_commit__ = "" diff --git a/python/cuspatial/cuspatial/_version.py b/python/cuspatial/cuspatial/_version.py index f38ca7add..e1333b17a 100644 --- a/python/cuspatial/cuspatial/_version.py +++ b/python/cuspatial/cuspatial/_version.py @@ -12,8 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os.path +import importlib.resources -with open(os.path.join(os.path.dirname(__file__), "VERSION")) as version_file: - __version__ = version_file.read().strip() +__version__ = ( + importlib.resources.files("cuspatial") + .joinpath("VERSION") + .read_text() + .strip() +) __git_commit__ = ""