Skip to content

Commit

Permalink
PR review updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Sep 7, 2022
1 parent 903454b commit 4dd62de
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion PyInstaller/__main__.py
Expand Up @@ -147,7 +147,7 @@ def generate_parser() -> _PyiArgumentParser:
return parser


def run(pyi_args: list | None = None, pyi_config: dict | list | None = None):
def run(pyi_args: list | None = None, pyi_config: dict | None = None):
"""
pyi_args allows running PyInstaller programmatically without a subprocess
pyi_config allows checking configuration once when running multiple tests
Expand Down
13 changes: 5 additions & 8 deletions PyInstaller/compat.py
Expand Up @@ -75,7 +75,7 @@
# The same logic applies to macOS 12 (Monterey).
is_macos_11_compat = bool(_macos_ver and _macos_ver[0:2] == (10, 16)) # Big Sur or newer in compat mode
is_macos_11_native = bool(_macos_ver and _macos_ver[0:2] >= (11, 0)) # Big Sur or newer in native mode
is_macos_11 = bool(is_macos_11_compat or is_macos_11_native) # Big Sur or newer
is_macos_11 = is_macos_11_compat or is_macos_11_native # Big Sur or newer

# On different platforms is different file for dynamic python library.
# TODO: When removing support for is_py37, the "m" variants can be
Expand Down Expand Up @@ -216,7 +216,7 @@


# Wine detection and support
def is_wine_dll(filename: str | bytes | os.PathLike | int):
def is_wine_dll(filename: str | os.PathLike | int):
"""
Check if the given PE file is a Wine DLL (PE-converted built-in, or fake/placeholder one).
Expand Down Expand Up @@ -283,10 +283,7 @@ def unsetenv(name: str):


def exec_command(
*cmdargs: str,
encoding: str | None = None,
raise_enoent: bool | None = None,
**kwargs: int | bool | Iterable | None
*cmdargs: str, encoding: str | None = None, raise_enoent: bool | None = None, **kwargs: int | bool | list | None
):
"""
Run the command specified by the passed positional arguments, optionally configured by the passed keyword arguments.
Expand Down Expand Up @@ -564,7 +561,7 @@ def exec_python_rc(*args: str, **kwargs: str | None):
# Path handling.


def expand_path(path: str | bytes | os.PathLike):
def expand_path(path: str | os.PathLike):
"""
Replace initial tilde '~' in path with user's home directory, and also expand environment variables
(i.e., ${VARNAME} on Unix, %VARNAME% on Windows).
Expand Down Expand Up @@ -605,7 +602,7 @@ def getsitepackages(prefixes: list | None = None):


# Wrapper to load a module from a Python source file. This function loads import hooks when processing them.
def importlib_load_source(name: str, pathname: bytes | str):
def importlib_load_source(name: str, pathname: str):
# Import module from a file.
mod_loader = importlib.machinery.SourceFileLoader(name, pathname)
return mod_loader.load_module()
Expand Down
14 changes: 6 additions & 8 deletions PyInstaller/utils/hooks/__init__.py
Expand Up @@ -127,7 +127,7 @@ def __exec_script(script_filename, *args, env=None, capture_stdout=True):
return __exec_python_cmd(cmd, env=env, capture_stdout=capture_stdout)


def exec_script(script_filename: str | bytes | os.PathLike, *args: str, env: dict | list | None = None):
def exec_script(script_filename: str | os.PathLike, *args: str, env: dict | None = None):
"""
Executes a Python script in an externally spawned interpreter, and returns anything that was emitted to the standard
output as a single string.
Expand All @@ -138,7 +138,7 @@ def exec_script(script_filename: str | bytes | os.PathLike, *args: str, env: dic
return __exec_script(script_filename, *args, env=env, capture_stdout=True)


def exec_script_rc(script_filename: str | bytes | os.PathLike, *args: str, env: dict | list | None = None):
def exec_script_rc(script_filename: str | os.PathLike, *args: str, env: dict | None = None):
"""
Executes a Python script in an externally spawned interpreter, and returns the exit code.
Expand Down Expand Up @@ -173,7 +173,7 @@ def eval_statement(statement: str):
return eval(txt)


def eval_script(script_filename: str | bytes | os.PathLike, *args: str, env: dict | list | None = None):
def eval_script(script_filename: str | os.PathLike, *args: str, env: dict | None = None):
txt = exec_script(script_filename, *args, env=env).strip()
if not txt:
# Return an empty string, which is "not true" but is iterable.
Expand Down Expand Up @@ -757,7 +757,7 @@ def is_module_or_submodule(name: str, mod_or_submod: str):
]


def collect_dynamic_libs(package: str, destdir: object | None = None):
def collect_dynamic_libs(package: str, destdir: str | None = None):
"""
This function produces a list of (source, dest) of dynamic library files that reside in package. Its output can be
directly assigned to ``binaries`` in a hook script. The package parameter must be a string which names the package.
Expand Down Expand Up @@ -801,7 +801,7 @@ def collect_dynamic_libs(package: str, destdir: object | None = None):
def collect_data_files(
package: str,
include_py_files: bool = False,
subdir: str | bytes | os.PathLike | None = None,
subdir: str | os.PathLike | None = None,
excludes: list | None = None,
includes: list | None = None,
):
Expand Down Expand Up @@ -907,9 +907,7 @@ def clude_walker(
return datas


def collect_system_data_files(
path: str, destdir: str | bytes | os.PathLike | None = None, include_py_files: bool = False
):
def collect_system_data_files(path: str, destdir: str | os.PathLike | None = None, include_py_files: bool = False):
"""
This function produces a list of (source, dest) non-Python (i.e., data) files that reside somewhere on the system.
Its output can be directly assigned to ``datas`` in a hook script.
Expand Down

0 comments on commit 4dd62de

Please sign in to comment.