diff options
-rw-r--r-- | mesonbuild/astinterpreter.py | 80 | ||||
-rw-r--r-- | mesonbuild/backend/backends.py | 4 | ||||
-rw-r--r-- | mesonbuild/backend/vs2010backend.py | 38 | ||||
-rw-r--r-- | mesonbuild/backend/xcodebackend.py | 41 | ||||
-rw-r--r-- | mesonbuild/build.py | 78 | ||||
-rw-r--r-- | mesonbuild/compilers.py | 196 | ||||
-rw-r--r-- | mesonbuild/coredata.py | 46 | ||||
-rw-r--r-- | mesonbuild/dependencies.py | 12 | ||||
-rw-r--r-- | mesonbuild/environment.py | 2 | ||||
-rw-r--r-- | mesonbuild/interpreter.py | 208 | ||||
-rw-r--r-- | mesonbuild/mintro.py | 28 | ||||
-rw-r--r-- | mesonbuild/modules/gnome.py | 14 | ||||
-rw-r--r-- | mesonbuild/modules/qt4.py | 22 | ||||
-rw-r--r-- | mesonbuild/modules/qt5.py | 22 | ||||
-rw-r--r-- | mesonbuild/modules/windows.py | 2 | ||||
-rw-r--r-- | mesonbuild/optinterpreter.py | 6 | ||||
-rw-r--r-- | mesonbuild/scripts/commandrunner.py | 6 | ||||
-rw-r--r-- | mesonbuild/scripts/meson_install.py | 8 | ||||
-rwxr-xr-x | mesontest.py | 14 | ||||
-rwxr-xr-x | run_project_tests.py | 14 | ||||
-rwxr-xr-x | tools/ac_converter.py | 64 | ||||
-rwxr-xr-x | tools/cmake2meson.py | 6 |
22 files changed, 456 insertions, 455 deletions
diff --git a/mesonbuild/astinterpreter.py b/mesonbuild/astinterpreter.py index 7a83736..1cdf523 100644 --- a/mesonbuild/astinterpreter.py +++ b/mesonbuild/astinterpreter.py @@ -47,47 +47,47 @@ class AstInterpreter(interpreterbase.InterpreterBase): def __init__(self, source_root, subdir): super().__init__(source_root, subdir) self.asts = {} - self.funcs.update({'project' : self.func_do_nothing, - 'test' : self.func_do_nothing, - 'benchmark' : self.func_do_nothing, - 'install_headers' : self.func_do_nothing, - 'install_man' : self.func_do_nothing, - 'install_data' : self.func_do_nothing, - 'install_subdir' : self.func_do_nothing, - 'configuration_data' : self.func_do_nothing, - 'configure_file' : self.func_do_nothing, - 'find_program' : self.func_do_nothing, - 'include_directories' : self.func_do_nothing, - 'add_global_arguments' : self.func_do_nothing, - 'add_global_link_arguments' : self.func_do_nothing, - 'add_project_arguments' : self.func_do_nothing, - 'add_project_link_arguments' : self.func_do_nothing, - 'message' : self.func_do_nothing, - 'generator' : self.func_do_nothing, - 'error' : self.func_do_nothing, - 'run_command' : self.func_do_nothing, - 'assert' : self.func_do_nothing, - 'subproject' : self.func_do_nothing, - 'dependency' : self.func_do_nothing, - 'get_option' : self.func_do_nothing, - 'join_paths' : self.func_do_nothing, - 'environment' : self.func_do_nothing, - 'import' : self.func_do_nothing, - 'vcs_tag' : self.func_do_nothing, - 'add_languages' : self.func_do_nothing, - 'declare_dependency' : self.func_do_nothing, - 'files' : self.func_files, + self.funcs.update({'project': self.func_do_nothing, + 'test': self.func_do_nothing, + 'benchmark': self.func_do_nothing, + 'install_headers': self.func_do_nothing, + 'install_man': self.func_do_nothing, + 'install_data': self.func_do_nothing, + 'install_subdir': self.func_do_nothing, + 'configuration_data': self.func_do_nothing, + 'configure_file': self.func_do_nothing, + 'find_program': self.func_do_nothing, + 'include_directories': self.func_do_nothing, + 'add_global_arguments': self.func_do_nothing, + 'add_global_link_arguments': self.func_do_nothing, + 'add_project_arguments': self.func_do_nothing, + 'add_project_link_arguments': self.func_do_nothing, + 'message': self.func_do_nothing, + 'generator': self.func_do_nothing, + 'error': self.func_do_nothing, + 'run_command': self.func_do_nothing, + 'assert': self.func_do_nothing, + 'subproject': self.func_do_nothing, + 'dependency': self.func_do_nothing, + 'get_option': self.func_do_nothing, + 'join_paths': self.func_do_nothing, + 'environment': self.func_do_nothing, + 'import': self.func_do_nothing, + 'vcs_tag': self.func_do_nothing, + 'add_languages': self.func_do_nothing, + 'declare_dependency': self.func_do_nothing, + 'files': self.func_files, 'executable': self.func_executable, - 'static_library' : self.func_static_lib, - 'shared_library' : self.func_shared_lib, - 'library' : self.func_library, - 'build_target' : self.func_build_target, - 'custom_target' : self.func_custom_target, - 'run_target' : self.func_run_target, - 'subdir' : self.func_subdir, - 'set_variable' : self.func_set_variable, - 'get_variable' : self.func_get_variable, - 'is_variable' : self.func_is_variable, + 'static_library': self.func_static_lib, + 'shared_library': self.func_shared_lib, + 'library': self.func_library, + 'build_target': self.func_build_target, + 'custom_target': self.func_custom_target, + 'run_target': self.func_run_target, + 'subdir': self.func_subdir, + 'set_variable': self.func_set_variable, + 'get_variable': self.func_get_variable, + 'is_variable': self.func_is_variable, }) def func_do_nothing(self, node, args, kwargs): diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 934f274..cde8d70 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -642,8 +642,8 @@ class Backend(): return (srcs, ofilenames, cmd) def run_postconf_scripts(self): - env = {'MESON_SOURCE_ROOT' : self.environment.get_source_dir(), - 'MESON_BUILD_ROOT' : self.environment.get_build_dir() + env = {'MESON_SOURCE_ROOT': self.environment.get_source_dir(), + 'MESON_BUILD_ROOT': self.environment.get_build_dir() } child_env = os.environ.copy() child_env.update(env) diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 3ba63f4..b28262d 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -327,12 +327,12 @@ class Vs2010Backend(backends.Backend): def create_basic_crap(self, target): project_name = target.name - root = ET.Element('Project', {'DefaultTargets' : "Build", - 'ToolsVersion' : '4.0', - 'xmlns' : 'http://schemas.microsoft.com/developer/msbuild/2003'}) - confitems = ET.SubElement(root, 'ItemGroup', {'Label' : 'ProjectConfigurations'}) + root = ET.Element('Project', {'DefaultTargets': "Build", + 'ToolsVersion': '4.0', + 'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003'}) + confitems = ET.SubElement(root, 'ItemGroup', {'Label': 'ProjectConfigurations'}) prjconf = ET.SubElement(confitems, 'ProjectConfiguration', - {'Include' : self.buildtype + '|' + self.platform}) + {'Include': self.buildtype + '|' + self.platform}) p = ET.SubElement(prjconf, 'Configuration') p.text= self.buildtype pl = ET.SubElement(prjconf, 'Platform') @@ -558,12 +558,12 @@ class Vs2010Backend(backends.Backend): buildtype_link_args = compiler.get_buildtype_linker_args(self.buildtype) project_name = target.name target_name = target.name - root = ET.Element('Project', {'DefaultTargets' : "Build", - 'ToolsVersion' : '4.0', - 'xmlns' : 'http://schemas.microsoft.com/developer/msbuild/2003'}) - confitems = ET.SubElement(root, 'ItemGroup', {'Label' : 'ProjectConfigurations'}) + root = ET.Element('Project', {'DefaultTargets': "Build", + 'ToolsVersion': '4.0', + 'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003'}) + confitems = ET.SubElement(root, 'ItemGroup', {'Label': 'ProjectConfigurations'}) prjconf = ET.SubElement(confitems, 'ProjectConfiguration', - {'Include' : self.buildtype + '|' + self.platform}) + {'Include': self.buildtype + '|' + self.platform}) p = ET.SubElement(prjconf, 'Configuration') p.text= self.buildtype pl = ET.SubElement(prjconf, 'Platform') @@ -925,11 +925,11 @@ class Vs2010Backend(backends.Backend): def gen_regenproj(self, project_name, ofname): root = ET.Element('Project', {'DefaultTargets': 'Build', - 'ToolsVersion' : '4.0', - 'xmlns' : 'http://schemas.microsoft.com/developer/msbuild/2003'}) - confitems = ET.SubElement(root, 'ItemGroup', {'Label' : 'ProjectConfigurations'}) + 'ToolsVersion': '4.0', + 'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003'}) + confitems = ET.SubElement(root, 'ItemGroup', {'Label': 'ProjectConfigurations'}) prjconf = ET.SubElement(confitems, 'ProjectConfiguration', - {'Include' : self.buildtype + '|' + self.platform}) + {'Include': self.buildtype + '|' + self.platform}) p = ET.SubElement(prjconf, 'Configuration') p.text= self.buildtype pl = ET.SubElement(prjconf, 'Platform') @@ -1003,12 +1003,12 @@ if %%errorlevel%% neq 0 goto :VCEnd''' def gen_testproj(self, target_name, ofname): project_name = target_name - root = ET.Element('Project', {'DefaultTargets' : "Build", - 'ToolsVersion' : '4.0', - 'xmlns' : 'http://schemas.microsoft.com/developer/msbuild/2003'}) - confitems = ET.SubElement(root, 'ItemGroup', {'Label' : 'ProjectConfigurations'}) + root = ET.Element('Project', {'DefaultTargets': "Build", + 'ToolsVersion': '4.0', + 'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003'}) + confitems = ET.SubElement(root, 'ItemGroup', {'Label': 'ProjectConfigurations'}) prjconf = ET.SubElement(confitems, 'ProjectConfiguration', - {'Include' : self.buildtype + '|' + self.platform}) + {'Include': self.buildtype + '|' + self.platform}) p = ET.SubElement(prjconf, 'Configuration') p.text= self.buildtype pl = ET.SubElement(prjconf, 'Platform') diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py index 8133e0f..03efaf9 100644 --- a/mesonbuild/backend/xcodebackend.py +++ b/mesonbuild/backend/xcodebackend.py @@ -27,21 +27,22 @@ class XCodeBackend(backends.Backend): self.project_conflist = self.gen_id() self.indent = ' ' self.indent_level = 0 - self.xcodetypemap = {'c' : 'sourcecode.c.c', - 'a' : 'archive.ar', + self.xcodetypemap = {'c': 'sourcecode.c.c', + 'a': 'archive.ar', 'cc': 'sourcecode.cpp.cpp', - 'cxx' : 'sourcecode.cpp.cpp', - 'cpp' : 'sourcecode.cpp.cpp', - 'c++' : 'sourcecode.cpp.cpp', - 'm' : 'sourcecode.c.objc', - 'mm' : 'sourcecode.cpp.objcpp', - 'h' : 'sourcecode.c.h', - 'hpp' : 'sourcecode.cpp.h', - 'hxx' : 'sourcecode.cpp.h', - 'hh' : 'sourcecode.cpp.hh', - 'inc' : 'sourcecode.c.h', - 'dylib' : 'compiled.mach-o.dylib', - 'o' : 'compiled.mach-o.objfile',} + 'cxx': 'sourcecode.cpp.cpp', + 'cpp': 'sourcecode.cpp.cpp', + 'c++': 'sourcecode.cpp.cpp', + 'm': 'sourcecode.c.objc', + 'mm': 'sourcecode.cpp.objcpp', + 'h': 'sourcecode.c.h', + 'hpp': 'sourcecode.cpp.h', + 'hxx': 'sourcecode.cpp.h', + 'hh': 'sourcecode.cpp.hh', + 'inc': 'sourcecode.c.h', + 'dylib': 'compiled.mach-o.dylib', + 'o': 'compiled.mach-o.objfile', + } self.maingroup_id = self.gen_id() self.all_id = self.gen_id() self.all_buildconf_id = self.gen_id() @@ -129,7 +130,7 @@ class XCodeBackend(backends.Backend): self.buildmap[o] = self.gen_id() def generate_buildstylemap(self): - self.buildstylemap = {'debug' : self.gen_id()} + self.buildstylemap = {'debug': self.gen_id()} def generate_build_phase_map(self): self.buildphasemap = {} @@ -139,17 +140,17 @@ class XCodeBackend(backends.Backend): def generate_build_configuration_map(self): self.buildconfmap = {} for t in self.build.targets: - bconfs = {'debug' : self.gen_id()} + bconfs = {'debug': self.gen_id()} self.buildconfmap[t] = bconfs def generate_project_configurations_map(self): - self.project_configurations = {'debug' : self.gen_id()} + self.project_configurations = {'debug': self.gen_id()} def generate_buildall_configurations_map(self): - self.buildall_configurations = {'debug' : self.gen_id()} + self.buildall_configurations = {'debug': self.gen_id()} def generate_test_configurations_map(self): - self.test_configurations = {'debug' : self.gen_id()} + self.test_configurations = {'debug': self.gen_id()} def generate_build_configurationlist_map(self): self.buildconflistmap = {} @@ -608,7 +609,7 @@ class XCodeBackend(backends.Backend): self.write_line('};') # Now finally targets. - langnamemap = {'c' : 'C', 'cpp' : 'CPLUSPLUS', 'objc' : 'OBJC', 'objcpp' : 'OBJCPLUSPLUS'} + langnamemap = {'c': 'C', 'cpp': 'CPLUSPLUS', 'objc': 'OBJC', 'objcpp': 'OBJCPLUSPLUS'} for target_name, target in self.build.targets.items(): for buildtype in self.buildtypes: dep_libs = [] diff --git a/mesonbuild/build.py b/mesonbuild/build.py index c7d4125..304dd40 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -20,30 +20,30 @@ from .mesonlib import File, flatten, MesonException, stringlistify, classify_uni from .environment import for_windows, for_darwin from .compilers import is_object, clike_langs, lang_suffixes -known_basic_kwargs = {'install' : True, - 'c_pch' : True, - 'cpp_pch' : True, - 'c_args' : True, - 'cpp_args' : True, - 'cs_args' : True, - 'vala_args' : True, - 'fortran_args' : True, - 'd_args' : True, - 'java_args' : True, - 'link_args' : True, +known_basic_kwargs = {'install': True, + 'c_pch': True, + 'cpp_pch': True, + 'c_args': True, + 'cpp_args': True, + 'cs_args': True, + 'vala_args': True, + 'fortran_args': True, + 'd_args': True, + 'java_args': True, + 'link_args': True, 'link_depends': True, - 'link_with' : True, + 'link_with': True, 'include_directories': True, - 'dependencies' : True, - 'install_dir' : True, - 'main_class' : True, - 'gui_app' : True, - 'extra_files' : True, - 'install_rpath' : True, - 'resources' : True, - 'sources' : True, - 'objects' : True, - 'native' : True, + 'dependencies': True, + 'install_dir': True, + 'main_class': True, + 'gui_app': True, + 'extra_files': True, + 'install_rpath': True, + 'resources': True, + 'sources': True, + 'objects': True, + 'native': True, } # These contain kwargs supported by both static and shared libraries. These are @@ -52,15 +52,15 @@ known_basic_kwargs = {'install' : True, # FIXME: Find a way to pass that info down here so we can have proper target # kwargs checking when specifically using shared_library() or static_library(). known_lib_kwargs = known_basic_kwargs.copy() -known_lib_kwargs.update({'version' : True, # Only for shared libs - 'soversion' : True, # Only for shared libs - 'name_prefix' : True, - 'name_suffix' : True, - 'vs_module_defs' : True, # Only for shared libs +known_lib_kwargs.update({'version': True, # Only for shared libs + 'soversion': True, # Only for shared libs + 'name_prefix': True, + 'name_suffix': True, + 'vs_module_defs': True, # Only for shared libs 'vala_header': True, 'vala_vapi': True, - 'vala_gir' : True, - 'pic' : True, # Only for static libs + 'vala_gir': True, + 'pic': True, # Only for static libs }) @@ -1224,16 +1224,16 @@ class SharedModule(SharedLibrary): super().__init__(name, subdir, subproject, is_cross, sources, objects, environment, kwargs) class CustomTarget: - known_kwargs = {'input' : True, - 'output' : True, - 'command' : True, - 'capture' : False, - 'install' : True, - 'install_dir' : True, - 'build_always' : True, - 'depends' : True, - 'depend_files' : True, - 'depfile' : True, + known_kwargs = {'input': True, + 'output': True, + 'command': True, + 'capture': False, + 'install': True, + 'install_dir': True, + 'build_always': True, + 'depends': True, + 'depend_files': True, + 'depfile': True, } def __init__(self, name, subdir, kwargs, absolute_paths=False): diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index e25fd5a..0a3f8cb 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -88,93 +88,93 @@ def is_library(fname): suffix = fname.split('.')[-1] return suffix in lib_suffixes -gnulike_buildtype_args = {'plain' : [], +gnulike_buildtype_args = {'plain': [], # -O0 is passed for improved debugging information with gcc # See https://github.com/mesonbuild/meson/pull/509 - 'debug' : ['-O0', '-g'], - 'debugoptimized' : ['-O2', '-g'], - 'release' : ['-O3'], - 'minsize' : ['-Os', '-g']} - -msvc_buildtype_args = {'plain' : [], - 'debug' : ["/MDd", "/ZI", "/Ob0", "/Od", "/RTC1"], - 'debugoptimized' : ["/MD", "/Zi", "/O2", "/Ob1"], - 'release' : ["/MD", "/O2", "/Ob2"], - 'minsize' : ["/MD", "/Zi", "/Os", "/Ob1"], + 'debug': ['-O0', '-g'], + 'debugoptimized': ['-O2', '-g'], + 'release': ['-O3'], + 'minsize': ['-Os', '-g']} + +msvc_buildtype_args = {'plain': [], + 'debug': ["/MDd", "/ZI", "/Ob0", "/Od", "/RTC1"], + 'debugoptimized': ["/MD", "/Zi", "/O2", "/Ob1"], + 'release': ["/MD", "/O2", "/Ob2"], + 'minsize': ["/MD", "/Zi", "/Os", "/Ob1"], } gnulike_buildtype_linker_args = {} if mesonlib.is_osx(): - gnulike_buildtype_linker_args.update({'plain' : [], - 'debug' : [], - 'debugoptimized' : [], - 'release' : [], - 'minsize' : [], + gnulike_buildtype_linker_args.update({'plain': [], + 'debug': [], + 'debugoptimized': [], + 'release': [], + 'minsize': [], }) else: - gnulike_buildtype_linker_args.update({'plain' : [], - 'debug' : [], - 'debugoptimized' : [], - 'release' : ['-Wl,-O1'], - 'minsize' : [], + gnulike_buildtype_linker_args.update({'plain': [], + 'debug': [], + 'debugoptimized': [], + 'release': ['-Wl,-O1'], + 'minsize': [], }) -msvc_buildtype_linker_args = {'plain' : [], - 'debug' : [], - 'debugoptimized' : [], - 'release' : [], - 'minsize' : ['/INCREMENTAL:NO'], +msvc_buildtype_linker_args = {'plain': [], + 'debug': [], + 'debugoptimized': [], + 'release': [], + 'minsize': ['/INCREMENTAL:NO'], } -java_buildtype_args = {'plain' : [], - 'debug' : ['-g'], - 'debugoptimized' : ['-g'], - 'release' : [], - 'minsize' : [], +java_buildtype_args = {'plain': [], + 'debug': ['-g'], + 'debugoptimized': ['-g'], + 'release': [], + 'minsize': [], } -rust_buildtype_args = {'plain' : [], - 'debug' : ['-g'], - 'debugoptimized' : ['-g', '--opt-level', '2'], - 'release' : ['--opt-level', '3'], - 'minsize' : [], +rust_buildtype_args = {'plain': [], + 'debug': ['-g'], + 'debugoptimized': ['-g', '--opt-level', '2'], + 'release': ['--opt-level', '3'], + 'minsize': [], } -d_gdc_buildtype_args = {'plain' : [], - 'debug' : ['-g', '-O0'], - 'debugoptimized' : ['-g', '-O'], - 'release' : ['-O3', '-frelease'], - 'minsize' : [], +d_gdc_buildtype_args = {'plain': [], + 'debug': ['-g', '-O0'], + 'debugoptimized': ['-g', '-O'], + 'release': ['-O3', '-frelease'], + 'minsize': [], } -d_ldc_buildtype_args = {'plain' : [], - 'debug' : ['-g', '-O0'], - 'debugoptimized' : ['-g', '-O'], - 'release' : ['-O3', '-release'], - 'minsize' : [], +d_ldc_buildtype_args = {'plain': [], + 'debug': ['-g', '-O0'], + 'debugoptimized': ['-g', '-O'], + 'release': ['-O3', '-release'], + 'minsize': [], } -d_dmd_buildtype_args = {'plain' : [], - 'debug' : ['-g'], - 'debugoptimized' : ['-g', '-O'], - 'release' : ['-O', '-release'], - 'minsize' : [], +d_dmd_buildtype_args = {'plain': [], + 'debug': ['-g'], + 'debugoptimized': ['-g', '-O'], + 'release': ['-O', '-release'], + 'minsize': [], } -mono_buildtype_args = {'plain' : [], - 'debug' : ['-debug'], +mono_buildtype_args = {'plain': [], + 'debug': ['-debug'], 'debugoptimized': ['-debug', '-optimize+'], - 'release' : ['-optimize+'], - 'minsize' : [], + 'release': ['-optimize+'], + 'minsize': [], } -swift_buildtype_args = {'plain' : [], - 'debug' : ['-g'], +swift_buildtype_args = {'plain': [], + 'debug': ['-g'], 'debugoptimized': ['-g', '-O'], - 'release' : ['-O'], - 'minsize' : [], + 'release': ['-O'], + 'minsize': [], } gnu_winlibs = ['-lkernel32', '-luser32', '-lgdi32', '-lwinspool', '-lshell32', @@ -184,9 +184,9 @@ msvc_winlibs = ['kernel32.lib', 'user32.lib', 'gdi32.lib', 'winspool.lib', 'shell32.lib', 'ole32.lib', 'oleaut32.lib', 'uuid.lib', 'comdlg32.lib', 'advapi32.lib'] -gnu_color_args = {'auto' : ['-fdiagnostics-color=auto'], +gnu_color_args = {'auto': ['-fdiagnostics-color=auto'], 'always': ['-fdiagnostics-color=always'], - 'never' : ['-fdiagnostics-color=never'], + 'never': ['-fdiagnostics-color=never'], } base_options = { @@ -204,15 +204,15 @@ base_options = { 'b_coverage': coredata.UserBooleanOption('b_coverage', 'Enable coverage tracking.', False), - 'b_colorout' : coredata.UserComboOption('b_colorout', 'Use colored output', + 'b_colorout': coredata.UserComboOption('b_colorout', 'Use colored output', ['auto', 'always', 'never'], 'always'), - 'b_ndebug' : coredata.UserBooleanOption('b_ndebug', - 'Disable asserts', - False), - 'b_staticpic' : coredata.UserBooleanOption('b_staticpic', - 'Build static libraries as position independent', - True), + 'b_ndebug': coredata.UserBooleanOption('b_ndebug', + 'Disable asserts', + False), + 'b_staticpic': coredata.UserBooleanOption('b_staticpic', + 'Build static libraries as position independent', + True), } def sanitizer_compile_args(value): @@ -1944,9 +1944,9 @@ class VisualStudioCCompiler(CCompiler): return [] def get_options(self): - return {'c_winlibs' : coredata.UserStringArrayOption('c_winlibs', - 'Windows libs to link against.', - msvc_winlibs) + return {'c_winlibs': coredata.UserStringArrayOption('c_winlibs', + 'Windows libs to link against.', + msvc_winlibs) } def get_option_link_args(self, options): @@ -2040,13 +2040,13 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler): self.base_options = ['b_pch'] # FIXME add lto, pgo and the like def get_options(self): - return {'cpp_eh' : coredata.UserComboOption('cpp_eh', - 'C++ exception handling type.', - ['none', 'a', 's', 'sc'], - 'sc'), - 'cpp_winlibs' : coredata.UserStringArrayOption('cpp_winlibs', - 'Windows libs to link against.', - msvc_winlibs) + return {'cpp_eh': coredata.UserComboOption('cpp_eh', + 'C++ exception handling type.', + ['none', 'a', 's', 'sc'], + 'sc'), + 'cpp_winlibs': coredata.UserStringArrayOption('cpp_winlibs', + 'Windows libs to link against.', + msvc_winlibs) } def get_option_compile_args(self, options): @@ -2153,13 +2153,13 @@ class GnuCCompiler(GnuCompiler, CCompiler): GnuCompiler.__init__(self, gcc_type, defines) self.warn_args = {'1': ['-Wall', '-Winvalid-pch'], '2': ['-Wall', '-Wextra', '-Winvalid-pch'], - '3' : ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch']} + '3': ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch']} def get_options(self): - opts = {'c_std' : coredata.UserComboOption('c_std', 'C language standard to use', - ['none', 'c89', 'c99', 'c11', - 'gnu89', 'gnu99', 'gnu11'], - 'none')} + opts = {'c_std': coredata.UserComboOption('c_std', 'C language standard to use', + ['none', 'c89', 'c99', 'c11', + 'gnu89', 'gnu99', 'gnu11'], + 'none')} if self.gcc_type == GCC_MINGW: opts.update({ 'c_winlibs': coredata.UserStringArrayOption('c_winlibs', 'Standard Win libraries to link against', @@ -2192,10 +2192,10 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): '3': ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch', '-Wnon-virtual-dtor']} def get_options(self): - opts = {'cpp_std' : coredata.UserComboOption('cpp_std', 'C++ language standard to use', - ['none', 'c++03', 'c++11', 'c++14', 'c++1z', - 'gnu++03', 'gnu++11', 'gnu++14', 'gnu++1z'], - 'none'), + opts = {'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use', + ['none', 'c++03', 'c++11', 'c++14', 'c++1z', + 'gnu++03', 'gnu++11', 'gnu++14', 'gnu++1z'], + 'none'), 'cpp_debugstl': coredata.UserBooleanOption('cpp_debugstl', 'STL debug mode', False)} @@ -2235,7 +2235,7 @@ class GnuObjCCompiler(GnuCompiler,ObjCCompiler): GnuCompiler.__init__(self, GCC_STANDARD, defines) self.warn_args = {'1': ['-Wall', '-Winvalid-pch'], '2': ['-Wall', '-Wextra', '-Winvalid-pch'], - '3' : ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch']} + '3': ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch']} class GnuObjCPPCompiler(GnuCompiler, ObjCPPCompiler): @@ -2246,7 +2246,7 @@ class GnuObjCPPCompiler(GnuCompiler, ObjCPPCompiler): GnuCompiler.__init__(self, GCC_STANDARD, defines) self.warn_args = {'1': ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'], '2': ['-Wall', '-Wextra', '-Winvalid-pch', '-Wnon-virtual-dtor'], - '3' : ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch', '-Wnon-virtual-dtor']} + '3': ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch', '-Wnon-virtual-dtor']} def get_compiler_check_args(self): # -fpermissive allows non-conforming code to compile which is necessary @@ -2324,13 +2324,13 @@ class ClangCCompiler(ClangCompiler, CCompiler): ClangCompiler.__init__(self, clang_type) self.warn_args = {'1': ['-Wall', '-Winvalid-pch'], '2': ['-Wall', '-Wextra', '-Winvalid-pch'], - '3' : ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch']} + '3': ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch']} def get_options(self): - return {'c_std' : coredata.UserComboOption('c_std', 'C language standard to use', - ['none', 'c89', 'c99', 'c11', - 'gnu89', 'gnu99', 'gnu11',], - 'none')} + return {'c_std': coredata.UserComboOption('c_std', 'C language standard to use', + ['none', 'c89', 'c99', 'c11', + 'gnu89', 'gnu99', 'gnu11',], + 'none')} def get_option_compile_args(self, options): args = [] @@ -2352,10 +2352,10 @@ class ClangCPPCompiler(ClangCompiler, CPPCompiler): '3': ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch', '-Wnon-virtual-dtor']} def get_options(self): - return {'cpp_std' : coredata.UserComboOption('cpp_std', 'C++ language standard to use', - ['none', 'c++03', 'c++11', 'c++14', 'c++1z', - 'gnu++03', 'gnu++11', 'gnu++14', 'gnu++1z'], - 'none')} + return {'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use', + ['none', 'c++03', 'c++11', 'c++14', 'c++1z', + 'gnu++03', 'gnu++11', 'gnu++14', 'gnu++1z'], + 'none')} def get_option_compile_args(self, options): args = [] diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 8d63a22..376319d 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -201,19 +201,19 @@ def get_builtin_option_default(optname): raise RuntimeError('Tried to get the default value for an unknown builtin option \'%s\'.' % optname) builtin_options = { - 'buildtype' : [ UserComboOption, 'Build type to use.', [ 'plain', 'debug', 'debugoptimized', 'release', 'minsize' ], 'debug' ], - 'strip' : [ UserBooleanOption, 'Strip targets on install.', False ], - 'unity' : [ UserBooleanOption, 'Unity build.', False ], - 'prefix' : [ UserStringOption, 'Installation prefix.', default_prefix() ], - 'libdir' : [ UserStringOption, 'Library directory.', default_libdir() ], - 'libexecdir' : [ UserStringOption, 'Library executable directory.', default_libexecdir() ], - 'bindir' : [ UserStringOption, 'Executable directory.', 'bin' ], - 'sbindir' : [ UserStringOption, 'System executable directory.', 'sbin' ], - 'includedir' : [ UserStringOption, 'Header file directory.', 'include' ], - 'datadir' : [ UserStringOption, 'Data file directory.', 'share' ], - 'mandir' : [ UserStringOption, 'Manual page directory.', 'share/man' ], - 'infodir' : [ UserStringOption, 'Info page directory.', 'share/info' ], - 'localedir' : [ UserStringOption, 'Locale data directory.', 'share/locale' ], + 'buildtype': [UserComboOption, 'Build type to use.', ['plain', 'debug', 'debugoptimized', 'release', 'minsize'], 'debug'], + 'strip': [UserBooleanOption, 'Strip targets on install.', False], + 'unity': [UserBooleanOption, 'Unity build.', False], + 'prefix': [UserStringOption, 'Installation prefix.', default_prefix()], + 'libdir': [UserStringOption, 'Library directory.', default_libdir()], + 'libexecdir': [UserStringOption, 'Library executable directory.', default_libexecdir()], + 'bindir': [UserStringOption, 'Executable directory.', 'bin'], + 'sbindir': [UserStringOption, 'System executable directory.', 'sbin'], + 'includedir': [UserStringOption, 'Header file directory.', 'include'], + 'datadir': [UserStringOption, 'Data file directory.', 'share'], + 'mandir': [UserStringOption, 'Manual page directory.', 'share/man'], + 'infodir': [UserStringOption, 'Info page directory.', 'share/info'], + 'localedir': [UserStringOption, 'Locale data directory.', 'share/locale'], # sysconfdir, localstatedir and sharedstatedir are a bit special. These defaults to ${prefix}/etc, # ${prefix}/var and ${prefix}/com but nobody uses that. Instead they always set it # manually to /etc, /var and /var/lib. This default values is thus pointless and not really used @@ -223,16 +223,16 @@ builtin_options = { # to set the following in project(): # # default_options : ['sysconfdir=/etc', 'localstatedir=/var', 'sharedstatedir=/var/lib'] - 'sysconfdir' : [ UserStringOption, 'Sysconf data directory.', 'etc' ], - 'localstatedir' : [ UserStringOption, 'Localstate data directory.', 'var' ], - 'sharedstatedir' : [ UserStringOption, 'Architecture-independent data directory.', 'com' ], - 'werror' : [ UserBooleanOption, 'Treat warnings as errors.', False ], - 'warning_level' : [ UserComboOption, 'Compiler warning level to use.', [ '1', '2', '3' ], '1'], - 'layout' : [ UserComboOption, 'Build directory layout.', ['mirror', 'flat' ], 'mirror' ], - 'default_library' : [ UserComboOption, 'Default library type.', [ 'shared', 'static' ], 'shared' ], - 'backend' : [ UserComboOption, 'Backend to use.', backendlist, 'ninja' ], - 'stdsplit' : [ UserBooleanOption, 'Split stdout and stderr in test logs.', True ], - 'errorlogs' : [ UserBooleanOption, "Whether to print the logs from failing tests.", True ], + 'sysconfdir': [UserStringOption, 'Sysconf data directory.', 'etc'], + 'localstatedir': [UserStringOption, 'Localstate data directory.', 'var'], + 'sharedstatedir': [UserStringOption, 'Architecture-independent data directory.', 'com'], + 'werror': [UserBooleanOption, 'Treat warnings as errors.', False], + 'warning_level': [UserComboOption, 'Compiler warning level to use.', [ '1', '2', '3' ], '1'], + 'layout': [UserComboOption, 'Build directory layout.', ['mirror', 'flat'], 'mirror'], + 'default_library': [UserComboOption, 'Default library type.', ['shared', 'static'], 'shared'], + 'backend': [UserComboOption, 'Backend to use.', backendlist, 'ninja'], + 'stdsplit': [UserBooleanOption, 'Split stdout and stderr in test logs.', True], + 'errorlogs': [UserBooleanOption, "Whether to print the logs from failing tests.", True], } forbidden_target_names = {'clean': None, diff --git a/mesonbuild/dependencies.py b/mesonbuild/dependencies.py index 9d6fb6c..c0e8851 100644 --- a/mesonbuild/dependencies.py +++ b/mesonbuild/dependencies.py @@ -529,7 +529,7 @@ class BoostDependency(Dependency): # Some boost libraries have different names for # their sources and libraries. This dict maps # between the two. - name2lib = {'test' : 'unit_test_framework'} + name2lib = {'test': 'unit_test_framework'} def __init__(self, environment, kwargs): Dependency.__init__(self, 'boost') @@ -1458,9 +1458,9 @@ packages = {'boost': BoostDependency, 'qt4': Qt4Dependency, 'gnustep': GnuStepDependency, 'appleframeworks': AppleFrameworks, - 'wxwidgets' : WxDependency, - 'sdl2' : SDL2Dependency, - 'gl' : GLDependency, - 'threads' : ThreadDependency, - 'python3' : Python3Dependency, + 'wxwidgets': WxDependency, + 'sdl2': SDL2Dependency, + 'gl': GLDependency, + 'threads': ThreadDependency, + 'python3': Python3Dependency, } diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 311b11c..d95f6f9 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -845,7 +845,7 @@ class CrossBuildInfo(): if ' ' in entry or '\t' in entry or "'" in entry or '"' in entry: raise EnvironmentException('Malformed variable name %s in cross file..' % entry) try: - res = eval(value, {'true' : True, 'false' : False}) + res = eval(value, {'true': True, 'false': False}) except Exception: raise EnvironmentException('Malformed value in cross file variable %s.' % entry) if self.ok_type(res): diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 4f679fd..b4c724e 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -49,10 +49,10 @@ class TryRunResultHolder(InterpreterObject): def __init__(self, res): super().__init__() self.res = res - self.methods.update({'returncode' : self.returncode_method, - 'compiled' : self.compiled_method, - 'stdout' : self.stdout_method, - 'stderr' : self.stderr_method, + self.methods.update({'returncode': self.returncode_method, + 'compiled': self.compiled_method, + 'stdout': self.stdout_method, + 'stderr': self.stderr_method, }) def returncode_method(self, args, kwargs): @@ -73,16 +73,16 @@ class RunProcess(InterpreterObject): super().__init__() pc, self.stdout, self.stderr = self.run_command(command_array, source_dir, build_dir, subdir, in_builddir) self.returncode = pc.returncode - self.methods.update({'returncode' : self.returncode_method, - 'stdout' : self.stdout_method, - 'stderr' : self.stderr_method, + self.methods.update({'returncode': self.returncode_method, + 'stdout': self.stdout_method, + 'stderr': self.stderr_method, }) def run_command(self, command_array, source_dir, build_dir, subdir, in_builddir): cmd_name = command_array[0] - env = {'MESON_SOURCE_ROOT' : source_dir, - 'MESON_BUILD_ROOT' : build_dir, - 'MESON_SUBDIR' : subdir} + env = {'MESON_SOURCE_ROOT': source_dir, + 'MESON_BUILD_ROOT': build_dir, + 'MESON_SUBDIR': subdir} if in_builddir: cwd = os.path.join(build_dir, subdir) else: @@ -129,7 +129,7 @@ class EnvironmentVariablesHolder(MutableInterpreterObject): self.held_object = build.EnvironmentVariables() self.methods.update({'set': self.set_method, 'append': self.append_method, - 'prepend' : self.prepend_method, + 'prepend': self.prepend_method, }) @stringArgs @@ -161,7 +161,7 @@ class ConfigurationDataHolder(MutableInterpreterObject): self.methods.update({'set': self.set_method, 'set10': self.set10_method, 'set_quoted': self.set_quoted_method, - 'has' : self.has_method, + 'has': self.has_method, }) def is_used(self): @@ -219,7 +219,7 @@ class DependencyHolder(InterpreterObject): def __init__(self, dep): InterpreterObject.__init__(self) self.held_object = dep - self.methods.update({'found' : self.found_method, + self.methods.update({'found': self.found_method, 'type_name': self.type_name_method, 'version': self.version_method, 'get_pkgconfig_variable': self.pkgconfig_method, @@ -251,7 +251,7 @@ class InternalDependencyHolder(InterpreterObject): def __init__(self, dep): InterpreterObject.__init__(self) self.held_object = dep - self.methods.update({'found' : self.found_method, + self.methods.update({'found': self.found_method, 'version': self.version_method, }) @@ -315,7 +315,7 @@ class GeneratorHolder(InterpreterObject): super().__init__() self.interpreter = interpreter self.held_object = build.Generator(args, kwargs) - self.methods.update({'process' : self.process_method}) + self.methods.update({'process': self.process_method}) def process_method(self, args, kwargs): extras = mesonlib.stringlistify(kwargs.get('extra_args', [])) @@ -342,10 +342,10 @@ class BuildMachine(InterpreterObject): def __init__(self, compilers): self.compilers = compilers InterpreterObject.__init__(self) - self.methods.update({'system' : self.system_method, - 'cpu_family' : self.cpu_family_method, - 'cpu' : self.cpu_method, - 'endian' : self.endian_method, + self.methods.update({'system': self.system_method, + 'cpu_family': self.cpu_family_method, + 'cpu': self.cpu_method, + 'endian': self.endian_method, }) def cpu_family_method(self, args, kwargs): @@ -371,10 +371,10 @@ class CrossMachineInfo(InterpreterObject): 'Machine info is currently {}\n'.format(cross_info) + 'but is missing {}.'.format(minimum_cross_info - set(cross_info))) self.info = cross_info - self.methods.update({'system' : self.system_method, - 'cpu' : self.cpu_method, - 'cpu_family' : self.cpu_family_method, - 'endian' : self.endian_method, + self.methods.update({'system': self.system_method, + 'cpu': self.cpu_method, + 'cpu_family': self.cpu_family_method, + 'endian': self.endian_method, }) def system_method(self, args, kwargs): @@ -481,12 +481,12 @@ class BuildTargetHolder(InterpreterObject): super().__init__() self.held_object = target self.interpreter = interp - self.methods.update({'extract_objects' : self.extract_objects_method, - 'extract_all_objects' : self.extract_all_objects_method, + self.methods.update({'extract_objects': self.extract_objects_method, + 'extract_all_objects': self.extract_all_objects_method, 'get_id': self.get_id_method, - 'outdir' : self.outdir_method, - 'full_path' : self.full_path_method, - 'private_dir_include' : self.private_dir_include_method, + 'outdir': self.outdir_method, + 'full_path': self.full_path_method, + 'private_dir_include': self.private_dir_include_method, }) def __repr__(self): @@ -543,7 +543,7 @@ class CustomTargetHolder(InterpreterObject): super().__init__() self.held_object = object_to_hold self.interpreter = interp - self.methods.update({'full_path' : self.full_path_method, + self.methods.update({'full_path': self.full_path_method, }) def __repr__(self): @@ -587,7 +587,7 @@ class SubprojectHolder(InterpreterObject): def __init__(self, subinterpreter): super().__init__() self.held_object = subinterpreter - self.methods.update({'get_variable' : self.get_variable_method, + self.methods.update({'get_variable': self.get_variable_method, }) def get_variable_method(self, args, kwargs): @@ -609,19 +609,19 @@ class CompilerHolder(InterpreterObject): 'sizeof': self.sizeof_method, 'has_header': self.has_header_method, 'has_header_symbol': self.has_header_symbol_method, - 'run' : self.run_method, - 'has_function' : self.has_function_method, - 'has_member' : self.has_member_method, - 'has_members' : self.has_members_method, - 'has_type' : self.has_type_method, - 'alignment' : self.alignment_method, - 'version' : self.version_method, - 'cmd_array' : self.cmd_array_method, + 'run': self.run_method, + 'has_function': self.has_function_method, + 'has_member': self.has_member_method, + 'has_members': self.has_members_method, + 'has_type': self.has_type_method, + 'alignment': self.alignment_method, + 'version': self.version_method, + 'cmd_array': self.cmd_array_method, 'find_library': self.find_library_method, - 'has_argument' : self.has_argument_method, - 'has_multi_arguments' : self.has_multi_arguments_method, - 'first_supported_argument' : self.first_supported_argument_method, - 'unittest_args' : self.unittest_args_method, + 'has_argument': self.has_argument_method, + 'has_multi_arguments': self.has_multi_arguments_method, + 'first_supported_argument': self.first_supported_argument_method, + 'unittest_args': self.unittest_args_method, 'symbols_have_underscore_prefix': self.symbols_have_underscore_prefix_method, }) @@ -701,7 +701,7 @@ class CompilerHolder(InterpreterObject): h = mlog.green('YES') else: h = mlog.red('NO (%d)' % result.returncode) - mlog.log('Checking if "', mlog.bold(testname), '" runs : ', h, sep='') + mlog.log('Checking if "', mlog.bold(testname), '" runs: ', h, sep='') return TryRunResultHolder(result) def get_id_method(self, args, kwargs): @@ -831,7 +831,7 @@ class CompilerHolder(InterpreterObject): h = mlog.green('YES') else: h = mlog.red('NO') - mlog.log('Checking if "', mlog.bold(testname), '" compiles : ', h, sep='') + mlog.log('Checking if "', mlog.bold(testname), '" compiles: ', h, sep='') return result def links_method(self, args, kwargs): @@ -854,7 +854,7 @@ class CompilerHolder(InterpreterObject): h = mlog.green('YES') else: h = mlog.red('NO') - mlog.log('Checking if "', mlog.bold(testname), '" links : ', h, sep='') + mlog.log('Checking if "', mlog.bold(testname), '" links: ', h, sep='') return result def has_header_method(self, args, kwargs): @@ -996,22 +996,22 @@ class MesonMain(InterpreterObject): self.interpreter = interpreter self._found_source_scripts = {} self.methods.update({'get_compiler': self.get_compiler_method, - 'is_cross_build' : self.is_cross_build_method, - 'has_exe_wrapper' : self.has_exe_wrapper_method, - 'is_unity' : self.is_unity_method, - 'is_subproject' : self.is_subproject_method, - 'current_source_dir' : self.current_source_dir_method, - 'current_build_dir' : self.current_build_dir_method, - 'source_root' : self.source_root_method, - 'build_root' : self.build_root_method, - 'add_install_script' : self.add_install_script_method, - 'add_postconf_script' : self.add_postconf_script_method, + 'is_cross_build': self.is_cross_build_method, + 'has_exe_wrapper': self.has_exe_wrapper_method, + 'is_unity': self.is_unity_method, + 'is_subproject': self.is_subproject_method, + 'current_source_dir': self.current_source_dir_method, + 'current_build_dir': self.current_build_dir_method, + 'source_root': self.source_root_method, + 'build_root': self.build_root_method, + 'add_install_script': self.add_install_script_method, + 'add_postconf_script': self.add_postconf_script_method, 'install_dependency_manifest': self.install_dependency_manifest_method, 'project_version': self.project_version_method, 'version': self.version_method, - 'project_name' : self.project_name_method, + 'project_name': self.project_name_method, 'get_cross_property': self.get_cross_property_method, - 'backend' : self.backend_method, + 'backend': self.backend_method, }) def _find_source_script(self, name, args): @@ -1180,53 +1180,53 @@ class Interpreter(InterpreterBase): self.build_def_files = [os.path.join(self.subdir, environment.build_filename)] def build_func_dict(self): - self.funcs.update({'project' : self.func_project, - 'message' : self.func_message, - 'error' : self.func_error, - 'executable': self.func_executable, - 'dependency' : self.func_dependency, - 'static_library' : self.func_static_lib, - 'shared_library' : self.func_shared_lib, - 'shared_module' : self.func_shared_module, - 'library' : self.func_library, - 'jar' : self.func_jar, - 'build_target': self.func_build_target, - 'custom_target' : self.func_custom_target, - 'run_target' : self.func_run_target, - 'generator' : self.func_generator, - 'test' : self.func_test, - 'benchmark' : self.func_benchmark, - 'install_headers' : self.func_install_headers, - 'install_man' : self.func_install_man, - 'subdir' : self.func_subdir, - 'install_data' : self.func_install_data, - 'install_subdir' : self.func_install_subdir, - 'configure_file' : self.func_configure_file, - 'include_directories' : self.func_include_directories, - 'add_global_arguments' : self.func_add_global_arguments, - 'add_project_arguments' : self.func_add_project_arguments, - 'add_global_link_arguments' : self.func_add_global_link_arguments, - 'add_project_link_arguments' : self.func_add_project_link_arguments, - 'add_languages' : self.func_add_languages, - 'find_program' : self.func_find_program, - 'find_library' : self.func_find_library, - 'configuration_data' : self.func_configuration_data, - 'run_command' : self.func_run_command, - 'gettext' : self.func_gettext, - 'option' : self.func_option, - 'get_option' : self.func_get_option, - 'subproject' : self.func_subproject, - 'vcs_tag' : self.func_vcs_tag, - 'set_variable' : self.func_set_variable, - 'is_variable' : self.func_is_variable, - 'get_variable' : self.func_get_variable, - 'import' : self.func_import, - 'files' : self.func_files, - 'declare_dependency': self.func_declare_dependency, - 'assert': self.func_assert, - 'environment' : self.func_environment, - 'join_paths' : self.func_join_paths, - }) + self.funcs.update({'project': self.func_project, + 'message': self.func_message, + 'error': self.func_error, + 'executable': self.func_executable, + 'dependency': self.func_dependency, + 'static_library': self.func_static_lib, + 'shared_library': self.func_shared_lib, + 'shared_module': self.func_shared_module, + 'library': self.func_library, + 'jar': self.func_jar, + 'build_target': self.func_build_target, + 'custom_target': self.func_custom_target, + 'run_target': self.func_run_target, + 'generator': self.func_generator, + 'test': self.func_test, + 'benchmark': self.func_benchmark, + 'install_headers': self.func_install_headers, + 'install_man': self.func_install_man, + 'subdir': self.func_subdir, + 'install_data': self.func_install_data, + 'install_subdir': self.func_install_subdir, + 'configure_file': self.func_configure_file, + 'include_directories': self.func_include_directories, + 'add_global_arguments': self.func_add_global_arguments, + 'add_project_arguments': self.func_add_project_arguments, + 'add_global_link_arguments': self.func_add_global_link_arguments, + 'add_project_link_arguments': self.func_add_project_link_arguments, + 'add_languages': self.func_add_languages, + 'find_program': self.func_find_program, + 'find_library': self.func_find_library, + 'configuration_data': self.func_configuration_data, + 'run_command': self.func_run_command, + 'gettext': self.func_gettext, + 'option': self.func_option, + 'get_option': self.func_get_option, + 'subproject': self.func_subproject, + 'vcs_tag': self.func_vcs_tag, + 'set_variable': self.func_set_variable, + 'is_variable': self.func_is_variable, + 'get_variable': self.func_get_variable, + 'import': self.func_import, + 'files': self.func_files, + 'declare_dependency': self.func_declare_dependency, + 'assert': self.func_assert, + 'environment': self.func_environment, + 'join_paths': self.func_join_paths, + }) def module_method_callback(self, invalues): unwrap_single = False diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 3f1d209..892770c 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -112,18 +112,18 @@ def list_target_files(target_name, coredata, builddata): def list_buildoptions(coredata, builddata): buildtype= {'choices': ['plain', 'debug', 'debugoptimized', 'release', 'minsize'], - 'type' : 'combo', - 'value' : coredata.get_builtin_option('buildtype'), - 'description' : 'Build type', - 'name' : 'type'} - strip = {'value' : coredata.get_builtin_option('strip'), - 'type' : 'boolean', - 'description' : 'Strip on install', - 'name' : 'strip'} - unity = {'value' : coredata.get_builtin_option('unity'), - 'type' : 'boolean', - 'description' : 'Unity build', - 'name' : 'unity'} + 'type': 'combo', + 'value': coredata.get_builtin_option('buildtype'), + 'description': 'Build type', + 'name': 'type'} + strip = {'value': coredata.get_builtin_option('strip'), + 'type': 'boolean', + 'description': 'Strip on install', + 'name': 'strip'} + unity = {'value': coredata.get_builtin_option('unity'), + 'type': 'boolean', + 'description': 'Unity build', + 'name': 'unity'} optlist = [buildtype, strip, unity] add_keys(optlist, coredata.user_options) add_keys(optlist, coredata.compiler_options) @@ -198,8 +198,8 @@ def list_projinfo(builddata): result['version'] = builddata.project_version subprojects = [] for k, v in builddata.subprojects.items(): - c = {'name' : k, - 'version' : v} + c = {'name': k, + 'version': v} subprojects.append(c) result['subprojects'] = subprojects print(json.dumps(result)) diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index ebd819a..95113a0 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -503,10 +503,10 @@ can not be used with the current version of glib-compiled-resources, due to elif isinstance(girtarget, build.SharedLibrary): libname = girtarget.get_basename() scan_command += ['--library', libname] - scankwargs = {'output' : girfile, - 'input' : libsources, - 'command' : scan_command, - 'depends' : depends, + scankwargs = {'output': girfile, + 'input': libsources, + 'command': scan_command, + 'depends': depends, } if kwargs.get('install'): scankwargs['install'] = kwargs['install'] @@ -739,9 +739,9 @@ can not be used with the current version of glib-compiled-resources, due to cmd += ['--c-namespace', kwargs.pop('namespace')] cmd += ['--generate-c-code', '@OUTDIR@/' + namebase, '@INPUT@'] outputs = [namebase + '.c', namebase + '.h'] - custom_kwargs = {'input' : xml_file, - 'output' : outputs, - 'command' : cmd + custom_kwargs = {'input': xml_file, + 'output': outputs, + 'command': cmd } return build.CustomTarget(target_name, state.subdir, custom_kwargs) diff --git a/mesonbuild/modules/qt4.py b/mesonbuild/modules/qt4.py index 8df4f3e..95932d9 100644 --- a/mesonbuild/modules/qt4.py +++ b/mesonbuild/modules/qt4.py @@ -127,30 +127,30 @@ class Qt4Module(): else: basename = os.path.split(rcc_files[0])[1] name = 'qt4-' + basename.replace('.', '_') - rcc_kwargs = {'input' : rcc_files, - 'output' : name + '.cpp', - 'command' : [self.rcc, '-o', '@OUTPUT@', '@INPUT@'], - 'depend_files' : qrc_deps, - } + rcc_kwargs = {'input': rcc_files, + 'output': name + '.cpp', + 'command': [self.rcc, '-o', '@OUTPUT@', '@INPUT@'], + 'depend_files': qrc_deps, + } res_target = build.CustomTarget(name, state.subdir, rcc_kwargs) sources.append(res_target) if len(ui_files) > 0: if not self.uic.found(): raise MesonException(err_msg.format('UIC', 'uic-qt4')) - ui_kwargs = {'output' : 'ui_@BASENAME@.h', - 'arguments' : ['-o', '@OUTPUT@', '@INPUT@']} + ui_kwargs = {'output': 'ui_@BASENAME@.h', + 'arguments': ['-o', '@OUTPUT@', '@INPUT@']} ui_gen = build.Generator([self.uic], ui_kwargs) ui_output = ui_gen.process_files('Qt4 ui', ui_files, state) sources.append(ui_output) if len(moc_headers) > 0: - moc_kwargs = {'output' : 'moc_@BASENAME@.cpp', - 'arguments' : ['@INPUT@', '-o', '@OUTPUT@']} + moc_kwargs = {'output': 'moc_@BASENAME@.cpp', + 'arguments': ['@INPUT@', '-o', '@OUTPUT@']} moc_gen = build.Generator([self.moc], moc_kwargs) moc_output = moc_gen.process_files('Qt4 moc header', moc_headers, state) sources.append(moc_output) if len(moc_sources) > 0: - moc_kwargs = {'output' : '@BASENAME@.moc', - 'arguments' : ['@INPUT@', '-o', '@OUTPUT@']} + moc_kwargs = {'output': '@BASENAME@.moc', + 'arguments': ['@INPUT@', '-o', '@OUTPUT@']} moc_gen = build.Generator([self.moc], moc_kwargs) moc_output = moc_gen.process_files('Qt4 moc source', moc_sources, state) sources.append(moc_output) diff --git a/mesonbuild/modules/qt5.py b/mesonbuild/modules/qt5.py index d4cd261..eb467f7 100644 --- a/mesonbuild/modules/qt5.py +++ b/mesonbuild/modules/qt5.py @@ -133,30 +133,30 @@ class Qt5Module(): else: basename = os.path.split(rcc_files[0])[1] name = 'qt5-' + basename.replace('.', '_') - rcc_kwargs = {'input' : rcc_files, - 'output' : name + '.cpp', - 'command' : [self.rcc, '-o', '@OUTPUT@', '@INPUT@'], - 'depend_files' : qrc_deps, - } + rcc_kwargs = {'input': rcc_files, + 'output': name + '.cpp', + 'command': [self.rcc, '-o', '@OUTPUT@', '@INPUT@'], + 'depend_files': qrc_deps, + } res_target = build.CustomTarget(name, state.subdir, rcc_kwargs) sources.append(res_target) if len(ui_files) > 0: if not self.uic.found(): raise MesonException(err_msg.format('UIC', 'uic-qt5')) - ui_kwargs = {'output' : 'ui_@BASENAME@.h', - 'arguments' : ['-o', '@OUTPUT@', '@INPUT@']} + ui_kwargs = {'output': 'ui_@BASENAME@.h', + 'arguments': ['-o', '@OUTPUT@', '@INPUT@']} ui_gen = build.Generator([self.uic], ui_kwargs) ui_output = ui_gen.process_files('Qt5 ui', ui_files, state) sources.append(ui_output) if len(moc_headers) > 0: - moc_kwargs = {'output' : 'moc_@BASENAME@.cpp', - 'arguments' : ['@INPUT@', '-o', '@OUTPUT@']} + moc_kwargs = {'output': 'moc_@BASENAME@.cpp', + 'arguments': ['@INPUT@', '-o', '@OUTPUT@']} moc_gen = build.Generator([self.moc], moc_kwargs) moc_output = moc_gen.process_files('Qt5 moc header', moc_headers, state) sources.append(moc_output) if len(moc_sources) > 0: - moc_kwargs = {'output' : '@BASENAME@.moc', - 'arguments' : ['@INPUT@', '-o', '@OUTPUT@']} + moc_kwargs = {'output': '@BASENAME@.moc', + 'arguments': ['@INPUT@', '-o', '@OUTPUT@']} moc_gen = build.Generator([self.moc], moc_kwargs) moc_output = moc_gen.process_files('Qt5 moc source', moc_sources, state) sources.append(moc_output) diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py index d034497..56bad2d 100644 --- a/mesonbuild/modules/windows.py +++ b/mesonbuild/modules/windows.py @@ -50,7 +50,7 @@ class WindowsModule: suffix = 'o' if not rescomp.found(): raise MesonException('Could not find Windows resource compiler %s.' % ' '.join(rescomp.get_command())) - res_kwargs = {'output' : '@BASENAME@.' + suffix, + res_kwargs = {'output': '@BASENAME@.' + suffix, 'arguments': res_args} res_gen = build.Generator([rescomp], res_kwargs) res_output = res_gen.process_files('Windows resource', args, state) diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py index 81f3177..b8f57ab 100644 --- a/mesonbuild/optinterpreter.py +++ b/mesonbuild/optinterpreter.py @@ -62,9 +62,9 @@ def ComboParser(name, description, kwargs): raise OptionException('Combo choice elements must be strings.') return coredata.UserComboOption(name, description, choices, kwargs.get('value', choices[0])) -option_types = {'string' : StringParser, - 'boolean' : BooleanParser, - 'combo' : ComboParser, +option_types = {'string': StringParser, + 'boolean': BooleanParser, + 'combo': ComboParser, } class OptionInterpreter: diff --git a/mesonbuild/scripts/commandrunner.py b/mesonbuild/scripts/commandrunner.py index 63b5bb1..695301b 100644 --- a/mesonbuild/scripts/commandrunner.py +++ b/mesonbuild/scripts/commandrunner.py @@ -18,9 +18,9 @@ what to run, sets up the environment and executes the command.""" import sys, os, subprocess, shutil def run_command(source_dir, build_dir, subdir, command, arguments): - env = {'MESON_SOURCE_ROOT' : source_dir, - 'MESON_BUILD_ROOT' : build_dir, - 'MESON_SUBDIR' : subdir + env = {'MESON_SOURCE_ROOT': source_dir, + 'MESON_BUILD_ROOT': build_dir, + 'MESON_SUBDIR': subdir } cwd = os.path.join(source_dir, subdir) child_env = os.environ.copy() diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/scripts/meson_install.py index c749b4f..f497f2c 100644 --- a/mesonbuild/scripts/meson_install.py +++ b/mesonbuild/scripts/meson_install.py @@ -142,10 +142,10 @@ def install_headers(d): do_copyfile(fullfilename, outfilename) def run_install_script(d): - env = {'MESON_SOURCE_ROOT' : d.source_dir, - 'MESON_BUILD_ROOT' : d.build_dir, - 'MESON_INSTALL_PREFIX' : d.prefix, - 'MESON_INSTALL_DESTDIR_PREFIX' : d.fullprefix, + env = {'MESON_SOURCE_ROOT': d.source_dir, + 'MESON_BUILD_ROOT': d.build_dir, + 'MESON_INSTALL_PREFIX': d.prefix, + 'MESON_INSTALL_DESTDIR_PREFIX': d.fullprefix, } child_env = os.environ.copy() child_env.update(env) diff --git a/mesontest.py b/mesontest.py index 36f7334..28440e0 100755 --- a/mesontest.py +++ b/mesontest.py @@ -126,13 +126,13 @@ def decode(stream): return stream.decode('iso-8859-1', errors='ignore') def write_json_log(jsonlogfile, test_name, result): - jresult = {'name' : test_name, - 'stdout' : result.stdo, - 'result' : result.res, - 'duration' : result.duration, - 'returncode' : result.returncode, - 'command' : result.cmd, - } + jresult = {'name': test_name, + 'stdout': result.stdo, + 'result': result.res, + 'duration': result.duration, + 'returncode': result.returncode, + 'command': result.cmd, + } if isinstance(result.env, dict): jresult['env'] = result.env else: diff --git a/run_project_tests.py b/run_project_tests.py index 61177ff..6e2cb45 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -395,7 +395,7 @@ def run_tests(all_tests, log_name_base, extra_args): executor = conc.ProcessPoolExecutor(max_workers=num_workers) for name, test_cases, skipped in all_tests: - current_suite = ET.SubElement(junit_root, 'testsuite', {'name' : name, 'tests' : str(len(test_cases))}) + current_suite = ET.SubElement(junit_root, 'testsuite', {'name': name, 'tests': str(len(test_cases))}) if skipped: print('\nNot running %s tests.\n' % name) else: @@ -415,8 +415,8 @@ def run_tests(all_tests, log_name_base, extra_args): result = result.result() if result is None or 'MESON_SKIP_TEST' in result.stdo: print('Skipping:', t) - current_test = ET.SubElement(current_suite, 'testcase', {'name' : testname, - 'classname' : name}) + current_test = ET.SubElement(current_suite, 'testcase', {'name': testname, + 'classname': name}) ET.SubElement(current_test, 'skipped', {}) skipped_tests += 1 else: @@ -435,11 +435,11 @@ def run_tests(all_tests, log_name_base, extra_args): test_time += result.testtime total_time = conf_time + build_time + test_time log_text_file(logfile, t, result.stdo, result.stde) - current_test = ET.SubElement(current_suite, 'testcase', {'name' : testname, - 'classname' : name, - 'time' : '%.3f' % total_time}) + current_test = ET.SubElement(current_suite, 'testcase', {'name': testname, + 'classname': name, + 'time': '%.3f' % total_time}) if result.msg != '': - ET.SubElement(current_test, 'failure', {'message' : result.msg}) + ET.SubElement(current_test, 'failure', {'message': result.msg}) stdoel = ET.SubElement(current_test, 'system-out') stdoel.text = result.stdo stdeel = ET.SubElement(current_test, 'system-err') diff --git a/tools/ac_converter.py b/tools/ac_converter.py index 4f284af..c5c4995 100755 --- a/tools/ac_converter.py +++ b/tools/ac_converter.py @@ -28,36 +28,36 @@ import sys # Add stuff here as it is encountered. function_data = \ - {'HAVE_FEENABLEEXCEPT' : ('feenableexcept', 'fenv.h'), - 'HAVE_FECLEAREXCEPT' : ('feclearexcept', 'fenv.h'), - 'HAVE_FEDISABLEEXCEPT' : ('fedisableexcept', 'fenv.h'), - 'HAVE_MMAP' : ('mmap', 'sys/mman.h'), - 'HAVE_GETPAGESIZE' : ('getpagesize', 'unistd.h'), - 'HAVE_GETISAX' : ('getisax', 'sys/auxv.h'), - 'HAVE_GETTIMEOFDAY' : ('gettimeofday', 'sys/time.h'), - 'HAVE_MPROTECT' : ('mprotect', 'sys/mman.h'), - 'HAVE_POSIX_MEMALIGN' : ('posix_memalign', 'stdlib.h'), - 'HAVE_SIGACTION' : ('sigaction', 'signal.h'), - 'HAVE_ALARM' : ('alarm', 'unistd.h'), - 'HAVE_CLOCK_GETTIME' : ('clock_gettime', 'time.h'), - 'HAVE_CTIME_R' : ('ctime_r', 'time.h'), - 'HAVE_DRAND48' : ('drand48', 'stdlib.h'), - 'HAVE_FLOCKFILE' : ('flockfile', 'stdio.h'), - 'HAVE_FORK' : ('fork', 'unistd.h'), - 'HAVE_FUNLOCKFILE' : ('funlockfile', 'stdio.h'), - 'HAVE_GETLINE' : ('getline', 'stdio.h'), - 'HAVE_LINK' : ('link', 'unistd.h'), - 'HAVE_RAISE' : ('raise', 'signal.h'), - 'HAVE_STRNDUP' : ('strndup', 'string.h'), - 'HAVE_SCHED_GETAFFINITY' : ('sched_getaffinity', 'sched.h'), - 'HAVE_WAITPID' : ('waitpid', 'sys/wait.h'), - 'HAVE_XRENDERCREATECONICALGRADIENT' : ('XRenderCreateConicalGradient', 'xcb/render.h'), - 'HAVE_XRENDERCREATELINEARGRADIENT' : ('XRenderCreateLinearGradient', 'xcb/render.h'), - 'HAVE_XRENDERCREATERADIALGRADIENT' : ('XRenderCreateRadialGradient', 'xcb/render.h'), - 'HAVE_XRENDERCREATESOLIDFILL' : ('XRenderCreateSolidFill', 'xcb/render.h'), + {'HAVE_FEENABLEEXCEPT': ('feenableexcept', 'fenv.h'), + 'HAVE_FECLEAREXCEPT': ('feclearexcept', 'fenv.h'), + 'HAVE_FEDISABLEEXCEPT': ('fedisableexcept', 'fenv.h'), + 'HAVE_MMAP': ('mmap', 'sys/mman.h'), + 'HAVE_GETPAGESIZE': ('getpagesize', 'unistd.h'), + 'HAVE_GETISAX': ('getisax', 'sys/auxv.h'), + 'HAVE_GETTIMEOFDAY': ('gettimeofday', 'sys/time.h'), + 'HAVE_MPROTECT': ('mprotect', 'sys/mman.h'), + 'HAVE_POSIX_MEMALIGN': ('posix_memalign', 'stdlib.h'), + 'HAVE_SIGACTION': ('sigaction', 'signal.h'), + 'HAVE_ALARM': ('alarm', 'unistd.h'), + 'HAVE_CLOCK_GETTIME': ('clock_gettime', 'time.h'), + 'HAVE_CTIME_R': ('ctime_r', 'time.h'), + 'HAVE_DRAND48': ('drand48', 'stdlib.h'), + 'HAVE_FLOCKFILE': ('flockfile', 'stdio.h'), + 'HAVE_FORK': ('fork', 'unistd.h'), + 'HAVE_FUNLOCKFILE': ('funlockfile', 'stdio.h'), + 'HAVE_GETLINE': ('getline', 'stdio.h'), + 'HAVE_LINK': ('link', 'unistd.h'), + 'HAVE_RAISE': ('raise', 'signal.h'), + 'HAVE_STRNDUP': ('strndup', 'string.h'), + 'HAVE_SCHED_GETAFFINITY': ('sched_getaffinity', 'sched.h'), + 'HAVE_WAITPID': ('waitpid', 'sys/wait.h'), + 'HAVE_XRENDERCREATECONICALGRADIENT': ('XRenderCreateConicalGradient', 'xcb/render.h'), + 'HAVE_XRENDERCREATELINEARGRADIENT': ('XRenderCreateLinearGradient', 'xcb/render.h'), + 'HAVE_XRENDERCREATERADIALGRADIENT': ('XRenderCreateRadialGradient', 'xcb/render.h'), + 'HAVE_XRENDERCREATESOLIDFILL': ('XRenderCreateSolidFill', 'xcb/render.h'), 'HAVE_DCGETTEXT': ('dcgettext', 'libintl.h'), 'HAVE_ENDMNTENT': ('endmntent', 'mntent.h'), - 'HAVE_ENDSERVENT' : ('endservent', 'netdb.h'), + 'HAVE_ENDSERVENT': ('endservent', 'netdb.h'), 'HAVE_EVENTFD': ('eventfd', 'sys/eventfd.h'), 'HAVE_FALLOCATE': ('fallocate', 'fcntl.h'), 'HAVE_FCHMOD': ('fchmod', 'sys/stat.h'), @@ -68,9 +68,9 @@ function_data = \ 'HAVE_GETFSSTAT': ('getfsstat', 'sys/mount.h'), 'HAVE_GETMNTENT_R': ('getmntent_r', 'mntent.h'), 'HAVE_GETPROTOBYNAME_R': ('getprotobyname_r', 'netdb.h'), - 'HAVE_GETRESUID' : ('getresuid', 'unistd.h'), - 'HAVE_GETVFSSTAT' : ('getvfsstat', 'sys/statvfs.h'), - 'HAVE_GMTIME_R' : ('gmtime_r', 'time.h'), + 'HAVE_GETRESUID': ('getresuid', 'unistd.h'), + 'HAVE_GETVFSSTAT': ('getvfsstat', 'sys/statvfs.h'), + 'HAVE_GMTIME_R': ('gmtime_r', 'time.h'), 'HAVE_HASMNTOPT': ('hasmntopt', 'mntent.h'), 'HAVE_IF_INDEXTONAME': ('if_indextoname', 'net/if.h'), 'HAVE_IF_NAMETOINDEX': ('if_nametoindex', 'net/if.h'), @@ -94,7 +94,7 @@ function_data = \ 'HAVE_READLINK': ('readlink', 'unistd.h'), 'HAVE_RES_INIT': ('res_init', 'resolv.h'), 'HAVE_SENDMMSG': ('sendmmsg', 'sys/socket.h'), - 'HAVE_SOCKET' : ('socket', 'sys/socket.h'), + 'HAVE_SOCKET': ('socket', 'sys/socket.h'), 'HAVE_GETENV': ('getenv', 'stdlib.h'), 'HAVE_SETENV': ('setenv', 'stdlib.h'), 'HAVE_PUTENV': ('putenv', 'stdlib.h'), diff --git a/tools/cmake2meson.py b/tools/cmake2meson.py index db405f7..7b28597 100755 --- a/tools/cmake2meson.py +++ b/tools/cmake2meson.py @@ -133,9 +133,9 @@ class Parser(): yield(self.statement()) class Converter: - ignored_funcs = {'cmake_minimum_required' : True, - 'enable_testing' : True, - 'include' : True} + ignored_funcs = {'cmake_minimum_required': True, + 'enable_testing': True, + 'include': True} def __init__(self, cmake_root): self.cmake_root = cmake_root self.indent_unit = ' ' |