Skip to content

Commit

Permalink
Backport PR #54525 on branch 2.1.x (BLD: Fix version script) (#54560)
Browse files Browse the repository at this point in the history
Backport PR #54525: BLD: Fix version script

Co-authored-by: Thomas Li <47963215+lithomas1@users.noreply.github.com>
  • Loading branch information
meeseeksmachine and lithomas1 committed Aug 15, 2023
1 parent f59950d commit e69fab9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
fi
- run:
name: Build aarch64 wheels
no_output_timeout: 30m # Sometimes the tests won't generate any output, make sure the job doesn't get killed by that
command: |
pip3 install cibuildwheel==2.14.1
cibuildwheel --prerelease-pythons --output-dir wheelhouse
Expand Down
28 changes: 23 additions & 5 deletions generate_version.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
# Note: This file has to live next to setup.py or versioneer will not work
import argparse
import os
import sys

import versioneer

sys.path.insert(0, "")


def write_version_info(path):
version = None
git_version = None

try:
import _version_meson

version = _version_meson.__version__
git_version = _version_meson.__git_version__
except ImportError:
version = versioneer.get_version()
git_version = versioneer.get_versions()["full-revisionid"]
if os.environ.get("MESON_DIST_ROOT"):
path = os.path.join(os.environ.get("MESON_DIST_ROOT"), path)
with open(path, "w", encoding="utf-8") as file:
file.write(f'__version__="{versioneer.get_version()}"\n')
file.write(
f'__git_version__="{versioneer.get_versions()["full-revisionid"]}"\n'
)
file.write(f'__version__="{version}"\n')
file.write(f'__git_version__="{git_version}"\n')


def main():
Expand Down Expand Up @@ -43,7 +55,13 @@ def main():
write_version_info(args.outfile)

if args.print:
print(versioneer.get_version())
try:
import _version_meson

version = _version_meson.__version__
except ImportError:
version = versioneer.get_version()
print(version)


main()
1 change: 1 addition & 0 deletions scripts/validate_unwanted_patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"_global_config",
"_chained_assignment_msg",
"_chained_assignment_method_msg",
"_version_meson",
}


Expand Down

0 comments on commit e69fab9

Please sign in to comment.