Skip to content

Commit

Permalink
BLD: fix a conversion error (char[2] -> int)
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Aug 13, 2024
1 parent d4d4fd5 commit 6f93a91
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,20 @@ def get_extensions():
if liberfa_versions:
print('Configure liberfa ("configure.ac" scan)')
lines = []
for name, value in get_liberfa_versions():
lines.append(f'#define {name} "{value}"')
for name, value in liberfa_versions:
if name in ("PACKAGE_VERSION", "SOFA_VERSION"):
# strings should be escaped
value_repr = f'"{value}"'
elif name in (
"PACKAGE_VERSION_MAJOR",
"PACKAGE_VERSION_MINOR",
"PACKAGE_VERSION_MICRO",
):
# integers
value_repr = value
else:
raise RuntimeError(f"Unexpected item {name=}, {value=}")
lines.append(f'#define {name} {value_repr}')
with open(config_h, 'w') as fd:
fd.write('\n'.join(lines))
else:
Expand Down

0 comments on commit 6f93a91

Please sign in to comment.