Skip to content

Commit

Permalink
hooks: fix regression in msys2 (#2357)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelotduarte authored Apr 25, 2024
1 parent 97efc15 commit de2888d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions cx_Freeze/hooks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def load_cryptography(finder: ModuleFinder, module: Module) -> None:

def load_ctypes(finder: ModuleFinder, module: Module) -> None:
"""The ctypes module should filter import names."""
if not IS_WINDOWS:
if not IS_WINDOWS and not IS_MINGW:
module.exclude_names.add("nt")


Expand Down Expand Up @@ -195,7 +195,7 @@ def load_dummy_threading(finder: ModuleFinder, module: Module) -> None:

def load_encodings(finder: ModuleFinder, module: Module) -> None:
"""The encodings module should filter import names."""
if not IS_WINDOWS:
if not IS_WINDOWS and not IS_MINGW:
module.exclude_names.add("_winapi")


Expand Down Expand Up @@ -339,13 +339,13 @@ def load_markdown(finder: ModuleFinder, module: Module) -> None:

def load_mimetypes(finder: ModuleFinder, module: Module) -> None:
"""The mimetypes module should filter import names."""
if not IS_WINDOWS:
if not IS_WINDOWS and not IS_MINGW:
module.exclude_names.update(("_winapi", "winreg"))


def load_ntpath(finder: ModuleFinder, module: Module) -> None:
"""The ntpath module should filter import names."""
if not IS_WINDOWS:
if not IS_WINDOWS and not IS_MINGW:
module.exclude_names.update(("nt", "_winapi"))


Expand All @@ -371,15 +371,15 @@ def load_os(finder: ModuleFinder, module: Module) -> None:
"""The os module should filter import names."""
if IS_WINDOWS:
module.exclude_names.add("posix")
else:
elif not IS_MINGW:
module.exclude_names.add("nt")


def load_pathlib(finder: ModuleFinder, module: Module) -> None:
"""The pathlib module should filter import names."""
if IS_WINDOWS:
module.exclude_names.update(("grp", "pwd"))
else:
elif not IS_MINGW:
module.exclude_names.add("nt")


Expand Down Expand Up @@ -408,7 +408,7 @@ def load_platform(finder: ModuleFinder, module: Module) -> None:
module.exclude_names.add("vms_lib")
if not IS_MACOS:
module.exclude_names.add("plistlib")
if not IS_WINDOWS:
if not IS_WINDOWS and not IS_MINGW:
module.exclude_names.add("winreg")
module.exclude_names.add("_winreg")

Expand All @@ -420,7 +420,7 @@ def load_plotly(finder: ModuleFinder, module: Module) -> None:

def load_posixpath(finder: ModuleFinder, module: Module) -> None:
"""The posixpath module should filter import names."""
if IS_WINDOWS:
if IS_WINDOWS and not IS_MINGW:
module.exclude_names.add("posix")
module.exclude_names.add("pwd")

Expand Down Expand Up @@ -566,7 +566,7 @@ def load_shutil(finder: ModuleFinder, module: Module) -> None:
"""The shutil module should filter import names."""
if IS_WINDOWS:
module.exclude_names.update(("grp", "posix", "pwd"))
else:
elif not IS_MINGW:
module.exclude_names.update(("nt", "_winapi"))


Expand Down Expand Up @@ -600,7 +600,7 @@ def load_subprocess(finder: ModuleFinder, module: Module) -> None:
"""The subprocess module should filter import names."""
if IS_WINDOWS:
exclude_names = ("_posixsubprocess", "fcntl", "grp", "pwd")
else:
elif not IS_MINGW:
exclude_names = ("msvcrt", "_winapi")
module.exclude_names.update(exclude_names)

Expand Down
6 changes: 3 additions & 3 deletions cx_Freeze/hooks/asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from typing import TYPE_CHECKING

from cx_Freeze._compat import IS_WINDOWS
from cx_Freeze._compat import IS_MINGW, IS_WINDOWS

if TYPE_CHECKING:
from cx_Freeze.finder import ModuleFinder
Expand All @@ -20,11 +20,11 @@ def load_asyncio(finder: ModuleFinder, module: Module) -> None: # noqa: ARG001

def load_asyncio_windows_events(_, module: Module) -> None:
"""Ignore modules not found in current OS."""
if not IS_WINDOWS:
if not IS_WINDOWS and not IS_MINGW:
module.exclude_names.update({"_overlapped", "_winapi", "msvcrt"})


def load_asyncio_windows_utils(_, module: Module) -> None:
"""Ignore modules not found in current OS."""
if not IS_WINDOWS:
if not IS_WINDOWS and not IS_MINGW:
module.exclude_names.update({"_winapi", "msvcrt"})

0 comments on commit de2888d

Please sign in to comment.