Skip to content

Commit fba37de

Browse files
authored
Merge pull request #1913 from opacam/feature-remove-crystax
Drop CrystaX support and code base
2 parents aa31c5c + 5ad8ad7 commit fba37de

File tree

42 files changed

+115
-404
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+115
-404
lines changed

ci/constants.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
class TargetPython(Enum):
55
python2 = 0
6-
python3crystax = 1
76
python3 = 2
87

98

@@ -22,7 +21,6 @@ class TargetPython(Enum):
2221
'ffpyplayer',
2322
'flask',
2423
'groestlcoin_hash',
25-
'hostpython3crystax',
2624
# https://github.com/kivy/python-for-android/issues/1354
2725
'kiwisolver',
2826
'libmysqlclient',
@@ -88,5 +86,5 @@ class TargetPython(Enum):
8886
# recipes that were already built will be skipped
8987
CORE_RECIPES = set([
9088
'pyjnius', 'kivy', 'openssl', 'requests', 'sqlite3', 'setuptools',
91-
'numpy', 'android', 'python2', 'python3',
89+
'numpy', 'android', 'hostpython2', 'hostpython3', 'python2', 'python3',
9290
])

ci/rebuild_updated_recipes.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from pythonforandroid.graph import get_recipe_order_and_bootstrap
2929
from pythonforandroid.toolchain import current_directory
3030
from pythonforandroid.util import BuildInterruptingException
31+
from pythonforandroid.recipe import Recipe
3132
from ci.constants import TargetPython, CORE_RECIPES, BROKEN_RECIPES
3233

3334

@@ -66,7 +67,7 @@ def build(target_python, requirements):
6667
# iterates to stream the output
6768
for line in sh.python(
6869
testapp, 'apk', '--sdk-dir', android_sdk_home,
69-
'--ndk-dir', android_ndk_home, '--bootstrap', 'sdl2', '--requirements',
70+
'--ndk-dir', android_ndk_home, '--requirements',
7071
requirements, _err_to_out=True, _iter=True):
7172
print(line)
7273

@@ -78,6 +79,18 @@ def main():
7879
recipes -= CORE_RECIPES
7980
logger.info('recipes to build: {}'.format(recipes))
8081
context = Context()
82+
83+
# removing the deleted recipes for the given target (if any)
84+
for recipe_name in recipes.copy():
85+
try:
86+
Recipe.get_recipe(recipe_name, context)
87+
except ValueError:
88+
# recipe doesn't exist, so probably we remove it
89+
recipes.remove(recipe_name)
90+
logger.warning(
91+
'removed {} from recipes because deleted'.format(recipe_name)
92+
)
93+
8194
# forces the default target
8295
recipes_and_target = recipes | set([target_python.name])
8396
try:

doc/source/buildoptions.rst

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,14 @@ e.g. ``--requirements=python3``.
3333

3434

3535
CrystaX python3
36-
###############
36+
~~~~~~~~~~~~~~~
3737

38-
.. warning:: python-for-android originally supported Python 3 using the CrystaX
39-
NDK. This support is now being phased out as CrystaX is no longer
40-
actively developed.
38+
python-for-android no longer supports building for Python 3 using the CrystaX
39+
NDK. Instead, use the python3 recipe, which can be built using the normal
40+
Google NDK.
4141

42-
.. note:: You must manually download the `CrystaX NDK
43-
<https://www.crystax.net/android/ndk>`__ and tell
44-
python-for-android to use it with ``--ndk-dir /path/to/NDK``.
45-
46-
Select this by adding the ``python3crystax`` recipe to your
47-
requirements, e.g. ``--requirements=python3crystax``.
48-
49-
This uses the prebuilt Python from the `CrystaX NDK
50-
<https://www.crystax.net/android/ndk>`__, a drop-in replacement for
51-
Google's official NDK which includes many improvements. You
52-
*must* use the CrystaX NDK 10.3.0 or higher when building with
53-
python3. You can get it `here
54-
<https://www.crystax.net/en/download>`__.
42+
.. note:: The last python-for-android version supporting CrystaX was `0.7.0.
43+
<https://github.com/kivy/python-for-android/archive/0.7.0.zip>`__
5544

5645
.. _bootstrap_build_options:
5746

