-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
62 lines (52 loc) · 1.58 KB
/
setup.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#
# Kivy - Crossplatform NUI toolkit
# http://kivy.org/
#
from distutils.core import setup
from os.path import sep
from os import environ
import sys
platform = sys.platform
kivy_ios_root = environ.get('KIVYIOSROOT', None)
if kivy_ios_root is not None:
platform = 'ios'
# -----------------------------------------------------------------------------
def get_modulename_from_file(filepath):
filepath = filepath.replace(sep, '/')
pyx = '.'.join(filepath.split('.')[:-1])
pyxl = pyx.split('/')
try:
while pyxl[0] != 'pente':
pyxl.pop(0)
if pyxl[1] == 'pente':
pyxl.pop(0)
except:
print "Couldn't get_modulename_from_file from %s" % filepath
pyxl = pyx.split('/')[1:] # Strip off the leading "./"
r = '.'.join(pyxl)
return r
if platform != 'ios':
# OS X
from Cython.Build import cythonize
ext_options = {"compiler_directives": {"profile": False}, "annotate": False}
#ext_options = {"compiler_directives": {"profile": True}, "annotate": False}
ext_modules = cythonize(["pentai/*/*.pyx"], **ext_options)
else:
from distutils.extension import Extension
import glob
ext_modules = []
c_files = glob.glob("pentai/*/*.c")
for filepath in c_files:
ext_name = get_modulename_from_file(filepath)
ext_modules.append(Extension(ext_name, [filepath]))
setup(
name='pentai',
author='Bruce Cropley',
packages=[
'pentai',
'pentai.base',
'pentai.ai',
# TODO: Why is db missing (openings book)
],
ext_modules=ext_modules,
)