Compare commits

...

33 commits

Author SHA1 Message Date
Mathieu Virbel
58a0bb7ba2 try to get cryptography and setuptools on ios 2016-12-04 19:32:19 +01:00
Mathieu Virbel
55e8785a53 host_cffi: custom cffi module to be used within hostpython 2016-12-04 01:46:16 +01:00
Mathieu Virbel
4b364991fc hostpython: remove dynload patch that is not necessary for host python 2016-12-04 01:45:49 +01:00
Robert Niederreiter
67e8a0fb52 merge kivy master 2016-11-11 13:12:43 +01:00
Robert Niederreiter
263f89bb8c don't try to install cffi to hostpython via cffi recipe 2016-11-11 13:06:15 +01:00
Robert Niederreiter
e0f7ec5197 document new findings, remove build logger, some cleanup 2016-11-04 15:49:44 +01:00
Robert Niederreiter
0404d269b4 Update enum34 url 2016-11-04 15:01:38 +01:00
Robert Niederreiter
da5040d5cd cffi installs and works on device, hostpython not working yet 2016-11-04 14:05:30 +01:00
Robert Niederreiter
b392c61ae5 make cffi recipe work, additionally install pycparser in hostpython 2016-11-04 12:48:30 +01:00
Robert Niederreiter
1eed3853d5 experimenting with cryptography build 2016-11-02 17:43:23 +01:00
Robert Niederreiter
38230677fb build logger experiments 2016-11-02 14:34:21 +01:00
Robert Niederreiter
d65c85b0a8 typo 2016-11-02 14:12:03 +01:00
Robert Niederreiter
7188aa1904 typo 2016-11-02 14:11:11 +01:00
Robert Niederreiter
cd626b1fb7 correct type 2016-11-02 14:09:45 +01:00
Robert Niederreiter
7ff865e274 add command logger for analyzing build process 2016-11-02 13:59:34 +01:00
Robert Niederreiter
cba2e7a30b comment on unpacking setuptools in host_setuptools recipe 2016-10-22 13:38:59 +02:00
Robert Niederreiter
2cb3124e35 pycparser and cffi recipes install 2016-10-17 08:55:33 +02:00
Robert Niederreiter
26a76b65e5 recipe dependencies 2016-10-14 17:59:39 +02:00
Robert Niederreiter
bad28e3735 add enum34 recipe 2016-10-14 17:26:38 +02:00
Robert Niederreiter
11f84ec830 add ipaddress recipe 2016-10-14 17:21:02 +02:00
Robert Niederreiter
d0ba2dd4dd fix host_setuptools recipe 2016-10-14 16:01:50 +02:00
Robert Niederreiter
1c37a80b81 Install pure python packages like werkzeug 2016-10-14 14:57:49 +02:00
Robert Niederreiter
d4cb02ccf1 work on twisted related recipes 2016-10-14 14:07:10 +02:00
Robert Niederreiter
bbd1dadb16 reduce zope_interface recipe 2016-10-14 13:04:01 +02:00
Robert Niederreiter
02e9e08b5a ... 2016-10-14 12:39:39 +02:00
Robert Niederreiter
638e355df0 add archive dummy for host_setuptools to make toolchain happy 2016-10-14 10:13:38 +02:00
Robert Niederreiter
3375a52195 host_setuptools WIP 2016-10-14 10:05:44 +02:00
Robert Niederreiter
c34f792a17 tell hostpython where to find openssl 2016-10-14 10:04:15 +02:00
Robert Niederreiter
228c4c320d Merge branch 'docs' into twisted_recipe 2016-10-14 09:59:11 +02:00
Robert Niederreiter
7ff3e7982f add minimal docs 2016-10-14 09:58:41 +02:00
Robert Niederreiter
805c52bd6d work on hostpython and host_setuptools 2016-10-14 09:57:34 +02:00
Robert Niederreiter
0b696d6557 implement build_arch 2016-10-13 16:07:58 +02:00
Robert Niederreiter
8481f19564 twisted and autobahn related recipe stubs 2016-10-13 11:20:55 +02:00
21 changed files with 568 additions and 15 deletions

