Skip to content

Commit

Permalink
BUG: Fix use of toml.load()
Browse files Browse the repository at this point in the history
  • Loading branch information
WarrenWeckesser committed Sep 6, 2023
1 parent c54b140 commit f9ff95a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions _build_utils/make_version_file.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
try:
import tomllib as toml

def myload(filename):
with open(filename, 'rb') as f:
proj = toml.load(f)
return proj

except Exception:
import toml

def myload(filename):
return toml.load(filename)


def get_version_from_pyproject_toml(filename):
"""
Find the value assigned to __version__ in pyproject.toml
"""
with open(filename, 'rb') as f:
proj = toml.load(f)
proj = myload(filename)
return proj['project']['version']


Expand Down

0 comments on commit f9ff95a

Please sign in to comment.