]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distutils/command/build.py
fixed broken TeX markup which resulted in broken links
[wxWidgets.git] / wxPython / distutils / command / build.py
1 """distutils.command.build
2
3 Implements the Distutils 'build' command."""
4
5 # This module should be kept compatible with Python 1.5.2.
6
7 __revision__ = "$Id$"
8
9 import sys, os
10 from distutils.core import Command
11 from distutils.util import get_platform
12
13
14 def show_compilers ():
15 from distutils.ccompiler import show_compilers
16 show_compilers()
17
18
19 class build (Command):
20
21 description = "build everything needed to install"
22
23 user_options = [
24 ('build-base=', 'b',
25 "base directory for build library"),
26 ('build-purelib=', None,
27 "build directory for platform-neutral distributions"),
28 ('build-platlib=', None,
29 "build directory for platform-specific distributions"),
30 ('build-lib=', None,
31 "build directory for all distribution (defaults to either " +
32 "build-purelib or build-platlib"),
33 ('build-scripts=', None,
34 "build directory for scripts"),
35 ('build-temp=', 't',
36 "temporary build directory"),
37 ('compiler=', 'c',
38 "specify the compiler type"),
39 ('debug', 'g',
40 "compile extensions and libraries with debugging information"),
41 ('force', 'f',
42 "forcibly build everything (ignore file timestamps)"),
43 ]
44
45 boolean_options = ['debug', 'force']
46
47 help_options = [
48 ('help-compiler', None,
49 "list available compilers", show_compilers),
50 ]
51
52 def initialize_options (self):
53 self.build_base = 'build'
54 # these are decided only after 'build_base' has its final value
55 # (unless overridden by the user or client)
56 self.build_purelib = None
57 self.build_platlib = None
58 self.build_lib = None
59 self.build_temp = None
60 self.build_scripts = None
61 self.compiler = None
62 self.debug = None
63 self.force = 0
64
65 def finalize_options (self):
66
67 plat_specifier = ".%s-%s" % (get_platform(), sys.version[0:3])
68
69 # 'build_purelib' and 'build_platlib' just default to 'lib' and
70 # 'lib.<plat>' under the base build directory. We only use one of
71 # them for a given distribution, though --
72 if self.build_purelib is None:
73 self.build_purelib = os.path.join(self.build_base, 'lib')
74 if self.build_platlib is None:
75 self.build_platlib = os.path.join(self.build_base,
76 'lib' + plat_specifier)
77
78 # 'build_lib' is the actual directory that we will use for this
79 # particular module distribution -- if user didn't supply it, pick
80 # one of 'build_purelib' or 'build_platlib'.
81 if self.build_lib is None:
82 if self.distribution.ext_modules:
83 self.build_lib = self.build_platlib
84 else:
85 self.build_lib = self.build_purelib
86
87 # 'build_temp' -- temporary directory for compiler turds,
88 # "build/temp.<plat>"
89 if self.build_temp is None:
90 self.build_temp = os.path.join(self.build_base,
91 'temp' + plat_specifier)
92 if self.build_scripts is None:
93 self.build_scripts = os.path.join(self.build_base,
94 'scripts-' + sys.version[0:3])
95
96 # finalize_options ()
97
98
99 def run (self):
100
101 # Run all relevant sub-commands. This will be some subset of:
102 # - build_py - pure Python modules
103 # - build_clib - standalone C libraries
104 # - build_ext - Python extensions
105 # - build_scripts - (Python) scripts
106 for cmd_name in self.get_sub_commands():
107 self.run_command(cmd_name)
108
109
110 # -- Predicates for the sub-command list ---------------------------
111
112 def has_pure_modules (self):
113 return self.distribution.has_pure_modules()
114
115 def has_c_libraries (self):
116 return self.distribution.has_c_libraries()
117
118 def has_ext_modules (self):
119 return self.distribution.has_ext_modules()
120
121 def has_scripts (self):
122 return self.distribution.has_scripts()
123
124
125 sub_commands = [('build_py', has_pure_modules),
126 ('build_clib', has_c_libraries),
127 ('build_ext', has_ext_modules),
128 ('build_scripts', has_scripts),
129 ]
130
131 # class build