kumquat-buildroot/support/scripts/pyinstaller.py
James Hilliard 29a12eb86a package/python-flit-core: new package/infrastructure
This adds pep517(needed for flit-core to build itself) and flit python
package types.

We need to add an installer script and pass it appropriate options for
installing pep517 wheels generated by python-pypa-build during the
build stage. Unfortunately it seems pep517 does not support builds
without using the wheel format.

We also need to add a patch fixing the version parser in flit-core.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
[Arnout:
 - fix indentation in pkg-python.mk (tabs, not spaces);
 - use the new _CMD variables instead of duplicating the entire _CMDS
   definitions;
 - no need to filter dependencies (they're not self-referencing);
 - _NEEDS_HOST_PYTHON no longer exists;
 - host-python-pypa-build gets added to DEPENDENCIES automatically.
]
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-02-16 22:16:43 +01:00

70 lines
2.0 KiB
Python
Executable File

#!/usr/bin/env python3
import argparse
import glob
from installer import install
from installer.destinations import SchemeDictionaryDestination
from installer.sources import WheelFile
def main():
"""Entry point for CLI."""
ap = argparse.ArgumentParser("python pyinstaller.py")
ap.add_argument("wheel_file", help="Path to a .whl file to install")
ap.add_argument(
"--interpreter", required=True, help="Interpreter path to be used in scripts"
)
ap.add_argument(
"--script-kind",
required=True,
choices=["posix", "win-ia32", "win-amd64", "win-arm", "win-arm64"],
help="Kind of launcher to create for each script",
)
dest_args = ap.add_argument_group("Destination directories")
dest_args.add_argument(
"--purelib",
required=True,
help="Directory for platform-independent Python modules",
)
dest_args.add_argument(
"--platlib",
help="Directory for platform-dependent Python modules (same as purelib "
"if not specified)",
)
dest_args.add_argument(
"--headers", required=True, help="Directory for C header files"
)
dest_args.add_argument(
"--scripts", required=True, help="Directory for executable scripts"
)
dest_args.add_argument(
"--data", required=True, help="Directory for external data files"
)
args = ap.parse_args()
destination = SchemeDictionaryDestination(
{
"purelib": args.purelib,
"platlib": args.platlib if args.platlib is not None else args.purelib,
"headers": args.headers,
"scripts": args.scripts,
"data": args.data,
},
interpreter=args.interpreter,
script_kind=args.script_kind,
)
with WheelFile.open(glob.glob(args.wheel_file)[0]) as source:
install(
source=source,
destination=destination,
additional_metadata={},
)
if __name__ == "__main__":
main()