dependencies: drop Dependency.methods and Dependency.get_methods()

Both of these are artifacts of the time before Dependency Factories,
when a dependency that could be discovered multiple ways did ugly stuff
like finding a specific dependency, then replacing it's own attributes
with that dependency's attributes. We don't have cases of that left in
the tree, so let's get rid of this code too
pull/8992/head
Dylan Baker 4 years ago
parent eac2d5eec5
commit dd97ec607d
  1. 13
      mesonbuild/dependencies/base.py
  2. 6
      mesonbuild/dependencies/cmake.py
  3. 4
      mesonbuild/dependencies/coarrays.py
  4. 6
      mesonbuild/dependencies/configtool.py
  5. 17
      mesonbuild/dependencies/dev.py
  6. 6
      mesonbuild/dependencies/dub.py
  7. 6
      mesonbuild/dependencies/framework.py
  8. 44
      mesonbuild/dependencies/misc.py
  9. 6
      mesonbuild/dependencies/pkgconfig.py
  10. 18
      mesonbuild/dependencies/ui.py

@ -89,7 +89,6 @@ class Dependency(HoldableObject):
# If None, self.link_args will be used
self.raw_link_args: T.Optional[T.List[str]] = None
self.sources: T.List['FileOrString'] = []
self.methods = process_method_kw(self.get_methods(), kwargs)
self.include_type = self._process_include_type_kw(kwargs)
self.ext_deps: T.List[Dependency] = []
@ -148,10 +147,6 @@ class Dependency(HoldableObject):
As an example, gtest-all.cc when using GTest."""
return self.sources
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.AUTO]
def get_name(self) -> str:
return self.name
@ -547,10 +542,6 @@ class SystemDependency(ExternalDependency):
super().__init__(DependencyTypeName('system'), env, kwargs, language=language)
self.name = name
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.SYSTEM]
def log_tried(self) -> str:
return 'system'
@ -564,9 +555,5 @@ class BuiltinDependency(ExternalDependency):
super().__init__(DependencyTypeName('builtin'), env, kwargs, language=language)
self.name = name
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.BUILTIN]
def log_tried(self) -> str:
return 'builtin'

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from .base import ExternalDependency, DependencyException, DependencyMethods, DependencyTypeName
from .base import ExternalDependency, DependencyException, DependencyTypeName
from ..mesonlib import is_windows, MesonException, OptionKey, PerMachine, stringlistify, extract_as_list
from ..mesondata import mesondata
from ..cmake import CMakeExecutor, CMakeTraceParser, CMakeException, CMakeToolchain, CMakeExecScope, check_cmake_args
@ -632,10 +632,6 @@ class CMakeDependency(ExternalDependency):
build_dir = self._setup_cmake_dir(cmake_file)
return self.cmakebin.call(args, build_dir, env=env)
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.CMAKE]
def log_tried(self) -> str:
return self.type_name

@ -84,7 +84,3 @@ class CoarrayDependency(SystemDependency):
elif cid == 'nagfor':
# NAG doesn't require any special arguments for Coarray
self.is_found = True
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.AUTO, DependencyMethods.CMAKE, DependencyMethods.PKGCONFIG]

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from .base import ExternalDependency, DependencyException, DependencyMethods, DependencyTypeName
from .base import ExternalDependency, DependencyException, DependencyTypeName
from ..mesonlib import listify, Popen_safe, split_args, version_compare, version_compare_many
from ..programs import find_external_program
from .. import mlog
@ -138,10 +138,6 @@ class ConfigToolDependency(ExternalDependency):
return []
return split_args(out)
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.AUTO, DependencyMethods.CONFIG_TOOL]
def get_configtool_variable(self, variable_name: str) -> str:
p, out, _ = Popen_safe(self.config + [f'--{variable_name}'])
if p.returncode != 0:

@ -106,10 +106,6 @@ class GTestDependencySystem(SystemDependency):
def log_tried(self) -> str:
return 'system'
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM]
class GTestDependencyPC(PkgConfigDependency):
@ -181,10 +177,6 @@ class GMockDependencySystem(SystemDependency):
def log_tried(self) -> str:
return 'system'
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM]
class GMockDependencyPC(PkgConfigDependency):
@ -508,11 +500,6 @@ class ZlibSystemDependency(SystemDependency):
self.version = v.strip('"')
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.SYSTEM]
class JDKSystemDependency(SystemDependency):
def __init__(self, environment: 'Environment', kwargs: T.Dict[str, T.Any]):
super().__init__('jdk', environment, kwargs)
@ -544,10 +531,6 @@ class JDKSystemDependency(SystemDependency):
self.compile_args.append(f'-I{java_home_include / platform_include_dir}')
self.is_found = True
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.SYSTEM]
@staticmethod
def __machine_info_to_platform_include_dir(m: 'MachineInfo') -> T.Optional[str]:
"""Translates the machine information to the platform-dependent include directory

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from .base import ExternalDependency, DependencyException, DependencyMethods, DependencyTypeName
from .base import ExternalDependency, DependencyException, DependencyTypeName
from .pkgconfig import PkgConfigDependency
from ..mesonlib import Popen_safe
from ..programs import ExternalProgram
@ -234,7 +234,3 @@ class DubDependency(ExternalDependency):
else:
mlog.log('Found DUB:', mlog.red('NO'))
return dubbin
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.DUB]

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from .base import DependencyTypeName, ExternalDependency, DependencyException, DependencyMethods
from .base import DependencyTypeName, ExternalDependency, DependencyException
from ..mesonlib import MesonException, Version, stringlistify
from .. import mlog
from pathlib import Path
@ -112,10 +112,6 @@ class ExtraFrameworkDependency(ExternalDependency):
return trial.as_posix()
return None
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.EXTRAFRAMEWORK]
def log_info(self) -> str:
return self.framework_path or ''

