Renamed many options to be consistent across commands.

Tweaked some help strings to be consistent with documentation.
Don't call 'set_final_options()' in 'run()' anymore -- that's now
  guaranteed to be taken care of for us by the Distribution instance.
This commit is contained in:
Greg Ward 1999-09-29 12:38:18 +00:00
parent df178f97de
commit e6ac2fcc12
5 changed files with 35 additions and 41 deletions

View File

@ -12,31 +12,32 @@ 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"),
options = [('build-base=', 'b',
"base directory for build library"),
('build-lib=', 'l',
"directory for platform-shared files"),
('build-platlib=', 'p',
"directory for platform-specific files"),
]
def set_default_options (self):
self.basedir = 'build'
# these are decided only after 'basedir' has its final value
self.build_base = 'build'
# these are decided only after 'build_base' has its final value
# (unless overridden by the user or client)
self.libdir = None
self.platdir = None
self.build_lib = None
self.build_platlib = None
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, 'platlib')
# 'build_lib' and 'build_platlib' just default to 'lib' and
# 'platlib' under the base build directory
if self.build_lib is None:
self.build_lib = os.path.join (self.build_base, 'lib')
if self.build_platlib is None:
self.build_platlib = os.path.join (self.build_base, 'platlib')
def run (self):
self.set_final_options ()
# For now, "build" means "build_py" then "build_ext". (Eventually
# it should also build documentation.)

View File

@ -16,16 +16,16 @@ from distutils.util import write_file
class Install (Command):
options = [('prefix=', None, "installation prefix"),
('execprefix=', None,
('exec-prefix=', None,
"prefix for platform-specific files"),
# Build directories: where to install from
('build-base=', None,
"base build directory"),
('build-lib=', None,
"build directory for non-platform-specific library files"),
"build directory for pure Python modules"),
('build-platlib=', None,
"build directory for platform-specific library files"),
"build directory for extension modules"),
# Installation directories: where to put modules and packages
('install-lib=', None,
@ -113,11 +113,11 @@ class Install (Command):
# to fix things.
# Figure out the build directories, ie. where to install from
self.set_peer_option ('build', 'basedir', self.build_base)
self.set_peer_option ('build', 'build_base', self.build_base)
self.set_undefined_options ('build',
('basedir', 'build_base'),
('libdir', 'build_lib'),
('platdir', 'build_platlib'))
('build_base', 'build_base'),
('build_lib', 'build_lib'),
('build_platlib', 'build_platlib'))
# Figure out actual installation directories; the basic principle
# is: if the user supplied nothing, then use the directories that
@ -275,8 +275,6 @@ class Install (Command):
def run (self):
self.set_final_options ()
# Obviously have to build before we can install
self.run_peer ('build')

View File

@ -11,28 +11,27 @@ from distutils.util import copy_tree
class InstallExt (Command):
options = [('dir=', 'd', "directory to install to"),
options = [('install-dir=', 'd', "directory to install to"),
('build-dir=','b', "build directory (where to install from)"),
]
def set_default_options (self):
# let the 'install' command dictate our installation directory
self.dir = None
self.install_dir = None
self.build_dir = None
def set_final_options (self):
self.set_undefined_options ('install',
('build_platlib', 'build_dir'),
('install_site_platlib', 'dir'))
('install_site_platlib', 'install_dir'))
def run (self):
self.set_final_options ()
# Dump the entire "build/platlib" directory (or whatever it really
# is; "build/platlib" is the default) to the installation target
# (eg. "/usr/local/lib/python1.5/site-packages"). Note that
# putting files in the right package dir is already done when we
# build.
outfiles = self.copy_tree (self.build_dir, self.dir)
outfiles = self.copy_tree (self.build_dir, self.install_dir)
# class InstallExt

View File

@ -8,7 +8,7 @@ from distutils.util import copy_tree
class InstallPy (Command):
options = [('dir=', 'd', "directory to install to"),
options = [('install-dir=', 'd', "directory to install to"),
('build-dir=','b', "build directory (where to install from)"),
('compile', 'c', "compile .py to .pyc"),
('optimize', 'o', "compile .py to .pyo (optimized)"),
@ -17,7 +17,7 @@ class InstallPy (Command):
def set_default_options (self):
# let the 'install' command dictate our installation directory
self.dir = None
self.install_dir = None
self.build_dir = None
self.compile = 1
self.optimize = 1
@ -39,18 +39,16 @@ class InstallPy (Command):
# install (target) directory, and whether to compile .py files.
self.set_undefined_options ('install',
('build_lib', 'build_dir'),
(dir_option, 'dir'),
(dir_option, 'install_dir'),
('compile_py', 'compile'),
('optimize_py', 'optimize'))
def run (self):
self.set_final_options ()
# Dump entire contents of the build directory to the installation
# directory (that's the beauty of having a build directory!)
outfiles = self.copy_tree (self.build_dir, self.dir)
outfiles = self.copy_tree (self.build_dir, self.install_dir)
# (Optionally) compile .py to .pyc
# XXX hey! we can't control whether we optimize or not; that's up

View File

@ -8,7 +8,7 @@ from distutils.util import copy_tree
class InstallPy (Command):
options = [('dir=', 'd', "directory to install to"),
options = [('install-dir=', 'd', "directory to install to"),
('build-dir=','b', "build directory (where to install from)"),
('compile', 'c', "compile .py to .pyc"),
('optimize', 'o', "compile .py to .pyo (optimized)"),
@ -17,7 +17,7 @@ class InstallPy (Command):
def set_default_options (self):
# let the 'install' command dictate our installation directory
self.dir = None
self.install_dir = None
self.build_dir = None
self.compile = 1
self.optimize = 1
@ -39,18 +39,16 @@ class InstallPy (Command):
# install (target) directory, and whether to compile .py files.
self.set_undefined_options ('install',
('build_lib', 'build_dir'),
(dir_option, 'dir'),
(dir_option, 'install_dir'),
('compile_py', 'compile'),
('optimize_py', 'optimize'))
def run (self):
self.set_final_options ()
# Dump entire contents of the build directory to the installation
# directory (that's the beauty of having a build directory!)
outfiles = self.copy_tree (self.build_dir, self.dir)
outfiles = self.copy_tree (self.build_dir, self.install_dir)
# (Optionally) compile .py to .pyc
# XXX hey! we can't control whether we optimize or not; that's up