Skip to content

Commit 9cd161e

Browse files
committed
Made flake8 fixes
1 parent f113131 commit 9cd161e

File tree

9 files changed

+27
-30
lines changed

9 files changed

+27
-30
lines changed

pythonforandroid/bootstrap.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from os import listdir
33
import sh
44
import glob
5-
import json
65
import importlib
76

87
from pythonforandroid.logger import (warning, shprint, info, logger,
@@ -246,12 +245,12 @@ def strip_libraries(self, arch):
246245

247246
if self.ctx.python_recipe.name == 'python2':
248247
filens = shprint(sh.find, join(self.dist_dir, 'private'),
249-
join(self.dist_dir, 'libs'),
250-
'-iname', '*.so', _env=env).stdout.decode('utf-8')
248+
join(self.dist_dir, 'libs'),
249+
'-iname', '*.so', _env=env).stdout.decode('utf-8')
251250
else:
252251
filens = shprint(sh.find, join(self.dist_dir, '_python_bundle', '_python_bundle', 'modules'),
253-
join(self.dist_dir, 'libs'),
254-
'-iname', '*.so', _env=env).stdout.decode('utf-8')
252+
join(self.dist_dir, 'libs'),
253+
'-iname', '*.so', _env=env).stdout.decode('utf-8')
255254
logger.info('Stripping libraries in private dir')
256255
for filen in filens.split('\n'):
257256
try:

pythonforandroid/bootstraps/sdl2/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
from pythonforandroid.toolchain import (
22
Bootstrap, shprint, current_directory, info, info_main)
33
from pythonforandroid.util import ensure_dir
4-
from os.path import join, exists, curdir, abspath
5-
from os import walk
6-
import os
4+
from os.path import join, exists
75
import sh
86

97

pythonforandroid/bootstraps/sdl2/build/build.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -544,18 +544,16 @@ def parse_args(args=None):
544544

545545
if ndk_api != args.min_sdk_version:
546546
print(('WARNING: --minsdk argument does not match the api that is '
547-
'compiled against. Only proceed if you know what you are '
548-
'doing, otherwise use --minsdk={} or recompile against api '
549-
'{}').format(ndk_api, args.min_sdk_version))
547+
'compiled against. Only proceed if you know what you are '
548+
'doing, otherwise use --minsdk={} or recompile against api '
549+
'{}').format(ndk_api, args.min_sdk_version))
550550
if not args.allow_minsdk_ndkapi_mismatch:
551551
print('You must pass --allow-minsdk-ndkapi-mismatch to build '
552-
'with --minsdk different to the target NDK api from the '
553-
'build step')
552+
'with --minsdk different to the target NDK api from the '
553+
'build step')
554554
exit(1)
555555
else:
556556
print('Proceeding with --minsdk not matching build target api')
557-
558-
559557

560558
if args.sdk_version != -1:
561559
print('WARNING: Received a --sdk argument, but this argument is '

pythonforandroid/recipe.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,7 @@ def get_recipe_env(self, arch, with_flags_in_cc=True):
10351035

10361036
return env
10371037

1038+
10381039
class TargetPythonRecipe(Recipe):
10391040
'''Class for target python recipes. Sets ctx.python_recipe to point to
10401041
itself, so as to know later what kind of Python was built or used.'''

pythonforandroid/recipes/hostpython3/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
from pythonforandroid.toolchain import Recipe, shprint, info, warning
1+
from pythonforandroid.toolchain import Recipe, shprint, info
22
from pythonforandroid.util import ensure_dir, current_directory
33
from os.path import join, exists
4-
import os
54
import sh
65

76

@@ -45,4 +44,5 @@ def build_arch(self, arch):
4544

4645
self.ctx.hostpython = join(build_dir, 'python')
4746

47+
4848
recipe = Hostpython3Recipe()

pythonforandroid/recipes/python2/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
EXCLUDE_EXTS = (".py", ".pyc", ".so.o", ".so.a", ".so.libs", ".pyx")
1111

12+
1213
class Python2Recipe(TargetPythonRecipe):
1314
version = "2.7.2"
1415
url = 'https://python.org/ftp/python/{version}/Python-{version}.tar.bz2'
@@ -187,7 +188,7 @@ def create_python_bundle(self, dirn, arch):
187188
shprint(sh.mv, libpymodules_fn, dirn)
188189
shprint(sh.cp,
189190
join('python-install', 'include',
190-
'python2.7', 'pyconfig.h'),
191+
'python2.7', 'pyconfig.h'),
191192
join(dirn, 'include', 'python2.7/'))
192193

