Skip to content

Commit 6649020

Browse files
committed
Changed python3crystax install process
1 parent 9e96d2c commit 6649020

File tree

3 files changed

+38
-27
lines changed

3 files changed

+38
-27
lines changed

pythonforandroid/build.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,6 @@ def ndk_ver(self, value):
130130
def ndk_is_crystax(self):
131131
return True if self.ndk_ver[:7] == 'crystax' else False
132132

133-
def ensure_crystax_python_install_dir(self):
134-
dirn = self.get_python_install_dir()
135-
ensure_dir(dirn)
136-
ensure_dir(join(dirn, 'lib'))
137-
sh.cp('-r', '/home/asandy/kivytest/crystax_stdlib', join(dirn, 'lib', 'python3.5'))
138-
sh.cp('-r', '/home/asandy/android/crystax-ndk-10.3.0/sources/python/3.5/libs/armeabi/modules', join(dirn, 'lib', 'python3.5', 'lib-dynload'))
139-
ensure_dir(join(dirn, 'lib', 'site-packages'))
140133

141134
@property
142135
def sdk_dir(self):

pythonforandroid/recipe.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -719,25 +719,26 @@ def install_python_package(self, arch, name=None, env=None, is_dir=True):
719719

720720

721721
if self.ctx.ndk_is_crystax:
722-
hppath = join(dirname(self.hostpython_location), 'Lib',
723-
'site-packages')
722+
# hppath = join(dirname(self.hostpython_location), 'Lib',
723+
# 'site-packages')
724724
hpenv = env.copy()
725-
if 'PYTHONPATH' in hpenv:
726-
hpenv['PYTHONPATH'] = ':'.join([hppath] +
727-
hpenv['PYTHONPATH'].split(':'))
728-
else:
729-
hpenv['PYTHONPATH'] = hppath
725+
# if 'PYTHONPATH' in hpenv:
726+
# hpenv['PYTHONPATH'] = ':'.join([hppath] +
727+
# hpenv['PYTHONPATH'].split(':'))
728+
# else:
729+
# hpenv['PYTHONPATH'] = hppath
730730
# hpenv['PYTHONHOME'] = self.ctx.get_python_install_dir()
731731
# shprint(hostpython, 'setup.py', 'build',
732732
# _env=hpenv, *self.setup_extra_args)
733733
shprint(hostpython, 'setup.py', 'install', '-O2',
734734
'--root={}'.format(self.ctx.get_python_install_dir()),
735-
'--install-lib=lib/python3.5/site-packages',
735+
'--install-lib=.',
736+
# AND: will need to unhardcode the 3.5 when adding 2.7 (and other crystax supported versions)
736737
_env=hpenv, *self.setup_extra_args)
737-
site_packages_dir = self.ctx.get_site_packages_dir()
738-
built_files = glob.glob(join('build', 'lib*', '*'))
739-
for filen in built_files:
740-
shprint(sh.cp, '-r', filen, join(site_packages_dir, split(filen)[-1]))
738+
# site_packages_dir = self.ctx.get_site_packages_dir()
739+
# built_files = glob.glob(join('build', 'lib*', '*'))
740+
# for filen in built_files:
741+
# shprint(sh.cp, '-r', filen, join(site_packages_dir, split(filen)[-1]))
741742
elif self.call_hostpython_via_targetpython:
742743
shprint(hostpython, 'setup.py', 'install', '-O2', _env=env,
743744
*self.setup_extra_args)
Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,45 @@
11

22
from pythonforandroid.toolchain import Recipe, shprint, current_directory, ArchARM
33
from pythonforandroid.logger import info
4+
from pythonforandroid.util import ensure_dir
45
from os.path import exists, join
56
from os import uname
67
import glob
78
import sh
89

910
class Python3Recipe(Recipe):
10-
version = ''
11+
version = '3.5'
1112
url = ''
1213
name = 'python3crystax'
1314

14-
depends = ['hostpython3']
15+
depends = ['hostpython3crystax']
1516
conflicts = ['python2', 'python3']
1617

17-
def __init__(self, **kwargs):
18-
super(Python3Recipe, self).__init__(**kwargs)
19-
self.crystax = lambda *args: True if self.ctx.ndk_is_crystax else False
18+
def get_dir_name(self):
19+
name = super(Python3Recipe, self).get_dir_name()
20+
name += '-version{}'.format(self.version)
21+
return name
2022

2123
def prebuild_arch(self, arch):
22-
self.ctx.ensure_crystax_python_install_dir()
24+
if not self.ctx.ndk_is_crystax:
25+
error('The python3crystax recipe can only be built when '
26+
'using the CrystaX NDK. Exiting.')
27+
exit(1)
2328

2429
def build_arch(self, arch):
25-
info('doing nothing, the crystax python3 is included in the ndk!')
26-
30+
info('Extracting CrystaX python3 from NDK package')
31+
# This is necessary (I think?) in order for the
32+
# cross-compilation to work
33+
34+
dirn = self.ctx.get_python_install_dir()
35+
ensure_dir(dirn)
36+
# ensure_dir(join(dirn, 'lib'))
37+
# ensure_dir(join(dirn, 'lib', 'python{}'.format(self.version),
38+
# 'site-packages'))
39+
40+
# ndk_dir = self.ctx.ndk_dir
41+
# sh.cp('-r', '/home/asandy/kivytest/crystax_stdlib', join(dirn, 'lib', 'python3.5'))
42+
# sh.cp('-r', '/home/asandy/android/crystax-ndk-10.3.0/sources/python/3.5/libs/armeabi/modules', join(dirn, 'lib', 'python3.5', 'lib-dynload'))
43+
# ensure_dir(join(dirn, 'lib', 'site-packages'))
2744

2845
recipe = Python3Recipe()

0 commit comments

Comments
 (0)