blob: 187dddc0b7cd01ee463d42bbc47c049b43f74c8b [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"),
Greg Ward13ae1c81999-03-22 14:55:25 +000018 ]
19
20 def set_default_options (self):
21 self.basedir = 'build'
22 # these are decided only after 'basedir' has its final value
23 # (unless overridden by the user or client)
24 self.libdir = None
25 self.platdir = None
26
Greg Ward13ae1c81999-03-22 14:55:25 +000027 def set_final_options (self):
28 # 'libdir' and 'platdir' just default to 'lib' and 'plat' under
29 # the base build directory
30 if self.libdir is None:
31 self.libdir = os.path.join (self.basedir, 'lib')
32 if self.platdir is None:
Greg Ward36e68e21999-09-13 13:52:12 +000033 self.platdir = os.path.join (self.basedir, 'platlib')
Greg Ward13ae1c81999-03-22 14:55:25 +000034
35
36 def run (self):
37
38 self.set_final_options ()
39
40 # For now, "build" means "build_py" then "build_ext". (Eventually
41 # it should also build documentation.)
42
43 # Invoke the 'build_py' command
44 self.run_peer ('build_py')
45
46 # And now 'build_ext'
Greg Ward36e68e21999-09-13 13:52:12 +000047 self.run_peer ('build_ext')
Greg Ward13ae1c81999-03-22 14:55:25 +000048
49# end class Build