doc/source/docker.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ already have Docker preinstalled and set up.
1717
.. warning::
1818
This approach is highly space unfriendly! The more layers (``commit``) or
1919
even Docker images (``build``) you create the more space it'll consume.
20-
Within the Docker image there is Android + Crystax SDK and NDK + various
21-
dependencies. Within the custom diff made by building the distribution
22-
there is another big chunk of space eaten. The very basic stuff such as
23-
a distribution with: CPython 3, setuptools, Python for Android ``android``
24-
module, SDL2 (+ deps), PyJNIus and Kivy takes almost 13 GB. Check your free
25-
space first!
20+
Within the Docker image there is Android SDK and NDK + various dependencies.
21+
Within the custom diff made by building the distribution there is another
22+
big chunk of space eaten. The very basic stuff such as a distribution with:
23+
CPython 3, setuptools, Python for Android ``android`` module, SDL2 (+ deps),
24+
PyJNIus and Kivy takes almost 2 GB. Check your free space first!
2625

2726
1. Clone the repository::
2827

pythonforandroid/archs.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ def get_env(self, with_flags_in_cc=True, clang=False):
9292

9393
env["LDFLAGS"] += " ".join(['-lm', '-L' + self.ctx.get_libs_dir(self.arch)])
9494

95-
if self.ctx.ndk == 'crystax':
96-
env['LDFLAGS'] += ' -L{}/sources/crystax/libs/{} -lcrystax'.format(self.ctx.ndk_dir, self.arch)
97-
9895
toolchain_prefix = self.ctx.toolchain_prefix
9996
toolchain_version = self.ctx.toolchain_version
10097
command_prefix = self.command_prefix
@@ -154,10 +151,7 @@ def get_env(self, with_flags_in_cc=True, clang=False):
154151
env['LD'] = '{}-ld'.format(command_prefix)
155152
env['LDSHARED'] = env["CC"] + " -pthread -shared " +\
156153
"-Wl,-O1 -Wl,-Bsymbolic-functions "
157-
if self.ctx.python_recipe and self.ctx.python_recipe.from_crystax:
158-
# For crystax python, we can't use the host python headers:
159-
env["CFLAGS"] += ' -I{}/sources/python/{}/include/python/'.\
160-
format(self.ctx.ndk_dir, self.ctx.python_recipe.version[0:3])
154+
161155
env['STRIP'] = '{}-strip --strip-unneeded'.format(command_prefix)
162156
env['MAKE'] = 'make -j5'
163157
env['READELF'] = '{}-readelf'.format(command_prefix)
@@ -180,9 +174,6 @@ def get_env(self, with_flags_in_cc=True, clang=False):
180174
env['ARCH'] = self.arch
181175
env['NDK_API'] = 'android-{}'.format(str(self.ctx.ndk_api))
182176

183-
if self.ctx.python_recipe and self.ctx.python_recipe.from_crystax:
184-
env['CRYSTAX_PYTHON_VERSION'] = self.ctx.python_recipe.version
185-
186177
return env
187178

188179

pythonforandroid/bootstrap.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,7 @@ class Bootstrap(object):
8080
distribution = None
8181

8282
# All bootstraps should include Python in some way:
83-
recipe_depends = [
84-
("python2", "python3", "python3crystax"),
85-
'android',
86-
]
83+
recipe_depends = [("python2", "python3"), 'android']
8784

