-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy path__init__.py
More file actions
35 lines (26 loc) · 1.14 KB
/
__init__.py
File metadata and controls
35 lines (26 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
from pythonforandroid.recipe import CythonRecipe
from pythonforandroid.util import rmdir
class TwistedRecipe(CythonRecipe):
version = '20.3.0'
url = 'https://github.com/twisted/twisted/archive/twisted-{version}.tar.gz'
depends = ['setuptools', 'zope_interface', 'incremental', 'constantly']
patches = ['incremental.patch', 'remove_tests.patch']
def prebuild_arch(self, arch):
super().prebuild_arch(arch)
# TODO Need to whitelist tty.pyo and termios.so here
# 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])
rmdir(full_path, ignore_errors=True)
def get_recipe_env(self, arch):
env = super().get_recipe_env(arch)
# We add BUILDLIB_PATH to PYTHONPATH so twisted can find _io.so
env['PYTHONPATH'] = ':'.join([
self.ctx.get_site_packages_dir(arch),
env['BUILDLIB_PATH'],
])
return env
recipe = TwistedRecipe()