-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
I'm trying to write a setuptools Recipe (as part of getting Twisted working), and currently have:
from pythonforandroid.toolchain import PythonRecipe, shprint
from os.path import exists, join
import sh
class SetuptoolsRecipe(PythonRecipe):
version = '18.3.1'
url = 'https://pypi.python.org/packages/source/s/setuptools/setuptools-{version}.tar.gz'
depends = ['python2']
def prebuild_arch(self, arch):
super(SetuptoolsRecipe, self).prebuild_arch(arch)
build_dir = self.get_build_dir(arch.arch)
if exists(join(build_dir, '.patched')):
print('setuptools already patched, skipping')
return
self.apply_patch('fix-setup-remove-io.patch')
shprint(sh.touch, join(build_dir, '.patched'))
def build_arch(self, arch):
# build setuptools for android
super(SetuptoolsRecipe, self).build_arch(arch)
# build setuptools for python-for-android
#self.install_python_package()
# trying to replicate this line from old py4a recipe:
# try $BUILD_hostpython/hostpython setup.py install -O2 --root=$BUILD_hostpython --install-lib=Lib/site-packages
recipe = SetuptoolsRecipe()diff -u setuptools-18.3.1.orig/setup.py setuptools-18.3.1/setup.py
--- setuptools-18.3.1.orig/setup.py 2015-09-07 02:55:31.000000000 +0000
+++ setuptools-18.3.1/setup.py 2015-09-12 02:12:50.880759164 +0000
@@ -3,7 +3,6 @@
Distutils setup file, used to install or test 'setuptools'
"""
-import io
import os
import sys
import textwrap
@@ -48,9 +47,7 @@
console_scripts = list(_gen_console_scripts())
-readme_file = io.open('README.txt', encoding='utf-8')
-
-with readme_file:
+with open('README.txt', encoding='utf-8') as readme_file:
long_description = readme_file.read()
package_data = {The patch is to get around a "wrong ELF class" error with io (similar to kivy/plyer#128), but now I get the same error with ctypes (FYI I had to modify sh.py to output the traceback):
[INFO]: Building setuptools for armeabi
name is None <class 'pythonforandroid.recipes.setuptools.SetuptoolsRecipe'>
[INFO]: setuptools apparently isn't already in site-packages
[INFO]: Installing setuptools into site-packages
[INFO]: -> directory context /home/str4d/.local/share/python-for-android/build/other_builds/setuptools/armeabi/setuptools
[INFO]: running python.host setup.py install -O2
working ... ImportError: /home/str4d/.local/share/python-for-android/build/python-installs/twisted/lib/python2.7 ...Traceback (most recent call last):
File "setup.py", line 20, in <module>
exec(init_file.read(), command_ns)
File "<string>", line 11, in <module>
File "/home/str4d/.local/share/python-for-android/build/other_builds/setuptools/armeabi/setuptools/setuptools/__init__.py", line 12, in <module>
from setuptools.extension import Extension
File "/home/str4d/.local/share/python-for-android/build/other_builds/setuptools/armeabi/setuptools/setuptools/extension.py", line 8, in <module>
from .dist import _get_unpatched
File "/home/str4d/.local/share/python-for-android/build/other_builds/setuptools/armeabi/setuptools/setuptools/dist.py", line 18, in <module>
from setuptools import windows_support
File "/home/str4d/.local/share/python-for-android/build/other_builds/setuptools/armeabi/setuptools/setuptools/windows_support.py", line 2, in <module>
import ctypes
File "/home/str4d/.local/share/python-for-android/build/python-installs/twisted/lib/python2.7/ctypes/__init__.py", line 10, in <module>
from _ctypes import Union, Structure, Array
ImportError: /home/str4d/.local/share/python-for-android/build/python-installs/twisted/lib/python2.7/lib-dynload/_ctypes.so: wrong ELF class: ELFCLASS32
I'm obviously doing something wrong, but the setuptools recipe for the old python-for-android didn't have any special library handling, which makes me think that there is some difference in the revamp causing it. It's a bug somewhere, I just don't know if it's in toolchain.py or my understanding of how to write recipes :P
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels