Skip to content

Commit

Permalink
Remove os path from _version.py
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-white committed Dec 3, 2024
1 parent 8a1b1d9 commit d6d4261
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/access_nri_intake/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import re
import subprocess
import sys
from pathlib import Path
from typing import Callable


Expand Down Expand Up @@ -129,7 +130,7 @@ def versions_from_parentdir(parentdir_prefix, root, verbose):
rootdirs = []

for _ in range(3):
dirname = os.path.basename(root)
dirname = Path(root).name
if dirname.startswith(parentdir_prefix):
return {
"version": dirname[len(parentdir_prefix) :],
Expand All @@ -139,7 +140,7 @@ def versions_from_parentdir(parentdir_prefix, root, verbose):
"date": None,
}
rootdirs.append(root)
root = os.path.dirname(root) # up a level
root = Path(root).parent # up a level

if verbose:
print(
Expand Down Expand Up @@ -658,12 +659,12 @@ def get_versions():
pass

try:
root = os.path.realpath(__file__)
root = Path(__file__).resolve()
# versionfile_source is the relative path from the top of the source
# tree (where the .git directory might live) to this file. Invert
# this to find the root from __file__.
for _ in cfg.versionfile_source.split("/"):
root = os.path.dirname(root)
root = Path(root).parent
except NameError:
return {
"version": "0+unknown",
Expand Down

0 comments on commit d6d4261

Please sign in to comment.