Skip to content

Commit

Permalink
Merge pull request #2147 from pavelsof/twisted
Browse files Browse the repository at this point in the history
Removes Twisted recipe unit tests from target install
  • Loading branch information
AndreMiras committed Apr 21, 2020
2 parents 710c3d5 + af8e1b7 commit 3aa2aec
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pythonforandroid/recipes/twisted/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import os
import shutil

from pythonforandroid.recipe import CythonRecipe


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

depends = ['setuptools', 'zope_interface', 'incremental', 'constantly']
patches = ['incremental.patch']
patches = ['incremental.patch', 'remove_tests.patch']

call_hostpython_via_targetpython = False
install_in_hostpython = False

def prebuild_arch(self, arch):
super().prebuild_arch(arch)
# TODO Need to whitelist tty.pyo and termios.so here
print('Should remove twisted tests etc. here, but skipping for now')

# remove the unit test dirs
source_dir = os.path.join(self.get_build_dir(arch.arch), 'src/twisted')
for item in os.walk(source_dir):
if os.path.basename(item[0]) == 'test':
full_path = os.path.join(source_dir, item[0])
shutil.rmtree(full_path, ignore_errors=True)

def get_recipe_env(self, arch):
env = super().get_recipe_env(arch)
Expand Down
16 changes: 16 additions & 0 deletions pythonforandroid/recipes/twisted/remove_tests.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/src/twisted/python/_setup.py b/src/twisted/python/_setup.py
index 32cb096c7..a607fef07 100644
--- a/src/twisted/python/_setup.py
+++ b/src/twisted/python/_setup.py
@@ -160,11 +160,6 @@ class ConditionalExtension(Extension, object):

# The C extensions used for Twisted.
_EXTENSIONS = [
- ConditionalExtension(
- "twisted.test.raiser",
- sources=["src/twisted/test/raiser.c"],
- condition=lambda _: _isCPython),
-
ConditionalExtension(
"twisted.internet.iocpreactor.iocpsupport",
sources=[

0 comments on commit 3aa2aec

Please sign in to comment.