Skip to content

Commit

Permalink
🚸 backward compatible fix for OZI.build 1.3+
Browse files Browse the repository at this point in the history
Signed-off-by: rjdbcm <[email protected]>
  • Loading branch information
rjdbcm committed Aug 28, 2024
1 parent 751c690 commit cae39ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion ozi/scripts/meson_dist_setuptools_scm.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@
with (source / 'pyproject.toml').open('rb') as project_file:
pyproject_toml = toml.load(project_file)
setuptools_scm = pyproject_toml.get('tool', {}).get('setuptools_scm', {})
path = Path(dist / setuptools_scm.get('version_file')).resolve()
try:
path = Path(source / setuptools_scm.get('version_file')).resolve()
except TypeError:
print('no METADATA path provided by setuptools_scm, assuming OZI.build 1.3+', file=sys.stderr)
exit(0)
if path.exists():
path.unlink()
if path.parent != Path(dist).resolve():
Expand Down
6 changes: 5 additions & 1 deletion ozi/scripts/meson_setuptools_scm.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@
with (source / 'pyproject.toml').open('rb') as project_file:
pyproject_toml = toml.load(project_file)
setuptools_scm = pyproject_toml.get('tool', {}).get('setuptools_scm', {})
path = Path(source / setuptools_scm.get('version_file')).resolve()
try:
path = Path(source / setuptools_scm.get('version_file')).resolve()
except TypeError:
print('no METADATA path provided by setuptools_scm, assuming OZI.build 1.3+', file=sys.stderr)
exit(0)
if path.parent != Path(source).resolve():
raise RuntimeError('Invalid version_file path in pyproject.toml')
else:
Expand Down

0 comments on commit cae39ae

Please sign in to comment.