Commit d4f4269c7b9b147ea4a79553f6d28f18c91ceb28

Authored by Jürgen Knödlseder
1 parent 73505b1b

Convert tabs to spaces.

Showing 1 changed file with 59 additions and 59 deletions
pyext/setup.py.in
1 ############################################################################# 1 #############################################################################
2 # Disutils setup file for ctools Python extension module # 2 # Disutils setup file for ctools Python extension module #
3 # ------------------------------------------------------------------------- # 3 # ------------------------------------------------------------------------- #
4 -# Copyright (C) 2011-2014 Juergen Knoedlseder # 4 +# Copyright (C) 2011-2016 Juergen Knoedlseder #
5 # ------------------------------------------------------------------------- # 5 # ------------------------------------------------------------------------- #
6 # # 6 # #
7 # This program is free software: you can redistribute it and/or modify # 7 # This program is free software: you can redistribute it and/or modify #
@@ -27,35 +27,35 @@ import sys @@ -27,35 +27,35 @@ import sys
27 # Detect execution mode 27 # Detect execution mode
28 is_build = True 28 is_build = True
29 if (len(sys.argv) >= 2): 29 if (len(sys.argv) >= 2):
30 - if (sys.argv[1] == 'install'):  
31 - is_build = False 30 + if (sys.argv[1] == 'install'):
  31 + is_build = False
32 if is_build: 32 if is_build:
33 - sys.stdout.write("Python extension module building:\n") 33 + sys.stdout.write("Python extension module building:\n")
34 else: 34 else:
35 - sys.stdout.write("Python extension module installation:\n") 35 + sys.stdout.write("Python extension module installation:\n")
36 36
37 # Darwin MacPorts kluge: Remove -L/opt/local/lib path from LDSHARED as this 37 # Darwin MacPorts kluge: Remove -L/opt/local/lib path from LDSHARED as this
38 # overrides the GammaLib settings. Otherwise, MacPorts libraries would be 38 # overrides the GammaLib settings. Otherwise, MacPorts libraries would be
39 # used instead of the libraries selected by GammaLib 39 # used instead of the libraries selected by GammaLib
40 if sys.platform.lower().startswith("darwin"): 40 if sys.platform.lower().startswith("darwin"):
41 -  
42 - # Get configuration variables  
43 - cvars = sysconfig.get_config_vars()  
44 -  
45 - # Extract LDSHARED  
46 - ldshared_old = cvars.get('LDSHARED')  
47 - ldshared_new = ''  
48 - ldshared_rm = ''  
49 - for option in ldshared_old.split(' '):  
50 - if option.lstrip().find('-L/opt/local/lib') != 0:  
51 - ldshared_new += option + ' '  
52 - else:  
53 - ldshared_rm += option + ' '  
54 - if (len(ldshared_rm) > 0):  
55 - sys.stdout.write("Removed following option(s) from LDSHARED: "+ldshared_rm+"\n");  
56 -  
57 - # Set LDSHARED  
58 - cvars['LDSHARED'] = ldshared_new 41 +
  42 + # Get configuration variables
  43 + cvars = sysconfig.get_config_vars()
  44 +
  45 + # Extract LDSHARED
  46 + ldshared_old = cvars.get('LDSHARED')
  47 + ldshared_new = ''
  48 + ldshared_rm = ''
  49 + for option in ldshared_old.split(' '):
  50 + if option.lstrip().find('-L/opt/local/lib') != 0:
  51 + ldshared_new += option + ' '
  52 + else:
  53 + ldshared_rm += option + ' '
  54 + if (len(ldshared_rm) > 0):
  55 + sys.stdout.write("Removed following option(s) from LDSHARED: "+ldshared_rm+"\n");
  56 +
  57 + # Set LDSHARED
  58 + cvars['LDSHARED'] = ldshared_new
59 59
60 # Set default include directories and data files 60 # Set default include directories and data files
61 include_dirs = ['@prefix@/include/gammalib'] 61 include_dirs = ['@prefix@/include/gammalib']
@@ -66,8 +66,8 @@ libraries = ['ctools','gamma'] @@ -66,8 +66,8 @@ libraries = ['ctools','gamma']
66 66
67 # Add install directory to runtime library path 67 # Add install directory to runtime library path
68 if os.path.exists('@prefix@/lib'): 68 if os.path.exists('@prefix@/lib'):
69 - library_dirs.append('@prefix@/lib')  
70 - runtime_library_dirs.append('@prefix@/lib') 69 + library_dirs.append('@prefix@/lib')
  70 + runtime_library_dirs.append('@prefix@/lib')
71 71
72 # Add application include files. The method we use here is not very 72 # Add application include files. The method we use here is not very
73 # intelligent as it simple will add all names that start with 'ct' 73 # intelligent as it simple will add all names that start with 'ct'
@@ -75,44 +75,44 @@ if os.path.exists('@prefix@/lib'): @@ -75,44 +75,44 @@ if os.path.exists('@prefix@/lib'):
75 # add an explicit filter to avoid appending those. 75 # add an explicit filter to avoid appending those.
76 dirs = glob.glob('../src/ct*') 76 dirs = glob.glob('../src/ct*')
77 for dir in dirs: 77 for dir in dirs:
78 - if len(dir) > 0 and 'ctools' not in dir:  
79 - path = os.path.abspath(dir)  
80 - include_dirs.append(path) 78 + if len(dir) > 0 and 'ctools' not in dir:
  79 + path = os.path.abspath(dir)
  80 + include_dirs.append(path)
