Make Dependency.get_methods() a static method

Since this is only consulted while constructing the Dependency object, it's
result doesn't depend on the instance (and it would make no sense if it did)
pull/2926/head
Jon Turney 7 years ago
parent bd128bc301
commit 8efdcca930
  1. 9
      mesonbuild/dependencies/base.py
  2. 12
      mesonbuild/dependencies/misc.py
  3. 12
      mesonbuild/dependencies/ui.py

@ -115,7 +115,8 @@ class Dependency:
As an example, gtest-all.cc when using GTest.""" As an example, gtest-all.cc when using GTest."""
return self.sources return self.sources
def get_methods(self): @staticmethod
def get_methods():
return [DependencyMethods.AUTO] return [DependencyMethods.AUTO]
def get_name(self): def get_name(self):
@ -308,7 +309,8 @@ class ConfigToolDependency(ExternalDependency):
return [] return []
return shlex.split(out) return shlex.split(out)
def get_methods(self): @staticmethod
def get_methods():
return [DependencyMethods.AUTO, DependencyMethods.CONFIG_TOOL] return [DependencyMethods.AUTO, DependencyMethods.CONFIG_TOOL]
def get_configtool_variable(self, variable_name): def get_configtool_variable(self, variable_name):
@ -535,7 +537,8 @@ class PkgConfigDependency(ExternalDependency):
mlog.debug('Got pkgconfig variable %s : %s' % (variable_name, variable)) mlog.debug('Got pkgconfig variable %s : %s' % (variable_name, variable))
return variable return variable
def get_methods(self): @staticmethod
def get_methods():
return [DependencyMethods.PKGCONFIG] return [DependencyMethods.PKGCONFIG]
def check_pkgconfig(self): def check_pkgconfig(self):

@ -792,7 +792,8 @@ class Python3Dependency(ExternalDependency):
self.version = sysconfig.get_config_var('py_version') self.version = sysconfig.get_config_var('py_version')
self.is_found = True self.is_found = True
def get_methods(self): @staticmethod
def get_methods():
if mesonlib.is_windows(): if mesonlib.is_windows():
return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSCONFIG] return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSCONFIG]
elif mesonlib.is_osx(): elif mesonlib.is_osx():
@ -839,7 +840,8 @@ class PcapDependency(ExternalDependency):
except Exception as e: except Exception as e:
mlog.debug('Pcap not found via pcap-config. Trying next, error was:', str(e)) mlog.debug('Pcap not found via pcap-config. Trying next, error was:', str(e))
def get_methods(self): @staticmethod
def get_methods():
if mesonlib.is_osx(): if mesonlib.is_osx():
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK] return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK]
else: else:
@ -893,7 +895,8 @@ class CupsDependency(ExternalDependency):
return return
mlog.log('Dependency', mlog.bold('cups'), 'found:', mlog.red('NO')) mlog.log('Dependency', mlog.bold('cups'), 'found:', mlog.red('NO'))
def get_methods(self): @staticmethod
def get_methods():
if mesonlib.is_osx(): if mesonlib.is_osx():
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK] return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK]
else: else:
@ -932,7 +935,8 @@ class LibWmfDependency(ExternalDependency):
except Exception as e: except Exception as e:
mlog.debug('cups not found via libwmf-config. Trying next, error was:', str(e)) mlog.debug('cups not found via libwmf-config. Trying next, error was:', str(e))
def get_methods(self): @staticmethod
def get_methods():
if mesonlib.is_osx(): if mesonlib.is_osx():
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK] return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK]
else: else:

@ -67,7 +67,8 @@ class GLDependency(ExternalDependency):
self.version = '1' self.version = '1'
return return
def get_methods(self): @staticmethod
def get_methods():
if mesonlib.is_osx() or mesonlib.is_windows(): if mesonlib.is_osx() or mesonlib.is_windows():
return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM] return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM]
else: else:
@ -337,7 +338,8 @@ class QtBaseDependency(ExternalDependency):
else: else:
return qvars['QT_INSTALL_BINS'] return qvars['QT_INSTALL_BINS']
def get_methods(self): @staticmethod
def get_methods():
return [DependencyMethods.PKGCONFIG, DependencyMethods.QMAKE] return [DependencyMethods.PKGCONFIG, DependencyMethods.QMAKE]
def get_exe_args(self, compiler): def get_exe_args(self, compiler):
@ -420,7 +422,8 @@ class SDL2Dependency(ExternalDependency):
return return
mlog.log('Dependency', mlog.bold('sdl2'), 'found:', mlog.red('NO')) mlog.log('Dependency', mlog.bold('sdl2'), 'found:', mlog.red('NO'))
def get_methods(self): @staticmethod
def get_methods():
if mesonlib.is_osx(): if mesonlib.is_osx():
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK] return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK]
else: else:
@ -526,5 +529,6 @@ class VulkanDependency(ExternalDependency):
self.link_args.append(lib) self.link_args.append(lib)
return return
def get_methods(self): @staticmethod
def get_methods():
return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM] return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM]

Loading…
Cancel
Save