Skip to content

Commit 10f23a2

Browse files
authored
Merge pull request #330 from davidhewitt/mypy-fixups
fixup mypy issues
2 parents f2224c8 + 0ca3eb4 commit 10f23a2

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

setuptools_rust/build.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from typing import Dict, Iterable, List, NamedTuple, Optional, Set, Tuple, cast
2121

2222
import pkg_resources
23+
from semantic_version import Version
2324
from setuptools.command.build import build as CommandBuild # type: ignore[import]
2425
from setuptools.command.build_ext import build_ext as CommandBuildExt
2526
from setuptools.command.build_ext import get_abi3_suffix
@@ -31,10 +32,9 @@
3132
from .rustc_info import (
3233
get_rust_host,
3334
get_rust_target_list,
34-
get_rustc_cfgs,
3535
get_rust_version,
36+
get_rustc_cfgs,
3637
)
37-
from semantic_version import Version
3838

3939

4040
def _check_cargo_supports_crate_type_option() -> bool:
@@ -108,8 +108,10 @@ def finalize_options(self) -> None:
108108

109109
def get_data_dir(self) -> str:
110110
components = (
111-
pkg_resources.safe_name(self.distribution.get_name()).replace("-", "_"), # type: ignore[attr-defined]
112-
pkg_resources.safe_version(self.distribution.get_version()).replace("-", "_"), # type: ignore[attr-defined]
111+
pkg_resources.safe_name(self.distribution.get_name()).replace("-", "_"),
112+
pkg_resources.safe_version(self.distribution.get_version()).replace(
113+
"-", "_"
114+
),
113115
)
114116
if self.build_number:
115117
components += (self.build_number,)

setuptools_rust/setuptools_ext.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,8 @@ def rust_extensions(
275275
has_rust_extensions = len(value) > 0
276276

277277
# Monkey patch has_ext_modules to include Rust extensions.
278-
#
279-
# has_ext_modules is missing from Distribution typing.
280-
orig_has_ext_modules = dist.has_ext_modules # type: ignore[attr-defined]
281-
dist.has_ext_modules = lambda: (orig_has_ext_modules() or has_rust_extensions) # type: ignore[attr-defined]
278+
orig_has_ext_modules = dist.has_ext_modules
279+
dist.has_ext_modules = lambda: (orig_has_ext_modules() or has_rust_extensions) # type: ignore[method-assign]
282280

283281
if has_rust_extensions:
284282
add_rust_extension(dist)

0 commit comments

Comments
 (0)