2626import contextlib
2727import logging
2828import shlex
29+ from glob import glob
2930from copy import deepcopy
3031from functools import wraps
3132from datetime import datetime
@@ -682,7 +683,7 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
682683 sdk_dir = environ .get ('ANDROID_HOME' , None )
683684 if sdk_dir is None : # Checks in the buildozer SDK dir, useful
684685 # for debug tests of p4a
685- possible_dirs = glob . glob (expanduser (join (
686+ possible_dirs = glob (expanduser (join (
686687 '~' , '.buildozer' , 'android' , 'platform' , 'android-sdk-*' )))
687688 if possible_dirs :
688689 info ('Found possible SDK dirs in buildozer dir: {}' .format (
@@ -754,7 +755,7 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
754755 info ('Found NDK dir in $ANDROID_NDK_HOME' )
755756 if ndk_dir is None : # Checks in the buildozer NDK dir, useful
756757 # for debug tests of p4a
757- possible_dirs = glob . glob (expanduser (join (
758+ possible_dirs = glob (expanduser (join (
758759 '~' , '.buildozer' , 'android' , 'platform' , 'android-ndk-r*' )))
759760 if possible_dirs :
760761 info ('Found possible NDK dirs in buildozer dir: {}' .format (
@@ -1127,9 +1128,9 @@ def get_distributions(cls, ctx, extra_dist_dirs=[]):
11271128 warning ('extra_dist_dirs argument to get_distributions is not yet implemented' )
11281129 exit (1 )
11291130 dist_dir = ctx .dist_dir
1130- folders = glob . glob (join (dist_dir , '*' ))
1131+ folders = glob (join (dist_dir , '*' ))
11311132 for dir in extra_dist_dirs :
1132- folders .extend (glob . glob (join (dir , '*' )))
1133+ folders .extend (glob (join (dir , '*' )))
11331134
11341135 dists = []
11351136 for folder in folders :
@@ -1828,11 +1829,9 @@ def clean_build(self, arch=None):
18281829
18291830 @classmethod
18301831 def list_recipes (cls ):
1831- forbidden_dirs = ('__pycache__' , )
1832- recipes_dir = join (dirname (__file__ ), "recipes" )
1833- for name in listdir (recipes_dir ):
1834- if name in forbidden_dirs :
1835- continue
1832+ recipes_dir = join (toolchain_dir , "recipes" )
1833+ for name in glob (recipes_dir , "*" , "__init__.py" ):
1834+ name = name .rsplit ("/" , 2 )[- 2 ]
18361835 fn = join (recipes_dir , name )
18371836 if isdir (fn ):
18381837 yield name
@@ -2061,7 +2060,7 @@ def build_cython_components(self, arch):
20612060 shprint (hostpython , 'setup.py' , 'build_ext' , '-v' , _env = env )
20622061
20632062 print ('stripping' )
2064- build_lib = glob . glob ('./build/lib*' )
2063+ build_lib = glob ('./build/lib*' )
20652064 shprint (sh .find , build_lib [0 ], '-name' , '*.o' , '-exec' ,
20662065 env ['STRIP' ], '{}' , ';' , _env = env )
20672066 print ('stripped!?' )
@@ -2203,7 +2202,7 @@ def biglink(ctx, arch):
22032202 if not exists (recipe_obj_dir ):
22042203 info ('{} recipe has no biglinkable files dir, skipping' .format (recipe .name ))
22052204 continue
2206- files = glob . glob (join (recipe_obj_dir , '*' ))
2205+ files = glob (join (recipe_obj_dir , '*' ))
22072206 if not len (files ):
22082207 info ('{} recipe has no biglinkable files, skipping' .format (recipe .name ))
22092208 info ('{} recipe has object files, copying' .format (recipe .name ))
@@ -2217,7 +2216,7 @@ def biglink(ctx, arch):
22172216 env ['LDFLAGS' ] = env ['LDFLAGS' ] + ' -L{}' .format (
22182217 join (ctx .bootstrap .build_dir , 'obj' , 'local' , 'armeabi' ))
22192218
2220- if not len (glob . glob (join (obj_dir , '*' ))):
2219+ if not len (glob (join (obj_dir , '*' ))):
22212220 info ('There seem to be no libraries to biglink, skipping.' )
22222221 return
22232222 info ('Biglinking' )
@@ -2805,7 +2804,7 @@ def apk(self, args):
28052804 # AND: This is very crude, needs improving. Also only works
28062805 # for debug for now.
28072806 info_main ('# Copying APK to current directory' )
2808- apks = glob . glob (join (dist .dist_dir , 'bin' , '*-*-debug.apk' ))
2807+ apks = glob (join (dist .dist_dir , 'bin' , '*-*-debug.apk' ))
28092808 if len (apks ) == 0 :
28102809 raise ValueError ('Couldn\' t find the built APK' )
28112810 if len (apks ) > 1 :
0 commit comments