Skip to content

Linter fixes E111, E116, E122, E202, E225, E241... #1397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pythonforandroid/archs.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_env(self, with_flags_in_cc=True):
env['CFLAGS'] = ' '.join([
'-DANDROID', '-mandroid', '-fomit-frame-pointer'
' -D__ANDROID_API__={}'.format(self.ctx._android_api),
])
])
env['LDFLAGS'] = ' '

sysroot = join(self.ctx._ndk_dir, 'sysroot')
Expand Down
12 changes: 6 additions & 6 deletions pythonforandroid/bootstraps/sdl2/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def make_package(args):
url_scheme=url_scheme,
private_version=str(time.time()))

## gradle build templates
# gradle build templates
render(
'build.tmpl.gradle',
'build.gradle',
Expand All @@ -388,7 +388,7 @@ def make_package(args):
android_api=android_api,
build_tools_version=build_tools_version)

## ant build templates
# ant build templates
render(
'build.tmpl.xml',
'build.xml',
Expand Down Expand Up @@ -418,10 +418,10 @@ def parse_args(args=None):
tools directory of the Android SDK.
''')

# `required=True` for launcher, crashes in make_package
# if not mentioned (and the check is there anyway)
ap.add_argument('--private', dest='private',
help='the dir of user files')
# , required=True) for launcher, crashes in make_package
# if not mentioned (and the check is there anyway)
ap.add_argument('--package', dest='package',
help=('The name of the java package the project will be'
' packaged under.'),
Expand Down Expand Up @@ -486,8 +486,8 @@ def parse_args(args=None):
ap.add_argument('--depend', dest='depends', action='append',
help=('Add a external dependency '
'(eg: com.android.support:appcompat-v7:19.0.1)'))
## The --sdk option has been removed, it is ignored in favour of
## --android-api handled by toolchain.py
# The --sdk option has been removed, it is ignored in favour of
# --android-api handled by toolchain.py
ap.add_argument('--sdk', dest='sdk_version', default=-1,
type=int, help=('Deprecated argument, does nothing'))
ap.add_argument('--minsdk', dest='min_sdk_version',
Expand Down
1 change: 0 additions & 1 deletion pythonforandroid/graph.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from copy import deepcopy
from itertools import product
from sys import exit
Expand Down
4 changes: 2 additions & 2 deletions pythonforandroid/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,8 @@ def clean_build(self, arch=None):
if exists(base_dir):
dirs.append(base_dir)
if not dirs:
warning(('Attempted to clean build for {} but found no existing '
'build dirs').format(self.name))
warning(('Attempted to clean build for {} but found no existing '
'build dirs').format(self.name))

for directory in dirs:
if exists(directory):
Expand Down
2 changes: 1 addition & 1 deletion pythonforandroid/recipes/android/src/android/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
'''

# legacy import
from android._android import * # noqa: F401
from android._android import * # noqa: F401, F403
3 changes: 2 additions & 1 deletion pythonforandroid/recipes/android/src/android/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

_callbacks = {
'on_new_intent': [],
'on_activity_result': [] }
'on_activity_result': [],
}


class NewIntentListener(PythonJavaClass):
Expand Down
7 changes: 4 additions & 3 deletions pythonforandroid/recipes/flask/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@


class FlaskRecipe(PythonRecipe):
version = '0.10.1' # The webserver of 'master' seems to fail
# after a little while on Android, so use
# 0.10.1 at least for now
# The webserver of 'master' seems to fail
# after a little while on Android, so use
# 0.10.1 at least for now
version = '0.10.1'
url = 'https://github.com/pallets/flask/archive/{version}.zip'

depends = [('python2', 'python3crystax'), 'setuptools', 'genericndkbuild']
Expand Down
4 changes: 2 additions & 2 deletions pythonforandroid/recipes/libffi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def build_arch(self, arch):
'--host=' + arch.toolchain_prefix,
'--prefix=' + self.ctx.get_python_install_dir(),
'--enable-shared', _env=env)
#'--with-sysroot={}'.format(self.ctx.ndk_platform),
#'--target={}'.format(arch.toolchain_prefix),
# '--with-sysroot={}'.format(self.ctx.ndk_platform),
# '--target={}'.format(arch.toolchain_prefix),

# ndk 15 introduces unified headers required --sysroot and
# -isysroot for libraries and headers. libtool's head explodes
Expand Down
4 changes: 2 additions & 2 deletions pythonforandroid/recipes/libgeos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class LibgeosRecipe(Recipe):
version = '3.5'
#url = 'http://download.osgeo.org/geos/geos-{version}.tar.bz2'
# url = 'http://download.osgeo.org/geos/geos-{version}.tar.bz2'
url = 'https://github.com/libgeos/libgeos/archive/svn-{version}.zip'
depends = ['python2']

