Skip to content

Commit 49bb02d

Browse files
authored
Merge pull request #3286 from boutproject/python-no-v-prefix
Remove v prefix from version for wheels
2 parents bc7f01f + 63af212 commit 49bb02d

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

tools/pylib/_boutpp_build/backend.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def getversion():
3333
with contextlib.suppress(KeyError):
3434
# 0. Check whether version is set via environment variable
3535
version = os.environ["BOUT_PRETEND_VERSION"]
36-
return version
36+
return version.lstrip("v")
3737

3838
_bout_previous_version = "v5.2.0"
3939
_bout_next_version = "v5.2.1"
@@ -74,7 +74,7 @@ def getversion():
7474
version = _bout_previous_version + ".rc+" + hash
7575
with open("_version.txt", "w") as f:
7676
f.write(version + "\n")
77-
return version
77+
return version.lstrip("v")
7878

7979

8080
def run(cmd):
@@ -212,10 +212,12 @@ def build_sdist(sdist_directory, config_settings=None):
212212
run(f"rm {tmp}")
213213

214214
with open(tmp, "w") as f:
215-
f.write(f"""Metadata-Version: 2.1
215+
f.write(
216+
f"""Metadata-Version: 2.1
216217
Name: {pkgname}
217218
Version: {getversion()}
218-
""")
219+
"""
220+
)
219221
with open("LICENSE") as src:
220222
pre = "License: "
221223
for l in src:
@@ -267,19 +269,23 @@ def prepare_metadata_for_build_wheel(
267269
distinfo = f"{metadata_directory}/{thisdir}"
268270
mkdir_p(distinfo)
269271
with open(f"{distinfo}/METADATA", "w") as f:
270-
f.write(f"""Metadata-Version: 2.1
272+
f.write(
273+
f"""Metadata-Version: 2.1
271274
Name: {pkgname}
272275
Version: {getversion()}
273276
License-File: COPYING
274-
""")
277+
"""
278+
)
275279
run(f"cp LICENSE {distinfo}/COPYING")
276280
run(f"cp LICENSE.GPL {distinfo}/COPYING.GPL")
277281
with open(f"{distinfo}/WHEEL", "w") as f:
278-
f.write(f"""Wheel-Version: 1.0
279-
Generator: boutpp_custom_build_wheel ({getversion()})
282+
f.write(
283+
f"""Wheel-Version: 1.0
284+
Generator: boutpp_custom_build_wheel (version {getversion()})
280285
Root-Is-Purelib: false
281286
Tag: {gettag()}
282-
""")
287+
"""
288+
)
283289

284290
if record:
285291
with open(f"{distinfo}/RECORD", "w") as f:

0 commit comments

Comments
 (0)