Add all classes in stubs/pyinstaller/PyInstaller/utils/win32/versioninfo.pyi (#13833)

This commit is contained in:
Avasam
2025-04-16 05:32:19 -04:00
committed by GitHub
parent 9b23a54897
commit 5113659d37
2 changed files with 121 additions and 10 deletions
@@ -0,0 +1,63 @@
from PyInstaller.utils.win32.versioninfo import (
FixedFileInfo,
StringFileInfo,
StringStruct,
StringTable,
VarFileInfo,
VarStruct,
VSVersionInfo,
)
# Everything below this line is the content from running `pyi-grab_version python3`
# ==============================================================================
# UTF-8
#
# For more details about fixed file info 'ffi' see:
# http://msdn.microsoft.com/en-us/library/ms646997.aspx
VSVersionInfo(
ffi=FixedFileInfo(
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
# Set not needed items to zero 0.
filevers=(3, 13, 1150, 1013),
prodvers=(3, 13, 1150, 1013),
# Contains a bitmask that specifies the valid bits 'flags'r
mask=0x3F,
# Contains a bitmask that specifies the Boolean attributes of the file.
flags=0x0,
# The operating system for which this file was designed.
# 0x4 - NT and there is no need to change it.
OS=0x4,
# The general type of file.
# 0x1 - the file is an application.
fileType=0x2,
# The function of the file.
# 0x0 - the function is not defined for this fileType
subtype=0x0,
# Creation date and time stamp.
date=(0, 0),
),
kids=[
StringFileInfo(
[
StringTable(
"000004b0",
[
StringStruct("CompanyName", "Python Software Foundation"),
StringStruct("FileDescription", "Python Core"),
StringStruct("FileVersion", "3.13.1"),
StringStruct("InternalName", "Python DLL"),
StringStruct(
"LegalCopyright",
"Copyright © 2001-2024 Python Software Foundation. Copyright © 2000 BeOpen.com. Copyright © 1995-2001 CNRI. Copyright © 1991-1995 SMC.",
),
StringStruct("OriginalFilename", "python3.dll"),
StringStruct("ProductName", "Python"),
StringStruct("ProductVersion", "3.13.1"),
],
)
]
),
VarFileInfo([VarStruct("Translation", [0, 1200])]),
],
)
@@ -1,28 +1,31 @@
from _typeshed import SliceableBuffer
from _typeshed import SliceableBuffer, Unused
from collections.abc import Sequence
from typing import Literal, Protocol
from typing import Any, Protocol, type_check_only
from typing_extensions import TypeAlias
_FourIntSequence: TypeAlias = Sequence[int]
_TwoIntSequence: TypeAlias = Sequence[int]
@type_check_only
class _Kid(Protocol):
def toRaw(self) -> bytes: ...
def __str__(self, indent: str = "", /) -> str: ...
# Used by other types referenced in https://pyinstaller.org/en/stable/spec-files.html#spec-file-operation
# All the classes below are used in version_file_info generated by `pyi-grab_version`
# See: https://pyinstaller.org/en/stable/usage.html#capturing-windows-version-data
# VSVersionInfo is also by other types referenced in https://pyinstaller.org/en/stable/spec-files.html#spec-file-operation
class VSVersionInfo:
ffi: FixedFileInfo | None
kids: list[_Kid]
def __init__(self, ffi: FixedFileInfo | None = None, kids: list[_Kid] | None = None) -> None: ...
def fromRaw(self, data: SliceableBuffer) -> int: ...
def toRaw(self) -> bytes: ...
def __eq__(self, other: object) -> bool: ...
def __str__(self, indent: str = "") -> str: ...
class FixedFileInfo:
sig: Literal[0xFEEF04BD]
strucVersion: Literal[0x10000]
sig: int
strucVersion: int
fileVersionMS: int
fileVersionLS: int
productVersionMS: int
@@ -36,16 +39,61 @@ class FixedFileInfo:
fileDateLS: int
def __init__(
self,
filevers: _FourIntSequence = ...,
prodvers: _FourIntSequence = ...,
filevers: _FourIntSequence = (0, 0, 0, 0),
prodvers: _FourIntSequence = (0, 0, 0, 0),
mask: int = 0x3F,
flags: int = 0x0,
OS: int = 0x40004,
fileType: int = 0x1,
subtype: int = 0x0,
date: _TwoIntSequence = ...,
date: _TwoIntSequence = (0, 0),
) -> None: ...
def fromRaw(self, data: SliceableBuffer, i: int) -> int: ...
def toRaw(self) -> bytes: ...
def __eq__(self, other: object) -> bool: ...
def __str__(self, indent: str = "") -> str: ...
class StringFileInfo:
name: str
kids: list[_Kid]
def __init__(self, kids: list[_Kid] | None = None) -> None: ...
def fromRaw(self, sublen: Unused, vallen: Unused, name: str, data: SliceableBuffer, i: int, limit: int) -> int: ...
def toRaw(self) -> bytes: ...
def __str__(self, indent: str = "") -> str: ...
class StringTable:
name: str
kids: list[_Kid]
def __init__(self, name: str | None = None, kids: list[_Kid] | None = None) -> None: ...
def fromRaw(self, data: SliceableBuffer, i: int, limit: int) -> int: ...
def toRaw(self) -> bytes: ...
def __str__(self, indent: str = "") -> str: ...
class StringStruct:
name: str
val: str
def __init__(self, name: str | None = None, val: str | None = None) -> None: ...
def fromRaw(self, data: SliceableBuffer, i: int, limit: int) -> int: ...
def toRaw(self) -> bytes: ...
def __str__(self, indent: Unused = "") -> str: ...
class VarFileInfo:
kids: list[_Kid]
def __init__(self, kids: list[_Kid] | None = None) -> None: ...
sublen: int
vallen: int
name: str
def fromRaw(self, sublen: int, vallen: int, name: str, data: SliceableBuffer, i: int, limit: int) -> int: ...
wType: int
def toRaw(self) -> bytes: ...
def __str__(self, indent: str = "") -> str: ...
class VarStruct:
name: str
kids: list[Any] # Whatever can be passed to struct.pack
def __init__(self, name: str | None = None, kids: list[Any] | None = None) -> None: ...
def fromRaw(self, data: SliceableBuffer, i: int, limit: Unused) -> int: ...
wValueLength: int
wType: int
sublen: int
def toRaw(self) -> bytes: ...
def __str__(self, indent: Unused = "") -> str: ...