193194
info('Removing some unwanted files')
@@ -220,4 +221,5 @@ def include_root(self, arch_name):
220221
def link_root(self, arch_name):
221222
return join(self.get_build_dir(arch_name), 'python-install', 'lib')
222223

224+
223225
recipe = Python2Recipe()

pythonforandroid/recipes/python3/__init__.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
from pythonforandroid.recipe import TargetPythonRecipe, Recipe
1+
from pythonforandroid.recipe import TargetPythonRecipe
22
from pythonforandroid.toolchain import shprint, current_directory
3-
from pythonforandroid.patching import (is_darwin, is_api_gt,
4-
check_all, is_api_lt, is_ndk)
53
from pythonforandroid.logger import logger, info
64
from pythonforandroid.util import ensure_dir, walk_valid_filens
7-
from os.path import exists, join, realpath, dirname
8-
from os import environ, listdir, walk
5+
from os.path import exists, join, dirname
6+
from os import environ
97
import glob
108
import sh
119

12-
1310
STDLIB_DIR_BLACKLIST = {
1411
'__pycache__',
1512
'test',
@@ -46,7 +43,7 @@ class Python3Recipe(TargetPythonRecipe):
4643

4744
def build_arch(self, arch):
4845
recipe_build_dir = self.get_build_dir(arch.arch)
49-
46+
5047
# Create a subdirectory to actually perform the build
5148
build_dir = join(recipe_build_dir, 'android-build')
5249
ensure_dir(build_dir)

pythonforandroid/recipes/python3crystax/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Python3CrystaXRecipe(TargetPythonRecipe):
2222
from_crystax = True
2323

2424
def get_dir_name(self):
25-
name = super(Python3Recipe, self).get_dir_name()
25+
name = super(Python3CrystaXRecipe, self).get_dir_name()
2626
name += '-version{}'.format(self.version)
2727
return name
2828

@@ -77,11 +77,11 @@ def create_python_bundle(self, dirn, arch):
7777
ndk_dir = self.ctx.ndk_dir
7878
py_recipe = self.ctx.python_recipe
7979
python_dir = join(ndk_dir, 'sources', 'python',
80-
py_recipe.version, 'libs', arch.arch)
80+
py_recipe.version, 'libs', arch.arch)
8181
shprint(sh.cp, '-r', join(python_dir,
82-
'stdlib.zip'), dirn)
82+
'stdlib.zip'), dirn)
8383
shprint(sh.cp, '-r', join(python_dir,
84-
'modules'), dirn)
84+
'modules'), dirn)
8585
shprint(sh.cp, '-r', self.ctx.get_python_install_dir(),
8686
join(dirn, 'site-packages'))
8787

@@ -98,4 +98,5 @@ def link_root(self, arch_name):
9898
return join(self.ctx.ndk_dir, 'sources', 'python', self.major_minor_version_string,
9999
'libs', arch_name)
100100

101+
101102
recipe = Python3CrystaXRecipe()

pythonforandroid/util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ def is_exe(fpath):
126126

127127
return None
128128

129+
129130
def walk_valid_filens(base_dir, invalid_dir_names, invalid_file_patterns):
130131
"""Recursively walks all the files and directories in ``dirn``,
131132
ignoring directories that match any pattern in ``invalid_dirns``
@@ -138,7 +139,7 @@ def walk_valid_filens(base_dir, invalid_dir_names, invalid_file_patterns):
138139
139140
File and directory paths are evaluated as full paths relative to ``dirn``.
140141
141-
"""
142+
"""
142143

143144
for dirn, subdirs, filens in walk(base_dir):
144145

0 commit comments

Comments
 (0)