summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-08-10 11:19:58 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2018-08-15 10:43:55 +0200
commit14dcc4a4f961bd6dd1d84ec858e0378cf43afa8b (patch)
tree356698c18599c17062e1f102b04f52558a94efc0 /giscanner
parentf2be65b417b7179f5490c0735d053bd466f7f317 (diff)
downloadgobject-introspection-14dcc4a4f961bd6dd1d84ec858e0378cf43afa8b.tar.gz
tests: depend on flake8 instead of including pep8/pyflakes
g-i includes an old version of pep8 and pyflakes and uses that during "make check". It (1) doesn't catch all cases newer versions of pycodestyle/pyflakes catch and (2) doesn't test all Python files (3) doesn't work with meson. Instead of updating just remove them and depend on flake8 instead. To run the checks simply run flake8 in the root dir. This also makes it possible to run those checks when using meson and not autotools. To not get test suite failures on flake8 updates move the checks from "make check" to an extra "make check.quality" target.
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/annotationmain.py3
-rw-r--r--giscanner/ast.py1
-rw-r--r--giscanner/ccompiler.py2
-rw-r--r--giscanner/docmain.py1
-rw-r--r--giscanner/docwriter.py1
-rw-r--r--giscanner/dumper.py1
-rw-r--r--giscanner/maintransformer.py5
-rw-r--r--giscanner/msvccompiler.py3
-rw-r--r--giscanner/scannermain.py3
-rw-r--r--giscanner/sourcescanner.py1
-rw-r--r--giscanner/transformer.py1
-rw-r--r--giscanner/utils.py5
-rwxr-xr-xgiscanner/xmlwriter.py1
13 files changed, 9 insertions, 19 deletions
diff --git a/giscanner/annotationmain.py b/giscanner/annotationmain.py
index c7be4f7c..eef0f035 100644
--- a/giscanner/annotationmain.py
+++ b/giscanner/annotationmain.py
@@ -29,7 +29,6 @@ import codecs
from contextlib import contextmanager
import giscanner
-from giscanner import message
from giscanner.annotationparser import GtkDocCommentBlockParser, GtkDocCommentBlockWriter
from giscanner.scannermain import (get_preprocessor_option_group,
create_source_scanner,
@@ -81,8 +80,6 @@ def annotation_main(args):
if options.packages:
process_packages(options, options.packages)
- logger = message.MessageLogger.get(namespace=None)
-
ss = create_source_scanner(options, args)
if options.extract:
diff --git a/giscanner/ast.py b/giscanner/ast.py
index a1a57cc2..a9a6e13b 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -202,6 +202,7 @@ class TypeUnknown(Type):
def __init__(self):
Type.__init__(self, _target_unknown=True)
+
# Fundamental types, two special ones
TYPE_NONE = Type(target_fundamental='none', ctype='void')
TYPE_ANY = Type(target_fundamental='gpointer', ctype='gpointer')
diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py
index b6b45e61..c0038285 100644
--- a/giscanner/ccompiler.py
+++ b/giscanner/ccompiler.py
@@ -212,8 +212,6 @@ class CCompiler(object):
def compile(self, pkg_config_cflags, cpp_includes, source, init_sections):
extra_postargs = []
includes = []
- source_str = ''.join(source)
- tmpdir_idx = source_str.rfind(os.sep, 0, source_str.rfind(os.sep))
(include_paths, macros, extra_args) = \
self._set_cpp_options(pkg_config_cflags)
diff --git a/giscanner/docmain.py b/giscanner/docmain.py
index f184014b..96d52750 100644
--- a/giscanner/docmain.py
+++ b/giscanner/docmain.py
@@ -24,7 +24,6 @@ from __future__ import print_function
from __future__ import unicode_literals
import os
-import sys
import argparse
import giscanner
diff --git a/giscanner/docwriter.py b/giscanner/docwriter.py
index d49446a0..4a8b94cc 100644
--- a/giscanner/docwriter.py
+++ b/giscanner/docwriter.py
@@ -1266,6 +1266,7 @@ class DevDocsFormatterGjs(DocFormatterGjs):
def format_in_parameters(self, node):
return ', '.join(p.argname for p in self.get_in_parameters(node))
+
LANGUAGES = {
"devdocs": {
"gjs": DevDocsFormatterGjs,
diff --git a/giscanner/dumper.py b/giscanner/dumper.py
index 494c7ff7..2c668f5a 100644
--- a/giscanner/dumper.py
+++ b/giscanner/dumper.py
@@ -29,7 +29,6 @@ import sys
import shlex
import subprocess
import tempfile
-from distutils.errors import LinkError
from .gdumpparser import IntrospectionBinary
from . import pkgconfig, utils
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index a7287ec2..2103e541 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -35,8 +35,7 @@ from .annotationparser import (ANN_ALLOW_NONE, ANN_ARRAY, ANN_ATTRIBUTES, ANN_CL
ANN_VFUNC, ANN_NULLABLE, ANN_OPTIONAL, ANN_NOT)
from .annotationparser import (OPT_ARRAY_FIXED_SIZE, OPT_ARRAY_LENGTH, OPT_ARRAY_ZERO_TERMINATED,
OPT_OUT_CALLEE_ALLOCATES, OPT_OUT_CALLER_ALLOCATES,
- OPT_TRANSFER_CONTAINER, OPT_TRANSFER_FLOATING, OPT_TRANSFER_NONE,
- OPT_NOT_NULLABLE)
+ OPT_TRANSFER_CONTAINER, OPT_TRANSFER_FLOATING, OPT_TRANSFER_NONE)
from .utils import to_underscores_noprefix
@@ -515,7 +514,7 @@ class MainTransformer(object):
initially_unowned_type = ast.Type(target_giname='GObject.InitiallyUnowned')
try:
initially_unowned = self._transformer.lookup_typenode(initially_unowned_type)
- except KeyError as e:
+ except KeyError:
message.error_node(node, "constructor found but GObject is not in includes")
return None
if initially_unowned and self._is_gi_subclass(typeval, initially_unowned_type):
diff --git a/giscanner/msvccompiler.py b/giscanner/msvccompiler.py
index 86049dad..d13eb808 100644
--- a/giscanner/msvccompiler.py
+++ b/giscanner/msvccompiler.py
@@ -21,8 +21,7 @@
import os
import distutils
-from distutils.errors import (DistutilsExecError, CompileError, LibError,
- LinkError, UnknownFileError)
+from distutils.errors import DistutilsExecError, CompileError
from distutils.ccompiler import CCompiler, gen_preprocess_options
from distutils.dep_util import newer
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
index e0af993a..ccb14e91 100644
--- a/giscanner/scannermain.py
+++ b/giscanner/scannermain.py
@@ -30,7 +30,6 @@ import optparse
import os
import shutil
import stat
-import subprocess
import sys
import tempfile
import platform
@@ -391,7 +390,7 @@ def create_transformer(namespace, options):
_error("Invalid include path '%s'" % (include, ))
try:
include_obj = Include.from_string(include)
- except:
+ except Exception:
_error("Malformed include '%s'\n" % (include, ))
transformer.register_include(include_obj)
for include_path in options.includes_uninstalled:
diff --git a/giscanner/sourcescanner.py b/giscanner/sourcescanner.py
index 0577ced8..aea05e65 100644
--- a/giscanner/sourcescanner.py
+++ b/giscanner/sourcescanner.py
@@ -25,7 +25,6 @@ from __future__ import print_function
from __future__ import unicode_literals
import os
-import subprocess
import tempfile
from .libtoolimporter import LibtoolImporter
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index c3187e82..335e229f 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -260,7 +260,6 @@ currently-scanned namespace is first."""
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
- _name = name
proc_name, err = proc.communicate(name.encode())
proc_name = proc_name.strip()
if proc.returncode:
diff --git a/giscanner/utils.py b/giscanner/utils.py
index 2feddab0..67d6a17f 100644
--- a/giscanner/utils.py
+++ b/giscanner/utils.py
@@ -55,6 +55,7 @@ def break_on_debug_flag(flag):
import pdb
pdb.set_trace()
+
# Copied from h2defs.py
_upperstr_pat1 = re.compile(r'([^A-Z])([A-Z])')
_upperstr_pat2 = re.compile(r'([A-Z][A-Z])([A-Z][0-9a-z])')
@@ -263,7 +264,7 @@ def get_user_cache_dir(dir=None):
xdg_cache_home = os.path.join(xdg_cache_home, dir)
try:
makedirs(xdg_cache_home, mode=0o755, exist_ok=True)
- except:
+ except EnvironmentError:
# Let's fall back to ~/.cache below
pass
else:
@@ -276,7 +277,7 @@ def get_user_cache_dir(dir=None):
cachedir = os.path.join(cachedir, dir)
try:
makedirs(cachedir, mode=0o755, exist_ok=True)
- except:
+ except EnvironmentError:
return None
else:
return cachedir
diff --git a/giscanner/xmlwriter.py b/giscanner/xmlwriter.py
index a65fc40c..099f9e1b 100755
--- a/giscanner/xmlwriter.py
+++ b/giscanner/xmlwriter.py
@@ -24,7 +24,6 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
-import os
import sys
from contextlib import contextmanager