reverted distutils its 3.1 state. All new work is now happening in disutils2, and distutils is now feature-frozen.

This commit is contained in:
Tarek Ziadé 2010-07-22 12:50:05 +00:00
parent 5db0c94072
commit 3679727939
64 changed files with 1626 additions and 1678 deletions

View file

@ -8,12 +8,10 @@ really defined in distutils.dist and distutils.cmd.
__revision__ = "$Id$"
import sys
import os
import sys, os
from distutils.debug import DEBUG
from distutils.errors import (DistutilsSetupError, DistutilsArgError,
DistutilsError, CCompilerError)
from distutils.errors import *
from distutils.util import grok_environment_error
# Mainly import these so setup scripts can "from distutils.core import" them.
@ -33,9 +31,9 @@ usage: %(script)s [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: %(script)s cmd --help
"""
def gen_usage(script_name):
def gen_usage (script_name):
script = os.path.basename(script_name)
return USAGE % {'script': script}
return USAGE % vars()
# Some mild magic to control the behaviour of 'setup()' from 'run_setup()'.
@ -58,7 +56,7 @@ extension_keywords = ('name', 'sources', 'include_dirs',
'extra_objects', 'extra_compile_args', 'extra_link_args',
'swig_opts', 'export_symbols', 'depends', 'language')
def setup(**attrs):
def setup (**attrs):
"""The gateway to the Distutils: do everything your setup script needs
to do, in a highly flexible and user-driven way. Briefly: create a
Distribution instance; find and parse config files; parse the command
@ -131,9 +129,8 @@ def setup(**attrs):
if _setup_stop_after == "config":
return dist
# Parse the command line and override config files; any
# command-line errors are the end user's fault, so turn them into
# SystemExit to suppress tracebacks.
# Parse the command line; any command-line errors are the end user's
# fault, so turn them into SystemExit to suppress tracebacks.
try:
ok = dist.parse_command_line()
except DistutilsArgError as msg:
@ -170,8 +167,10 @@ def setup(**attrs):
return dist
# setup ()
def run_setup(script_name, script_args=None, stop_after="run"):
def run_setup (script_name, script_args=None, stop_after="run"):
"""Run a setup script in a somewhat controlled environment, and
return the Distribution instance that drives things. This is useful
if you need to find out the distribution meta-data (passed as
@ -234,4 +233,7 @@ def run_setup(script_name, script_args=None, stop_after="run"):
# I wonder if the setup script's namespace -- g and l -- would be of
# any interest to callers?
#print "_setup_distribution:", _setup_distribution
return _setup_distribution
# run_setup ()