aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-06-14 00:42:26 -0400
committerEli Schwartz <eschwartz@archlinux.org>2022-07-03 14:11:31 -0400
commit0703ee0aef68e235c1e22d6448b79dfbbb5c8039 (patch)
tree0f7ba031362d926b726852d2070ecc8377bdb5bd /mesonbuild/compilers
parent46148f923b196e1b1d004e68d43edc2daca4dd25 (diff)
downloadmeson-0703ee0aef68e235c1e22d6448b79dfbbb5c8039.zip
meson-0703ee0aef68e235c1e22d6448b79dfbbb5c8039.tar.gz
meson-0703ee0aef68e235c1e22d6448b79dfbbb5c8039.tar.bz2
move various unused typing-only imports into type-checking blocks
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/compilers.py4
-rw-r--r--mesonbuild/compilers/cpp.py6
-rw-r--r--mesonbuild/compilers/cuda.py7
-rw-r--r--mesonbuild/compilers/d.py4
-rw-r--r--mesonbuild/compilers/fortran.py4
-rw-r--r--mesonbuild/compilers/java.py4
-rw-r--r--mesonbuild/compilers/objc.py4
-rw-r--r--mesonbuild/compilers/swift.py4
-rw-r--r--mesonbuild/compilers/vala.py4
9 files changed, 30 insertions, 11 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 18ba6e9..5aab9c1 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import annotations
import abc
import contextlib, os.path, re
@@ -24,7 +25,7 @@ from .. import mlog
from .. import mesonlib
from ..mesonlib import (
HoldableObject,
- EnvironmentException, MachineChoice, MesonException,
+ EnvironmentException, MesonException,
Popen_safe, LibType, TemporaryDirectoryWinProof, OptionKey,
)
@@ -36,6 +37,7 @@ if T.TYPE_CHECKING:
from ..envconfig import MachineInfo
from ..environment import Environment
from ..linkers import DynamicLinker, RSPFileSyntax
+ from ..mesonlib import MachineChoice
from ..dependencies import Dependency
CompilerType = T.TypeVar('CompilerType', bound='Compiler')
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py
index 253dc42..c8f0df4 100644
--- a/mesonbuild/compilers/cpp.py
+++ b/mesonbuild/compilers/cpp.py
@@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import annotations
import copy
import functools
@@ -19,13 +20,12 @@ import typing as T
from .. import coredata
from .. import mlog
-from ..mesonlib import MesonException, MachineChoice, version_compare, OptionKey
+from ..mesonlib import MesonException, version_compare, OptionKey
from .compilers import (
gnu_winlibs,
msvc_winlibs,
Compiler,
- CompileCheckMode,
)
from .c_function_attributes import CXX_FUNC_ATTRIBUTES, C_FUNC_ATTRIBUTES
from .mixins.clike import CLikeCompiler
@@ -41,11 +41,13 @@ from .mixins.pgi import PGICompiler
from .mixins.emscripten import EmscriptenMixin
if T.TYPE_CHECKING:
+ from .compilers import CompileCheckMode
from ..coredata import MutableKeyedOptionDictType, KeyedOptionDictType
from ..dependencies import Dependency
from ..envconfig import MachineInfo
from ..environment import Environment
from ..linkers import DynamicLinker
+ from ..mesonlib import MachineChoice
from ..programs import ExternalProgram
CompilerMixinBase = CLikeCompiler
else:
diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py
index 78a58c7..172b9a5 100644
--- a/mesonbuild/compilers/cuda.py
+++ b/mesonbuild/compilers/cuda.py
@@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import annotations
import enum
import os.path
@@ -20,19 +21,21 @@ import typing as T
from .. import coredata
from .. import mlog
from ..mesonlib import (
- EnvironmentException, MachineChoice, Popen_safe, OptionOverrideProxy,
+ EnvironmentException, Popen_safe, OptionOverrideProxy,
is_windows, LibType, OptionKey,
)
from .compilers import (Compiler, cuda_buildtype_args, cuda_optimization_args,
- cuda_debug_args, CompileCheckMode)
+ cuda_debug_args)
if T.TYPE_CHECKING:
+ from .compilers import CompileCheckMode
from ..build import BuildTarget
from ..coredata import MutableKeyedOptionDictType, KeyedOptionDictType
from ..dependencies import Dependency
from ..environment import Environment # noqa: F401
from ..envconfig import MachineInfo
from ..linkers import DynamicLinker
+ from ..mesonlib import MachineChoice
from ..programs import ExternalProgram
diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py
index 35ab024..f4fd0cd 100644
--- a/mesonbuild/compilers/d.py
+++ b/mesonbuild/compilers/d.py
@@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import annotations
import os.path
import re
@@ -22,7 +23,7 @@ from .. import mlog
from ..arglist import CompilerArgs
from ..linkers import RSPFileSyntax
from ..mesonlib import (
- EnvironmentException, MachineChoice, version_compare, OptionKey, is_windows
+ EnvironmentException, version_compare, OptionKey, is_windows
)
from . import compilers
@@ -42,6 +43,7 @@ if T.TYPE_CHECKING:
from ..envconfig import MachineInfo
from ..environment import Environment
from ..linkers import DynamicLinker
+ from ..mesonlib import MachineChoice
CompilerMixinBase = Compiler
else:
diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py
index 0a0c3ec..263b46b 100644
--- a/mesonbuild/compilers/fortran.py
+++ b/mesonbuild/compilers/fortran.py
@@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import annotations
from pathlib import Path
import typing as T
@@ -31,7 +32,7 @@ from .mixins.elbrus import ElbrusCompiler
from .mixins.pgi import PGICompiler
from mesonbuild.mesonlib import (
- version_compare, EnvironmentException, MesonException, MachineChoice,
+ version_compare, EnvironmentException, MesonException,
LibType, OptionKey,
)
@@ -41,6 +42,7 @@ if T.TYPE_CHECKING:
from ..envconfig import MachineInfo
from ..environment import Environment
from ..linkers import DynamicLinker
+ from ..mesonlib import MachineChoice
from ..programs import ExternalProgram
from .compilers import CompileCheckMode
diff --git a/mesonbuild/compilers/java.py b/mesonbuild/compilers/java.py
index 05c271a..9794c69 100644
--- a/mesonbuild/compilers/java.py
+++ b/mesonbuild/compilers/java.py
@@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import annotations
import os
import os.path
@@ -19,13 +20,14 @@ import subprocess
import textwrap
import typing as T
-from ..mesonlib import EnvironmentException, MachineChoice
+from ..mesonlib import EnvironmentException
from .compilers import Compiler, java_buildtype_args
from .mixins.islinker import BasicLinkerIsCompilerMixin
if T.TYPE_CHECKING:
from ..envconfig import MachineInfo
from ..environment import Environment
+ from ..mesonlib import MachineChoice
class JavaCompiler(BasicLinkerIsCompilerMixin, Compiler):
diff --git a/mesonbuild/compilers/objc.py b/mesonbuild/compilers/objc.py
index 22a2012..bd358c3 100644
--- a/mesonbuild/compilers/objc.py
+++ b/mesonbuild/compilers/objc.py
@@ -11,11 +11,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import annotations
import typing as T
from .. import coredata
-from ..mesonlib import MachineChoice, OptionKey
+from ..mesonlib import OptionKey
from .compilers import Compiler
from .mixins.clike import CLikeCompiler
@@ -27,6 +28,7 @@ if T.TYPE_CHECKING:
from ..envconfig import MachineInfo
from ..environment import Environment
from ..linkers import DynamicLinker
+ from ..mesonlib import MachineChoice
class ObjCCompiler(CLikeCompiler, Compiler):
diff --git a/mesonbuild/compilers/swift.py b/mesonbuild/compilers/swift.py
index a2b57b8..2e427f1 100644
--- a/mesonbuild/compilers/swift.py
+++ b/mesonbuild/compilers/swift.py
@@ -11,11 +11,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import annotations
import subprocess, os.path
import typing as T
-from ..mesonlib import EnvironmentException, MachineChoice
+from ..mesonlib import EnvironmentException
from .compilers import Compiler, swift_buildtype_args, clike_debug_args
@@ -23,6 +24,7 @@ if T.TYPE_CHECKING:
from ..envconfig import MachineInfo
from ..environment import Environment
from ..linkers import DynamicLinker
+ from ..mesonlib import MachineChoice
swift_optimization_args = {
'0': [],
diff --git a/mesonbuild/compilers/vala.py b/mesonbuild/compilers/vala.py
index 7c3eac0..14bc39b 100644
--- a/mesonbuild/compilers/vala.py
+++ b/mesonbuild/compilers/vala.py
@@ -11,18 +11,20 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import annotations
import os.path
import typing as T
from .. import mlog
-from ..mesonlib import EnvironmentException, MachineChoice, version_compare, OptionKey
+from ..mesonlib import EnvironmentException, version_compare, OptionKey
from .compilers import Compiler, LibType
if T.TYPE_CHECKING:
from ..envconfig import MachineInfo
from ..environment import Environment
+ from ..mesonlib import MachineChoice
class ValaCompiler(Compiler):