Added 'description' class attribute to every command class (to help the
authorGreg Ward <gward@python.net>
Sun, 30 Jan 2000 18:34:15 +0000 (18:34 +0000)
committerGreg Ward <gward@python.net>
Sun, 30 Jan 2000 18:34:15 +0000 (18:34 +0000)
  '--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).

Lib/distutils/command/build.py
Lib/distutils/command/build_ext.py
Lib/distutils/command/build_py.py
Lib/distutils/command/dist.py
Lib/distutils/command/install.py
Lib/distutils/command/install_ext.py
Lib/distutils/command/install_lib.py
Lib/distutils/command/install_py.py

index 1586e60b07145d2c10efd8c5e438db1f74fe658a..e6c87bfcaef997b47adddb6d8545391bda200a6c 100644 (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',
index d38cb18b5ca7819b3064e43b8581a7fca3859410..4f7e53ff306dd991c89901988aae62e0307aa614 100644 (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
index e27a36d4644017fe79d0356e05eebb41dbffebce..57ddf7e7ea653d5ddd814307e2af33680b69243e 100644 (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"),
               ]
 
index 0f9e30bad8eb8f3a32bbf360b32440cfbd8487a8..76332b2751317a7e37f0aebbe40f308897e622f6 100644 (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',
index 6f5d6715ca41c4f749c930046983ed09524bd918..0e5b01cc98c5142d12702b15047a04ff2f4e9187 100644 (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
index b5673d235ae5c1375beebd64b4bbae8f69b0f147..599a37e1cecf3a5fcbde569f7854c9ef3f23dc2a 100644 (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)"),
               ]
index 50939a3431894d27341fdf0a46def5174cb1fdef..2e8a6706862bbb40676f30667f9ac5be5336d24d 100644 (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"),
index 50939a3431894d27341fdf0a46def5174cb1fdef..2e8a6706862bbb40676f30667f9ac5be5336d24d 100644 (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"),