|
| 1 | +# PYZ, EXE and COLLECT referenced in https://pyinstaller.org/en/stable/spec-files.html#spec-file-operation |
| 2 | +# MERGE is referenced in https://pyinstaller.org/en/stable/spec-files.html#example-merge-spec-file |
| 3 | +# Not to be imported during runtime, but is the type reference for spec files which are executed as python code |
| 4 | +import sys |
| 5 | +from _typeshed import FileDescriptorOrPath, StrOrBytesPath, StrPath, Unused |
| 6 | +from collections.abc import Iterable, Mapping, Sequence |
| 7 | +from types import CodeType |
| 8 | +from typing import ClassVar |
| 9 | +from typing_extensions import Final, Literal, TypeAlias |
| 10 | + |
| 11 | +from PyInstaller.building import _PyiBlockCipher |
| 12 | +from PyInstaller.building.build_main import Analysis |
| 13 | +from PyInstaller.building.datastruct import TOC, Target, _TOCTuple |
| 14 | +from PyInstaller.building.splash import Splash |
| 15 | +from PyInstaller.utils.win32.versioninfo import VSVersionInfo |
| 16 | +from PyInstaller.utils.win32.winmanifest import Manifest |
| 17 | + |
| 18 | +if sys.platform == "darwin": |
| 19 | + _TargetArch: TypeAlias = Literal["x86_64", "arm64", "universal2"] |
| 20 | + _SuportedTargetArchParam: TypeAlias = _TargetArch | None |
| 21 | + _CodesignIdentity: TypeAlias = str | None |
| 22 | + _CodesignIdentityParam: TypeAlias = str | None |
| 23 | +else: |
| 24 | + _TargetArch: TypeAlias = None |
| 25 | + _SuportedTargetArchParam: TypeAlias = object |
| 26 | + _CodesignIdentity: TypeAlias = None |
| 27 | + _CodesignIdentityParam: TypeAlias = object |
| 28 | + |
| 29 | +if sys.platform == "win32": |
| 30 | + _Icon: TypeAlias = list[StrPath] | str |
| 31 | + _IconParam: TypeAlias = StrPath | list[StrPath] | None |
| 32 | +elif sys.platform == "darwin": |
| 33 | + _Icon: TypeAlias = list[StrPath] | None |
| 34 | + _IconParam: TypeAlias = StrPath | list[StrPath] | None |
| 35 | +else: |
| 36 | + _Icon: TypeAlias = None |
| 37 | + _IconParam: TypeAlias = object |
| 38 | + |
| 39 | +if sys.platform == "win32": |
| 40 | + _VersionSrc: TypeAlias = VSVersionInfo | None |
| 41 | + _VersionParam: TypeAlias = VSVersionInfo | StrOrBytesPath | None |
| 42 | + _Manifest: TypeAlias = Manifest |
| 43 | + _ManifestParam: TypeAlias = Manifest | None |
| 44 | +else: |
| 45 | + _VersionSrc: TypeAlias = None |
| 46 | + _VersionParam: TypeAlias = object |
| 47 | + _Manifest: TypeAlias = None |
| 48 | + _ManifestParam: TypeAlias = object |
| 49 | + |
| 50 | +class PYZ(Target): |
| 51 | + name: str |
| 52 | + cipher: _PyiBlockCipher |
| 53 | + dependencies: list[_TOCTuple] # type: ignore[assignment] |
| 54 | + toc: TOC |
| 55 | + code_dict: dict[str, CodeType] |
| 56 | + def __init__(self, *tocs: TOC, name: str | None = None, cipher: _PyiBlockCipher = None) -> None: ... |
| 57 | + def assemble(self) -> None: ... |
| 58 | + |
| 59 | +class PKG(Target): |
| 60 | + xformdict: ClassVar[dict[str, str]] |
| 61 | + toc: TOC |
| 62 | + cdict: Mapping[str, bool] |
| 63 | + name: str |
| 64 | + exclude_binaries: bool |
| 65 | + strip_binaries: bool |
| 66 | + upx_binaries: bool |
| 67 | + upx_exclude: Iterable[str] |
| 68 | + target_arch: _TargetArch | None |
| 69 | + codesign_identity: _CodesignIdentity |
| 70 | + entitlements_file: FileDescriptorOrPath | None |
| 71 | + def __init__( |
| 72 | + self, |
| 73 | + toc: TOC, |
| 74 | + name: str | None = None, |
| 75 | + cdict: Mapping[str, bool] | None = None, |
| 76 | + exclude_binaries: bool = False, |
| 77 | + strip_binaries: bool = False, |
| 78 | + upx_binaries: bool = False, |
| 79 | + upx_exclude: Iterable[str] | None = None, |
| 80 | + target_arch: _SuportedTargetArchParam = None, |
| 81 | + codesign_identity: _CodesignIdentityParam = None, |
| 82 | + entitlements_file: FileDescriptorOrPath | None = None, |
| 83 | + ) -> None: ... |
| 84 | + def assemble(self) -> None: ... |
| 85 | + |
| 86 | +class EXE(Target): |
| 87 | + exclude_binaries: bool |
| 88 | + bootloader_ignore_signals: bool |
| 89 | + console: bool |
| 90 | + disable_windowed_traceback: bool |
| 91 | + debug: bool |
| 92 | + name: str |
| 93 | + icon: _Icon |
| 94 | + versrsrc: _VersionSrc |
| 95 | + manifest: _Manifest |
| 96 | + embed_manifest: bool |
| 97 | + resources: Sequence[str] |
| 98 | + strip: bool |
| 99 | + upx_exclude: Iterable[str] |
| 100 | + runtime_tmpdir: str | None |
| 101 | + append_pkg: bool |
| 102 | + uac_admin: bool |
| 103 | + uac_uiaccess: bool |
| 104 | + argv_emulation: bool |
| 105 | + target_arch: _TargetArch |
| 106 | + codesign_identity: _CodesignIdentity |
| 107 | + entitlements_file: FileDescriptorOrPath | None |
| 108 | + upx: bool |
| 109 | + pkgname: str |
| 110 | + toc: TOC |
| 111 | + pkg: PKG |
| 112 | + dependencies: TOC |
| 113 | + exefiles: TOC |
| 114 | + def __init__( |
| 115 | + self, |
| 116 | + *args: Iterable[_TOCTuple] | PYZ | Splash, |
| 117 | + exclude_binaries: bool = False, |
| 118 | + bootloader_ignore_signals: bool = False, |
| 119 | + console: bool = True, |
| 120 | + disable_windowed_traceback: bool = False, |
| 121 | + debug: bool = False, |
| 122 | + name: str | None = None, |
| 123 | + icon: _IconParam = None, |
| 124 | + version: _VersionParam = None, |
| 125 | + manifest: _ManifestParam = None, |
| 126 | + embed_manifest: bool = True, |
| 127 | + resources: Sequence[str] = ..., |
| 128 | + strip: bool = False, |
| 129 | + upx_exclude: Iterable[str] = ..., |
| 130 | + runtime_tmpdir: str | None = None, |
| 131 | + append_pkg: bool = True, |
| 132 | + uac_admin: bool = False, |
| 133 | + uac_uiaccess: bool = False, |
| 134 | + argv_emulation: bool = False, |
| 135 | + target_arch: _SuportedTargetArchParam = None, |
| 136 | + codesign_identity: _CodesignIdentityParam = None, |
| 137 | + entitlements_file: FileDescriptorOrPath | None = None, |
| 138 | + upx: bool = False, |
| 139 | + cdict: Mapping[str, bool] | None = None, |
| 140 | + ) -> None: ... |
| 141 | + mtm: float |
| 142 | + def assemble(self) -> None: ... |
| 143 | + |
| 144 | +class COLLECT(Target): |
| 145 | + strip_binaries: bool |
| 146 | + upx_exclude: Iterable[str] |
| 147 | + console: bool |
| 148 | + target_arch: _TargetArch | None |
| 149 | + codesign_identity: _CodesignIdentity |
| 150 | + entitlements_file: FileDescriptorOrPath | None |
| 151 | + upx_binaries: bool |
| 152 | + name: str |
| 153 | + toc: TOC |
| 154 | + def __init__( |
| 155 | + self, |
| 156 | + *args: Iterable[_TOCTuple] | EXE, |
| 157 | + strip: bool = False, |
| 158 | + upx_exclude: Iterable[str] = ..., |
| 159 | + upx: bool = False, |
| 160 | + name: str, |
| 161 | + ) -> None: ... |
| 162 | + def assemble(self) -> None: ... |
| 163 | + |
| 164 | +class MERGE: |
| 165 | + def __init__(self, *args: tuple[Analysis, Unused, str]) -> None: ... |
| 166 | + |
| 167 | +UNCOMPRESSED: Final = False |
| 168 | +COMPRESSED: Final = True |
0 commit comments