Skip to content

Commit af8e1b7

Browse files
committed
Better recipe for Twisted: removed the unit tests.
1 parent 710c3d5 commit af8e1b7

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

pythonforandroid/recipes/twisted/__init__.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import os
2+
import shutil
3+
14
from pythonforandroid.recipe import CythonRecipe
25

36

@@ -6,15 +9,21 @@ class TwistedRecipe(CythonRecipe):
69
url = 'https://github.com/twisted/twisted/archive/twisted-{version}.tar.gz'
710

811
depends = ['setuptools', 'zope_interface', 'incremental', 'constantly']
9-
patches = ['incremental.patch']
12+
patches = ['incremental.patch', 'remove_tests.patch']
1013

1114
call_hostpython_via_targetpython = False
1215
install_in_hostpython = False
1316

1417
def prebuild_arch(self, arch):
1518
super().prebuild_arch(arch)
1619
# TODO Need to whitelist tty.pyo and termios.so here
17-
print('Should remove twisted tests etc. here, but skipping for now')
20+
21+
# remove the unit test dirs
22+
source_dir = os.path.join(self.get_build_dir(arch.arch), 'src/twisted')
23+
for item in os.walk(source_dir):
24+
if os.path.basename(item[0]) == 'test':
25+
full_path = os.path.join(source_dir, item[0])
26+
shutil.rmtree(full_path, ignore_errors=True)
1827

1928
def get_recipe_env(self, arch):
2029
env = super().get_recipe_env(arch)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff --git a/src/twisted/python/_setup.py b/src/twisted/python/_setup.py
2+
index 32cb096c7..a607fef07 100644
3+
--- a/src/twisted/python/_setup.py
4+
+++ b/src/twisted/python/_setup.py
5+
@@ -160,11 +160,6 @@ class ConditionalExtension(Extension, object):
6+
7+
# The C extensions used for Twisted.
8+
_EXTENSIONS = [
9+
- ConditionalExtension(
10+
- "twisted.test.raiser",
11+
- sources=["src/twisted/test/raiser.c"],
12+
- condition=lambda _: _isCPython),
13+
-
14+
ConditionalExtension(
15+
"twisted.internet.iocpreactor.iocpsupport",
16+
sources=[

0 commit comments

Comments
 (0)