abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
setup.py
Go to the documentation of this file.
1 import sys
2 
3 from distutils.core import setup, Extension
4 from distutils.sysconfig import get_config_vars
5 from distutils import util
6 from distutils.command.build_ext import build_ext
7 from distutils import sysconfig
8 
9 define_macros = []
10 libraries = []
11 library_dirs = []
12 
13 if sys.platform == "win32":
14 
15  src_file = [ 'pyabc.i' ]
16 
17  define_macros.append( ('WIN32', 1) )
18  define_macros.append( ('ABC_DLL', 'ABC_DLLEXPORT') )
19 
20  libraries.append('abcr')
21  library_dirs.append('./../../lib')
22 
23 else:
24 
25  src_file = [ 'pyabc_wrap.c' ]
26 
27  if get_config_vars()['SIZEOF_VOID_P'] > 4:
28  define_macros.append( ('LIN64', 1) )
29  else:
30  define_macros.append( ('LIN', 1) )
31 
32  libraries.append( 'abc' )
33  libraries.append( 'rt' )
34  libraries.append( 'readline' )
35  library_dirs.append('./../../')
36 
37 
38 # ugly hack to silence strict-prototype warnings
39 
40 class build_ext_subclass( build_ext ):
41 
42  def build_extensions(self):
43 
44  CC = sysconfig.get_config_var("CC")
45 
46  if self.compiler.compiler_type == 'unix' and ( 'gcc' in CC or 'g++' in CC):
47  for e in self.extensions:
48  e.extra_compile_args.append( '-Wno-strict-prototypes' )
49 
50  build_ext.build_extensions(self)
51 
52 ext = Extension(
53  '_pyabc',
54  src_file,
55  define_macros=define_macros,
56  include_dirs = ["../../src"],
57  library_dirs=library_dirs,
58  libraries=libraries
59  )
60 
61 setup(
62  name='pyabc',
63  version='1.0',
64  ext_modules=[ext],
65  py_modules=['pyabc','getch','pyabc_split','redirect', 'reachx_cmd'],
66  cmdclass = {'build_ext': build_ext_subclass }
67 )
Definition: setup.py:1