mirror of
https://git.yoctoproject.org/poky
synced 2026-09-15 15:49:32 +02:00
python3-installer: add installer module
Add a recipe for Installer, a minimal library/tool to install Python Wheels. Unlike PIP, it explicitly only installs wheels and does nothing else. (From OE-Core rev: bf09c0bd99e4defbc259775b4a2e3fcce09bde17) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
7769b1f3fa
commit
c4cfeb96a3
@@ -612,6 +612,7 @@ RECIPE_MAINTAINER:pn-python3-importlib-metadata = "Tim Orling <tim.orling@konsul
|
|||||||
RECIPE_MAINTAINER:pn-python3-iniconfig = "Tim Orling <tim.orling@konsulko.com>"
|
RECIPE_MAINTAINER:pn-python3-iniconfig = "Tim Orling <tim.orling@konsulko.com>"
|
||||||
RECIPE_MAINTAINER:pn-python3-iniparse = "Oleksandr Kravchuk <open.source@oleksandr-kravchuk.com>"
|
RECIPE_MAINTAINER:pn-python3-iniparse = "Oleksandr Kravchuk <open.source@oleksandr-kravchuk.com>"
|
||||||
RECIPE_MAINTAINER:pn-python3-iso8601 = "Tim Orling <tim.orling@konsulko.com>"
|
RECIPE_MAINTAINER:pn-python3-iso8601 = "Tim Orling <tim.orling@konsulko.com>"
|
||||||
|
RECIPE_MAINTAINER:pn-python3-installer = "Ross Burton <ross.burton@arm.com>"
|
||||||
RECIPE_MAINTAINER:pn-python3-jinja2 = "Richard Purdie <richard.purdie@linuxfoundation.org>"
|
RECIPE_MAINTAINER:pn-python3-jinja2 = "Richard Purdie <richard.purdie@linuxfoundation.org>"
|
||||||
RECIPE_MAINTAINER:pn-python3-jsonpointer = "Bruce Ashfield <bruce.ashfield@gmail.com>"
|
RECIPE_MAINTAINER:pn-python3-jsonpointer = "Bruce Ashfield <bruce.ashfield@gmail.com>"
|
||||||
RECIPE_MAINTAINER:pn-python3-jsonschema = "Bruce Ashfield <bruce.ashfield@gmail.com>"
|
RECIPE_MAINTAINER:pn-python3-jsonschema = "Bruce Ashfield <bruce.ashfield@gmail.com>"
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
Let us override the hashbang directly (possibly upstreamable), and don't
|
||||||
|
play games with hashbangs: for now assume that even hashbangs with spaces
|
||||||
|
are simple (assume the spaces are only used to separate arguments) and
|
||||||
|
we don't have long hashbangs.
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate
|
||||||
|
Signed-off-by: Ross Burton <ross.burton@arm.com>
|
||||||
|
|
||||||
|
diff --git a/src/installer/__main__.py b/src/installer/__main__.py
|
||||||
|
index 3357ec5..d2fd8d2 100644
|
||||||
|
--- a/src/installer/__main__.py
|
||||||
|
+++ b/src/installer/__main__.py
|
||||||
|
@@ -23,6 +23,13 @@ def _get_main_parser() -> argparse.ArgumentParser:
|
||||||
|
type=str,
|
||||||
|
help="destination directory (prefix to prepend to each file)",
|
||||||
|
)
|
||||||
|
+ parser.add_argument(
|
||||||
|
+ "--interpreter",
|
||||||
|
+ "-i",
|
||||||
|
+ type=str,
|
||||||
|
+ default=sys.executable,
|
||||||
|
+ help=f"interpreter (defaults to {sys.executable})",
|
||||||
|
+ )
|
||||||
|
parser.add_argument(
|
||||||
|
"--compile-bytecode",
|
||||||
|
action="append",
|
||||||
|
@@ -73,7 +80,7 @@ def _main(cli_args: Sequence[str], program: Optional[str] = None) -> None:
|
||||||
|
with WheelFile.open(args.wheel) as source:
|
||||||
|
destination = SchemeDictionaryDestination(
|
||||||
|
scheme_dict=_get_scheme_dict(source.distribution),
|
||||||
|
- interpreter=sys.executable,
|
||||||
|
+ interpreter=args.interpreter,
|
||||||
|
script_kind=get_launcher_kind(),
|
||||||
|
bytecode_optimization_levels=bytecode_levels,
|
||||||
|
destdir=args.destdir,
|
||||||
|
diff --git a/src/installer/scripts.py b/src/installer/scripts.py
|
||||||
|
index 7e3c8fc..ba6ed5a 100644
|
||||||
|
--- a/src/installer/scripts.py
|
||||||
|
+++ b/src/installer/scripts.py
|
||||||
|
@@ -59,20 +59,7 @@ def _build_shebang(executable: str, forlauncher: bool) -> bytes:
|
||||||
|
https://bitbucket.org/pypa/distlib/src/58cd5c6/distlib/scripts.py#lines-124
|
||||||
|
"""
|
||||||
|
executable_bytes = executable.encode("utf-8")
|
||||||
|
- if forlauncher: # The launcher can just use the command as-is.
|
||||||
|
- return b"#!" + executable_bytes
|
||||||
|
- if _is_executable_simple(executable_bytes):
|
||||||
|
- return b"#!" + executable_bytes
|
||||||
|
-
|
||||||
|
- # Shebang support for an executable with a space in it is under-specified
|
||||||
|
- # and platform-dependent, so we use a clever hack to generate a script to
|
||||||
|
- # run in ``/bin/sh`` that should work on all reasonably modern platforms.
|
||||||
|
- # Read the following message to understand how the hack works:
|
||||||
|
- # https://github.com/pradyunsg/installer/pull/4#issuecomment-623668717
|
||||||
|
-
|
||||||
|
- quoted = shlex.quote(executable).encode("utf-8")
|
||||||
|
- # I don't understand a lick what this is trying to do.
|
||||||
|
- return b"#!/bin/sh\n'''exec' " + quoted + b' "$0" "$@"\n' + b"' '''"
|
||||||
|
+ return b"#!" + executable_bytes
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidScript(ValueError):
|
||||||
22
meta/recipes-devtools/python/python3-installer_0.5.1.bb
Normal file
22
meta/recipes-devtools/python/python3-installer_0.5.1.bb
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
SUMMARY = "Library and tool for installing Python wheels"
|
||||||
|
DESCRIPTION = "A low-level library for installing a Python package from a wheel distribution."
|
||||||
|
HOMEPAGE = "https://installer.readthedocs.io/"
|
||||||
|
BUGTRACKER = "https://github.com/pypa/installer/issues"
|
||||||
|
|
||||||
|
LICENSE = "MIT"
|
||||||
|
LIC_FILES_CHKSUM = "file://LICENSE;md5=5038641aec7a77451e31da828ebfae00"
|
||||||
|
|
||||||
|
SRC_URI += "file://interpreter.patch"
|
||||||
|
|
||||||
|
SRC_URI[sha256sum] = "f970995ec2bb815e2fdaf7977b26b2091e1e386f0f42eafd5ac811953dc5d445"
|
||||||
|
|
||||||
|
inherit pypi flit_core
|
||||||
|
|
||||||
|
DEPENDS:remove:class-native = "python3-installer-native"
|
||||||
|
DEPENDS:append:class-native = " unzip-native"
|
||||||
|
|
||||||
|
do_install:class-native () {
|
||||||
|
python_pep517_do_bootstrap_install
|
||||||
|
}
|
||||||
|
|
||||||
|
BBCLASSEXTEND = "native nativesdk"
|
||||||
Reference in New Issue
Block a user