Branch merge

This commit is contained in:
Éric Araujo 2012-02-05 13:41:47 +01:00
commit cd2a6033ac
15 changed files with 55 additions and 46 deletions

View File

@ -449,7 +449,9 @@ This module provides the following functions.
Define a preprocessor macro for all compilations driven by this compiler object. Define a preprocessor macro for all compilations driven by this compiler object.
The optional parameter *value* should be a string; if it is not supplied, then The optional parameter *value* should be a string; if it is not supplied, then
the macro will be defined without an explicit value and the exact outcome the macro will be defined without an explicit value and the exact outcome
depends on the compiler used (XXX true? does ANSI say anything about this?) depends on the compiler used.
.. XXX true? does ANSI say anything about this?
.. method:: CCompiler.undefine_macro(name) .. method:: CCompiler.undefine_macro(name)
@ -603,7 +605,9 @@ This module provides the following functions.
*output_libname* should be a library name, not a filename; the filename will be *output_libname* should be a library name, not a filename; the filename will be
inferred from the library name. *output_dir* is the directory where the library inferred from the library name. *output_dir* is the directory where the library
file will be put. XXX defaults to what? file will be put.
.. XXX defaults to what?
*debug* is a boolean; if true, debugging information will be included in the *debug* is a boolean; if true, debugging information will be included in the
library (note that on most platforms, it is the compile step where this matters: library (note that on most platforms, it is the compile step where this matters:
@ -723,30 +727,29 @@ This module provides the following functions.
Invokes :func:`distutils.util.execute` This method invokes a Python function Invokes :func:`distutils.util.execute` This method invokes a Python function
*func* with the given arguments *args*, after logging and taking into account *func* with the given arguments *args*, after logging and taking into account
the *dry_run* flag. XXX see also. the *dry_run* flag.
.. method:: CCompiler.spawn(cmd) .. method:: CCompiler.spawn(cmd)
Invokes :func:`distutils.util.spawn`. This invokes an external process to run Invokes :func:`distutils.util.spawn`. This invokes an external process to run
the given command. XXX see also. the given command.
.. method:: CCompiler.mkpath(name[, mode=511]) .. method:: CCompiler.mkpath(name[, mode=511])
Invokes :func:`distutils.dir_util.mkpath`. This creates a directory and any Invokes :func:`distutils.dir_util.mkpath`. This creates a directory and any
missing ancestor directories. XXX see also. missing ancestor directories.
.. method:: CCompiler.move_file(src, dst) .. method:: CCompiler.move_file(src, dst)
Invokes :meth:`distutils.file_util.move_file`. Renames *src* to *dst*. XXX see Invokes :meth:`distutils.file_util.move_file`. Renames *src* to *dst*.
also.
.. method:: CCompiler.announce(msg[, level=1]) .. method:: CCompiler.announce(msg[, level=1])
Write a message using :func:`distutils.log.debug`. XXX see also. Write a message using :func:`distutils.log.debug`.
.. method:: CCompiler.warn(msg) .. method:: CCompiler.warn(msg)
@ -874,8 +877,6 @@ tarballs or zipfiles.
prefix of all files and directories in the archive. *root_dir* and *base_dir* prefix of all files and directories in the archive. *root_dir* and *base_dir*
both default to the current directory. Returns the name of the archive file. both default to the current directory. Returns the name of the archive file.
.. XXX This should be changed to support bz2 files.
.. function:: make_tarball(base_name, base_dir[, compress='gzip', verbose=0, dry_run=0]) .. function:: make_tarball(base_name, base_dir[, compress='gzip', verbose=0, dry_run=0])
@ -887,8 +888,6 @@ tarballs or zipfiles.
possibly plus the appropriate compression extension (:file:`.gz`, :file:`.bz2` possibly plus the appropriate compression extension (:file:`.gz`, :file:`.bz2`
or :file:`.Z`). Return the output filename. or :file:`.Z`). Return the output filename.
.. XXX This should be replaced with calls to the :mod:`tarfile` module.
.. function:: make_zipfile(base_name, base_dir[, verbose=0, dry_run=0]) .. function:: make_zipfile(base_name, base_dir[, verbose=0, dry_run=0])
@ -1000,8 +999,6 @@ directories.
errors are ignored (apart from being reported to ``sys.stdout`` if *verbose* is errors are ignored (apart from being reported to ``sys.stdout`` if *verbose* is
true). true).
.. XXX Some of this could be replaced with the shutil module?
:mod:`distutils.file_util` --- Single file operations :mod:`distutils.file_util` --- Single file operations
===================================================== =====================================================
@ -1115,8 +1112,6 @@ other utility module.
* ``macosx-10.6-intel`` * ``macosx-10.6-intel``
.. % XXX isn't this also provided by some other non-distutils module?
.. function:: convert_path(pathname) .. function:: convert_path(pathname)
@ -1321,8 +1316,6 @@ provides the following additional features:
the "negative alias" of :option:`--verbose`, then :option:`--quiet` on the the "negative alias" of :option:`--verbose`, then :option:`--quiet` on the
command line sets *verbose* to false. command line sets *verbose* to false.
.. XXX Should be replaced with optparse
.. function:: fancy_getopt(options, negative_opt, object, args) .. function:: fancy_getopt(options, negative_opt, object, args)
Wrapper function. *options* is a list of ``(long_option, short_option, Wrapper function. *options* is a list of ``(long_option, short_option,
@ -1338,9 +1331,6 @@ provides the following additional features:
Wraps *text* to less than *width* wide. Wraps *text* to less than *width* wide.
.. XXX Should be replaced with :mod:`textwrap` (which is available in Python
2.3 and later).
.. class:: FancyGetopt([option_table=None]) .. class:: FancyGetopt([option_table=None])
@ -1403,10 +1393,6 @@ filesystem and building lists of files.
:synopsis: A simple logging mechanism, 282-style :synopsis: A simple logging mechanism, 282-style
.. XXX Should be replaced with standard :mod:`logging` module.
:mod:`distutils.spawn` --- Spawn a sub-process :mod:`distutils.spawn` --- Spawn a sub-process
============================================== ==============================================

View File

@ -271,7 +271,7 @@ it.
To find out the required compiler and linker flags, you can execute the To find out the required compiler and linker flags, you can execute the
:file:`python{X.Y}-config` script which is generated as part of the :file:`python{X.Y}-config` script which is generated as part of the
installation process (a generic :file:`python3-config` script is also installation process (a :file:`python3-config` script may also be
available). This script has several options, of which the following will available). This script has several options, of which the following will
be directly useful to you: be directly useful to you:
@ -294,9 +294,10 @@ be directly useful to you:
example. example.
If this procedure doesn't work for you (it is not guaranteed to work for If this procedure doesn't work for you (it is not guaranteed to work for
all Unix-like platforms; however, we welcome bug reports at all Unix-like platforms; however, we welcome :ref:`bug reports <reporting-bugs>`)
http://bugs.python.org), you will have to read your system's documentation you will have to read your system's documentation about dynamic linking and/or
about dynamic linking and/or examine Python's Makefile and compilation examine Python's :file:`Makefile` (use :func:`sysconfig.get_makefile_filename`
to find its location) and compilation
options. In this case, the :mod:`sysconfig` module is a useful tool to options. In this case, the :mod:`sysconfig` module is a useful tool to
programmatically extract the configuration values that you will want to programmatically extract the configuration values that you will want to
combine together:: combine together::

View File

@ -6,6 +6,7 @@ Data Compression and Archiving
The modules described in this chapter support data compression with the zlib, The modules described in this chapter support data compression with the zlib,
gzip, and bzip2 algorithms, and the creation of ZIP- and tar-format archives. gzip, and bzip2 algorithms, and the creation of ZIP- and tar-format archives.
See also :ref:`archiving-operations` provided by the :mod:`shutil` module.
.. toctree:: .. toctree::

View File

@ -12,9 +12,6 @@ This module provides a comprehensive interface for the bz2 compression library.
It implements a complete file interface, one-shot (de)compression functions, and It implements a complete file interface, one-shot (de)compression functions, and
types for sequential (de)compression. types for sequential (de)compression.
For other archive formats, see the :mod:`gzip`, :mod:`zipfile`, and
:mod:`tarfile` modules.
Here is a summary of the features offered by the bz2 module: Here is a summary of the features offered by the bz2 module:
* :class:`BZ2File` class implements a complete file interface, including * :class:`BZ2File` class implements a complete file interface, including

View File

@ -21,9 +21,6 @@ Note that additional file formats which can be decompressed by the
:program:`gzip` and :program:`gunzip` programs, such as those produced by :program:`gzip` and :program:`gunzip` programs, such as those produced by
:program:`compress` and :program:`pack`, are not supported by this module. :program:`compress` and :program:`pack`, are not supported by this module.
For other archive formats, see the :mod:`bz2`, :mod:`zipfile`, and
:mod:`tarfile` modules.
The module defines the following items: The module defines the following items:

View File

@ -125,6 +125,10 @@ Basic Usage
:class:`bytes` objects. Therefore, ``fp.write()`` must support :class:`str` :class:`bytes` objects. Therefore, ``fp.write()`` must support :class:`str`
input. input.
If *ensure_ascii* is ``True`` (the default), the output is guaranteed to
have all incoming non-ASCII characters escaped. If *ensure_ascii* is
``False``, these characters will be output as-is.
If *check_circular* is ``False`` (default: ``True``), then the circular If *check_circular* is ``False`` (default: ``True``), then the circular
reference check for container types will be skipped and a circular reference reference check for container types will be skipped and a circular reference
will result in an :exc:`OverflowError` (or worse). will result in an :exc:`OverflowError` (or worse).

View File

@ -31,6 +31,8 @@ copying and removal. For operations on individual files, see also the
are not copied. are not copied.
.. _file-operations:
Directory and files operations Directory and files operations
------------------------------ ------------------------------
@ -181,7 +183,7 @@ Directory and files operations
(*srcname*, *dstname*, *exception*). (*srcname*, *dstname*, *exception*).
.. _shutil-example: .. _shutil-copytree-example:
copytree example copytree example
:::::::::::::::: ::::::::::::::::
@ -248,6 +250,9 @@ Another example that uses the *ignore* argument to add a logging call::
Archiving operations Archiving operations
-------------------- --------------------
High-level utilities to create and read compressed and archived files are also
provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
.. function:: make_archive(base_name, format, [root_dir, [base_dir, [verbose, [dry_run, [owner, [group, [logger]]]]]]]) .. function:: make_archive(base_name, format, [root_dir, [base_dir, [verbose, [dry_run, [owner, [group, [logger]]]]]]])
Create an archive file (such as zip or tar) and return its name. Create an archive file (such as zip or tar) and return its name.
@ -375,6 +380,7 @@ Archiving operations
.. versionadded:: 3.2 .. versionadded:: 3.2
.. _shutil-archiving-example:
Archiving example Archiving example
::::::::::::::::: :::::::::::::::::
@ -400,5 +406,3 @@ The resulting archive contains::
-rw------- tarek/staff 1675 2008-06-09 13:26:54 ./id_rsa -rw------- tarek/staff 1675 2008-06-09 13:26:54 ./id_rsa
-rw-r--r-- tarek/staff 397 2008-06-09 13:26:54 ./id_rsa.pub -rw-r--r-- tarek/staff 397 2008-06-09 13:26:54 ./id_rsa.pub
-rw-r--r-- tarek/staff 37192 2010-02-06 18:23:10 ./known_hosts -rw-r--r-- tarek/staff 37192 2010-02-06 18:23:10 ./known_hosts

View File

@ -14,7 +14,8 @@
The :mod:`tarfile` module makes it possible to read and write tar The :mod:`tarfile` module makes it possible to read and write tar
archives, including those using gzip or bz2 compression. archives, including those using gzip or bz2 compression.
(:file:`.zip` files can be read and written using the :mod:`zipfile` module.) Use the :mod:`zipfile` module to read or write :file:`.zip` files, or the
higher-level functions in :ref:`shutil <archiving-operations>`.
Some facts and figures: Some facts and figures:

View File

@ -23,9 +23,6 @@ decryption of encrypted files in ZIP archives, but it currently cannot
create an encrypted file. Decryption is extremely slow as it is create an encrypted file. Decryption is extremely slow as it is
implemented in native Python rather than C. implemented in native Python rather than C.
For other archive formats, see the :mod:`bz2`, :mod:`gzip`, and
:mod:`tarfile` modules.
The module defines the following items: The module defines the following items:
.. exception:: BadZipFile .. exception:: BadZipFile

View File

@ -18,9 +18,7 @@ order. This documentation doesn't attempt to cover all of the permutations;
consult the zlib manual at http://www.zlib.net/manual.html for authoritative consult the zlib manual at http://www.zlib.net/manual.html for authoritative
information. information.
For reading and writing ``.gz`` files see the :mod:`gzip` module. For For reading and writing ``.gz`` files see the :mod:`gzip` module.
other archive formats, see the :mod:`bz2`, :mod:`zipfile`, and
:mod:`tarfile` modules.
The available exception and functions in this module are: The available exception and functions in this module are:

View File

@ -365,16 +365,28 @@ class bdist_rpm(Command):
self.spawn(rpm_cmd) self.spawn(rpm_cmd)
if not self.dry_run: if not self.dry_run:
if self.distribution.has_ext_modules():
pyversion = get_python_version()
else:
pyversion = 'any'
if not self.binary_only: if not self.binary_only:
srpm = os.path.join(rpm_dir['SRPMS'], source_rpm) srpm = os.path.join(rpm_dir['SRPMS'], source_rpm)
assert(os.path.exists(srpm)) assert(os.path.exists(srpm))
self.move_file(srpm, self.dist_dir) self.move_file(srpm, self.dist_dir)
filename = os.path.join(self.dist_dir, source_rpm)
self.distribution.dist_files.append(
('bdist_rpm', pyversion, filename))
if not self.source_only: if not self.source_only:
for rpm in binary_rpms: for rpm in binary_rpms:
rpm = os.path.join(rpm_dir['RPMS'], rpm) rpm = os.path.join(rpm_dir['RPMS'], rpm)
if os.path.exists(rpm): if os.path.exists(rpm):
self.move_file(rpm, self.dist_dir) self.move_file(rpm, self.dist_dir)
filename = os.path.join(self.dist_dir,
os.path.basename(rpm))
self.distribution.dist_files.append(
('bdist_rpm', pyversion, filename))
def _dist_path(self, path): def _dist_path(self, path):
return os.path.join(self.dist_dir, os.path.basename(path)) return os.path.join(self.dist_dir, os.path.basename(path))

View File

@ -78,6 +78,10 @@ class BuildRpmTestCase(support.TempdirManager,
dist_created = os.listdir(os.path.join(pkg_dir, 'dist')) dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created) self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created)
# bug #2945: upload ignores bdist_rpm files
self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm'), dist.dist_files)
self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.noarch.rpm'), dist.dist_files)
def test_no_optimize_flag(self): def test_no_optimize_flag(self):
# XXX I am unable yet to make this test work without # XXX I am unable yet to make this test work without
@ -117,6 +121,11 @@ class BuildRpmTestCase(support.TempdirManager,
dist_created = os.listdir(os.path.join(pkg_dir, 'dist')) dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created) self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created)
# bug #2945: upload ignores bdist_rpm files
self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm'), dist.dist_files)
self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.noarch.rpm'), dist.dist_files)
os.remove(os.path.join(pkg_dir, 'dist', 'foo-0.1-1.noarch.rpm')) os.remove(os.path.join(pkg_dir, 'dist', 'foo-0.1-1.noarch.rpm'))
def test_suite(): def test_suite():

View File

@ -493,7 +493,6 @@ def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None):
_ARCHIVE_FORMATS = { _ARCHIVE_FORMATS = {
'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"), 'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"),
'bztar': (_make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"),
'tar': (_make_tarball, [('compress', None)], "uncompressed tar file"), 'tar': (_make_tarball, [('compress', None)], "uncompressed tar file"),
'zip': (_make_zipfile, [],"ZIP file") 'zip': (_make_zipfile, [],"ZIP file")
} }

View File

@ -767,6 +767,7 @@ Vlad Riscutia
Juan M. Bello Rivas Juan M. Bello Rivas
Davide Rizzo Davide Rizzo
Anthony Roach Anthony Roach
Carl Robben
Mark Roberts Mark Roberts
Jim Robinson Jim Robinson
Andy Robinson Andy Robinson

View File

@ -113,6 +113,8 @@ Core and Builtins
Library Library
------- -------
- Issue #2945: Make the distutils upload command aware of bdist_rpm products.
- Issue #13933: IDLE auto-complete did not work with some imported - Issue #13933: IDLE auto-complete did not work with some imported
module, like hashlib. (Patch by Roger Serwy) module, like hashlib. (Patch by Roger Serwy)