From 574ea3af89baf026cef424ea0b2286e5304fa08a Mon Sep 17 00:00:00 2001 From: Proton Date: Mon, 26 Dec 2022 18:05:56 +0800 Subject: [PATCH] [misc] Keeping up with new python-wheel implementation --- python/taichi/_lib/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/taichi/_lib/utils.py b/python/taichi/_lib/utils.py index be2b4eaeee934..9c6869a0fc772 100644 --- a/python/taichi/_lib/utils.py +++ b/python/taichi/_lib/utils.py @@ -175,9 +175,11 @@ def _print_taichi_header(): def try_get_wheel_tag(module): try: - import wheel.metadata # pylint: disable=import-outside-toplevel + from email.parser import \ + Parser # pylint: disable=import-outside-toplevel wheel_path = f'{module.__path__[0]}-{".".join(map(str, module.__version__))}.dist-info/WHEEL' - meta = wheel.metadata.read_pkg_info(wheel_path) + with open(wheel_path, 'r') as f: + meta = Parser().parse(f) return meta.get('Tag') except Exception: return None