26
26
import contextlib
27
27
import logging
28
28
import shlex
29
+ from glob import glob
29
30
from copy import deepcopy
30
31
from functools import wraps
31
32
from datetime import datetime
@@ -682,7 +683,7 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
682
683
sdk_dir = environ .get ('ANDROID_HOME' , None )
683
684
if sdk_dir is None : # Checks in the buildozer SDK dir, useful
684
685
# for debug tests of p4a
685
- possible_dirs = glob . glob (expanduser (join (
686
+ possible_dirs = glob (expanduser (join (
686
687
'~' , '.buildozer' , 'android' , 'platform' , 'android-sdk-*' )))
687
688
if possible_dirs :
688
689
info ('Found possible SDK dirs in buildozer dir: {}' .format (
@@ -754,7 +755,7 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
754
755
info ('Found NDK dir in $ANDROID_NDK_HOME' )
755
756
if ndk_dir is None : # Checks in the buildozer NDK dir, useful
756
757
# for debug tests of p4a
757
- possible_dirs = glob . glob (expanduser (join (
758
+ possible_dirs = glob (expanduser (join (
758
759
'~' , '.buildozer' , 'android' , 'platform' , 'android-ndk-r*' )))
759
760
if possible_dirs :
760
761
info ('Found possible NDK dirs in buildozer dir: {}' .format (
@@ -1127,9 +1128,9 @@ def get_distributions(cls, ctx, extra_dist_dirs=[]):
1127
1128
warning ('extra_dist_dirs argument to get_distributions is not yet implemented' )
1128
1129
exit (1 )
1129
1130
dist_dir = ctx .dist_dir
1130
- folders = glob . glob (join (dist_dir , '*' ))
1131
+ folders = glob (join (dist_dir , '*' ))
1131
1132
for dir in extra_dist_dirs :
1132
- folders .extend (glob . glob (join (dir , '*' )))
1133
+ folders .extend (glob (join (dir , '*' )))
1133
1134
1134
1135
dists = []
1135
1136
for folder in folders :
@@ -1828,11 +1829,9 @@ def clean_build(self, arch=None):
1828
1829
1829
1830
@classmethod
1830
1831
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 ]
1836
1835
fn = join (recipes_dir , name )
1837
1836
if isdir (fn ):
1838
1837
yield name
@@ -2061,7 +2060,7 @@ def build_cython_components(self, arch):
2061
2060
shprint (hostpython , 'setup.py' , 'build_ext' , '-v' , _env = env )
2062
2061
2063
2062
print ('stripping' )
2064
- build_lib = glob . glob ('./build/lib*' )
2063
+ build_lib = glob ('./build/lib*' )
2065
2064
shprint (sh .find , build_lib [0 ], '-name' , '*.o' , '-exec' ,
2066
2065
env ['STRIP' ], '{}' , ';' , _env = env )
2067
2066
print ('stripped!?' )
@@ -2203,7 +2202,7 @@ def biglink(ctx, arch):
2203
2202
if not exists (recipe_obj_dir ):
2204
2203
info ('{} recipe has no biglinkable files dir, skipping' .format (recipe .name ))
2205
2204
continue
2206
- files = glob . glob (join (recipe_obj_dir , '*' ))
2205
+ files = glob (join (recipe_obj_dir , '*' ))
2207
2206
if not len (files ):
2208
2207
info ('{} recipe has no biglinkable files, skipping' .format (recipe .name ))
2209
2208
info ('{} recipe has object files, copying' .format (recipe .name ))
@@ -2217,7 +2216,7 @@ def biglink(ctx, arch):
2217
2216
env ['LDFLAGS' ] = env ['LDFLAGS' ] + ' -L{}' .format (
2218
2217
join (ctx .bootstrap .build_dir , 'obj' , 'local' , 'armeabi' ))
2219
2218
2220
- if not len (glob . glob (join (obj_dir , '*' ))):
2219
+ if not len (glob (join (obj_dir , '*' ))):
2221
2220
info ('There seem to be no libraries to biglink, skipping.' )
2222
2221
return
2223
2222
info ('Biglinking' )
@@ -2805,7 +2804,7 @@ def apk(self, args):
2805
2804
# AND: This is very crude, needs improving. Also only works
2806
2805
# for debug for now.
2807
2806
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' ))
2809
2808
if len (apks ) == 0 :
2810
2809
raise ValueError ('Couldn\' t find the built APK' )
2811
2810
if len (apks ) > 1 :
0 commit comments