Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rewrite some imports as absolute #2083

Merged
merged 1 commit into from Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 10 additions & 11 deletions cx_Freeze/__init__.py
Expand Up @@ -2,18 +2,17 @@
and is cross-platform.
"""
# pylint: disable=invalid-name

from __future__ import annotations

import sys

import setuptools

from .command.build_exe import BuildEXE as build_exe
from .command.install import Install as install
from .command.install_exe import InstallEXE as install_exe
from .finder import Module, ModuleFinder
from .freezer import ConstantsModule, Executable, Freezer
from cx_Freeze.command.build_exe import BuildEXE as build_exe
from cx_Freeze.command.install import Install as install
from cx_Freeze.command.install_exe import InstallEXE as install_exe
from cx_Freeze.finder import Module, ModuleFinder
from cx_Freeze.freezer import ConstantsModule, Executable, Freezer

__all__ = [
"build_exe",
Expand All @@ -29,17 +28,17 @@
]

if sys.platform == "win32":
from .command.bdist_msi import BdistMSI as bdist_msi
from cx_Freeze.command.bdist_msi import BdistMSI as bdist_msi

__all__.append(bdist_msi.__name__)
elif sys.platform == "darwin":
from .command.bdist_mac import BdistDMG as bdist_dmg
from .command.bdist_mac import BdistMac as bdist_mac
from cx_Freeze.command.bdist_mac import BdistDMG as bdist_dmg
from cx_Freeze.command.bdist_mac import BdistMac as bdist_mac

__all__.extend([bdist_dmg.__name__, bdist_mac.__name__])
else:
from .command.bdist_deb import BdistDEB as bdist_deb
from .command.bdist_rpm import BdistRPM as bdist_rpm
from cx_Freeze.command.bdist_deb import BdistDEB as bdist_deb
from cx_Freeze.command.bdist_rpm import BdistRPM as bdist_rpm

__all__.extend([bdist_deb.__name__, bdist_rpm.__name__])

Expand Down
2 changes: 1 addition & 1 deletion cx_Freeze/_typing.py
Expand Up @@ -4,7 +4,7 @@
from pathlib import Path, PurePath
from typing import List, Optional, Tuple, Union

from .module import Module
from cx_Freeze.module import Module

DeferredList = List[Tuple[Module, Module, List[str]]]

Expand Down
9 changes: 4 additions & 5 deletions cx_Freeze/cli.py
@@ -1,16 +1,15 @@
"""cxfreeze command line tool."""

from __future__ import annotations

import argparse
import os
import sys
import sysconfig

from . import __version__
from .common import normalize_to_list
from .executable import Executable
from .freezer import Freezer
from cx_Freeze import __version__
from cx_Freeze.common import normalize_to_list
from cx_Freeze.executable import Executable
from cx_Freeze.freezer import Freezer

__all__ = ["main"]

Expand Down
5 changes: 2 additions & 3 deletions cx_Freeze/common.py
@@ -1,5 +1,4 @@
"""Common utility functions shared between cx_Freeze modules."""

from __future__ import annotations

import shutil
Expand All @@ -8,8 +7,8 @@
from textwrap import dedent
from types import CodeType

from ._typing import IncludesList, InternalIncludesList
from .exception import OptionError
from cx_Freeze._typing import IncludesList, InternalIncludesList
from cx_Freeze.exception import OptionError


class FilePath(Path):
Expand Down
2 changes: 1 addition & 1 deletion cx_Freeze/darwintools.py
Expand Up @@ -9,7 +9,7 @@
import tempfile
from collections.abc import Iterable
from pathlib import Path
from .exception import PlatformError
from cx_Freeze.exception import PlatformError


# In a MachO file, need to deal specially with links that use @executable_path,
Expand Down
7 changes: 3 additions & 4 deletions cx_Freeze/executable.py
@@ -1,5 +1,4 @@
"""Module for the Executable base class."""

from __future__ import annotations

import os
Expand All @@ -10,9 +9,9 @@

from setuptools import Distribution

from ._compat import IS_MINGW, IS_WINDOWS
from .common import get_resource_file_path
from .exception import OptionError, SetupError
from cx_Freeze._compat import IS_MINGW, IS_WINDOWS
from cx_Freeze.common import get_resource_file_path
from cx_Freeze.exception import OptionError, SetupError

STRINGREPLACE = list(
string.whitespace + string.punctuation.replace(".", "").replace("_", "")
Expand Down
3 changes: 1 addition & 2 deletions cx_Freeze/finder.py
Expand Up @@ -24,8 +24,7 @@
get_resource_file_path,
process_path_specs,
)

from .module import ConstantsModule, Module
from cx_Freeze.module import ConstantsModule, Module

ALL_SUFFIXES = importlib.machinery.all_suffixes()

Expand Down
16 changes: 8 additions & 8 deletions cx_Freeze/freezer.py
Expand Up @@ -20,14 +20,14 @@
from typing import Any
from zipfile import ZIP_DEFLATED, ZIP_STORED, PyZipFile, ZipInfo

from ._compat import IS_MACOS, IS_MINGW, IS_WINDOWS
from ._typing import IncludesList, InternalIncludesList
from .common import get_resource_file_path, process_path_specs
from .exception import FileError, OptionError
from .executable import Executable
from .finder import ModuleFinder
from .module import ConstantsModule, Module
from .parser import ELFParser, Parser, PEParser
from cx_Freeze._compat import IS_MACOS, IS_MINGW, IS_WINDOWS
from cx_Freeze._typing import IncludesList, InternalIncludesList
from cx_Freeze.common import get_resource_file_path, process_path_specs
from cx_Freeze.exception import FileError, OptionError
from cx_Freeze.executable import Executable
from cx_Freeze.finder import ModuleFinder
from cx_Freeze.module import ConstantsModule, Module
from cx_Freeze.parser import ELFParser, Parser, PEParser

if IS_WINDOWS or IS_MINGW:
with suppress(ImportError):
Expand Down
9 changes: 4 additions & 5 deletions cx_Freeze/hooks/__init__.py
Expand Up @@ -3,18 +3,17 @@
"""
# pylint: disable=invalid-name
# ruff: noqa: ARG001

