Skip to content

Commit

Permalink
Fix: version number in filename for distribution. (#588)
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock authored Nov 15, 2023
1 parent a0e8bd7 commit 4874437
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@
base_dir = abspath(dirname(__file__))

with open(join(base_dir, package_name.replace("-", ""), "_version.py")) as f:
m = re.search(r"__versionstr__\s+=\s+[\"\']([^\"\']+)[\"\']", f.read())
data = f.read()
m = re.search(r"^__versionstr__: str\s+=\s+[\"\']([^\"\']+)[\"\']", data, re.M)
if m:
package_version = m.group(1)
else:
raise Exception(f"Invalid version: {data}")

with open(join(base_dir, "README.md")) as f:
long_description = f.read().strip()
Expand Down
6 changes: 3 additions & 3 deletions utils/build-dists.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def main() -> None:
if m:
version = m.group(1)
else:
raise Exception(f"Invalid version {data}")
raise Exception(f"Invalid version: {data}")

major_version = version.split(".")[0]

Expand Down Expand Up @@ -258,8 +258,8 @@ def main() -> None:
with open(version_path) as f:
version_data = f.read()
version_data = re.sub(
r"__versionstr__ = \"[^\"]+\"",
'__versionstr__ = "%s"' % version,
r"__versionstr__: str = \"[^\"]+\"",
'__versionstr__: str = "%s"' % version,
version_data,
)
with open(version_path, "w") as f:
Expand Down

0 comments on commit 4874437

Please sign in to comment.