blob: 788609282d125ca1137a956eeae3852d5dbb08b7 [file] [log] [blame]
Greg Ward13ae1c81999-03-22 14:55:25 +00001"""distutils.command.build
2
3Implements the Distutils 'build' command."""
4
5# created 1999/03/08, Greg Ward
6
7__rcsid__ = "$Id$"
8
9import os
10from distutils.core import Command
11
12
13class Build (Command):
14
15 options = [('basedir=', 'b', "base directory for build library"),
16 ('libdir=', 'l', "directory for platform-shared files"),
17 ('platdir=', 'p', "directory for platform-specific files"),
18
19 # Flags for 'build_py'
20 ('compile-py', None, "compile .py to .pyc"),
21 ('optimize-py', None, "compile .py to .pyo (optimized)"),
22 ]
23
24 def set_default_options (self):
25 self.basedir = 'build'
26 # these are decided only after 'basedir' has its final value
27 # (unless overridden by the user or client)
28 self.libdir = None
29 self.platdir = None
30
31 self.compile_py = 1
32 self.optimize_py = 1
33
34 def set_final_options (self):
35 # 'libdir' and 'platdir' just default to 'lib' and 'plat' under
36 # the base build directory
37 if self.libdir is None:
38 self.libdir = os.path.join (self.basedir, 'lib')
39 if self.platdir is None:
40 self.platdir = os.path.join (self.basedir, 'plat')
41
42
43 def run (self):
44
45 self.set_final_options ()
46
47 # For now, "build" means "build_py" then "build_ext". (Eventually
48 # it should also build documentation.)
49
50 # Invoke the 'build_py' command
51 self.run_peer ('build_py')
52
53 # And now 'build_ext'
54 #self.run_peer ('build_ext')
55
56# end class Build