mit neuen venv und exe-Files
This commit is contained in:
@@ -0,0 +1 @@
|
||||
# Directory for initscripts.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
140
venv3_12/Lib/site-packages/cx_Freeze/initscripts/__startup__.py
Normal file
140
venv3_12/Lib/site-packages/cx_Freeze/initscripts/__startup__.py
Normal file
@@ -0,0 +1,140 @@
|
||||
"""First script that is run when cx_Freeze starts up. It determines the name of
|
||||
the initscript that is to be executed after a basic initialization.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
import os
|
||||
import string
|
||||
import sys
|
||||
from importlib.machinery import (
|
||||
EXTENSION_SUFFIXES,
|
||||
ExtensionFileLoader,
|
||||
ModuleSpec,
|
||||
PathFinder,
|
||||
)
|
||||
|
||||
import BUILD_CONSTANTS
|
||||
|
||||
STRINGREPLACE = list(
|
||||
string.whitespace + string.punctuation.replace(".", "").replace("_", "")
|
||||
)
|
||||
|
||||
|
||||
class ExtensionFinder(PathFinder):
|
||||
"""A Finder for extension modules of packages in zip files."""
|
||||
|
||||
@classmethod
|
||||
def find_spec(
|
||||
cls,
|
||||
fullname,
|
||||
path=None,
|
||||
target=None, # noqa: ARG003
|
||||
) -> ModuleSpec | None:
|
||||
"""Finder only for extension modules found within packages that
|
||||
are included in the zip file (instead of as files on disk);
|
||||
extension modules cannot be found within zip files but are stored in
|
||||
the lib subdirectory; if the extension module is found in a package,
|
||||
however, its name has been altered so this finder is needed.
|
||||
"""
|
||||
if path is None:
|
||||
return None
|
||||
suffixes = EXTENSION_SUFFIXES
|
||||
for entry in sys.path:
|
||||
if ".zip" in entry:
|
||||
continue
|
||||
for ext in suffixes:
|
||||
location = os.path.join(entry, fullname + ext)
|
||||
if os.path.isfile(location):
|
||||
loader = ExtensionFileLoader(fullname, location)
|
||||
return ModuleSpec(fullname, loader, origin=location)
|
||||
return None
|
||||
|
||||
|
||||
def get_name(executable) -> str:
|
||||
"""Get the module basename to search for init and main scripts."""
|
||||
name = os.path.normcase(os.path.basename(executable))
|
||||
if sys.platform.startswith("win"):
|
||||
name, _ = os.path.splitext(name)
|
||||
name = name.partition(".")[0]
|
||||
if not name.isidentifier():
|
||||
for char in STRINGREPLACE:
|
||||
name = name.replace(char, "_")
|
||||
return name
|
||||
|
||||
|
||||
def init() -> None:
|
||||
"""Basic initialization of the startup script."""
|
||||
# to avoid bugs (especially in MSYS2) use normpath after any change
|
||||
sys.executable = os.path.normpath(sys.executable)
|
||||
sys.frozen_dir = frozen_dir = os.path.dirname(sys.executable)
|
||||
sys.meta_path.append(ExtensionFinder)
|
||||
|
||||
# normalize and check sys.path, preserving the reference
|
||||
j = 0
|
||||
for path in list(map(os.path.normpath, sys.path)):
|
||||
if os.path.exists(path):
|
||||
sys.path[j] = path
|
||||
j = j + 1
|
||||
else:
|
||||
sys.path.remove(path)
|
||||
|
||||
if sys.platform.startswith("win"):
|
||||
# the search path for dependencies
|
||||
search_path: list[str] = [
|
||||
entry for entry in sys.path if os.path.isdir(entry)
|
||||
]
|
||||
# add to dll search path (or to path)
|
||||
env_path = os.environ.get("PATH", "").split(os.pathsep)
|
||||
env_path = list(map(os.path.normpath, env_path))
|
||||
for directory in search_path:
|
||||
with contextlib.suppress(OSError):
|
||||
os.add_dll_directory(directory)
|
||||
# we need to add to path for packages like 'gi' in MSYS2
|
||||
if directory not in env_path:
|
||||
env_path.insert(0, directory)
|
||||
env_path = [entry.replace(os.sep, "\\") for entry in env_path]
|
||||
os.environ["PATH"] = os.pathsep.join(env_path)
|
||||
|
||||
# set environment variables
|
||||
for name in (
|
||||
"TCL_LIBRARY",
|
||||
"TK_LIBRARY",
|
||||
"PYTHONTZPATH",
|
||||
):
|
||||
try:
|
||||
value = getattr(BUILD_CONSTANTS, name)
|
||||
except AttributeError:
|
||||
pass
|
||||
else:
|
||||
var_path = os.path.join(frozen_dir, os.path.normpath(value))
|
||||
if not os.path.exists(var_path) and sys.platform == "darwin":
|
||||
# when using bdist_mac
|
||||
var_path = os.path.join(
|
||||
os.path.dirname(frozen_dir),
|
||||
"Resources",
|
||||
os.path.normpath(value),
|
||||
)
|
||||
os.environ[name] = var_path
|
||||
|
||||
|
||||
def run() -> None:
|
||||
"""Determines the name of the initscript and execute it."""
|
||||
name = get_name(sys.executable)
|
||||
try:
|
||||
# basically is __init__ plus the basename of the executable
|
||||
module_init = __import__(f"__init__{name}")
|
||||
except ModuleNotFoundError:
|
||||
# but can be renamed when only one executable exists
|
||||
num = BUILD_CONSTANTS._EXECUTABLES_NUMBER # noqa: SLF001
|
||||
if num > 1:
|
||||
msg = (
|
||||
"Apparently, the original executable has been renamed to "
|
||||
f"{name!r}. When multiple executables are generated, "
|
||||
"renaming is not allowed."
|
||||
)
|
||||
raise RuntimeError(msg) from None
|
||||
name = get_name(BUILD_CONSTANTS._EXECUTABLE_NAME_0) # noqa: SLF001
|
||||
module_init = __import__(f"__init__{name}")
|
||||
module_init.run(f"__main__{name}")
|
||||
25
venv3_12/Lib/site-packages/cx_Freeze/initscripts/console.py
Normal file
25
venv3_12/Lib/site-packages/cx_Freeze/initscripts/console.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""Initialization script for cx_Freeze. Sets the attribute sys.frozen so that
|
||||
modules that expect it behave as they should.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
import sys
|
||||
|
||||
sys.frozen = True
|
||||
|
||||
|
||||
def run(name) -> None:
|
||||
"""Execute the main script of the frozen application."""
|
||||
spec = importlib.util.find_spec(name)
|
||||
code = spec.loader.get_code(name)
|
||||
main_module = sys.modules["__main__"]
|
||||
main_globals = main_module.__dict__
|
||||
main_globals.update(
|
||||
__cached__=spec.cached,
|
||||
__file__=spec.cached,
|
||||
__loader__=spec.loader,
|
||||
__spec__=spec,
|
||||
)
|
||||
exec(code, main_globals)
|
||||
@@ -0,0 +1,41 @@
|
||||
"""Initialization script for cx_Freeze which manipulates the path so that the
|
||||
directory in which the executable is found is searched for extensions but
|
||||
no other directory is searched. The environment variable LD_LIBRARY_PATH is
|
||||
manipulated first, however, to ensure that shared libraries found in the
|
||||
target directory are found. This requires a restart of the executable because
|
||||
the environment variable LD_LIBRARY_PATH is only checked at startup.
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
import sys
|
||||
|
||||
DIR_NAME = os.path.dirname(sys.executable)
|
||||
|
||||
paths = os.environ.get("LD_LIBRARY_PATH", "").split(os.pathsep)
|
||||
|
||||
if DIR_NAME not in paths:
|
||||
paths.insert(0, DIR_NAME)
|
||||
os.environ["LD_LIBRARY_PATH"] = os.pathsep.join(paths)
|
||||
os.execv(sys.executable, sys.argv) # noqa: S606
|
||||
|
||||
sys.frozen = True
|
||||
sys.path = sys.path[:4]
|
||||
|
||||
|
||||
def run(name) -> None:
|
||||
"""Execute the main script of the frozen application."""
|
||||
spec = importlib.util.find_spec(name)
|
||||
code = spec.loader.get_code(name)
|
||||
main_module = sys.modules["__main__"]
|
||||
main_globals = main_module.__dict__
|
||||
main_globals.update(
|
||||
__cached__=spec.cached,
|
||||
__file__=spec.cached,
|
||||
__loader__=spec.loader,
|
||||
__spec__=spec,
|
||||
)
|
||||
exec(code, main_globals)
|
||||
@@ -0,0 +1,63 @@
|
||||
## Why this file is included
|
||||
|
||||
This program has been frozen with cx_Freeze. The freezing process
|
||||
resulted in certain components from the cx_Freeze software being included
|
||||
in the frozen application, in particular bootstrap code for launching
|
||||
the frozen python script. The cx_Freeze software is subject to the
|
||||
license set out below.
|
||||
|
||||
# Licensing
|
||||
|
||||
- Copyright © 2020-2024, Marcelo Duarte.
|
||||
- Copyright © 2007-2019, Anthony Tuininga.
|
||||
- Copyright © 2001-2006, Computronix (Canada) Ltd., Edmonton, Alberta,
|
||||
Canada.
|
||||
- All rights reserved.
|
||||
|
||||
NOTE: This license is derived from the Python Software Foundation
|
||||
License which can be found at
|
||||
<https://docs.python.org/3/license.html#psf-license-agreement-for-python-release>
|
||||
|
||||
## License for cx_Freeze
|
||||
|
||||
1. This LICENSE AGREEMENT is between the copyright holders and the
|
||||
Individual or Organization ("Licensee") accessing and otherwise
|
||||
using cx_Freeze software in source or binary form and its associated
|
||||
documentation.
|
||||
2. Subject to the terms and conditions of this License Agreement, the
|
||||
copyright holders hereby grant Licensee a nonexclusive,
|
||||
royalty-free, world-wide license to reproduce, analyze, test,
|
||||
perform and/or display publicly, prepare derivative works,
|
||||
distribute, and otherwise use cx_Freeze alone or in any derivative
|
||||
version, provided, however, that this License Agreement and this
|
||||
notice of copyright are retained in cx_Freeze alone or in any
|
||||
derivative version prepared by Licensee.
|
||||
3. In the event Licensee prepares a derivative work that is based on or
|
||||
incorporates cx_Freeze or any part thereof, and wants to make the
|
||||
derivative work available to others as provided herein, then
|
||||
Licensee hereby agrees to include in any such work a brief summary
|
||||
of the changes made to cx_Freeze.
|
||||
4. The copyright holders are making cx_Freeze available to Licensee on
|
||||
an "AS IS" basis. THE COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR
|
||||
WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT
|
||||
LIMITATION, THE COPYRIGHT HOLDERS MAKE NO AND DISCLAIM ANY
|
||||
REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY
|
||||
PARTICULAR PURPOSE OR THAT THE USE OF CX_FREEZE WILL NOT INFRINGE
|
||||
ANY THIRD PARTY RIGHTS.
|
||||
5. THE COPYRIGHT HOLDERS SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER
|
||||
USERS OF CX_FREEZE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL
|
||||
DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE
|
||||
USING CX_FREEZE, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY THEREOF.
|
||||
6. This License Agreement will automatically terminate upon a material
|
||||
breach of its terms and conditions.
|
||||
7. Nothing in this License Agreement shall be deemed to create any
|
||||
relationship of agency, partnership, or joint venture between the
|
||||
copyright holders and Licensee. This License Agreement does not
|
||||
grant permission to use copyright holder's trademarks or trade name
|
||||
in a trademark sense to endorse or promote products or services of
|
||||
Licensee, or any third party.
|
||||
8. By copying, installing or otherwise using cx_Freeze, Licensee agrees
|
||||
to be bound by the terms and conditions of this License Agreement.
|
||||
|
||||
Computronix® is a registered trademark of Computronix (Canada) Ltd.
|
||||
@@ -0,0 +1,17 @@
|
||||
"""Initialization script for cx_Freeze which behaves similarly to the one for
|
||||
console based applications but must handle the case where Python has already
|
||||
been initialized and another DLL of this kind has been loaded. As such it
|
||||
does not block the path unless sys.frozen is not already set.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
|
||||
if not hasattr(sys, "frozen"):
|
||||
sys.frozen = True
|
||||
sys.path = sys.path[:4]
|
||||
|
||||
|
||||
def run() -> None: # noqa: D103
|
||||
pass
|
||||
@@ -0,0 +1,25 @@
|
||||
"""Initialization script for cx_Freeze which imports the site module (as per
|
||||
normal processing of a Python script) and then searches for a file with the
|
||||
same name as the shared library but with the extension .pth. The entries in
|
||||
this file are used to modify the path to use for subsequent imports.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
# the site module must be imported for normal behavior to take place; it is
|
||||
# done dynamically so that cx_Freeze will not add all modules referenced by
|
||||
# the site module to the frozen executable
|
||||
__import__("site")
|
||||
|
||||
# now locate the pth file to modify the path appropriately
|
||||
name, ext = os.path.splitext(sys.executable)
|
||||
filename = name + ".pth"
|
||||
with open(filename, encoding="utf-8") as in_file:
|
||||
sys.path = [s.strip() for s in in_file.read().splitlines()] + sys.path
|
||||
|
||||
|
||||
def run() -> None: # noqa: D103
|
||||
pass
|
||||
Reference in New Issue
Block a user