From ef63f1311197b5376b3038aef18279649e6b91a3 Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Mon, 13 Apr 2020 13:54:55 +0200 Subject: [PATCH 1/2] Organises linter errors and check tests/ directory --- tox.ini | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/tox.ini b/tox.ini index 3c938cee9..5e5b8bbb1 100644 --- a/tox.ini +++ b/tox.ini @@ -16,10 +16,38 @@ commands = [testenv:pep8] deps = flake8 -commands = flake8 buildozer/ +commands = flake8 buildozer/ tests/ [flake8] ignore = - E121, E122, E123, E125, E126, E127, E128, E129, E131, E226, E231, E241, - E262, E265, E301, E302, E303, E305, E402, E501, E502, E722, E731, E741, - F401, F821, F841, W391, W504, W605 + E121, # continuation line under-indented for hanging indent + E122, # continuation line missing indentation or outdented + E123, # closing bracket does not match indentation of opening bracket's line + E125, # continuation line with same indent as next logical line + E126, # continuation line over-indented for hanging indent + E127, # continuation line over-indented for visual indent + E128, # continuation line under-indented for visual indent + E129, # visually indented line with same indent as next logical line + E131, # continuation line unaligned for hanging indent + E226, # missing whitespace around arithmetic operator + E231, # missing whitespace after ',' + E241, # multiple spaces after ',' + E262, # inline comment should start with '# ' + E265, # block comment should start with '# ' + E301, # expected 1 blank line, found 0 + E302, # expected 2 blank lines, found 1 + E303, # too many blank lines + E305, # expected 2 blank lines after class or function definition, found 1 + E402, # module level import not at top of file + E501, # line too long + E502, # the backslash is redundant between brackets + E722, # do not use bare 'except' + E731, # do not assign a lambda expression, use a def + E741, # ambiguous variable name + F401, # imported but unused + F821, # undefined name + F841, # local variable is assigned to but never used + W391, # blank line at end of file + W503, # line break before binary operator + W504, # line break after binary operator + W605 # invalid escape sequence From 6b03c54832606a31a14f92c447c45c15611d95f7 Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Mon, 13 Apr 2020 14:23:03 +0200 Subject: [PATCH 2/2] PEP8 fixes - E129 visually indented line with same indent as next logical line - E226 missing whitespace around arithmetic operator - E241 multiple spaces after ',' - E262 inline comment should start with '# ' - E301 expected 1 blank line, found 0 - E303 too many blank lines - E502 the backslash is redundant between bracket - E741 ambiguous variable name - W391 blank line at end of file --- buildozer/__init__.py | 3 --- buildozer/jsonstore.py | 1 - buildozer/targets/android.py | 26 ++++++++++++-------------- buildozer/targets/osx.py | 6 +++--- tox.ini | 9 --------- 5 files changed, 15 insertions(+), 30 deletions(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index 9ffef8441..5e7f73604 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -940,7 +940,6 @@ def package_full_name(self): return package_name return '{}.{}'.format(package_domain, package_name) - # # command line invocation # @@ -1198,8 +1197,6 @@ def _merge_config_profile(self): value, section_base, profile)) self.config.set(section_base, name, value) - - def _get_config_list_values(self, *args, **kwargs): kwargs['with_values'] = True return self._get_config_list(*args, **kwargs) diff --git a/buildozer/jsonstore.py b/buildozer/jsonstore.py index a70d5c44b..fb1ce96de 100644 --- a/buildozer/jsonstore.py +++ b/buildozer/jsonstore.py @@ -53,4 +53,3 @@ def sync(self): else: with io.open(self.filename, 'w', encoding='utf-8') as fd: fd.write(unicode(dumps(self.data, ensure_ascii=False))) - diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 94f37a941..b03f51a70 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -328,13 +328,12 @@ def _set_win32_java_home(self): import _winreg with _winreg.OpenKey( _winreg.HKEY_LOCAL_MACHINE, - r"SOFTWARE\JavaSoft\Java Development Kit") as jdk: #@UndefinedVariable + r"SOFTWARE\JavaSoft\Java Development Kit") as jdk: # @UndefinedVariable current_version, _type = _winreg.QueryValueEx( - jdk, "CurrentVersion") #@UndefinedVariable - with _winreg.OpenKey(jdk, - current_version) as cv: #@UndefinedVariable + jdk, "CurrentVersion") # @UndefinedVariable + with _winreg.OpenKey(jdk, current_version) as cv: # @UndefinedVariable java_home, _type = _winreg.QueryValueEx( - cv, "JavaHome") #@UndefinedVariable + cv, "JavaHome") # @UndefinedVariable self.buildozer.environ['JAVA_HOME'] = java_home def _locate_java(self, s): @@ -518,7 +517,6 @@ def _android_get_installed_platform_tools_version(self): return revision - def _android_update_sdk(self, *sdkmanager_commands): """Update the tools and package-tools if possible""" auto_accept_license = self.buildozer.config.getbooldefault( @@ -922,7 +920,7 @@ def cmd_run(self, *args): entrypoint = self.buildozer.config.getdefault( 'app', 'android.entrypoint') if not entrypoint: - self.buildozer.config.set('app', 'android.entrypoint', 'org.kivy.android.PythonActivity') + self.buildozer.config.set('app', 'android.entrypoint', 'org.kivy.android.PythonActivity') super(TargetAndroid, self).cmd_run(*args) @@ -995,11 +993,11 @@ def build_package(self): # add extra libs/armeabi files in dist/default/libs/armeabi # (same for armeabi-v7a, arm64-v8a, x86, mips) for config_key, lib_dir in ( - ('android.add_libs_armeabi', 'armeabi'), - ('android.add_libs_armeabi_v7a', 'armeabi-v7a'), - ('android.add_libs_arm64_v8a', 'arm64-v8a'), - ('android.add_libs_x86', 'x86'), - ('android.add_libs_mips', 'mips')): + ('android.add_libs_armeabi', 'armeabi'), + ('android.add_libs_armeabi_v7a', 'armeabi-v7a'), + ('android.add_libs_arm64_v8a', 'arm64-v8a'), + ('android.add_libs_x86', 'x86'), + ('android.add_libs_mips', 'mips')): patterns = config.getlist('app', config_key, []) if not patterns: @@ -1289,10 +1287,10 @@ def serials(self): serial = environ.get('ANDROID_SERIAL') if serial: return serial.split(',') - l = self.buildozer.cmd('{} devices'.format(self.adb_cmd), + lines = self.buildozer.cmd('{} devices'.format(self.adb_cmd), get_stdout=True)[0].splitlines() serials = [] - for serial in l: + for serial in lines: if not serial: continue if serial.startswith('*') or serial.startswith('List '): diff --git a/buildozer/targets/osx.py b/buildozer/targets/osx.py index 816842b92..45c15863e 100644 --- a/buildozer/targets/osx.py +++ b/buildozer/targets/osx.py @@ -35,7 +35,7 @@ def ensure_sdk(self): if exists( join(self.buildozer.platform_dir, 'kivy-sdk-packager-master')): self.buildozer.info( - 'kivy-sdk-packager found at '\ + 'kivy-sdk-packager found at ' '{}'.format(self.buildozer.platform_dir)) return @@ -62,7 +62,7 @@ def download_kivy(self, cwd, py_branch=2): self.buildozer.info('Downloading kivy...') status_code = check_output( ('curl', '-L', '--write-out', '%{http_code}', '-o', 'Kivy{}.dmg'.format(py_branch), - 'http://kivy.org/downloads/{}/Kivy-{}-osx-python{}.dmg'\ + 'http://kivy.org/downloads/{}/Kivy-{}-osx-python{}.dmg' .format(current_kivy_vers, current_kivy_vers, py_branch)), cwd=cwd) @@ -162,7 +162,7 @@ def build_package(self): self.buildozer.user_build_dir or dirname(abspath(self.buildozer.specfilename)), 'bin') check_output( - ('cp', '-a', package_name+'.dmg', binpath), + ('cp', '-a', package_name + '.dmg', binpath), cwd=cwd) self.buildozer.info('All Done!') diff --git a/tox.ini b/tox.ini index 5e5b8bbb1..e112d6e9b 100644 --- a/tox.ini +++ b/tox.ini @@ -27,27 +27,18 @@ ignore = E126, # continuation line over-indented for hanging indent E127, # continuation line over-indented for visual indent E128, # continuation line under-indented for visual indent - E129, # visually indented line with same indent as next logical line E131, # continuation line unaligned for hanging indent - E226, # missing whitespace around arithmetic operator E231, # missing whitespace after ',' - E241, # multiple spaces after ',' - E262, # inline comment should start with '# ' E265, # block comment should start with '# ' - E301, # expected 1 blank line, found 0 E302, # expected 2 blank lines, found 1 - E303, # too many blank lines E305, # expected 2 blank lines after class or function definition, found 1 E402, # module level import not at top of file E501, # line too long - E502, # the backslash is redundant between brackets E722, # do not use bare 'except' E731, # do not assign a lambda expression, use a def - E741, # ambiguous variable name F401, # imported but unused F821, # undefined name F841, # local variable is assigned to but never used - W391, # blank line at end of file W503, # line break before binary operator W504, # line break after binary operator W605 # invalid escape sequence