2022-12-02 21:15:34 +01:00
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
|
2019-03-30 21:58:45 +01:00
|
|
|
from pythonforandroid.recipe import CythonRecipe
|
2017-08-13 03:24:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
class TwistedRecipe(CythonRecipe):
|
2022-12-02 21:15:34 +01:00
|
|
|
version = '20.3.0'
|
2017-08-13 03:24:00 +02:00
|
|
|
url = 'https://github.com/twisted/twisted/archive/twisted-{version}.tar.gz'
|
|
|
|
|
2019-03-30 21:58:45 +01:00
|
|
|
depends = ['setuptools', 'zope_interface', 'incremental', 'constantly']
|
2022-12-02 21:15:34 +01:00
|
|
|
patches = ['incremental.patch', 'remove_tests.patch']
|
2017-08-13 03:24:00 +02:00
|
|
|
|
|
|
|
call_hostpython_via_targetpython = False
|
2019-03-30 21:58:45 +01:00
|
|
|
install_in_hostpython = False
|
2017-08-13 03:24:00 +02:00
|
|
|
|
|
|
|
def prebuild_arch(self, arch):
|
2022-12-02 21:15:34 +01:00
|
|
|
super().prebuild_arch(arch)
|
2017-08-13 03:24:00 +02:00
|
|
|
# TODO Need to whitelist tty.pyo and termios.so here
|
2022-12-02 21:15:34 +01:00
|
|
|
|
|
|
|
# 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)
|
2017-08-13 03:24:00 +02:00
|
|
|
|
|
|
|
def get_recipe_env(self, arch):
|
2022-12-02 21:15:34 +01:00
|
|
|
env = super().get_recipe_env(arch)
|
2017-08-13 03:24:00 +02:00
|
|
|
# We add BUILDLIB_PATH to PYTHONPATH so twisted can find _io.so
|
|
|
|
env['PYTHONPATH'] = ':'.join([
|
2022-12-02 21:15:34 +01:00
|
|
|
self.ctx.get_site_packages_dir(arch),
|
2017-08-13 03:24:00 +02:00
|
|
|
env['BUILDLIB_PATH'],
|
|
|
|
])
|
|
|
|
return env
|
|
|
|
|
2019-03-30 21:58:45 +01:00
|
|
|
|
2017-08-13 03:24:00 +02:00
|
|
|
recipe = TwistedRecipe()
|