Merge pull request #3171 from jon-turney/flake8

Fix flake8 issues
pull/3180/head
Jussi Pakkanen 7 years ago committed by GitHub
commit 0744601fda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      meson.py
  2. 2
      mesonbuild/backend/vs2010backend.py
  3. 2
      mesonbuild/backend/xcodebackend.py
  4. 2
      mesonbuild/compilers/cpp.py
  5. 1
      mesonbuild/dependencies/ui.py
  6. 2
      mesonbuild/interpreter.py
  7. 2
      mesonbuild/interpreterbase.py
  8. 27
      mesonbuild/minit.py
  9. 1
      mesonbuild/modules/python3.py
  10. 13
      mesonbuild/modules/unstable_icestorm.py
  11. 5
      msi/createmsi.py
  12. 10
      run_unittests.py
  13. 1
      test cases/common/98 gen extra/srcgen3.py

@ -14,8 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from mesonbuild import mesonmain, mesonlib
import sys, os, locale
from mesonbuild import mesonmain
import sys, os
def main():
# Always resolve the command path so Ninja can find it for regen, tests, etc.

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os, sys
import os
import pickle
import xml.dom.minidom
import xml.etree.ElementTree as ET

@ -16,7 +16,7 @@ from . import backends
from .. import build
from .. import dependencies
from .. import mesonlib
import uuid, os, sys
import uuid, os
from ..mesonlib import MesonException

@ -112,7 +112,7 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler):
if self.gcc_type == GCC_MINGW:
opts.update({
'cpp_winlibs': coredata.UserArrayOption('cpp_winlibs', 'Standard Win libraries to link against',
gnu_winlibs), })
gnu_winlibs), })
return opts
def get_option_compile_args(self, options):

@ -17,7 +17,6 @@
import os
import re
import shutil
import subprocess
from collections import OrderedDict

@ -2339,7 +2339,7 @@ root and issuing %s.
cmds = []
command_templ = 'meson wrap promote '
for l in found:
cmds.append(command_templ + l[len(self.source_root)+1:])
cmds.append(command_templ + l[len(self.source_root) + 1:])
final_message = message + '\n'.join(cmds)
print(final_message)

@ -408,7 +408,7 @@ The result of this is undefined and will become a hard error in a future Meson r
varname = node.var_name
addition = self.evaluate_statement(node.value)
if is_disabler(addition):
set_variable(varname, addition)
self.set_variable(varname, addition)
return
# Remember that all variables are immutable. We must always create a
# full new variable and then assign it.

@ -1,5 +1,4 @@
# Copyright 2017 The Meson development team
from pyclbr import Function
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -15,7 +14,7 @@ from pyclbr import Function
"""Code that creates simple startup projects."""
import os, sys, argparse, re
import sys, argparse, re
from glob import glob
lib_h_template = '''#pragma once
@ -107,7 +106,7 @@ pkg_mod.generate(
)
'''
hello_c_template = '''#include <stdio.h>
hello_c_template = '''#include <stdio.h>
#define PROJECT_NAME "{project_name}"
@ -128,11 +127,11 @@ hello_c_meson_template = '''project('{project_name}', 'c',
exe = executable('{exe_name}', '{source_name}',
install : true)
test('basic', exe)
'''
hello_cpp_template = '''#include <iostream>
hello_cpp_template = '''#include <iostream>
#define PROJECT_NAME "{project_name}"
@ -152,7 +151,7 @@ hello_cpp_meson_template = '''project('{project_name}', 'cpp',
exe = executable('{exe_name}', '{source_name}',
install : true)
test('basic', exe)
'''
@ -178,9 +177,9 @@ class {utoken}_PUBLIC {class_name} {{
public:
{class_name}();
int get_number() const;
private:
int number;
}};
@ -270,7 +269,6 @@ ninja -C builddir
def create_exe_c_sample(project_name, project_version):
lowercase_token = re.sub(r'[^a-z0-9]', '_', project_name.lower())
uppercase_token = lowercase_token.upper()
source_name = lowercase_token + '.c'
open(source_name, 'w').write(hello_c_template.format(project_name=project_name))
open('meson.build', 'w').write(hello_c_meson_template.format(project_name=project_name,
@ -291,7 +289,7 @@ def create_lib_c_sample(project_name, version):
'function_name': function_name,
'header_file': lib_h_name,
'source_file': lib_c_name,
'test_source_file': test_c_name,
'test_source_file': test_c_name,
'test_exe_name': lowercase_token,
'project_name': project_name,
'lib_name': lowercase_token,
@ -305,13 +303,12 @@ def create_lib_c_sample(project_name, version):
def create_exe_cpp_sample(project_name, project_version):
lowercase_token = re.sub(r'[^a-z0-9]', '_', project_name.lower())
uppercase_token = lowercase_token.upper()
source_name = lowercase_token + '.cpp'
open(source_name, 'w').write(hello_cpp_template.format(project_name=project_name))
open('meson.build', 'w').write(hello_cpp_meson_template.format(project_name=project_name,
exe_name=lowercase_token,
source_name=source_name,
version=project_version))
exe_name=lowercase_token,
source_name=source_name,
version=project_version))
def create_lib_cpp_sample(project_name, version):
lowercase_token = re.sub(r'[^a-z0-9]', '_', project_name.lower())
@ -328,7 +325,7 @@ def create_lib_cpp_sample(project_name, version):
'namespace': namespace,
'header_file': lib_h_name,
'source_file': lib_c_name,
'test_source_file': test_c_name,
'test_source_file': test_c_name,
'test_exe_name': lowercase_token,
'project_name': project_name,
'lib_name': lowercase_token,

