diff options
Diffstat (limited to 'Lib/distutils/command')
-rw-r--r-- | Lib/distutils/command/bdist_dumb.py | 5 | ||||
-rw-r--r-- | Lib/distutils/command/bdist_packager.py | 9 | ||||
-rw-r--r-- | Lib/distutils/command/bdist_pkgtool.py | 13 | ||||
-rw-r--r-- | Lib/distutils/command/bdist_rpm.py | 3 | ||||
-rw-r--r-- | Lib/distutils/command/bdist_sdux.py | 7 | ||||
-rw-r--r-- | Lib/distutils/command/bdist_wininst.py | 7 | ||||
-rw-r--r-- | Lib/distutils/command/build_clib.py | 5 | ||||
-rw-r--r-- | Lib/distutils/command/build_ext.py | 18 | ||||
-rw-r--r-- | Lib/distutils/command/build_py.py | 17 | ||||
-rw-r--r-- | Lib/distutils/command/build_scripts.py | 7 | ||||
-rw-r--r-- | Lib/distutils/command/clean.py | 15 | ||||
-rw-r--r-- | Lib/distutils/command/config.py | 14 | ||||
-rw-r--r-- | Lib/distutils/command/install_lib.py | 8 | ||||
-rw-r--r-- | Lib/distutils/command/install_scripts.py | 5 | ||||
-rw-r--r-- | Lib/distutils/command/sdist.py | 37 |
15 files changed, 77 insertions, 93 deletions
diff --git a/Lib/distutils/command/bdist_dumb.py b/Lib/distutils/command/bdist_dumb.py index a135877..712fec8 100644 --- a/Lib/distutils/command/bdist_dumb.py +++ b/Lib/distutils/command/bdist_dumb.py @@ -13,6 +13,7 @@ from distutils.core import Command from distutils.util import get_platform from distutils.dir_util import create_tree, remove_tree from distutils.errors import * +from distutils import log class bdist_dumb (Command): @@ -83,7 +84,7 @@ class bdist_dumb (Command): install.skip_build = self.skip_build install.warn_dir = 0 - self.announce("installing to %s" % self.bdist_dir) + log.info("installing to %s" % self.bdist_dir) self.run_command('install') # And make an archive relative to the root of the @@ -101,7 +102,7 @@ class bdist_dumb (Command): root_dir=self.bdist_dir) if not self.keep_temp: - remove_tree(self.bdist_dir, self.verbose, self.dry_run) + remove_tree(self.bdist_dir, dry_run=self.dry_run) # run() diff --git a/Lib/distutils/command/bdist_packager.py b/Lib/distutils/command/bdist_packager.py index 667c030..11278ee 100644 --- a/Lib/distutils/command/bdist_packager.py +++ b/Lib/distutils/command/bdist_packager.py @@ -14,6 +14,7 @@ from distutils.util import get_platform from distutils.dir_util import create_tree, remove_tree from distutils.file_util import write_file from distutils.errors import * +from distutils import log import string, sys class bdist_packager (Command): @@ -102,8 +103,8 @@ class bdist_packager (Command): else: setattr(self,attr,default) val = default - if val!="": - self.announce('Creating %s script', attr) + if val != "": + log.info('Creating %s script', attr) self.execute(write_file, (path, self.get_script(attr)), "writing '%s'" % path) @@ -234,7 +235,7 @@ class bdist_packager (Command): install = self.reinitialize_command('install', reinit_subcommands=1) install.root = self.pkg_dir - self.announce("installing to %s" % self.pkg_dir) + log.info("installing to %s", self.pkg_dir) self.run_command('install') # And make an archive relative to the root of the @@ -243,7 +244,7 @@ class bdist_packager (Command): self.plat_name) if not self.keep_temp: - remove_tree(self.pkg_dir, self.verbose, self.dry_run) + remove_tree(self.pkg_dir, dry_run=self.dry_run) # run() diff --git a/Lib/distutils/command/bdist_pkgtool.py b/Lib/distutils/command/bdist_pkgtool.py index a36638a..4fd9501 100644 --- a/Lib/distutils/command/bdist_pkgtool.py +++ b/Lib/distutils/command/bdist_pkgtool.py @@ -15,6 +15,7 @@ from distutils.file_util import write_file from distutils.errors import * from distutils.command import bdist_packager from distutils import sysconfig +from distutils import log import compileall from commands import getoutput @@ -211,9 +212,9 @@ class bdist_pkgtool (bdist_packager.bdist_packager): install = self.reinitialize_command('install', reinit_subcommands=1) # build package - self.announce('Building package') + log.info('Building package') self.run_command('build') - self.announce('Creating pkginfo file') + log.info('Creating pkginfo file') path = os.path.join(pkg_dir, "pkginfo") self.execute(write_file, (path, @@ -244,7 +245,7 @@ class bdist_pkgtool (bdist_packager.bdist_packager): self.write_script(os.path.join(pkg_dir, "depend"), 'depend',None) - self.announce('Creating prototype file') + log.info('Creating prototype file') path = os.path.join(pkg_dir, "prototype") self.execute(write_file, (path, @@ -256,7 +257,7 @@ class bdist_pkgtool (bdist_packager.bdist_packager): return - self.announce('Creating package') + log.info('Creating package') pkg_cmd = ['pkgmk', '-o', '-f'] pkg_cmd.append(path) pkg_cmd.append('-b') @@ -265,7 +266,7 @@ class bdist_pkgtool (bdist_packager.bdist_packager): pkg_cmd = ['pkgtrans', '-s', '/var/spool/pkg'] path = os.path.join(os.environ['PWD'],pkg_dir, self.get_binary_name() + ".pkg") - self.announce('Transferring package to ' + pkg_dir) + log.info('Transferring package to ' + pkg_dir) pkg_cmd.append(path) pkg_cmd.append(self.pkg_abrev) self.spawn(pkg_cmd) @@ -326,7 +327,7 @@ class bdist_pkgtool (bdist_packager.bdist_packager): if self.no_autorelocate==0: request=string.split(DEFAULT_REQUEST,"\012") else: - self.announce('Creating relocation request script') + log.info('Creating relocation request script') if self.request: users_request=self.get_script('request') if users_request!=None and users_request!=[]: diff --git a/Lib/distutils/command/bdist_rpm.py b/Lib/distutils/command/bdist_rpm.py index 4bc2561..808ddc1 100644 --- a/Lib/distutils/command/bdist_rpm.py +++ b/Lib/distutils/command/bdist_rpm.py @@ -14,6 +14,7 @@ from distutils.core import Command, DEBUG from distutils.util import get_platform from distutils.file_util import write_file from distutils.errors import * +from distutils import log class bdist_rpm (Command): @@ -278,7 +279,7 @@ class bdist_rpm (Command): # build package - self.announce('building RPMs') + log.info("building RPMs") rpm_cmd = ['rpm'] if self.source_only: # what kind of RPMs? rpm_cmd.append('-bs') diff --git a/Lib/distutils/command/bdist_sdux.py b/Lib/distutils/command/bdist_sdux.py index 985a37a..e4765f9 100644 --- a/Lib/distutils/command/bdist_sdux.py +++ b/Lib/distutils/command/bdist_sdux.py @@ -14,6 +14,7 @@ from distutils.util import get_platform from distutils.file_util import write_file from distutils.errors import * from distutils.command import bdist_packager +from distutils import log import sys from commands import getoutput @@ -185,9 +186,9 @@ class bdist_sdux(bdist_packager.bdist_packager): psf_path = os.path.join(self.pkg_dir, "%s.psf" % self.get_binary_name()) # build package - self.announce('Building package') + log.info('Building package') self.run_command('build') - self.announce('Creating psf file') + log.info('Creating psf file') self.execute(write_file, (psf_path, self._make_control_file()), @@ -195,7 +196,7 @@ class bdist_sdux(bdist_packager.bdist_packager): if self.control_only: # stop if requested return - self.announce('Creating package') + log.info('Creating package') spawn_cmd = ['swpackage', '-s'] spawn_cmd.append(psf_path) spawn_cmd.append('-x') diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py index 1683bb3..6a985f1 100644 --- a/Lib/distutils/command/bdist_wininst.py +++ b/Lib/distutils/command/bdist_wininst.py @@ -12,6 +12,7 @@ from distutils.core import Command from distutils.util import get_platform from distutils.dir_util import create_tree, remove_tree from distutils.errors import * +from distutils import log class bdist_wininst (Command): @@ -115,7 +116,7 @@ class bdist_wininst (Command): 'install_' + key, value) - self.announce("installing to %s" % self.bdist_dir) + log.info("installing to %s", self.bdist_dir) install.ensure_finalized() # avoid warning of 'install_lib' about installing @@ -136,11 +137,11 @@ class bdist_wininst (Command): # create an exe containing the zip-file self.create_exe(arcname, fullname, self.bitmap) # remove the zip-file again - self.announce("removing temporary file '%s'" % arcname) + log.debug("removing temporary file '%s'", arcname) os.remove(arcname) if not self.keep_temp: - remove_tree(self.bdist_dir, self.verbose, self.dry_run) + remove_tree(self.bdist_dir, dry_run=self.dry_run) # run() diff --git a/Lib/distutils/command/build_clib.py b/Lib/distutils/command/build_clib.py index b659147..f0207e4 100644 --- a/Lib/distutils/command/build_clib.py +++ b/Lib/distutils/command/build_clib.py @@ -24,7 +24,7 @@ from types import * from distutils.core import Command from distutils.errors import * from distutils.sysconfig import customize_compiler - +from distutils import log def show_compilers (): from distutils.ccompiler import show_compilers @@ -111,7 +111,6 @@ class build_clib (Command): # Yech -- this is cut 'n pasted from build_ext.py! from distutils.ccompiler import new_compiler self.compiler = new_compiler(compiler=self.compiler, - verbose=self.verbose, dry_run=self.dry_run, force=self.force) customize_compiler(self.compiler) @@ -213,7 +212,7 @@ class build_clib (Command): "a list of source filenames") % lib_name sources = list(sources) - self.announce("building '%s' library" % lib_name) + log.info("building '%s' library", lib_name) # First, compile the source code to object files in the library # directory. (This should probably change to putting object diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index ddbd03e..89ca1dc 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -15,6 +15,7 @@ from distutils.errors import * from distutils.sysconfig import customize_compiler from distutils.dep_util import newer_group from distutils.extension import Extension +from distutils import log # An extension name is just a dot-separated list of Python NAMEs (ie. # the same as a fully-qualified module name). @@ -291,9 +292,9 @@ class build_ext (Command): # by Extension constructor) (ext_name, build_info) = ext - self.warn(("old-style (ext_name, build_info) tuple found in " - "ext_modules for extension '%s'" - "-- please convert to Extension instance" % ext_name)) + log.warn(("old-style (ext_name, build_info) tuple found in " + "ext_modules for extension '%s'" + "-- please convert to Extension instance" % ext_name)) if type(ext) is not TupleType and len(ext) != 2: raise DistutilsSetupError, \ ("each element of 'ext_modules' option must be an " @@ -329,8 +330,8 @@ class build_ext (Command): # Medium-easy stuff: same syntax/semantics, different names. ext.runtime_library_dirs = build_info.get('rpath') if build_info.has_key('def_file'): - self.warn("'def_file' element of build info dict " - "no longer supported") + log.warn("'def_file' element of build info dict " + "no longer supported") # Non-trivial stuff: 'macros' split into 'define_macros' # and 'undef_macros'. @@ -422,11 +423,10 @@ class build_ext (Command): self.get_ext_filename(fullname)) if not (self.force or newer_group(sources, ext_filename, 'newer')): - self.announce("skipping '%s' extension (up-to-date)" % - ext.name) + log.debug("skipping '%s' extension (up-to-date)", ext.name) return else: - self.announce("building '%s' extension" % ext.name) + log.info("building '%s' extension", ext.name) # First, scan the sources for SWIG definition files (.i), run # SWIG on 'em to create .c files, and modify the sources list @@ -539,7 +539,7 @@ class build_ext (Command): for source in swig_sources: target = swig_targets[source] - self.announce("swigging %s to %s" % (source, target)) + log.info("swigging %s to %s", source, target) self.spawn(swig_cmd + ["-o", target, source]) return new_sources diff --git a/Lib/distutils/command/build_py.py b/Lib/distutils/command/build_py.py index 97d094b..388d3cb 100644 --- a/Lib/distutils/command/build_py.py +++ b/Lib/distutils/command/build_py.py @@ -13,7 +13,7 @@ from glob import glob from distutils.core import Command from distutils.errors import * from distutils.util import convert_path - +from distutils import log class build_py (Command): @@ -176,8 +176,8 @@ class build_py (Command): if os.path.isfile(init_py): return init_py else: - self.warn(("package init file '%s' not found " + - "(or not a regular file)") % init_py) + log.warn(("package init file '%s' not found " + + "(or not a regular file)"), init_py) # Either not in a package at all (__init__.py not expected), or # __init__.py doesn't exist -- so don't return the filename. @@ -188,8 +188,7 @@ class build_py (Command): def check_module (self, module, module_file): if not os.path.isfile(module_file): - self.warn("file %s (for module %s) not found" % - (module_file, module)) + log.warn("file %s (for module %s) not found", module_file, module) return 0 else: return 1 @@ -389,13 +388,9 @@ class build_py (Command): if self.compile: byte_compile(files, optimize=0, - force=self.force, - prefix=prefix, - verbose=self.verbose, dry_run=self.dry_run) + force=self.force, prefix=prefix, dry_run=self.dry_run) if self.optimize > 0: byte_compile(files, optimize=self.optimize, - force=self.force, - prefix=prefix, - verbose=self.verbose, dry_run=self.dry_run) + force=self.force, prefix=prefix, dry_run=self.dry_run) # class build_py diff --git a/Lib/distutils/command/build_scripts.py b/Lib/distutils/command/build_scripts.py index 444284f..211ade4 100644 --- a/Lib/distutils/command/build_scripts.py +++ b/Lib/distutils/command/build_scripts.py @@ -11,6 +11,7 @@ from distutils import sysconfig from distutils.core import Command from distutils.dep_util import newer from distutils.util import convert_path +from distutils import log # check if Python is called on the first line with this expression first_line_re = re.compile(r'^#!.*python[0-9.]*(\s+.*)?$') @@ -59,7 +60,7 @@ class build_scripts (Command): outfile = os.path.join(self.build_dir, os.path.basename(script)) if not self.force and not newer(script, outfile): - self.announce("not copying %s (up-to-date)" % script) + log.debug("not copying %s (up-to-date)", script) continue # Always open the file, but ignore failures in dry-run mode -- @@ -83,8 +84,8 @@ class build_scripts (Command): post_interp = match.group(1) or '' if adjust: - self.announce("copying and adjusting %s -> %s" % - (script, self.build_dir)) + log.info("copying and adjusting %s -> %s", script, + self.build_dir) if not self.dry_run: outf = open(outfile, "w") if not sysconfig.python_build: diff --git a/Lib/distutils/command/clean.py b/Lib/distutils/command/clean.py index b4a9be4..8fddeb4 100644 --- a/Lib/distutils/command/clean.py +++ b/Lib/distutils/command/clean.py @@ -9,6 +9,7 @@ __revision__ = "$Id$" import os from distutils.core import Command from distutils.dir_util import remove_tree +from distutils import log class clean (Command): @@ -51,10 +52,10 @@ class clean (Command): # remove the build/temp.<plat> directory (unless it's already # gone) if os.path.exists(self.build_temp): - remove_tree(self.build_temp, self.verbose, self.dry_run) + remove_tree(self.build_temp, dry_run=self.dry_run) else: - self.warn("'%s' does not exist -- can't clean it" % - self.build_temp) + log.warn("'%s' does not exist -- can't clean it", + self.build_temp) if self.all: # remove build directories @@ -62,17 +63,17 @@ class clean (Command): self.bdist_base, self.build_scripts): if os.path.exists(directory): - remove_tree(directory, self.verbose, self.dry_run) + remove_tree(directory, dry_run=self.dry_run) else: - self.warn("'%s' does not exist -- can't clean it" % - directory) + log.warn("'%s' does not exist -- can't clean it", + directory) # just for the heck of it, try to remove the base build directory: # we might have emptied it right now, but if not we don't care if not self.dry_run: try: os.rmdir(self.build_base) - self.announce("removing '%s'" % self.build_base) + log.info("removing '%s'", self.build_base) except OSError: pass diff --git a/Lib/distutils/command/config.py b/Lib/distutils/command/config.py index 27c2cc1..d74aa6a 100644 --- a/Lib/distutils/command/config.py +++ b/Lib/distutils/command/config.py @@ -17,7 +17,7 @@ import sys, os, string, re from types import * from distutils.core import Command from distutils.errors import DistutilsExecError - +from distutils import log LANG_EXT = {'c': '.c', 'c++': '.cxx'} @@ -103,9 +103,7 @@ class config (Command): from distutils.ccompiler import CCompiler, new_compiler if not isinstance(self.compiler, CCompiler): self.compiler = new_compiler(compiler=self.compiler, - verbose=self.noisy, - dry_run=self.dry_run, - force=1) + dry_run=self.dry_run, force=1) if self.include_dirs: self.compiler.set_include_dirs(self.include_dirs) if self.libraries: @@ -161,7 +159,7 @@ class config (Command): if not filenames: filenames = self.temp_files self.temp_files = [] - self.announce("removing: " + string.join(filenames)) + log.info("removing: %s", string.join(filenames)) for filename in filenames: try: os.remove(filename) @@ -239,7 +237,7 @@ class config (Command): except CompileError: ok = 0 - self.announce(ok and "success!" or "failure.") + log.info(ok and "success!" or "failure.") self._clean() return ok @@ -260,7 +258,7 @@ class config (Command): except (CompileError, LinkError): ok = 0 - self.announce(ok and "success!" or "failure.") + log.info(ok and "success!" or "failure.") self._clean() return ok @@ -282,7 +280,7 @@ class config (Command): except (CompileError, LinkError, DistutilsExecError): ok = 0 - self.announce(ok and "success!" or "failure.") + log.info(ok and "success!" or "failure.") self._clean() return ok diff --git a/Lib/distutils/command/install_lib.py b/Lib/distutils/command/install_lib.py index 03b44ee..1e771c6 100644 --- a/Lib/distutils/command/install_lib.py +++ b/Lib/distutils/command/install_lib.py @@ -124,13 +124,11 @@ class install_lib (Command): if self.compile: byte_compile(files, optimize=0, - force=self.force, - prefix=install_root, - verbose=self.verbose, dry_run=self.dry_run) + force=self.force, prefix=install_root, + dry_run=self.dry_run) if self.optimize > 0: byte_compile(files, optimize=self.optimize, - force=self.force, - prefix=install_root, + force=self.force, prefix=install_root, verbose=self.verbose, dry_run=self.dry_run) diff --git a/Lib/distutils/command/install_scripts.py b/Lib/distutils/command/install_scripts.py index d4cbaa3..4044ba0 100644 --- a/Lib/distutils/command/install_scripts.py +++ b/Lib/distutils/command/install_scripts.py @@ -9,6 +9,7 @@ __revision__ = "$Id$" import os from distutils.core import Command +from distutils import log from stat import ST_MODE class install_scripts (Command): @@ -48,10 +49,10 @@ class install_scripts (Command): # all the scripts we just installed. for file in self.get_outputs(): if self.dry_run: - self.announce("changing mode of %s" % file) + log.info("changing mode of %s to %o", file, mode) else: mode = ((os.stat(file)[ST_MODE]) | 0111) & 07777 - self.announce("changing mode of %s to %o" % (file, mode)) + log.info("changing mode of %s to %o", file, mode) os.chmod(file, mode) def get_inputs (self): diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py index fbd3c6d..082aa88 100644 --- a/Lib/distutils/command/sdist.py +++ b/Lib/distutils/command/sdist.py @@ -14,6 +14,7 @@ from distutils import dir_util, dep_util, file_util, archive_util from distutils.text_file import TextFile from distutils.errors import * from distutils.filelist import FileList +from distutils import log def show_formats (): @@ -233,31 +234,17 @@ class sdist (Command): self.warn(("manifest template '%s' does not exist " + "(using default file list)") % self.template) - self.filelist.findall() - # Add default file set to 'files' if self.use_defaults: self.add_defaults() - - # Read manifest template if it exists if template_exists: self.read_template() - - # Prune away any directories that don't belong in the source - # distribution if self.prune: self.prune_file_list() - # File list now complete -- sort it so that higher-level files - # come first self.filelist.sort() - - # Remove duplicates from the file list self.filelist.remove_duplicates() - - # And write complete file list (including default file set) to - # the manifest. self.write_manifest() # Don't regenerate the manifest, just read it in. @@ -321,13 +308,12 @@ class sdist (Command): def read_template (self): + """Read and parse manifest template file named by self.template. - """Read and parse the manifest template file named by - 'self.template' (usually "MANIFEST.in"). The parsing and - processing is done by 'self.filelist', which updates itself - accordingly. + (usually "MANIFEST.in") The parsing and processing is done by + 'self.filelist', which updates itself accordingly. """ - self.announce("reading manifest template '%s'" % self.template) + log.info("reading manifest template '%s'", self.template) template = TextFile(self.template, strip_comments=1, skip_blanks=1, @@ -384,7 +370,7 @@ class sdist (Command): fill in 'self.filelist', the list of files to include in the source distribution. """ - self.announce("reading manifest file '%s'" % self.manifest) + log.info("reading manifest file '%s'", self.manifest) manifest = open(self.manifest) while 1: line = manifest.readline() @@ -410,8 +396,7 @@ class sdist (Command): # put 'files' there; the 'mkpath()' is just so we don't die # if the manifest happens to be empty. self.mkpath(base_dir) - dir_util.create_tree(base_dir, files, - verbose=self.verbose, dry_run=self.dry_run) + dir_util.create_tree(base_dir, files, dry_run=self.dry_run) # And walk over the list of files, either making a hard link (if # os.link exists) to each one that doesn't already exist in its @@ -428,12 +413,12 @@ class sdist (Command): msg = "copying files to %s..." % base_dir if not files: - self.warn("no files to distribute -- empty manifest?") + log.warn("no files to distribute -- empty manifest?") else: - self.announce(msg) + log.info(msg) for file in files: if not os.path.isfile(file): - self.warn("'%s' not a regular file -- skipping" % file) + log.warn("'%s' not a regular file -- skipping" % file) else: dest = os.path.join(base_dir, file) self.copy_file(file, dest, link=link) @@ -464,7 +449,7 @@ class sdist (Command): self.archive_files = archive_files if not self.keep_temp: - dir_util.remove_tree(base_dir, self.verbose, self.dry_run) + dir_util.remove_tree(base_dir, dry_run=self.dry_run) def get_archive_files (self): """Return the list of archive files created when the command |