8885
can_be_chosen_automatically = True
8986
'''Determines whether the bootstrap can be chosen as one that
@@ -345,9 +342,6 @@ def _unpack_aar(self, aar, arch):
345342

346343
def strip_libraries(self, arch):
347344
info('Stripping libraries')
348-
if self.ctx.python_recipe.from_crystax:
349-
info('Python was loaded from CrystaX, skipping strip')
350-
return
351345
env = arch.get_env()
352346
tokens = shlex.split(env['STRIP'])
353347
strip = sh.Command(tokens[0])

pythonforandroid/bootstraps/common/build/build.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,7 @@ def make_package(args):
332332
shutil.copyfile(join(args.private, "main.py"),
333333
join(main_py_only_dir, "main.py"))
334334
tar_dirs.append(main_py_only_dir)
335-
for python_bundle_dir in ('private',
336-
'crystax_python',
337-
'_python_bundle'):
335+
for python_bundle_dir in ('private', '_python_bundle'):
338336
if exists(python_bundle_dir):
339337
tar_dirs.append(python_bundle_dir)
340338
if get_bootstrap_name() == "webview":
@@ -783,14 +781,13 @@ def _read_configuration():
783781
if args.try_system_python_compile:
784782
# Hardcoding python2.7 is okay for now, as python3 skips the
785783
# compilation anyway
786-
if not exists('crystax_python'):
787-
python_executable = 'python2.7'
788-
try:
789-
subprocess.call([python_executable, '--version'])
790-
except (OSError, subprocess.CalledProcessError):
791-
pass
792-
else:
793-
PYTHON = python_executable
784+
python_executable = 'python2.7'
785+
try:
786+
subprocess.call([python_executable, '--version'])
787+
except (OSError, subprocess.CalledProcessError):
788+
pass
789+
else:
790+
PYTHON = python_executable
794791

795792
if args.no_compile_pyo:
796793
PYTHON = None

pythonforandroid/bootstraps/common/build/jni/application/src/Android.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,3 @@ LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog $(EXTRA_LDLIBS)
2121
LOCAL_LDFLAGS += -L$(PYTHON_LINK_ROOT) $(APPLICATION_ADDITIONAL_LDFLAGS)
2222

2323
include $(BUILD_SHARED_LIBRARY)
24-
25-
ifdef CRYSTAX_PYTHON_VERSION
26-
$(call import-module,python/$(CRYSTAX_PYTHON_VERSION))
27-
endif

pythonforandroid/bootstraps/common/build/jni/application/src/start.c

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -165,26 +165,14 @@ int main(int argc, char *argv[]) {
165165
// Set up the python path
166166
char paths[256];
167167

168-
char crystax_python_dir[256];
169-
snprintf(crystax_python_dir, 256,
170-
"%s/crystax_python", getenv("ANDROID_UNPACK"));
171168
char python_bundle_dir[256];
172169
snprintf(python_bundle_dir, 256,
173170
"%s/_python_bundle", getenv("ANDROID_UNPACK"));
174-
if (dir_exists(crystax_python_dir) || dir_exists(python_bundle_dir)) {
175-
if (dir_exists(crystax_python_dir)) {
176-
LOGP("crystax_python exists");
177-
snprintf(paths, 256,
178-
"%s/stdlib.zip:%s/modules",
179-
crystax_python_dir, crystax_python_dir);
180-
}
181-
182-
if (dir_exists(python_bundle_dir)) {
183-
LOGP("_python_bundle dir exists");
184-
snprintf(paths, 256,
185-
"%s/stdlib.zip:%s/modules",
186-
python_bundle_dir, python_bundle_dir);
187-
}
171+
if (dir_exists(python_bundle_dir)) {
172+
LOGP("_python_bundle dir exists");
173+
snprintf(paths, 256,
174+
"%s/stdlib.zip:%s/modules",
175+
python_bundle_dir, python_bundle_dir);
188176

189177
LOGP("calculated paths to be...");
190178
LOGP(paths);
@@ -196,10 +184,8 @@ int main(int argc, char *argv[]) {
196184

197185
LOGP("set wchar paths...");
198186
} else {
199-
// We do not expect to see crystax_python any more, so no point
200-
// reminding the user about it. If it does exist, we'll have
201-
// logged it earlier.
202-
LOGP("_python_bundle does not exist");
187+
LOGP("_python_bundle does not exist...this not looks good, all python"
188+
" recipes should have this folder, should we expect a crash soon?");
203189
}
204190

205191
Py_Initialize();
@@ -234,18 +220,6 @@ int main(int argc, char *argv[]) {
234220
PyRun_SimpleString("import sys, posix\n");
235221

236222
char add_site_packages_dir[256];
237-
if (dir_exists(crystax_python_dir)) {
238-
snprintf(add_site_packages_dir, 256,
239-
"sys.path.append('%s/site-packages')",
240-
crystax_python_dir);
241-
242-
PyRun_SimpleString("import sys\n"
243-
"sys.argv = ['notaninterpreterreally']\n"
244-
"from os.path import realpath, join, dirname");
245-
PyRun_SimpleString(add_site_packages_dir);
246-
/* "sys.path.append(join(dirname(realpath(__file__)), 'site-packages'))") */
247-
PyRun_SimpleString("sys.path = ['.'] + sys.path");
248-
}
249223

250224
if (dir_exists(python_bundle_dir)) {
251225
snprintf(add_site_packages_dir, 256,

pythonforandroid/bootstraps/common/build/src/main/java/org/kivy/android/PythonUtil.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ protected static void addLibraryIfExists(ArrayList<String> libsList, String patt
3232

3333
protected static ArrayList<String> getLibraries(File libsDir) {
3434
ArrayList<String> libsList = new ArrayList<String>();
35-
addLibraryIfExists(libsList, "crystax", libsDir);
3635
addLibraryIfExists(libsList, "sqlite3", libsDir);
3736
addLibraryIfExists(libsList, "ffi", libsDir);
3837
addLibraryIfExists(libsList, "ssl.*", libsDir);

pythonforandroid/bootstraps/sdl2/build/src/main/java/org/kivy/android/PythonUtil.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ protected static void addLibraryIfExists(ArrayList<String> libsList, String patt
3131

3232
protected static ArrayList<String> getLibraries(File libsDir) {
3333
ArrayList<String> libsList = new ArrayList<String>();
34-
addLibraryIfExists(libsList, "crystax", libsDir);
3534
addLibraryIfExists(libsList, "sqlite3", libsDir);
3635
addLibraryIfExists(libsList, "ffi", libsDir);
3736
addLibraryIfExists(libsList, "png16", libsDir);

pythonforandroid/bootstraps/service_only/build/jni/application/src/Android.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,3 @@ LOCAL_LDLIBS := -llog $(EXTRA_LDLIBS)
1616
LOCAL_LDFLAGS += -L$(PYTHON_LINK_ROOT) $(APPLICATION_ADDITIONAL_LDFLAGS)
1717

1818
include $(BUILD_SHARED_LIBRARY)
19-
20-
ifdef CRYSTAX_PYTHON_VERSION
21-
$(call import-module,python/$(CRYSTAX_PYTHON_VERSION))
22-
endif

pythonforandroid/bootstraps/webview/build/jni/application/src/Android.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,3 @@ LOCAL_LDLIBS := -llog $(EXTRA_LDLIBS)
1818
LOCAL_LDFLAGS += -L$(PYTHON_LINK_ROOT) $(APPLICATION_ADDITIONAL_LDFLAGS)
1919

2020
include $(BUILD_SHARED_LIBRARY)
21-
22-
ifdef CRYSTAX_PYTHON_VERSION
23-
$(call import-module,python/$(CRYSTAX_PYTHON_VERSION))
24-
endif

pythonforandroid/build.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,13 @@ def build_recipes(build_order, python_modules, ctx, project_dir,
561561

562562
# 4) biglink everything
563563
info_main('# Biglinking object files')
564-
if not ctx.python_recipe or not ctx.python_recipe.from_crystax:
564+
if not ctx.python_recipe:
565565
biglink(ctx, arch)
566566
else:
567-
info('NDK is crystax, skipping biglink (will this work?)')
567+
warning(
568+
"Context's python recipe found, "
569+
"skipping biglink (will this work?)"
570+
)
568571

569572
# 5) postbuild packages
570573
info_main('# Postbuilding recipes')

pythonforandroid/python.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,9 @@ class GuestPythonRecipe(TargetPythonRecipe):
4949
this limitation.
5050
'''
5151