@ -125,10 +125,6 @@ class ThreadDependency(SystemDependency):
self.compile_args = self.clib_compiler.thread_flags(environment)
self.link_args = self.clib_compiler.thread_link_flags(environment)
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.AUTO, DependencyMethods.CMAKE]
class BlocksDependency(SystemDependency):
def __init__(self, environment: 'Environment', kwargs: T.Dict[str, T.Any]) -> None:
@ -262,15 +258,6 @@ class Python3DependencySystem(SystemDependency):
self.version = sysconfig.get_config_var('py_version')
self.is_found = True
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
if mesonlib.is_windows():
return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSCONFIG]
elif mesonlib.is_osx():
return [DependencyMethods.PKGCONFIG, DependencyMethods.EXTRAFRAMEWORK]
else:
return [DependencyMethods.PKGCONFIG]
def log_tried(self) -> str:
return 'sysconfig'
@ -287,10 +274,6 @@ class PcapDependencyConfigTool(ConfigToolDependency):
self.link_args = self.get_config_value(['--libs'], 'link_args')
self.version = self.get_pcap_lib_version()
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL]
def get_pcap_lib_version(self) -> T.Optional[str]:
# Since we seem to need to run a program to discover the pcap version,
# we can't do that when cross-compiling
@ -317,13 +300,6 @@ class CupsDependencyConfigTool(ConfigToolDependency):
self.compile_args = self.get_config_value(['--cflags'], 'compile_args')
self.link_args = self.get_config_value(['--ldflags', '--libs'], 'link_args')
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
if mesonlib.is_osx():
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK, DependencyMethods.CMAKE]
else:
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.CMAKE]
class LibWmfDependencyConfigTool(ConfigToolDependency):
@ -337,10 +313,6 @@ class LibWmfDependencyConfigTool(ConfigToolDependency):
self.compile_args = self.get_config_value(['--cflags'], 'compile_args')
self.link_args = self.get_config_value(['--libs'], 'link_args')
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL]
class LibGCryptDependencyConfigTool(ConfigToolDependency):
@ -355,10 +327,6 @@ class LibGCryptDependencyConfigTool(ConfigToolDependency):
self.link_args = self.get_config_value(['--libs'], 'link_args')
self.version = self.get_config_value(['--version'], 'version')[0]
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL]
class GpgmeDependencyConfigTool(ConfigToolDependency):
@ -373,10 +341,6 @@ class GpgmeDependencyConfigTool(ConfigToolDependency):
self.link_args = self.get_config_value(['--libs'], 'link_args')
self.version = self.get_config_value(['--version'], 'version')[0]
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL]
class ShadercDependency(SystemDependency):
@ -406,10 +370,6 @@ class ShadercDependency(SystemDependency):
def log_tried(self) -> str:
return 'system'
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.SYSTEM, DependencyMethods.PKGCONFIG]
class CursesConfigToolDependency(ConfigToolDependency):
@ -481,10 +441,6 @@ class CursesSystemDependency(SystemDependency):
if self.is_found:
break
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.SYSTEM]
class IntlBuiltinDependency(BuiltinDependency):
def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any]):

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from .base import ExternalDependency, DependencyException, DependencyMethods, sort_libpaths, DependencyTypeName
from .base import ExternalDependency, DependencyException, sort_libpaths, DependencyTypeName
from ..mesonlib import LibType, MachineChoice, OptionKey, OrderedSet, PerMachine, Popen_safe
from ..programs import find_external_program, ExternalProgram
from .. import mlog
@ -396,10 +396,6 @@ class PkgConfigDependency(ExternalDependency):
mlog.debug(f'Got pkgconfig variable {variable_name} : {variable}')
return variable
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.PKGCONFIG]
def check_pkgconfig(self, pkgbin: ExternalProgram) -> T.Optional[str]:
if not pkgbin.found():
mlog.log(f'Did not find pkg-config by name {pkgbin.name!r}')

@ -50,13 +50,6 @@ class GLDependencySystem(SystemDependency):
# FIXME: Detect version using self.clib_compiler
return
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
if mesonlib.is_osx() or mesonlib.is_windows():
return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM]
else:
return [DependencyMethods.PKGCONFIG]
def log_tried(self) -> str:
return 'system'
@ -149,13 +142,6 @@ class SDL2DependencyConfigTool(ConfigToolDependency):
self.compile_args = self.get_config_value(['--cflags'], 'compile_args')
self.link_args = self.get_config_value(['--libs'], 'link_args')
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
if mesonlib.is_osx():
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK]
else:
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL]
class WxDependency(ConfigToolDependency):
@ -251,10 +237,6 @@ class VulkanDependencySystem(SystemDependency):
self.link_args.append(lib)
return
@staticmethod
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.SYSTEM]
def log_tried(self) -> str:
return 'system'

Loading…
Cancel
Save