from __future__ import annotations

import sys
import sysconfig
from contextlib import suppress
from pathlib import Path

from .._compat import IS_MACOS, IS_MINGW, IS_WINDOWS
from ..finder import ModuleFinder
from ..module import Module
from ._qthooks import get_qt_plugins_paths # noqa: F401
from cx_Freeze._compat import IS_MACOS, IS_MINGW, IS_WINDOWS
from cx_Freeze.finder import ModuleFinder
from cx_Freeze.hooks._qthooks import get_qt_plugins_paths # noqa: F401
from cx_Freeze.module import Module


def load_aiofiles(finder: ModuleFinder, module: Module) -> None:
Expand Down
5 changes: 2 additions & 3 deletions cx_Freeze/module.py
@@ -1,5 +1,4 @@
"""Base class for Module and ConstantsModule."""

from __future__ import annotations

import ast
Expand All @@ -14,8 +13,8 @@
from pathlib import Path
from types import CodeType

from ._compat import importlib_metadata
from .exception import ModuleError, OptionError
from cx_Freeze._compat import importlib_metadata
from cx_Freeze.exception import ModuleError, OptionError

__all__ = ["ConstantsModule", "Module", "ModuleHook"]

Expand Down
3 changes: 1 addition & 2 deletions cx_Freeze/winversioninfo.py
@@ -1,5 +1,4 @@
"""Module for the VersionInfo base class."""

from __future__ import annotations

import argparse
Expand All @@ -8,7 +7,7 @@
from pathlib import Path
from struct import calcsize, pack

from ._compat import packaging
from cx_Freeze._compat import packaging

try:
from win32verstamp import stamp as version_stamp
Expand Down