22from pythonforandroid .toolchain import shprint , current_directory
33from pythonforandroid .patching import (is_darwin , is_api_gt ,
44 check_all , is_api_lt , is_ndk )
5- from pythonforandroid .logger import logger , info , debug
6- from pythonforandroid .util import ensure_dir
5+ from pythonforandroid .logger import logger , info
6+ from pythonforandroid .util import ensure_dir , walk_valid_filens
77from os .path import exists , join , realpath , basename
88from os import environ , listdir , walk
99import glob
10- from fnmatch import fnmatch
1110import sh
1211
1312
@@ -152,7 +151,7 @@ def create_python_bundle(self, dirn, arch):
152151 # zip up the standard library
153152 stdlib_zip = join (dirn , 'stdlib.zip' )
154153 with current_directory (join (self .get_build_dir (arch .arch ), 'Lib' )):
155- stdlib_filens = self . get_stdlib_filens ('.' )
154+ stdlib_filens = walk_valid_filens ('.' , STDLIB_DIR_BLACKLIST , STDLIB_FILEN_BLACKLIST )
156155 shprint (sh .zip , stdlib_zip , * stdlib_filens )
157156
158157 # copy the site-packages into place
@@ -174,24 +173,5 @@ def create_python_bundle(self, dirn, arch):
174173 info ('Renaming .so files to reflect cross-compile' )
175174 self .reduce_object_file_names (join (dirn , 'site-packages' ))
176175
177- def get_stdlib_filens (self , basedir ):
178- return_filens = []
179- for dirn , subdirs , filens in walk (basedir ):
180- if basename (dirn ) in STDLIB_DIR_BLACKLIST :
181- debug ('stdlib.zip ignoring directory {}' .format (dirn ))
182- while subdirs :
183- subdirs .pop ()
184- continue
185- for filen in filens :
186- for pattern in STDLIB_FILEN_BLACKLIST :
187- if fnmatch (filen , pattern ):
188- debug ('stdlib.zip ignoring file {}' .format (join (dirn , filen )))
189- break
190- else :
191- return_filens .append (join (dirn , filen ))
192- return return_filens
193-
194-
195-
196176
197177recipe = Python3Recipe ()
0 commit comments