Skip to content

Commit 45bf09e

Browse files
committed
Initial fixes for python3
1 parent e615db6 commit 45bf09e

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

pythonforandroid/recipes/python2/__init__.py

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ def prebuild_armeabi(self):
1717
print('Python2 already patched, skipping.')
1818
return
1919
self.apply_patch(join('patches', 'Python-{}-xcompile.patch'.format(self.version)))
20-
self.apply_patch(join('patches', 'disable-modules.patch'))
21-
self.apply_patch(join('patches', 'fix-locale.patch'))
22-
self.apply_patch(join('patches', 'fix-gethostbyaddr.patch'))
23-
self.apply_patch(join('patches', 'fix-setup-flags.patch'))
24-
self.apply_patch(join('patches', 'fix-filesystemdefaultencoding.patch'))
25-
self.apply_patch(join('patches', 'fix-termios.patch'))
26-
self.apply_patch(join('patches', 'custom-loader.patch'))
27-
self.apply_patch(join('patches', 'verbose-compilation.patch'))
28-
self.apply_patch(join('patches', 'fix-remove-corefoundation.patch'))
29-
self.apply_patch(join('patches', 'fix-dynamic-lookup.patch'))
30-
self.apply_patch(join('patches', 'fix-dlfcn.patch'))
20+
self.apply_patch(join('patches', 'disable-modules.patch'))
21+
self.apply_patch(join('patches', 'fix-locale.patch'))
22+
self.apply_patch(join('patches', 'fix-gethostbyaddr.patch'))
23+
self.apply_patch(join('patches', 'fix-setup-flags.patch'))
24+
self.apply_patch(join('patches', 'fix-filesystemdefaultencoding.patch'))
25+
self.apply_patch(join('patches', 'fix-termios.patch'))
26+
self.apply_patch(join('patches', 'custom-loader.patch'))
27+
self.apply_patch(join('patches', 'verbose-compilation.patch'))
28+
self.apply_patch(join('patches', 'fix-remove-corefoundation.patch'))
29+
self.apply_patch(join('patches', 'fix-dynamic-lookup.patch'))
30+
self.apply_patch(join('patches', 'fix-dlfcn.patch'))
3131

3232
if uname()[0] == 'Linux':
3333
self.apply_patch(join('patches', 'fix-configure-darwin.patch'))
@@ -55,7 +55,7 @@ def build_armeabi(self):
5555

5656
with current_directory(self.get_build_dir('armeabi')):
5757

58-
58+
5959
hostpython_recipe = Recipe.get_recipe('hostpython2', self.ctx)
6060
shprint(sh.cp, join(hostpython_recipe.get_recipe_dir(), 'Setup'), 'Modules')
6161

@@ -88,7 +88,7 @@ def build_armeabi(self):
8888
_env=env)
8989
except sh.ErrorReturnCode_2:
9090
print('First python2 make failed. This is expected, trying again.')
91-
91+
9292

9393
print('Second install (expected to work)')
9494
shprint(sh.touch, 'python.exe', 'python')
@@ -113,8 +113,8 @@ def build_armeabi(self):
113113
'python.host'))
114114
self.ctx.hostpython = join(self.ctx.build_dir, 'python-install',
115115
'bin', 'python.host')
116-
117-
116+
117+
118118
# reduce python?
119119
for dir_name in ('test', join('json', 'tests'), 'lib-tk',
120120
join('sqlite3', 'test'), join('unittest, test'),
@@ -123,11 +123,6 @@ def build_armeabi(self):
123123
'curses'):
124124
shprint(sh.rm, '-rf', join(self.ctx.build_dir, 'python-install',
125125
'lib', 'python2.7', dir_name))
126-
127-
128-
129-
130-
131126

132127

133128
recipe = Python2Recipe()

pythonforandroid/toolchain.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,8 +1409,11 @@ def prepare_build_dir(self, arch):
14091409

14101410
@classmethod
14111411
def list_recipes(cls):
1412+
forbidden_dirs = ('__pycache__', )
14121413
recipes_dir = join(dirname(__file__), "recipes")
14131414
for name in listdir(recipes_dir):
1415+
if name in forbidden_dirs:
1416+
continue
14141417
fn = join(recipes_dir, name)
14151418
if isdir(fn):
14161419
yield name
@@ -1424,6 +1427,7 @@ def get_recipe(cls, name, ctx):
14241427
mod = importlib.import_module("pythonforandroid.recipes.{}".format(name))
14251428
if len(logger.handlers) > 1:
14261429
logger.removeHandler(logger.handlers[1])
1430+
print('mod is', mod)
14271431
recipe = mod.recipe
14281432
recipe.recipe_dir = join(ctx.root_dir, "recipes", name)
14291433
recipe.ctx = ctx
@@ -2057,11 +2061,15 @@ def recipes(self, args):
20572061
ctx = self.ctx
20582062
for name in Recipe.list_recipes():
20592063
recipe = Recipe.get_recipe(name, ctx)
2064+
print('recipe is', recipe, recipe.name, recipe.version)
2065+
print(type(recipe.name), type(recipe.version))
2066+
version = str(recipe.version)
20602067
if args.color:
20612068
print('{Fore.BLUE}{Style.BRIGHT}{recipe.name:<12} '
20622069
'{Style.RESET_ALL}{Fore.LIGHTBLUE_EX}'
2063-
'{recipe.version:<8}{Style.RESET_ALL}'.format(
2064-
recipe=recipe, Fore=Fore, Style=Style))
2070+
'{version:<8}{Style.RESET_ALL}'.format(
2071+
recipe=recipe, Fore=Fore, Style=Style,
2072+
version=version))
20652073
print(' {Fore.GREEN}depends: {recipe.depends}'
20662074
'{Fore.RESET}'.format(recipe=recipe, Fore=Fore))
20672075
if recipe.conflicts:

0 commit comments

Comments
 (0)