2
.gitignore vendored
View file

@ -2,6 +2,8 @@
*.pyc
*.pyo
*.swp
.project
.pydevproject
freetype-*
build/*
dist/*

View file

@ -87,6 +87,7 @@ For a complete list of available commands, type::
$ ./toolchain.py
Create the Xcode project
------------------------
@ -109,6 +110,7 @@ Then click on `Play`, and enjoy.
the `<title>-ios/YourApp` directory. Don't make changes in the -ios
directory directly.
Configuring your App
--------------------
@ -123,6 +125,7 @@ launch environment.
the 'export_orientation' function in 'main.m'. The XCode orientation
settings should be set to support all.
FAQ
---
@ -132,6 +135,7 @@ Fatal error: "stdio.h" file not found
You must build with bitcode disabled (Xcode setting ENABLE_BITCODE should be No).
We don't support bitcode. You need to go to the project setting, and disable bitcode.
Support
-------
@ -146,6 +150,7 @@ We also have an IRC channel:
* Port : 6667, 6697 (SSL only)
* Channel : #kivy
Contributing
------------
@ -165,6 +170,7 @@ IRC channel:
* Port : 6667, 6697 (SSL only)
* Channel : #kivy-dev
License
-------

View file

@ -0,0 +1,26 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class AutobahnRecipe(PythonRecipe):
name = "autobahn"
version = "0.16.0"
url = "https://github.com/crossbario/autobahn-python/archive/v{version}.zip"
depends = ["twisted", "six", "txaio"]
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
hostpython = sh.Command(self.ctx.hostpython)
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = AutobahnRecipe()

68
recipes/cffi/__init__.py Normal file
View file

@ -0,0 +1,68 @@
from os.path import join
from toolchain import CythonRecipe
from toolchain import shprint
import os
import sh
class CffiRecipe(CythonRecipe):
depends = ["host_cffi"]
name = "cffi"
version = "1.8.3"
url = (
"https://pypi.python.org/packages/0a/f3/"
"686af8873b70028fccf67b15c78fd4e4667a3da995007afc71e786d61b0a/"
"cffi-{version}.tar.gz"
)
library = "libcffi.a"
depends = ["libffi", "host_setuptools", "pycparser"]
cythonize = False
def get_recipe_env(self, arch):
env = super(CffiRecipe, self).get_recipe_env(arch)
env["CC"] += " -I{}".format(
join(self.ctx.dist_dir, "include", arch.arch, "libffi"))
return env
def install(self):
arch = [arch for arch in self.filtered_archs if arch.arch == 'x86_64'][0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
# manually create expected directory in build directory
scripts_dir = join("build", "scripts-2.7")
if not os.path.exists(scripts_dir):
os.makedirs(scripts_dir)
hostpython = sh.Command(self.ctx.hostpython)
# install cffi in hostpython
#
# XXX: installs, module import works, but FFI fails to instanciate:
#
# myhost:kivy-ios user$ ./dist/hostpython/bin/python
# Could not find platform dependent libraries <exec_prefix>
# Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
# Python 2.7.1 (r271:86832, Nov 4 2016, 10:41:44)
# [GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
# Type "help", "copyright", "credits" or "license" for more information.
# >>> import cffi
# >>> cffi.api.FFI()
# Traceback (most recent call last):
# File "<stdin>", line 1, in <module>
# File "/.../kivy-ios/dist/hostpython/lib/python2.7/site-packages/cffi/api.py", line 56, in __init__
# import _cffi_backend as backend
# ImportError: dynamic module does not define init function (init_cffi_backend)
#
#r = self.get_recipe('hostlibffi', self.ctx)
#build_env = r.get_recipe_env(arch)
#args = [hostpython, "setup.py", "install"]
#shprint(*args, _env=build_env)
# install cffi in root site packages
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = CffiRecipe()

View file

@ -0,0 +1,49 @@
from os.path import join
from toolchain import CythonRecipe, PythonRecipe
from toolchain import shprint
import os
import sh
class CryptographyRecipe(PythonRecipe):
name = "cryptography"
version = "1.5.2"
url = (
"https://pypi.python.org/packages/03/1a/"
"60984cb85cc38c4ebdfca27b32a6df6f1914959d8790f5a349608c78be61/"
"cryptography-{version}.tar.gz"
)
# library = "libcryptography.a"
depends = ["host_setuptools", "host_cffi", "cffi", "six", "idna", "pyasn1",
"enum34", "setuptools"]
cythonize = False
def get_recipe_env(self, arch):
env = super(CryptographyRecipe, self).get_recipe_env(arch)
env["CC"] += " -I{}".format(
join(self.ctx.dist_dir, "include", arch.arch, "libffi"))
env["CFLAGS"] += " -I{}".format(
join(self.ctx.dist_dir, "include", arch.arch, "openssl", "openssl"))
return env
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
# manually create expected directory in build directory
scripts_dir = join("build", "scripts-2.7")
if not os.path.exists(scripts_dir):
os.makedirs(scripts_dir)
hostpython = sh.Command(self.ctx.hostpython)
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir,
"--old-and-unmanageable"]
shprint(*args, _env=build_env)
#args = [hostpython, "setup.py", "install"]
#shprint(*args, _env=build_env)
recipe = CryptographyRecipe()

View file

@ -0,0 +1,26 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class Enum34Recipe(PythonRecipe):
version = "1.1.6"
url = "https://pypi.python.org/packages/bf/3e/31d502c25302814a7c2f1d3959d2a3b3f78e509002ba91aea64993936876/enum34-1.1.6.tar.gz"
# url = 'https://pypi.python.org/packages/source/e/enum34/enum34-{version}.tar.gz'
depends = ["python", "host_setuptools"]
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
hostpython = sh.Command(self.ctx.hostpython)
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = Enum34Recipe()

View file

@ -0,0 +1,66 @@
from os.path import join
from toolchain import Recipe
from toolchain import shprint
import os
import sh
libffi_tpl = """
prefix=%PREFIX%
exec_prefix=${prefix}
libdir=${exec_prefix}/build/Release
includedir=${libdir}/build_macosx-x86_64/include
Name: libffi
Description: Library supporting Foreign Function Interfaces
Version: %VERSION%
Libs: -L${libdir} -lffi
Cflags: -I${includedir}
"""
class HostCffiRecipe(Recipe):
name = "host_cffi"
version = "1.8.3"
archs = ["x86_64"]
url = (
"https://pypi.python.org/packages/0a/f3/"
"686af8873b70028fccf67b15c78fd4e4667a3da995007afc71e786d61b0a/"
"cffi-{version}.tar.gz"
)
depends = ["libffi", "host_setuptools", "pycparser"]
def get_recipe_env(self, arch):
sdk_path = sh.xcrun("--sdk", "macosx", "--show-sdk-path").strip()
env = super(HostCffiRecipe, self).get_recipe_env(arch)
env["CC"] = "clang -Qunused-arguments -fcolor-diagnostics"
env["LDFLAGS"] = " ".join([
"-undefined dynamic_lookup",
"-shared",
"-L{}".format(join(self.ctx.dist_dir, "hostlibffi", "usr", "local", "lib"))
])
env["CFLAGS"] = " ".join([
"--sysroot={}".format(sdk_path),
"-I{}".format(join(self.ctx.dist_dir, "hostlibffi", "usr", "local", "include"))
])
return env
def prebuild_arch(self, arch):
hostpython = sh.Command(self.ctx.hostpython)
build_dir = self.get_build_dir(arch.arch)
build_env = self.get_recipe_env(arch)
os.chdir(build_dir)
# generate a fake libffi pkg-config to let cffi use it
hostlibffi = Recipe.get_recipe("hostlibffi", self.ctx)
with open("libffi.pc", "w") as fd:
tpl = libffi_tpl.replace("%PREFIX%",
hostlibffi.get_build_dir(arch.arch))
tpl = tpl.replace("%VERSION%", hostlibffi.version)
fd.write(tpl)
build_env["PKG_CONFIG"] = "/usr/local/bin/pkg-config"
build_env["PKG_CONFIG_PATH"] = build_dir
shprint(hostpython, "setup.py", "build_ext", _env=build_env)
shprint(hostpython, "setup.py", "install", _env=build_env)
recipe = HostCffiRecipe()

View file

@ -28,7 +28,9 @@ class HostSetuptools(Recipe):
shprint(unzip, setuptools_egg_path)
os.remove(setuptools_egg_path)
os.remove('setuptools.pth')
os.remove('easy-install.pth')
# XXX: setuptools egg is referenced in easy-install.pth, check removal
# after unpacking setuptools if necessary
#os.remove('easy-install.pth')
shutil.rmtree('EGG-INFO')
recipe = HostSetuptools()

View file

@ -24,7 +24,7 @@ class HostpythonRecipe(Recipe):
return
self.copy_file("_scproxy.py", "Lib/_scproxy.py")
self.apply_patch("ssize-t-max.patch")
self.apply_patch("dynload.patch")
# self.apply_patch("dynload.patch")
self.apply_patch("static-_sqlite3.patch")
self.copy_file("ModulesSetup", "Modules/Setup.local")
if "openssl.build_all" in self.ctx.state:

29
recipes/idna/__init__.py Normal file
View file

@ -0,0 +1,29 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class IdnaRecipe(PythonRecipe):
version = "2.1"
url = (
"https://pypi.python.org/packages/fb/84/"
"8c27516fbaa8147acd2e431086b473c453c428e24e8fb99a1d89ce381851/"
"idna-{version}.tar.gz"
)
depends = ["python", "host_setuptools"]
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
hostpython = sh.Command(self.ctx.hostpython)
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = IdnaRecipe()

View file

@ -0,0 +1,29 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class IPAddressRecipe(PythonRecipe):
version = "1.0.17"
url = (
"https://pypi.python.org/packages/bb/26/"
"3b64955ff73f9e3155079b9ed31812afdfa5333b5c76387454d651ef593a/"
"ipaddress-{version}.tar.gz"
)
depends = ["python", "host_setuptools"]
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
hostpython = sh.Command(self.ctx.hostpython)
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = IPAddressRecipe()

View file

@ -0,0 +1,29 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class Pyasn1Recipe(PythonRecipe):
version = "0.1.9"
url = (
"https://pypi.python.org/packages/f7/83/"
"377e3dd2e95f9020dbd0dfd3c47aaa7deebe3c68d3857a4e51917146ae8b/"
"pyasn1-{version}.tar.gz"
)
depends = ["ipaddress"]
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
hostpython = sh.Command(self.ctx.hostpython)
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = Pyasn1Recipe()

View file

@ -0,0 +1,35 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class PycparserRecipe(PythonRecipe):
version = "2.14"
url = (
"https://pypi.python.org/packages/6d/31/"
"666614af3db0acf377876d48688c5d334b6e493b96d21aa7d332169bee50/"
"pycparser-{version}.tar.gz"
)
depends = ["python"]
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
# manually create expected directory in build directory
scripts_dir = join("build", "scripts-2.7")
if not os.path.exists(scripts_dir):
os.makedirs(scripts_dir)
hostpython = sh.Command(self.ctx.hostpython)
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
args = [hostpython, "setup.py", "install"]
shprint(*args, _env=build_env)
recipe = PycparserRecipe()

View file

@ -0,0 +1,29 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class PyOpenSSLRecipe(PythonRecipe):
version = "16.1.0"
url = (
"https://pypi.python.org/packages/15/1e/"
"79c75db50e57350a7cefb70b110255757e9abd380a50ebdc0cfd853b7450/"
"pyOpenSSL-{version}.tar.gz"
)
depends = ["openssl", "cryptography"]
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
hostpython = sh.Command(self.ctx.hostpython)
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = PyOpenSSLRecipe()

View file

@ -7,7 +7,7 @@ import os
class PythonRecipe(Recipe):
version = "2.7.1"
url = "https://www.python.org/ftp/python/{version}/Python-{version}.tar.bz2"
depends = ["hostpython", "libffi", ]
depends = ["hostpython", "libffi"]
optional_depends = ["openssl"]
library = "libpython2.7.a"
pbx_libraries = ["libz", "libbz2", "libsqlite3"]
@ -33,7 +33,6 @@ class PythonRecipe(Recipe):
self.append_file("ModulesSetup.mobile", "Modules/Setup.local")
if "openssl.build_all" in self.ctx.state:
self.append_file("ModulesSetup.openssl", "Modules/Setup.local")
self.set_marker("patched")
def build_arch(self, arch):

View file

@ -0,0 +1,32 @@
from toolchain import CythonRecipe
class SetuptoolsRecipe(CythonRecipe):
name = "setuptools"
version = "4.3.2"
url = 'https://pypi.python.org/packages/f1/92/12c7251039b274c30106c3e0babdcb040cbd13c3ad4b3f0ef9a7c217e36a/setuptools-30.2.0.tar.gz'
depends = ["python", "host_setuptools"]
cythonize = False
def get_recipe_env(self, arch):
env = super(SetuptoolsRecipe, self).get_recipe_env(arch)
env["PYTHONPATH"] = self.get_build_dir(arch.arch) + "/iosbuild/lib/python2.7/site-packages"
return env
def install_python_package(self):
import sh
from toolchain import shprint
from os import chdir
arch = self.filtered_archs[0]
build_dir = self.get_build_dir(arch.arch)
chdir(build_dir)
hostpython = sh.Command(self.ctx.hostpython)
shprint(hostpython, "setup.py", "install", "--prefix",
self.ctx.install_dir, "--old-and-unmanageable")
# "--single-version-externally-managed", "--root", "/", "-O2")
recipe = SetuptoolsRecipe()

29
recipes/six/__init__.py Normal file
View file

@ -0,0 +1,29 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class SixRecipe(PythonRecipe):
version = "1.10.0"
url = (
"https://pypi.python.org/packages/b3/b2/"
"238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/"
"six-{version}.tar.gz"
)
depends = ["python"]
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
hostpython = sh.Command(self.ctx.hostpython)
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = SixRecipe()

View file

@ -0,0 +1,12 @@
from toolchain import CythonRecipe
class TwistedRecipe(CythonRecipe):
name = "twisted"
version = "16.1.1"
url = "https://github.com/twisted/twisted/archive/twisted-{version}.zip"
depends = ["pyopenssl", "zope_interface"]
cythonize = False
recipe = TwistedRecipe()

29
recipes/txaio/__init__.py Normal file
View file

@ -0,0 +1,29 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class TxaioRecipe(PythonRecipe):
version = "2.5.1"
url = (
"https://pypi.python.org/packages/45/e1/"
"f7d88767d65dbfc20d4b4aa0dad657dbbe8ca629ead2bef24da04630a12a/"
"txaio-{version}.tar.gz"
)
depends = ["host_setuptools", "six"]
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
hostpython = sh.Command(self.ctx.hostpython)
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = TxaioRecipe()

View file

@ -0,0 +1,13 @@
from toolchain import CythonRecipe
class ZopeInterfaceRecipe(CythonRecipe):
name = "zope"
version = "4.3.2"
url = 'http://pypi.python.org/packages/source/z/zope.interface/zope.interface-{version}.tar.gz'
depends = ["python", "host_setuptools"]
cythonize = False
recipe = ZopeInterfaceRecipe()

View file

@ -118,7 +118,9 @@ class JsonStore(object):
with io.open(self.filename, 'w', encoding='utf-8') as fd:
fd.write(unicode(json.dumps(self.data, ensure_ascii=False)))
class Arch(object):
def __init__(self, ctx):
super(Arch, self).__init__()
self.ctx = ctx
@ -135,7 +137,6 @@ class Arch(object):
d.format(arch=self))
for d in self.ctx.include_dirs]
def get_env(self):
include_dirs = [
"-I{}/{}".format(
@ -196,7 +197,6 @@ class Arch(object):
return env
class ArchSimulator(Arch):
sdk = "iphonesimulator"
arch = "i386"
@ -227,7 +227,7 @@ class Arch64IOS(Arch):
triple = "aarch64-apple-darwin13"
version_min = "-miphoneos-version-min=7.0"
sysroot = sh.xcrun("--sdk", "iphoneos", "--show-sdk-path").strip()
class Graph(object):
# Taken from python-for-android/depsort
@ -375,19 +375,60 @@ class Context(object):
class Recipe(object):
version = None
"""Base recipe for compiling and installing dependency libraries and
packages to kivy iOS build.
"""
url = None
"""Either folder name relative to recipe or download URL.
"""
version = None
"""Gets formatted with ``url`` if download URL.
"""
archs = []
"""Architectures this recipe applies, empty list means all.
"""
depends = []
"""Dependency recipes.
"""
optional_depends = []
"""???
"""
library = None
"""???
"""
libraries = []
"""???
"""
include_dir = None
"""Include directory for compilation"""
include_per_arch = False
"""???
"""
frameworks = []
"""OS X frameworks.
"""
sources = []
"""???
"""
pbx_frameworks = []
"""???
"""
pbx_libraries = []
"""???
"""
# API available for recipes
def download_file(self, url, filename, cwd=None):
@ -396,6 +437,7 @@ class Recipe(object):
"""
if not url:
return
def report_hook(index, blksize, size):
if size <= 0:
progression = '{0} bytes'.format(index * blksize)
@ -414,6 +456,7 @@ class Recipe(object):
urlcleanup()
print('Downloading {0}'.format(url))
print("filename", filename)
urlretrieve(url, filename, report_hook)
return filename
@ -638,7 +681,7 @@ class Recipe(object):
shutil.copytree(src_dir, dest_dir)
return
ensure_dir(build_dir)
self.extract_file(self.archive_fn, build_dir)
self.extract_file(self.archive_fn, build_dir)
@cache_execution
def build(self, arch):
@ -812,7 +855,7 @@ class Recipe(object):
@classmethod
def get_recipe(cls, name, ctx):
if not hasattr(cls, "recipes"):
cls.recipes = {}
cls.recipes = {}
if '==' in name:
name, version = name.split('==')
@ -850,7 +893,8 @@ class PythonRecipe(Recipe):
"""Automate the installation of a Python package into the target
site-packages.
It will works with the first filtered_archs, and the name of the recipe.
It will works with the first filtered_archs, and the name of the
recipe.
"""
arch = self.filtered_archs[0]
if name is None:
@ -1047,7 +1091,6 @@ def update_pbxproj(filename):
fn = join(ctx.dist_dir, "sources", name)
project.add_folder(fn, parent=g_classes)
if project.modified:
project.backup()
project.save()
@ -1055,13 +1098,13 @@ def update_pbxproj(filename):
if __name__ == "__main__":
import argparse
class ToolchainCL(object):
def __init__(self):
parser = argparse.ArgumentParser(
description="Tool for managing the iOS / Python toolchain",
usage="""toolchain <command> [<args>]
Available commands:
build Build a recipe (compile a library for the required target
architecture)
@ -1177,7 +1220,7 @@ Xcode:
parser.add_argument("name", help="Name of your project")
parser.add_argument("directory", help="Directory where your project live")
args = parser.parse_args(sys.argv[2:])
from cookiecutter.main import cookiecutter
ctx = Context()
template_dir = join(curdir, "tools", "templates")