mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 05:36:47 +00:00
pyinstaller: initial package
This commit is contained in:
parent
68313a722e
commit
28bc5fe111
18
packages/python/devel/pyinstaller/package.mk
Normal file
18
packages/python/devel/pyinstaller/package.mk
Normal file
@ -0,0 +1,18 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2024-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
PKG_NAME="pyinstaller"
|
||||
PKG_VERSION="0.7.0"
|
||||
PKG_SHA256="a26d3e3116289bb08216e0d0f7d925fcef0b0194eedfa0c944bcaaa106c4b631"
|
||||
PKG_LICENSE="MIT"
|
||||
PKG_SITE="https://pypi.org/project/installer/"
|
||||
PKG_URL="https://files.pythonhosted.org/packages/source/i/installer/installer-${PKG_VERSION}.tar.gz"
|
||||
PKG_SOURCE_DIR="installer-${PKG_VERSION}"
|
||||
PKG_DEPENDS_HOST="flit:host"
|
||||
PKG_LONGDESC="installer provides basic functionality and abstractions for handling wheels and installing packages from wheels."
|
||||
PKG_TOOLCHAIN="python-flit"
|
||||
|
||||
makeinstall_host() {
|
||||
# simple bootstrap install, but should be able to call itself if needed
|
||||
unzip -o -d ${TOOLCHAIN}/lib/${PKG_PYTHON_VERSION}/site-packages dist/*.whl
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
From 4628ef70e1159d3cbab58d395f647c3dff887650 Mon Sep 17 00:00:00 2001
|
||||
From: Carl Smedstad <carl.smedstad@protonmail.com>
|
||||
Date: Tue, 13 Feb 2024 21:10:22 +0100
|
||||
Subject: [PATCH] Add --overwrite-existing option that overwrites existing
|
||||
files
|
||||
|
||||
Implement the --overwrite-existing option that, if supplied, will make
|
||||
installer overwrite any already existing package files instead of
|
||||
failing. With this flag, installer can be used in an idempotent manner,
|
||||
i.e. the same command can be executed multiple times with the same
|
||||
result:
|
||||
|
||||
python -m installer --overwrite-existing --destdir=tmp dist/*.whl
|
||||
python -m installer --overwrite-existing --destdir=tmp dist/*.whl
|
||||
python -m installer --overwrite-existing --destdir=tmp dist/*.whl
|
||||
---
|
||||
src/installer/__main__.py | 6 ++++++
|
||||
src/installer/destinations.py | 5 ++++-
|
||||
tests/test_destinations.py | 22 ++++++++++++++++++++++
|
||||
3 files changed, 32 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/installer/__main__.py b/src/installer/__main__.py
|
||||
index 7ece8d213fe4..b587232912f9 100644
|
||||
--- a/src/installer/__main__.py
|
||||
+++ b/src/installer/__main__.py
|
||||
@@ -51,6 +51,11 @@ def _get_main_parser() -> argparse.ArgumentParser:
|
||||
choices=["all", "entries", "none"],
|
||||
help="validate the wheel against certain part of its record (default=none)",
|
||||
)
|
||||
+ parser.add_argument(
|
||||
+ "--overwrite-existing",
|
||||
+ action="store_true",
|
||||
+ help="silently overwrite existing files",
|
||||
+ )
|
||||
return parser
|
||||
|
||||
|
||||
@@ -95,6 +100,7 @@ def _main(cli_args: Sequence[str], program: Optional[str] = None) -> None:
|
||||
script_kind=get_launcher_kind(),
|
||||
bytecode_optimization_levels=bytecode_levels,
|
||||
destdir=args.destdir,
|
||||
+ overwrite_existing=args.overwrite_existing,
|
||||
)
|
||||
installer.install(source, destination, {})
|
||||
|
||||
diff --git a/src/installer/destinations.py b/src/installer/destinations.py
|
||||
index 31a254c387be..982e6adfc218 100644
|
||||
--- a/src/installer/destinations.py
|
||||
+++ b/src/installer/destinations.py
|
||||
@@ -111,6 +111,7 @@ class SchemeDictionaryDestination(WheelDestination):
|
||||
hash_algorithm: str = "sha256",
|
||||
bytecode_optimization_levels: Collection[int] = (),
|
||||
destdir: Optional[str] = None,
|
||||
+ overwrite_existing: bool = False,
|
||||
) -> None:
|
||||
"""Construct a ``SchemeDictionaryDestination`` object.
|
||||
|
||||
@@ -127,6 +128,7 @@ class SchemeDictionaryDestination(WheelDestination):
|
||||
:param destdir: A staging directory in which to write all files. This
|
||||
is expected to be the filesystem root at runtime, so embedded paths
|
||||
will be written as though this was the root.
|
||||
+ :param overwrite_existing: silently overwrite existing files.
|
||||
"""
|
||||
self.scheme_dict = scheme_dict
|
||||
self.interpreter = interpreter
|
||||
@@ -134,6 +136,7 @@ class SchemeDictionaryDestination(WheelDestination):
|
||||
self.hash_algorithm = hash_algorithm
|
||||
self.bytecode_optimization_levels = bytecode_optimization_levels
|
||||
self.destdir = destdir
|
||||
+ self.overwrite_existing = overwrite_existing
|
||||
|
||||
def _path_with_destdir(self, scheme: Scheme, path: str) -> str:
|
||||
file = os.path.join(self.scheme_dict[scheme], path)
|
||||
@@ -161,7 +164,7 @@ class SchemeDictionaryDestination(WheelDestination):
|
||||
- Hashes the written content, to determine the entry in the ``RECORD`` file.
|
||||
"""
|
||||
target_path = self._path_with_destdir(scheme, path)
|
||||
- if os.path.exists(target_path):
|
||||
+ if not self.overwrite_existing and os.path.exists(target_path):
|
||||
message = f"File already exists: {target_path}"
|
||||
raise FileExistsError(message)
|
||||
|
Loading…
x
Reference in New Issue
Block a user