Skip to content

Commit 1c7088f

Browse files
committed
Add ios to deploy
1 parent 68e163c commit 1c7088f

File tree

1 file changed

+13
-40
lines changed

1 file changed

+13
-40
lines changed

setup.py

Lines changed: 13 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,65 +3,31 @@
33
from os.path import dirname, join, exists
44
import sys
55
import platform
6-
from distutils.command.build_ext import build_ext
6+
import Cython
7+
from Cython.Distutils import build_ext
78

89
with open(join('pyobjus', '__init__.py')) as fd:
910
VERSION = [
1011
x for x in fd.readlines()
1112
if x.startswith('__version__')
1213
][0].split("'")[-2]
1314

14-
dev_platform = sys.platform
15-
kivy_ios_root = environ.get('KIVYIOSROOT', None)
1615
arch = environ.get('ARCH', platform.machine())
17-
if kivy_ios_root is not None:
18-
dev_platform = 'ios'
1916

20-
print("Pyobjus platform is {}".format(dev_platform))
17+
print("Pyobjus platform is {}".format(sys.platform))
2118

22-
# OSX
23-
files = []
24-
if dev_platform == 'darwin':
25-
files = ['pyobjus.pyx']
26-
# iOS
27-
elif dev_platform == 'ios':
28-
files = ['pyobjus.c']
19+
files = ['pyobjus.pyx']
2920

3021

3122
class PyObjusBuildExt(build_ext, object):
3223

33-
def __new__(cls, *a, **kw):
34-
# Note how this class is declared as a subclass of distutils
35-
# build_ext as the Cython version may not be available in the
36-
# environment it is initially started in. However, if Cython
37-
# can be used, setuptools will bring Cython into the environment
38-
# thus its version of build_ext will become available.
39-
# The reason why this is done as a __new__ rather than through a
40-
# factory function is because there are distutils functions that check
41-
# the values provided by cmdclass with issublcass, and so it would
42-
# result in an exception.
43-
# The following essentially supply a dynamically generated subclass
44-
# that mix in the cython version of build_ext so that the
45-
# functionality provided will also be executed.
46-
if dev_platform != 'ios':
47-
from Cython.Distutils import build_ext as cython_build_ext
48-
build_ext_cls = type(
49-
'PyObjusBuildExt', (PyObjusBuildExt, cython_build_ext), {})
50-
return super(PyObjusBuildExt, cls).__new__(build_ext_cls)
51-
else:
52-
return super(PyObjusBuildExt, cls).__new__(cls)
53-
5424
def build_extensions(self):
5525
# create a configuration file for pyobjus (export the platform)
5626
config_pxi_fn = join(dirname(__file__), 'pyobjus', 'config.pxi')
5727
config_pxi_need_update = True
58-
config_pxi = 'DEF PLATFORM = "{}"\n'.format(dev_platform)
28+
config_pxi = 'DEF PLATFORM = "{}"\n'.format(sys.platform)
5929
config_pxi += 'DEF ARCH = "{}"\n'.format(arch)
60-
if dev_platform == 'ios':
61-
cython3 = False # Assume Cython 0.29, which is what we use for kivy-ios (ATM)
62-
else:
63-
import Cython
64-
cython3 = Cython.__version__.startswith('3.')
30+
cython3 = Cython.__version__.startswith('3.')
6531
config_pxi += f"DEF PYOBJUS_CYTHON_3 = {cython3}"
6632
if exists(config_pxi_fn):
6733
with open(config_pxi_fn) as fd:
@@ -78,6 +44,13 @@ def build_extensions(self):
7844
extra_compile_args = []
7945
extra_link_args = []
8046
include_dirs = []
47+
48+
if sys.platform == "ios":
49+
ios_ver = platform.ios_ver()
50+
ios_deps_path = join(dirname(__file__), 'ios-deps-install')
51+
print(ios_ver)
52+
53+
8154
depends = [join('pyobjus', x) for x in (
8255
'common.pxi',
8356
'config.pxi',

0 commit comments

Comments
 (0)