Files
MINGW-packages/mingw-w64-python-wheel/install_wheel.py
Christoph Reiter 3bb7634d43 Add a bootstrap flag to tomli and wheel
In case of wheel the launcher is missing when we just unpack,
so add a bootstrap flag which we can turn off once everything
is built.
2022-06-11 10:16:01 +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)