52-
from_crystax = False
53-
'''True if the python is used from CrystaX, False otherwise (i.e. if
54-
it is built by p4a).'''
55-
5652
configure_args = ()
5753
'''The configure arguments needed to build the python recipe. Those are
58-
used in method :meth:`build_arch` (if not overwritten like python3crystax's
54+
used in method :meth:`build_arch` (if not overwritten like python3's
5955
recipe does).
6056
6157
.. note:: This variable should be properly set in subclass.
@@ -108,10 +104,6 @@ def __init__(self, *args, **kwargs):
108104
super(GuestPythonRecipe, self).__init__(*args, **kwargs)
109105

110106
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
111-
if self.from_crystax:
112-
return super(GuestPythonRecipe, self).get_recipe_env(
113-
arch=arch, with_flags_in_cc=with_flags_in_cc)
114-
115107
env = environ.copy()
116108

117109
android_host = env['HOSTARCH'] = arch.command_prefix
@@ -215,10 +207,6 @@ def add_flags(include_flags, link_dirs, link_libs):
215207

216208
def prebuild_arch(self, arch):
217209
super(TargetPythonRecipe, self).prebuild_arch(arch)
218-
if self.from_crystax and self.ctx.ndk != 'crystax':
219-
raise BuildInterruptingException(
220-
'The {} recipe can only be built when using the CrystaX NDK. '
221-
'Exiting.'.format(self.name))
222210
self.ctx.python_recipe = self
223211

224212
def build_arch(self, arch):

0 commit comments

Comments
 (0)