@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import sysconfig
from .. import mesonlib, dependencies

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from .. import mesonlib, compilers, mlog
from .. import mesonlib
from . import ExtensionModule
@ -33,7 +33,6 @@ class IceStormModule(ExtensionModule):
def project(self, interpreter, state, args, kwargs):
if not self.yosys_bin:
self.detect_binaries(interpreter)
result = []
if not len(args):
raise mesonlib.MesonException('Project requires at least one argument, which is the project name.')
proj_name = args[0]
@ -46,7 +45,7 @@ class IceStormModule(ExtensionModule):
all_sources = interpreter.source_strings_to_files(interpreter.flatten(arg_sources + kwarg_sources))
if 'constraint_file' not in kwargs:
raise mesonlib.MesonException('Constraint file not specified.')
constraint_file = interpreter.source_strings_to_files(kwargs['constraint_file'])
if len(constraint_file) != 1:
raise mesonlib.MesonException('Constraint file must contain one and only one entry.')
@ -73,13 +72,13 @@ class IceStormModule(ExtensionModule):
'input': asc_target,
'output': bin_fname,
'command': [self.icepack_bin, '@INPUT@', '@OUTPUT@'],
'build_by_default' : True})
'build_by_default': True})
up_target = interpreter.func_run_target(None, [upload_name], {
interpreter.func_run_target(None, [upload_name], {
'command': [self.iceprog_bin, bin_target]})
time_target = interpreter.func_run_target(None, [time_name], {
'command' : [self.icetime_bin, bin_target]})
interpreter.func_run_target(None, [time_name], {
'command': [self.icetime_bin, bin_target]})
def initialize():
return IceStormModule()

@ -153,7 +153,7 @@ class PackageGenerator:
'SourceFile': self.redist_path,
'DiskId': '1',
'Language': '0',
})
})
ET.SubElement(product, 'Property', {
'Id': 'WIXUI_INSTALLDIR',
@ -185,7 +185,7 @@ class PackageGenerator:
'AllowAdvertise': 'no',
'Display': 'hidden',
'Level': '1',
})
})
ET.SubElement(vcredist_feature, 'MergeRef', {'Id': 'VCRedist'})
ET.ElementTree(self.root).write(self.main_xml, encoding='utf-8', xml_declaration=True)
# ElementTree can not do prettyprinting so do it manually
@ -223,7 +223,6 @@ class PackageGenerator:
})
self.component_num += 1
for f in cur_node.files:
file_source = os.path.join(current_dir, f).replace('\\', '\\\\')
file_id = os.path.join(current_dir, f).replace('\\', '_').replace('#', '_').replace('-', '_')
ET.SubElement(comp_xml_node, 'File', {
'Id': file_id,

@ -21,7 +21,6 @@ import tempfile
import textwrap
import os
import shutil
import sys
import unittest
from unittest import mock
from configparser import ConfigParser
@ -1360,9 +1359,9 @@ class AllPlatformTests(BasePlatformTests):
subprocess.check_call(['git', 'config',
'user.email', 'teh_coderz@example.com'], cwd=project_dir)
subprocess.check_call(['git', 'add', 'meson.build', 'distexe.c'], cwd=project_dir,
stdout=subprocess.DEVNULL)
stdout=subprocess.DEVNULL)
subprocess.check_call(['git', 'commit', '-a', '-m', 'I am a project'], cwd=project_dir,
stdout=subprocess.DEVNULL)
stdout=subprocess.DEVNULL)
try:
self.dist_impl(git_init)
@ -1503,7 +1502,6 @@ int main(int argc, char **argv) {
cmd += ['-c', source, '-o', objectfile] + extra_args
subprocess.check_call(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
def test_prebuilt_object(self):
(compiler, _, object_suffix, _) = self.detect_prebuild_env()
tdir = os.path.join(self.unit_test_dir, '14 prebuilt object')
@ -1995,8 +1993,8 @@ class FailureTests(BasePlatformTests):
env = Environment('', self.builddir, self.meson_command,
get_fake_options(self.prefix), [])
try:
objc = env.detect_objc_compiler(False)
objcpp = env.detect_objcpp_compiler(False)
env.detect_objc_compiler(False)
env.detect_objcpp_compiler(False)
except EnvironmentException:
code = "add_languages('objc')\nadd_languages('objcpp')"
self.assertMesonRaises(code, "Unknown compiler")

@ -1,6 +1,5 @@
#!/usr/bin/env python3
import os
import sys
import argparse

Loading…
Cancel
Save