summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/command/build.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>1999-03-22 14:55:25 (GMT)
committerGreg Ward <gward@python.net>1999-03-22 14:55:25 (GMT)
commit13ae1c8ff81befcfd0b0ece98ef471cd504642d8 (patch)
tree3ec9b551a151d407a01fb74b48c6a166248c336d /Lib/distutils/command/build.py
parent03f8c3cdd013313374482bdac82609225e58561c (diff)
downloadcpython-13ae1c8ff81befcfd0b0ece98ef471cd504642d8.zip
cpython-13ae1c8ff81befcfd0b0ece98ef471cd504642d8.tar.gz
cpython-13ae1c8ff81befcfd0b0ece98ef471cd504642d8.tar.bz2
First checkin of real Distutils command modules.
Diffstat (limited to 'Lib/distutils/command/build.py')
-rw-r--r--Lib/distutils/command/build.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/Lib/distutils/command/build.py b/Lib/distutils/command/build.py
new file mode 100644
index 0000000..7886092
--- /dev/null
+++ b/Lib/distutils/command/build.py
@@ -0,0 +1,56 @@
+"""distutils.command.build
+
+Implements the Distutils 'build' command."""
+
+# created 1999/03/08, Greg Ward
+
+__rcsid__ = "$Id$"
+
+import os
+from distutils.core import Command
+
+
+class Build (Command):
+
+ options = [('basedir=', 'b', "base directory for build library"),
+ ('libdir=', 'l', "directory for platform-shared files"),
+ ('platdir=', 'p', "directory for platform-specific files"),
+
+ # Flags for 'build_py'
+ ('compile-py', None, "compile .py to .pyc"),
+ ('optimize-py', None, "compile .py to .pyo (optimized)"),
+ ]
+
+ def set_default_options (self):
+ self.basedir = 'build'
+ # these are decided only after 'basedir' has its final value
+ # (unless overridden by the user or client)
+ self.libdir = None
+ self.platdir = None
+
+ self.compile_py = 1
+ self.optimize_py = 1
+
+ def set_final_options (self):
+ # 'libdir' and 'platdir' just default to 'lib' and 'plat' under
+ # the base build directory
+ if self.libdir is None:
+ self.libdir = os.path.join (self.basedir, 'lib')
+ if self.platdir is None:
+ self.platdir = os.path.join (self.basedir, 'plat')
+
+
+ def run (self):
+
+ self.set_final_options ()
+
+ # For now, "build" means "build_py" then "build_ext". (Eventually
+ # it should also build documentation.)
+
+ # Invoke the 'build_py' command
+ self.run_peer ('build_py')
+
+ # And now 'build_ext'
+ #self.run_peer ('build_ext')
+
+# end class Build