Added 'description' class attribute to every command class (to help the

'--help-commands' option).
Shuffled imports around in a few command modules to avoid expensive
  up-front import of sysconfig (and resulting delays in generating list
  of all commands).
This commit is contained in:
Greg Ward 2000-01-30 18:34:15 +00:00
parent 4c67936e4e
commit 37bc815053
8 changed files with 26 additions and 6 deletions

View File

@ -12,6 +12,8 @@ from distutils.core import Command
class Build (Command):
description = "build everything needed to install"
options = [('build-base=', 'b',
"base directory for build library"),
('build-lib=', 'l',

View File

@ -11,8 +11,6 @@ __rcsid__ = "$Id$"
import sys, os, string, re
from types import *
from distutils.core import Command
from distutils.ccompiler import new_compiler
from distutils.sysconfig import INCLUDEPY, SO, exec_prefix
from distutils.errors import *
@ -24,6 +22,8 @@ extension_name_re = re.compile \
class BuildExt (Command):
description = "build C/C++ extensions (compile/link to build directory)"
# XXX thoughts on how to deal with complex command-line options like
# these, i.e. how to make it so fancy_getopt can suck them off the
# command line and make it look like setup.py defined the appropriate
@ -76,6 +76,8 @@ class BuildExt (Command):
def set_final_options (self):
from distutils import sysconfig
self.set_undefined_options ('build', ('build_platlib', 'build_dir'))
if self.package is None:
@ -88,8 +90,8 @@ class BuildExt (Command):
# etc.) are in the include search path. We have to roll our own
# "exec include dir", because the Makefile parsed by sysconfig
# doesn't have it (sigh).
py_include = INCLUDEPY # prefix + "include" + "python" + ver
exec_py_include = os.path.join (exec_prefix, 'include',
py_include = sysconfig.INCLUDEPY # prefix + "include" + "python" + ver
exec_py_include = os.path.join (sysconfig.exec_prefix, 'include',
'python' + sys.version[0:3])
if self.include_dirs is None:
self.include_dirs = self.distribution.include_dirs or []
@ -104,6 +106,8 @@ class BuildExt (Command):
def run (self):
from distutils.ccompiler import new_compiler
# 'self.extensions', as supplied by setup.py, is a list of 2-tuples.
# Each tuple is simple:
# (ext_name, build_info)
@ -246,9 +250,10 @@ class BuildExt (Command):
def extension_filename (self, ext_name, package=None):
from distutils import sysconfig
if package:
ext_name = package + '.' + ext_name
ext_path = string.split (ext_name, '.')
return apply (os.path.join, ext_path) + SO
return apply (os.path.join, ext_path) + sysconfig.SO
# class BuildExt

View File

@ -16,6 +16,8 @@ from distutils.errors import *
class BuildPy (Command):
description = "\"build\" pure Python modules (copy to build directory)"
options = [('build-dir=', 'd', "directory for platform-shared files"),
]

View File

@ -131,6 +131,8 @@ from distutils.errors import DistutilsExecError
class Dist (Command):
description = "create a source distribution (tarball, zip file, etc.)"
options = [('formats=', None,
"formats for source distribution (tar, ztar, gztar, or zip)"),
('manifest=', 'm',

View File

@ -8,13 +8,14 @@ __rcsid__ = "$Id$"
import sys, os, string
from types import *
from distutils import sysconfig
from distutils.core import Command
from distutils.util import write_file
class Install (Command):
description = "install everything from build directory"
options = [('prefix=', None, "installation prefix"),
('exec-prefix=', None,
"prefix for platform-specific files"),
@ -246,6 +247,8 @@ class Install (Command):
then replace it with the current installation prefix and
return the "relocated" installation directory."""
from distutils import sysconfig
if use_exec:
sys_prefix = os.path.normpath (sys.exec_prefix)
my_prefix = self.exec_prefix

View File

@ -11,6 +11,8 @@ from distutils.util import copy_tree
class InstallExt (Command):
description = "install C/C++ extension modules"
options = [('install-dir=', 'd', "directory to install to"),
('build-dir=','b', "build directory (where to install from)"),
]

View File

@ -8,6 +8,8 @@ from distutils.util import copy_tree
class InstallPy (Command):
description = "install pure Python modules"
options = [('install-dir=', 'd', "directory to install to"),
('build-dir=','b', "build directory (where to install from)"),
('compile', 'c', "compile .py to .pyc"),

View File

@ -8,6 +8,8 @@ from distutils.util import copy_tree
class InstallPy (Command):
description = "install pure Python modules"
options = [('install-dir=', 'd', "directory to install to"),
('build-dir=','b', "build directory (where to install from)"),
('compile', 'c', "compile .py to .pyc"),