aboutsummaryrefslogtreecommitdiffstats
path: root/setup.py
blob: 8b4ca0e13688a57a97695df1f3b77c67a811a507 (plain) (blame)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
from distutils.core import setup
from distutils.extension import Extension

#True, False, 'auto'
USE_CYTHON = 'auto'

import sys, commands

def pkgconfig(_libs):
  cf = commands.getoutput("pkg-config --cflags %s"%_libs).split()
  ldf = commands.getoutput("pkg-config --libs %s"%_libs).split()
  return (cf, ldf)

(e_compile_args, e_link_args) = pkgconfig("eo")

e_include_dirs = ["."]
e_library_dirs = []
e_libraries = []

ext_modules = []


if USE_CYTHON:
   try:
      from Cython.Distutils import build_ext
   except ImportError:
      if USE_CYTHON=='auto':
         USE_CYTHON=False
      else:
         raise

if USE_CYTHON:
   print "Using Cython"
   ext_modules += [
         Extension("eorepo.eodefault", ['eorepo/eodefault.pyx'], include_dirs = e_include_dirs, library_dirs = e_library_dirs, libraries = e_libraries, extra_compile_args = e_compile_args, extra_link_args = e_link_args),
         ]
   ext_modules += [
         Extension("eorepo.eobase", ['eorepo/eobase.pyx'], include_dirs = e_include_dirs, library_dirs = e_library_dirs, libraries = e_libraries, extra_compile_args = e_compile_args, extra_link_args = e_link_args),
         ]

   cmdclass = {'build_ext' : build_ext},
else:
   print "Not using Cython"
   ext_modules += [
         Extension("eorepo.eodefault", ['eorepo/eodefault.c'], include_dirs = e_include_dirs, library_dirs = e_library_dirs, libraries = e_libraries, extra_compile_args = e_compile_args, extra_link_args = e_link_args),
         ]
   ext_modules += [
         Extension("eorepo.eobase", ['eorepo/eobase.c'], include_dirs = e_include_dirs, library_dirs = e_library_dirs, libraries = e_libraries, extra_compile_args = e_compile_args, extra_link_args = e_link_args),
         ]


setup(
      name='eoparser_eorepo',
      version='0.1dev',
      author='Yakov Goldberg',
      author_email='yakov.goldberg@gmail.com',
      packages=['eoparser', 'eorepo'],
      package_data={'eoparser': ['data/types.xml'],
         'eorepo': ['EoBase.xml', 'eodefault.pxd']
         },
      ext_modules = ext_modules,

      data_files=[('/usr/local/share/eoparser/examples', ['examples/evas_elem_test.py', 
                                                          'examples/elm_elm.js',
                                                          'examples/elw_button.js',
                                                          'examples/elw_button_new_names.js',
                                                          'examples/elw_button_old.js',
                                                          'examples/elw_eoisa.js',
                                                          'examples/elw_mixin.js',
                                                          'examples/elw_signal.js',
                                                          'examples/eoisa_test.py',
                                                          'examples/evas_lib_test.py',
                                                          'examples/evas_test.py',
                                                          'examples/evas_test2.py',
                                                          'examples/mixin_test.py',
                                                          'examples/signal_test.py',
                                                          'examples/simple_test.py'
                                                         ])],
      scripts=['bin/eo_xml_gen.py', 'bin/eo_graph_gen.py',
         'bin/eo_py_gen.py', 'bin/eo_js_gen.py'],
      license='GPL',
      long_description=open('README').read(),
      )