Expand All @@ -23,7 +23,7 @@ def build_arch(self, arch):
bash = sh.Command('bash')
print("If this fails make sure you have autoconf and libtool installed")
shprint(bash, 'autogen.sh') # Requires autoconf and libtool
shprint(bash, 'configure', '--host=arm-linux-androideabi', '--enable-shared', '--prefix={}'.format(dst_dir), _env=env)
shprint(bash, 'configure', '--host=arm-linux-androideabi', '--enable-shared', '--prefix={}'.format(dst_dir), _env=env)
shprint(sh.make, '-j', str(cpu_count()), _env=env)
shprint(sh.make, 'install', _env=env)
shutil.copyfile('{}/lib/libgeos_c.so'.format(dst_dir), join(self.ctx.get_libs_dir(arch.arch), 'libgeos_c.so'))
Expand Down
2 changes: 1 addition & 1 deletion pythonforandroid/recipes/opencv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class OpenCVRecipe(NDKRecipe):
version = '2.4.10.1'
url = 'https://github.com/Itseez/opencv/archive/{version}.zip'
#md5sum = '2ddfa98e867e6611254040df841186dc'
# md5sum = '2ddfa98e867e6611254040df841186dc'
depends = ['numpy']
patches = ['patches/p4a_build-2.4.10.1.patch']
generated_libraries = ['cv2.so']
Expand Down
20 changes: 10 additions & 10 deletions pythonforandroid/recipes/python2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,23 @@ def do_python_build(self, arch):
# TODO need to add a should_build that checks if optional
# dependencies have changed (possibly in a generic way)
if 'openssl' in self.ctx.recipe_build_order:
r = Recipe.get_recipe('openssl', self.ctx)
openssl_build_dir = r.get_build_dir(arch.arch)
recipe = Recipe.get_recipe('openssl', self.ctx)
openssl_build_dir = recipe.get_build_dir(arch.arch)
setuplocal = join('Modules', 'Setup.local')
shprint(sh.cp, join(self.get_recipe_dir(), 'Setup.local-ssl'), setuplocal)
shprint(sh.sed, '-i.backup', 's#^SSL=.*#SSL={}#'.format(openssl_build_dir), setuplocal)
env['OPENSSL_VERSION'] = r.version
env['OPENSSL_VERSION'] = recipe.version

if 'sqlite3' in self.ctx.recipe_build_order:
# Include sqlite3 in python2 build
r = Recipe.get_recipe('sqlite3', self.ctx)
i = ' -I' + r.get_build_dir(arch.arch)
l = ' -L' + r.get_lib_dir(arch) + ' -lsqlite3'
recipe = Recipe.get_recipe('sqlite3', self.ctx)
include = ' -I' + recipe.get_build_dir(arch.arch)
lib = ' -L' + recipe.get_lib_dir(arch) + ' -lsqlite3'
# Insert or append to env
f = 'CPPFLAGS'
env[f] = env[f] + i if f in env else i
f = 'LDFLAGS'
env[f] = env[f] + l if f in env else l
flag = 'CPPFLAGS'
env[flag] = env[flag] + include if flag in env else include
flag = 'LDFLAGS'
env[flag] = env[flag] + lib if flag in env else lib

# NDK has langinfo.h but doesn't define nl_langinfo()
env['ac_cv_header_langinfo_h'] = 'no'
Expand Down
3 changes: 2 additions & 1 deletion pythonforandroid/recipes/reportlab/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os, sh
import os
import sh
from pythonforandroid.recipe import CompiledComponentsPythonRecipe
from pythonforandroid.util import (current_directory, ensure_dir)
from pythonforandroid.logger import (info, shprint)
Expand Down
4 changes: 2 additions & 2 deletions pythonforandroid/recipes/vlc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def build_arch(self, arch):
info("compiling vlc from sources")
debug("environment: {}".format(env))
if not isfile(join('bin', 'VLC-debug.apk')):
shprint(sh.Command('./compile.sh'), _env=env,
_tail=50, _critical=True)
shprint(sh.Command('./compile.sh'), _env=env,
_tail=50, _critical=True)
shprint(sh.Command('./compile-libvlc.sh'), _env=env,
_tail=50, _critical=True)
shprint(sh.cp, '-a', aar, self.ctx.aars_dir)
Expand Down
6 changes: 3 additions & 3 deletions pythonforandroid/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def add_parser(subparsers, *args, **kwargs):
action='store_true',
help='If passed, do not delete existing dists')

parser_clean_download_cache= add_parser(
parser_clean_download_cache = add_parser(
subparsers,
'clean_download_cache', aliases=['clean-download-cache'],
help='Delete cached downloads for requirement builds',
Expand Down Expand Up @@ -584,8 +584,8 @@ def recipes(self, args):
print('{Fore.BLUE}{Style.BRIGHT}{recipe.name:<12} '
'{Style.RESET_ALL}{Fore.LIGHTBLUE_EX}'
'{version:<8}{Style.RESET_ALL}'.format(
recipe=recipe, Fore=Out_Fore, Style=Out_Style,
version=version))
recipe=recipe, Fore=Out_Fore, Style=Out_Style,
version=version))
print(' {Fore.GREEN}depends: {recipe.depends}'
'{Fore.RESET}'.format(recipe=recipe, Fore=Out_Fore))
if recipe.conflicts:
Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ commands = flake8 pythonforandroid/ tests/

[flake8]
ignore =
E111, E116, E202, E121, E123, E124, E225, E126,
E226, E241, E265, E266,
E401, E402, E501, E502, E722, E741, F403,
F812, F841, F811, W292, W503
E123, E124, E126,
E226,
E402, E501, E722,
F812, F841, W503