99from __future__ import print_function
1010
1111import sys
12- from sys import stdout , stderr , platform
13- from os .path import (join , dirname , realpath , exists , isdir , basename ,
14- expanduser , splitext , split )
15- from os import listdir , unlink , makedirs , environ , chdir , getcwd , uname
12+ from sys import platform
13+ from os .path import (join , dirname , realpath , exists , basename ,
14+ expanduser , split )
15+ from os import environ
1616import os
17- import tarfile
18- import io
19- import json
2017import glob
2118import shutil
2219import re
2623from copy import deepcopy
2724from functools import wraps
2825from datetime import datetime
29- from math import log10
3026
3127import argparse
3228from appdirs import user_data_dir
3935 CompiledComponentsPythonRecipe )
4036from pythonforandroid .logger import (logger , info , debug , warning , error ,
4137 Out_Style , Out_Fore , Err_Style , Err_Fore ,
42- info_notify , info_main , shprint )
43- from pythonforandroid .util import (ensure_dir , current_directory , temp_directory ,
38+ info_notify , info_main , shprint ,
39+ Null_Fore , Null_Style )
40+ from pythonforandroid .util import (ensure_dir , current_directory ,
4441 which )
4542from pythonforandroid .bootstrap import Bootstrap
4643from pythonforandroid .distribution import Distribution , pretty_log_dists
6865 Err_Style .RESET_ALL ]))
6966
7067
71-
72- # shprint(sh.ls, '-lah')
73- # exit(1)
74-
75-
7668def add_boolean_option (parser , names , no_names = None ,
7769 default = True , dest = None , description = None ):
7870 group = parser .add_argument_group (description = description )
@@ -162,8 +154,6 @@ def _cache_execution(self, *args, **kwargs):
162154 return _cache_execution
163155
164156
165-
166-
167157class Graph (object ):
168158 # Taken from the old python-for-android/depsort
169159 # Modified to include alternative dependencies
@@ -180,16 +170,16 @@ def remove_redundant_graphs(self):
180170
181171 # n.b. no need to test graph 0 as it will have been tested against
182172 # all others by the time we get to it
183- for i in range (len (graphs ) - 1 , 0 , - 1 ):
173+ for i in range (len (graphs ) - 1 , 0 , - 1 ):
184174 graph = graphs [i ]
185175
186- #test graph i against all graphs 0 to i-1
176+ # test graph i against all graphs 0 to i-1
187177 for j in range (0 , i ):
188178 comparison_graph = graphs [j ]
189-
179+
190180 if set (comparison_graph .keys ()) == set (graph .keys ()):
191- #graph[i] == graph[j]
192- #so remove graph[i] and continue on to testing graph[i-1]
181+ # graph[i] == graph[j]
182+ # so remove graph[i] and continue on to testing graph[i-1]
193183 graphs .pop (i )
194184 break
195185
@@ -280,7 +270,8 @@ class Context(object):
280270 root_dir = None # the filepath of toolchain.py
281271 storage_dir = None # the root dir where builds and dists will be stored
282272
283- build_dir = None # in which bootstraps are copied for building and recipes are built
273+ build_dir = None # in which bootstraps are copied for building
274+ # and recipes are built
284275 dist_dir = None # the Android project folder where everything ends up
285276 libs_dir = None # where Android libs are cached after build but
286277 # before being placed in dists
@@ -646,7 +637,8 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
646637 executable ))
647638
648639 if not ok :
649- error ('{}python-for-android cannot continue; aborting{}' .format (Err_Fore .RED , Err_Fore .RESET ))
640+ error ('{}python-for-android cannot continue; aborting{}' .format (
641+ Err_Fore .RED , Err_Fore .RESET ))
650642 sys .exit (1 )
651643
652644 def __init__ (self ):
@@ -766,7 +758,7 @@ def build_recipes(build_order, python_modules, ctx):
766758 .format (recipe .name ))
767759
768760 # 4) biglink everything
769- # AND: Should make this optional
761+ # AND: Should make this optional
770762 info_main ('# Biglinking object files' )
771763 biglink (ctx , arch )
772764
@@ -1126,7 +1118,6 @@ def __init__(self):
11261118 help = ('The version of the Android NDK. This is optional, '
11271119 'we try to work it out automatically from the ndk_dir.' ))
11281120
1129-
11301121 # AND: This option doesn't really fit in the other categories, the
11311122 # arg structure needs a rethink
11321123 parser .add_argument (
@@ -1171,7 +1162,6 @@ def __init__(self):
11711162 description = ('Whether the dist recipes must perfectly match '
11721163 'those requested' ))
11731164
1174-
11751165 self ._read_configuration ()
11761166
11771167 args , unknown = parser .parse_known_args (sys .argv [1 :])
@@ -1283,7 +1273,6 @@ def clean_all(self, args):
12831273 parser = argparse .ArgumentParser (
12841274 description = "Clean the build cache, downloads and dists" )
12851275 parsed_args = parser .parse_args (args )
1286- ctx = Context ()
12871276 self .clean_dists (args )
12881277 self .clean_builds (args )
12891278 self .clean_download_cache (args )
0 commit comments