comparison DEPENDENCIES/mingw32/Python27/Lib/site-packages/numpy/distutils/command/config_compiler.py @ 87:2a2c65a20a8b

Add Python libs and headers
author Chris Cannam
date Wed, 25 Feb 2015 14:05:22 +0000
parents
children
comparison
equal deleted inserted replaced
86:413a9d26189e 87:2a2c65a20a8b
1 from __future__ import division, absolute_import, print_function
2
3 from distutils.core import Command
4 from numpy.distutils import log
5
6 #XXX: Linker flags
7
8 def show_fortran_compilers(_cache=[]):
9 # Using cache to prevent infinite recursion
10 if _cache: return
11 _cache.append(1)
12 from numpy.distutils.fcompiler import show_fcompilers
13 import distutils.core
14 dist = distutils.core._setup_distribution
15 show_fcompilers(dist)
16
17 class config_fc(Command):
18 """ Distutils command to hold user specified options
19 to Fortran compilers.
20
21 config_fc command is used by the FCompiler.customize() method.
22 """
23
24 description = "specify Fortran 77/Fortran 90 compiler information"
25
26 user_options = [
27 ('fcompiler=', None, "specify Fortran compiler type"),
28 ('f77exec=', None, "specify F77 compiler command"),
29 ('f90exec=', None, "specify F90 compiler command"),
30 ('f77flags=', None, "specify F77 compiler flags"),
31 ('f90flags=', None, "specify F90 compiler flags"),
32 ('opt=', None, "specify optimization flags"),
33 ('arch=', None, "specify architecture specific optimization flags"),
34 ('debug', 'g', "compile with debugging information"),
35 ('noopt', None, "compile without optimization"),
36 ('noarch', None, "compile without arch-dependent optimization"),
37 ]
38
39 help_options = [
40 ('help-fcompiler', None, "list available Fortran compilers",
41 show_fortran_compilers),
42 ]
43
44 boolean_options = ['debug', 'noopt', 'noarch']
45
46 def initialize_options(self):
47 self.fcompiler = None
48 self.f77exec = None
49 self.f90exec = None
50 self.f77flags = None
51 self.f90flags = None
52 self.opt = None
53 self.arch = None
54 self.debug = None
55 self.noopt = None
56 self.noarch = None
57
58 def finalize_options(self):
59 log.info('unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options')
60 build_clib = self.get_finalized_command('build_clib')
61 build_ext = self.get_finalized_command('build_ext')
62 config = self.get_finalized_command('config')
63 build = self.get_finalized_command('build')
64 cmd_list = [self, config, build_clib, build_ext, build]
65 for a in ['fcompiler']:
66 l = []
67 for c in cmd_list:
68 v = getattr(c, a)
69 if v is not None:
70 if not isinstance(v, str): v = v.compiler_type
71 if v not in l: l.append(v)
72 if not l: v1 = None
73 else: v1 = l[0]
74 if len(l)>1:
75 log.warn(' commands have different --%s options: %s'\
76 ', using first in list as default' % (a, l))
77 if v1:
78 for c in cmd_list:
79 if getattr(c, a) is None: setattr(c, a, v1)
80
81 def run(self):
82 # Do nothing.
83 return
84
85 class config_cc(Command):
86 """ Distutils command to hold user specified options
87 to C/C++ compilers.
88 """
89
90 description = "specify C/C++ compiler information"
91
92 user_options = [
93 ('compiler=', None, "specify C/C++ compiler type"),
94 ]
95
96 def initialize_options(self):
97 self.compiler = None
98
99 def finalize_options(self):
100 log.info('unifing config_cc, config, build_clib, build_ext, build commands --compiler options')
101 build_clib = self.get_finalized_command('build_clib')
102 build_ext = self.get_finalized_command('build_ext')
103 config = self.get_finalized_command('config')
104 build = self.get_finalized_command('build')
105 cmd_list = [self, config, build_clib, build_ext, build]
106 for a in ['compiler']:
107 l = []
108 for c in cmd_list:
109 v = getattr(c, a)
110 if v is not None:
111 if not isinstance(v, str): v = v.compiler_type
112 if v not in l: l.append(v)
113 if not l: v1 = None
114 else: v1 = l[0]
115 if len(l)>1:
116 log.warn(' commands have different --%s options: %s'\
117 ', using first in list as default' % (a, l))
118 if v1:
119 for c in cmd_list:
120 if getattr(c, a) is None: setattr(c, a, v1)
121 return
122
123 def run(self):
124 # Do nothing.
125 return