Skip to content

Commit

Permalink
Merge pull request kivy#1065 from AndreMiras/feature/linting_organisa…
Browse files Browse the repository at this point in the history
…tion_and_fixes

Linting organisation and fixes
  • Loading branch information
AndreMiras authored Apr 13, 2020
2 parents 556724f + 6b03c54 commit 58774d8
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 25 deletions.
3 changes: 0 additions & 3 deletions buildozer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,6 @@ def package_full_name(self):
return package_name
return '{}.{}'.format(package_domain, package_name)


#
# command line invocation
#
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion buildozer/jsonstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))

26 changes: 12 additions & 14 deletions buildozer/targets/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 '):
Expand Down
6 changes: 3 additions & 3 deletions buildozer/targets/osx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)

Expand Down Expand Up @@ -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!')

Expand Down
27 changes: 23 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,29 @@ 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
E131, # continuation line unaligned for hanging indent
E231, # missing whitespace after ','
E265, # block comment should start with '# '
E302, # expected 2 blank lines, found 1
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
E722, # do not use bare 'except'
E731, # do not assign a lambda expression, use a def
F401, # imported but unused
F821, # undefined name
F841, # local variable is assigned to but never used
W503, # line break before binary operator
W504, # line break after binary operator
W605 # invalid escape sequence

0 comments on commit 58774d8

Please sign in to comment.