MSYS2-packages/python-tomli/install_wheel.py
Christoph Reiter febb4b4bb0 Add python-tomli
install via the wheel since it will be part of the bootstrap chain
like the mingw package and we can't use any build tools there.

Required for newer pytest
2022-07-03 09:20:56 +02:00

34 lines
819 B
Python

import argparse
import sys
import sysconfig
from pathlib import Path
from zipfile import ZipFile
def extract_wheel(whl_path, dest):
print("Installing to", dest)
with ZipFile(whl_path) as zf:
zf.extractall(dest)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
'wheel',
type=Path,
help=f'wheel to install (.whl file)',
)
purelib = Path(sysconfig.get_path('purelib')).resolve()
parser.add_argument(
'--installdir',
'-i',
type=Path,
default=purelib,
help=f'installdir directory (defaults to {purelib})',
)
args = parser.parse_args()
if not args.installdir.is_dir():
sys.exit(f"{args.installdir} is not a directory")
extract_wheel(args.wheel, args.installdir)