Skip to content

Commit 6fc0aa8

Browse files
author
gabriel pettier
committed
some more cleanup
1 parent bc452e8 commit 6fc0aa8

File tree

1 file changed

+27
-23
lines changed

1 file changed

+27
-23
lines changed

pythonforandroid/toolchain.py

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212
from sys import stdout, platform
1313
from os.path import (join, dirname, realpath, exists, isdir, basename,
1414
expanduser)
15-
from os import listdir, unlink, makedirs, environ, chdir, getcwd, walk, uname
15+
from os import listdir, unlink, makedirs, environ, chdir, getcwd, uname
1616
import os
1717
import zipfile
18-
import tarfile
1918
import importlib
2019
import io
2120
import json
@@ -546,11 +545,12 @@ class Context(object):
546545
env = environ.copy()
547546
root_dir = None # the filepath of toolchain.py
548547
storage_dir = None # the root dir where builds and dists will be stored
549-
build_dir = None # in which bootstraps are copied for building and
550-
# recipes are built
548+
# in which bootstraps are copied for building and recipes are built
549+
build_dir = None
551550
dist_dir = None # the Android project folder where everything ends up
552-
libs_dir = None # where Android libs are cached after build but
553-
# before being placed in dists
551+
# where Android libs are cached after build but before being placed
552+
# in dists
553+
libs_dir = None
554554
javaclass_dir = None
555555
ccache = None # whether to use ccache
556556
cython = None # the cython interpreter name
@@ -692,8 +692,8 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
692692
sdk_dir = environ.get('ANDROIDSDK', None)
693693
if sdk_dir is None: # This seems used more conventionally
694694
sdk_dir = environ.get('ANDROID_HOME', None)
695-
if sdk_dir is None: # Checks in the buildozer SDK dir, useful
696-
# for debug tests of p4a
695+
# Checks in the buildozer SDK dir, useful for debug tests of p4a
696+
if sdk_dir is None:
697697
possible_dirs = glob.glob(expanduser(join(
698698
'~', '.buildozer', 'android', 'platform', 'android-sdk-*')))
699699
if possible_dirs:
@@ -763,8 +763,8 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
763763
ndk_dir = environ.get('ANDROID_NDK_HOME', None)
764764
if ndk_dir is not None:
765765
info('Found NDK dir in $ANDROID_NDK_HOME')
766-
if ndk_dir is None: # Checks in the buildozer NDK dir, useful
767-
# for debug tests of p4a
766+
# Checks in the buildozer NDK dir, useful for debug tests of p4a
767+
if ndk_dir is None:
768768
possible_dirs = glob.glob(expanduser(join(
769769
'~', '.buildozer', 'android', 'platform', 'android-ndk-r*')))
770770
if possible_dirs:
@@ -1373,7 +1373,8 @@ class Recipe(object):
13731373

13741374
version = None
13751375
'''A string giving the version of the software the recipe describes,
1376-
e.g. ``2.0.3`` or ``master``.'''
1376+
e.g. ``2.0.3`` or ``master``.
1377+
'''
13771378

13781379
md5sum = None
13791380
'''The md5sum of the source from the :attr:`url`. Non-essential, but
@@ -1387,11 +1388,13 @@ class Recipe(object):
13871388

13881389
conflicts = []
13891390
'''A list containing the names of any recipes that are known to be
1390-
incompatible with this one.'''
1391+
incompatible with this one.
1392+
'''
13911393

13921394
opt_depends = []
13931395
'''A list of optional dependencies, that must be built before this
1394-
recipe if they are built at all, but whose presence is not essential.'''
1396+
recipe if they are built at all, but whose presence is not essential.
1397+
'''
13951398

13961399
archs = ['armeabi'] # Not currently implemented properly
13971400

@@ -1706,7 +1709,8 @@ def unpack(self, arch):
17061709
extraction_filename = join(
17071710
self.ctx.packages_path, self.name, filename)
17081711
if os.path.isfile(extraction_filename):
1709-
if (extraction_filename.endswith('.tar.gz') or
1712+
if (
1713+
extraction_filename.endswith('.tar.gz') or
17101714
extraction_filename.endswith('.tgz')
17111715
):
17121716
sh.tar('xzf', extraction_filename)
@@ -2292,7 +2296,7 @@ def biglink_function(soname, objs_paths, extra_link_dirs=[], env=None):
22922296
sofiles.append(fn[:-2])
22932297

22942298
# The raw argument list.
2295-
args = [ ]
2299+
args = []
22962300

22972301
for fn in sofiles:
22982302
afn = fn + ".o"
@@ -2303,7 +2307,7 @@ def biglink_function(soname, objs_paths, extra_link_dirs=[], env=None):
23032307
data = fd.read()
23042308
args.extend(data.split(" "))
23052309

2306-
unique_args = [ ]
2310+
unique_args = []
23072311
while args:
23082312
a = args.pop()
23092313
if a in ('-L', ):
@@ -2770,9 +2774,9 @@ def clean_download_cache(self, args):
27702774
# args = parser.parse_args(args)
27712775
# ctx = Context()
27722776
# # AND: TODO
2773-
2774-
# print('This isn\'t implemented yet, but should list all currently existing '
2775-
# 'distributions, the modules they include, and all the build caches.')
2777+
# print('This isn\'t implemented yet, but should list all
2778+
# currently existing ' 'distributions, the modules they include,
2779+
# and all the build caches.')
27762780
# exit(1)
27772781

27782782
@require_prebuilt_dist
@@ -2878,10 +2882,10 @@ def create(self, args):
28782882

28792883
# dist = dist_from_args(ctx, self.dist_args)
28802884
# if not dist.needs_build:
2881-
# info('You asked to create a distribution, but a dist with this name '
2882-
# 'already exists. If you don\'t want to use '
2883-
# 'it, you must delete it and rebuild, or create your '
2884-
# 'new dist with a different name.')
2885+
# info('You asked to create a distribution, but a dist with '
2886+
# 'this name already exists. If you don\'t want to use '
2887+
# 'it, you must delete it and rebuild, or create your new '
2888+
# 'dist with a different name.')
28852889
# exit(1)
28862890
# info('Ready to create dist {}, contains recipes {}'.format(
28872891
# dist.name, ', '.join(dist.recipes)))

0 commit comments

Comments
 (0)