@@ -30,57 +30,69 @@ def run_distribute(self):
3030
3131 if not exists ('private' ) and not self .ctx .ndk_is_crystax :
3232 shprint (sh .mkdir , 'private' )
33- if not exists ('crystax_python' ) and self .ctx .. ndk_is_crystax :
34- shprint (sh .mkdir , 'crytax_python ' )
33+ if not exists ('crystax_python' ) and self .ctx .ndk_is_crystax :
34+ shprint (sh .mkdir , 'crystax_python ' )
3535 if not exists ('assets' ):
3636 shprint (sh .mkdir , 'assets' )
3737
3838 hostpython = sh .Command (self .ctx .hostpython )
39- shprint (hostpython , '-OO' , '-m' , 'compileall' ,
40- self .ctx .get_python_install_dir (),
41- _tail = 10 , _filterout = "^Listing" , _critical = True )
42- if not exists ('python-install' ):
43- shprint (sh .cp , '-a' , self .ctx .get_python_install_dir (), './python-install' )
39+ if not self .ctx .ndk_is_crystax :
40+ shprint (hostpython , '-OO' , '-m' , 'compileall' ,
41+ self .ctx .get_python_install_dir (),
42+ _tail = 10 , _filterout = "^Listing" , _critical = True )
43+ if not exists ('python-install' ):
44+ shprint (sh .cp , '-a' , self .ctx .get_python_install_dir (), './python-install' )
4445
4546 self .distribute_libs (arch , [self .ctx .get_libs_dir (arch .arch )])
4647 self .distribute_aars (arch )
4748 self .distribute_javaclasses (self .ctx .javaclass_dir )
4849
49- info ('Filling private directory' )
50- if not exists (join ('private' , 'lib' )):
51- info ('private/lib does not exist, making' )
52- shprint (sh .cp , '-a' , join ('python-install' , 'lib' ), 'private' )
53- shprint (sh .mkdir , '-p' , join ('private' , 'include' , 'python2.7' ))
50+ if not self .ctx .ndk_is_crystax :
51+ info ('Filling private directory' )
52+ if not exists (join ('private' , 'lib' )):
53+ info ('private/lib does not exist, making' )
54+ shprint (sh .cp , '-a' , join ('python-install' , 'lib' ), 'private' )
55+ shprint (sh .mkdir , '-p' , join ('private' , 'include' , 'python2.7' ))
5456
55- # AND: Copylibs stuff should go here
56- if exists (join ('libs' , arch .arch , 'libpymodules.so' )):
57- shprint (sh .mv , join ('libs' , arch .arch , 'libpymodules.so' ), 'private/' )
58- shprint (sh .cp , join ('python-install' , 'include' , 'python2.7' , 'pyconfig.h' ), join ('private' , 'include' , 'python2.7/' ))
57+ # AND: Copylibs stuff should go here
58+ if exists (join ('libs' , arch .arch , 'libpymodules.so' )):
59+ shprint (sh .mv , join ('libs' , arch .arch , 'libpymodules.so' ), 'private/' )
60+ shprint (sh .cp , join ('python-install' , 'include' , 'python2.7' , 'pyconfig.h' ), join ('private' , 'include' , 'python2.7/' ))
5961
60- info ('Removing some unwanted files' )
61- shprint (sh .rm , '-f' , join ('private' , 'lib' , 'libpython2.7.so' ))
62- shprint (sh .rm , '-rf' , join ('private' , 'lib' , 'pkgconfig' ))
62+ info ('Removing some unwanted files' )
63+ shprint (sh .rm , '-f' , join ('private' , 'lib' , 'libpython2.7.so' ))
64+ shprint (sh .rm , '-rf' , join ('private' , 'lib' , 'pkgconfig' ))
6365
64- with current_directory (join (self .dist_dir , 'private' , 'lib' , 'python2.7' )):
65- # shprint(sh.xargs, 'rm', sh.grep('-E', '*\.(py|pyx|so\.o|so\.a|so\.libs)$', sh.find('.')))
66- removes = []
67- for dirname , something , filens in walk ('.' ):
68- for filename in filens :
69- for suffix in ('py' , 'pyc' , 'so.o' , 'so.a' , 'so.libs' ):
70- if filename .endswith (suffix ):
71- removes .append (filename )
72- shprint (sh .rm , '-f' , * removes )
66+ with current_directory (join (self .dist_dir , 'private' , 'lib' , 'python2.7' )):
67+ # shprint(sh.xargs, 'rm', sh.grep('-E', '*\.(py|pyx|so\.o|so\.a|so\.libs)$', sh.find('.')))
68+ removes = []
69+ for dirname , something , filens in walk ('.' ):
70+ for filename in filens :
71+ for suffix in ('py' , 'pyc' , 'so.o' , 'so.a' , 'so.libs' ):
72+ if filename .endswith (suffix ):
73+ removes .append (filename )
74+ shprint (sh .rm , '-f' , * removes )
7375
74- info ('Deleting some other stuff not used on android' )
75- # To quote the original distribute.sh, 'well...'
76- # shprint(sh.rm, '-rf', 'ctypes')
77- shprint (sh .rm , '-rf' , 'lib2to3' )
78- shprint (sh .rm , '-rf' , 'idlelib' )
79- for filename in glob .glob ('config/libpython*.a' ):
80- shprint (sh .rm , '-f' , filename )
81- shprint (sh .rm , '-rf' , 'config/python.o' )
82- # shprint(sh.rm, '-rf', 'lib-dynload/_ctypes_test.so')
83- # shprint(sh.rm, '-rf', 'lib-dynload/_testcapi.so')
76+ info ('Deleting some other stuff not used on android' )
77+ # To quote the original distribute.sh, 'well...'
78+ # shprint(sh.rm, '-rf', 'ctypes')
79+ shprint (sh .rm , '-rf' , 'lib2to3' )
80+ shprint (sh .rm , '-rf' , 'idlelib' )
81+ for filename in glob .glob ('config/libpython*.a' ):
82+ shprint (sh .rm , '-f' , filename )
83+ shprint (sh .rm , '-rf' , 'config/python.o' )
84+ # shprint(sh.rm, '-rf', 'lib-dynload/_ctypes_test.so')
85+ # shprint(sh.rm, '-rf', 'lib-dynload/_testcapi.so')
86+
87+ else : # NDK *is* crystax
88+ ndk_dir = self .ctx .ndk_dir
89+ python_dir = join (ndk_dir , 'sources' , 'python' , '3.5' ,
90+ 'libs' , arch .arch )
91+
92+ shprint (sh .cp , '-r' , join (python_dir , 'stdlib.zip' ), 'crystax_python/' )
93+ shprint (sh .cp , '-r' , join (python_dir , 'modules' ), 'crystax_python/' )
94+ shprint (sh .cp , '-r' , self .ctx .get_python_install_dir (), 'crystax_python/site-packages' )
95+
8496
8597 self .strip_libraries (arch )
8698 super (SDL2Bootstrap , self ).run_distribute ()
0 commit comments