81 include_dirs.append(os.path.abspath('../src/support')) 81 include_dirs.append(os.path.abspath('../src/support'))
82 82
83 # Add extra libraries 83 # Add extra libraries
84 extra_libs = ('@PYTHON_EXTRA_LIBS@').split(',') 84 extra_libs = ('@PYTHON_EXTRA_LIBS@').split(',')
85 for extra_lib in extra_libs: 85 for extra_lib in extra_libs:
86 - if len(extra_lib) > 0:  
87 - libraries.append(extra_lib) 86 + if len(extra_lib) > 0:
  87 + libraries.append(extra_lib)
88 88
89 # Get extra library paths 89 # Get extra library paths
90 extra_lib_paths = ('@LDFLAGS@').split(' ') 90 extra_lib_paths = ('@LDFLAGS@').split(' ')
91 for extra_lib_path in extra_lib_paths: 91 for extra_lib_path in extra_lib_paths:
92 - if extra_lib_path.lstrip().find('-L') == 0:  
93 - dir = extra_lib_path.lstrip().lstrip('-L')  
94 - if len(dir) > 0:  
95 - library_dirs.append(dir)  
96 - runtime_library_dirs.append(dir) 92 + if extra_lib_path.lstrip().find('-L') == 0:
  93 + dir = extra_lib_path.lstrip().lstrip('-L')
  94 + if len(dir) > 0:
  95 + library_dirs.append(dir)
  96 + runtime_library_dirs.append(dir)
97 97
98 # Get extra include directories 98 # Get extra include directories
99 extra_include_dirs = ('@CPPFLAGS@').split(' ') 99 extra_include_dirs = ('@CPPFLAGS@').split(' ')
100 for extra_include_dir in extra_include_dirs: 100 for extra_include_dir in extra_include_dirs:
101 - if extra_include_dir.lstrip().find('-I') == 0:  
102 - dir = extra_include_dir.lstrip().lstrip('-I')  
103 - if len(dir) > 0:  
104 - include_dirs.append(dir) 101 + if extra_include_dir.lstrip().find('-I') == 0:
  102 + dir = extra_include_dir.lstrip().lstrip('-I')
  103 + if len(dir) > 0:
  104 + include_dirs.append(dir)
105 105
106 # Set data files to install. 106 # Set data files to install.
107 data_files=[('@prefix@/share/ctools/swig', install_files)] 107 data_files=[('@prefix@/share/ctools/swig', install_files)]
108 108
109 # Optionally enable OpenMP 109 # Optionally enable OpenMP
110 if '@OPENMP_TRUE@' != '#': 110 if '@OPENMP_TRUE@' != '#':
111 - extra_compile_args = ['@OPENMP_CXXFLAGS@']  
112 - extra_link_args = ['@OPENMP_CXXFLAGS@'] 111 + extra_compile_args = ['@OPENMP_CXXFLAGS@']
  112 + extra_link_args = ['@OPENMP_CXXFLAGS@']
113 else: 113 else:
114 - extra_compile_args = []  
115 - extra_link_args = [] 114 + extra_compile_args = []
  115 + extra_link_args = []
116 116
117 # Append coverage CXXFLAGS 117 # Append coverage CXXFLAGS
118 if len('@COVERAGE_CXXFLAGS@') > 0: 118 if len('@COVERAGE_CXXFLAGS@') > 0:
@@ -138,25 +138,25 @@ setup(name='@PACKAGE_NAME@', @@ -138,25 +138,25 @@ setup(name='@PACKAGE_NAME@',
138 runtime_library_dirs=runtime_library_dirs, 138 runtime_library_dirs=runtime_library_dirs,
139 extra_compile_args=extra_compile_args, 139 extra_compile_args=extra_compile_args,
140 extra_link_args=extra_link_args)], 140 extra_link_args=extra_link_args)],
141 - data_files=data_files,  
142 - license="GNU GPL v3",  
143 - long_description="CTA science analysis tools",  
144 - platforms=["Linux", "Solaris", "Mac OS-X", "Unix", "BSD"], 141 + data_files=data_files,
  142 + license="GNU GPL v3",
  143 + long_description="CTA science analysis tools",
  144 + platforms=["Linux", "Solaris", "Mac OS-X", "Unix", "BSD"],
145 ) 145 )
146 146
147 # Post-processing. A symbolic link is created to the directory containing the 147 # Post-processing. A symbolic link is created to the directory containing the
148 # shared wrapper libraries so that we can add this directory to the PYTHONPATH 148 # shared wrapper libraries so that we can add this directory to the PYTHONPATH
149 # for testing. 149 # for testing.
150 if is_build: 150 if is_build:
151 - try:  
152 - os.chdir('build')  
153 - os.remove('ctools')  
154 - sys.stdout.write("Removed symbolic link build/ctools.\n")  
155 - except:  
156 - pass  
157 - try:  
158 - path = glob.glob('lib.*')  
159 - os.symlink(path[0], 'ctools')  
160 - sys.stdout.write("Created symbolic link build/ctools.\n")  
161 - except:  
162 - sys.stdout.write("WARNING: Failed to create symbolic link build/ctools.\n") 151 + try:
  152 + os.chdir('build')
  153 + os.remove('ctools')
  154 + sys.stdout.write("Removed symbolic link build/ctools.\n")
  155 + except:
  156 + pass
  157 + try:
  158 + path = glob.glob('lib.*')
  159 + os.symlink(path[0], 'ctools')
  160 + sys.stdout.write("Created symbolic link build/ctools.\n")
  161 + except:
  162 + sys.stdout.write("WARNING: Failed to create symbolic link build/ctools.\n")