Commit 92904d3a authored by Éric Araujo's avatar Éric Araujo

Branch merge

parents 8b48c66e 6d37c4e3
...@@ -444,7 +444,9 @@ This module provides the following functions. ...@@ -444,7 +444,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)
...@@ -598,7 +600,9 @@ This module provides the following functions. ...@@ -598,7 +600,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:
...@@ -718,30 +722,29 @@ This module provides the following functions. ...@@ -718,30 +722,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)
...@@ -869,8 +872,6 @@ tarballs or zipfiles. ...@@ -869,8 +872,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])
...@@ -882,8 +883,6 @@ tarballs or zipfiles. ...@@ -882,8 +883,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])
...@@ -995,8 +994,6 @@ directories. ...@@ -995,8 +994,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
===================================================== =====================================================
...@@ -1110,8 +1107,6 @@ other utility module. ...@@ -1110,8 +1107,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)
...@@ -1311,8 +1306,6 @@ provides the following additional features: ...@@ -1311,8 +1306,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 :mod:`optparse`.
.. function:: fancy_getopt(options, negative_opt, object, args) .. function:: fancy_getopt(options, negative_opt, object, args)
...@@ -1329,8 +1322,6 @@ provides the following additional features: ...@@ -1329,8 +1322,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])
...@@ -1394,10 +1385,6 @@ filesystem and building lists of files. ...@@ -1394,10 +1385,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
============================================== ==============================================
...@@ -1894,9 +1881,6 @@ Subclasses of :class:`Command` must define the following methods. ...@@ -1894,9 +1881,6 @@ Subclasses of :class:`Command` must define the following methods.
:synopsis: Build the .py/.pyc files of a package :synopsis: Build the .py/.pyc files of a package
.. % todo
:mod:`distutils.command.build_scripts` --- Build the scripts of a package :mod:`distutils.command.build_scripts` --- Build the scripts of a package
========================================================================= =========================================================================
......
...@@ -7,6 +7,7 @@ Data Compression and Archiving ...@@ -7,6 +7,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::
......
...@@ -14,9 +14,6 @@ This module provides a comprehensive interface for the bz2 compression library. ...@@ -14,9 +14,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
......
...@@ -22,9 +22,6 @@ Note that additional file formats which can be decompressed by the ...@@ -22,9 +22,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:
......
...@@ -915,12 +915,11 @@ with the :mod:`warnings` module. ...@@ -915,12 +915,11 @@ with the :mod:`warnings` module.
If *capture* is ``True``, warnings issued by the :mod:`warnings` module will If *capture* is ``True``, warnings issued by the :mod:`warnings` module will
be redirected to the logging system. Specifically, a warning will be be redirected to the logging system. Specifically, a warning will be
formatted using :func:`warnings.formatwarning` and the resulting string formatted using :func:`warnings.formatwarning` and the resulting string
logged to a logger named 'py.warnings' with a severity of `WARNING`. logged to a logger named ``'py.warnings'`` with a severity of :const:`WARNING`.
If *capture* is ``False``, the redirection of warnings to the logging system If *capture* is ``False``, the redirection of warnings to the logging system
will stop, and warnings will be redirected to their original destinations will stop, and warnings will be redirected to their original destinations
(i.e. those in effect before `captureWarnings(True)` was called). (i.e. those in effect before ``captureWarnings(True)`` was called).
.. seealso:: .. seealso::
......
...@@ -31,6 +31,8 @@ copying and removal. For operations on individual files, see also the ...@@ -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
------------------------------ ------------------------------
...@@ -185,7 +187,7 @@ Directory and files operations ...@@ -185,7 +187,7 @@ Directory and files operations
.. versionadded:: 2.3 .. versionadded:: 2.3
.. _shutil-example: .. _copytree-example:
copytree example copytree example
:::::::::::::::: ::::::::::::::::
...@@ -254,8 +256,13 @@ Another example that uses the *ignore* argument to add a logging call:: ...@@ -254,8 +256,13 @@ Another example that uses the *ignore* argument to add a logging call::
copytree(source, destination, ignore=_logpath) copytree(source, destination, ignore=_logpath)
Archives operations .. _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]]]]]]])
...@@ -278,7 +285,8 @@ Archives operations ...@@ -278,7 +285,8 @@ Archives operations
*owner* and *group* are used when creating a tar archive. By default, *owner* and *group* are used when creating a tar archive. By default,
uses the current owner and group. uses the current owner and group.
*logger* is an instance of :class:`logging.Logger`. *logger* must be an object compatible with :pep:`282`, usually an instance of
:class:`logging.Logger`.
.. versionadded:: 2.7 .. versionadded:: 2.7
...@@ -322,6 +330,8 @@ Archives operations ...@@ -322,6 +330,8 @@ Archives operations
.. versionadded:: 2.7 .. versionadded:: 2.7
.. _archiving-example:
Archiving example Archiving example
::::::::::::::::: :::::::::::::::::
...@@ -346,5 +356,3 @@ The resulting archive contains:: ...@@ -346,5 +356,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
...@@ -72,17 +72,17 @@ numeric address in *host* portion. ...@@ -72,17 +72,17 @@ numeric address in *host* portion.
tuple, and the fields depend on the address type. The general tuple form is tuple, and the fields depend on the address type. The general tuple form is
``(addr_type, v1, v2, v3 [, scope])``, where: ``(addr_type, v1, v2, v3 [, scope])``, where:
- *addr_type* is one of TIPC_ADDR_NAMESEQ, TIPC_ADDR_NAME, or - *addr_type* is one of :const;`TIPC_ADDR_NAMESEQ`, :const:`TIPC_ADDR_NAME`,
TIPC_ADDR_ID. or :const:`TIPC_ADDR_ID`.
- *scope* is one of TIPC_ZONE_SCOPE, TIPC_CLUSTER_SCOPE, and - *scope* is one of :const:`TIPC_ZONE_SCOPE`, :const:`TIPC_CLUSTER_SCOPE`,
TIPC_NODE_SCOPE. and :const:`TIPC_NODE_SCOPE`.
- If *addr_type* is TIPC_ADDR_NAME, then *v1* is the server type, *v2* is - If *addr_type* is :const:`TIPC_ADDR_NAME`, then *v1* is the server type, *v2* is
the port identifier, and *v3* should be 0. the port identifier, and *v3* should be 0.
If *addr_type* is TIPC_ADDR_NAMESEQ, then *v1* is the server type, *v2* If *addr_type* is :const:`TIPC_ADDR_NAMESEQ`, then *v1* is the server type, *v2*
is the lower port number, and *v3* is the upper port number. is the lower port number, and *v3* is the upper port number.
If *addr_type* is TIPC_ADDR_ID, then *v1* is the node, *v2* is the If *addr_type* is :const:`TIPC_ADDR_ID`, then *v1* is the node, *v2* is the
reference, and *v3* should be set to 0. reference, and *v3* should be set to 0.
......
:mod:`sys` --- System-specific parameters and functions :mod:`sys` --- System-specific parameters and functions
======================================================= =======================================================
...@@ -208,7 +207,7 @@ always available. ...@@ -208,7 +207,7 @@ always available.
be set at build time with the ``--exec-prefix`` argument to the be set at build time with the ``--exec-prefix`` argument to the
:program:`configure` script. Specifically, all configuration files (e.g. the :program:`configure` script. Specifically, all configuration files (e.g. the
:file:`pyconfig.h` header file) are installed in the directory :file:`pyconfig.h` header file) are installed in the directory
:file:`{exec_prefix}/lib/python{X.Y}/config', and shared library modules are :file:`{exec_prefix}/lib/python{X.Y}/config`, and shared library modules are
installed in :file:`{exec_prefix}/lib/python{X.Y}/lib-dynload`, where *X.Y* installed in :file:`{exec_prefix}/lib/python{X.Y}/lib-dynload`, where *X.Y*
is the version number of Python, for example ``2.7``. is the version number of Python, for example ``2.7``.
...@@ -291,6 +290,8 @@ always available. ...@@ -291,6 +290,8 @@ always available.
.. versionadded:: 2.6 .. versionadded:: 2.6
.. versionadded:: 2.7.3
The ``hash_randomization`` attribute.
.. data:: float_info .. data:: float_info
...@@ -775,7 +776,7 @@ always available. ...@@ -775,7 +776,7 @@ always available.
argument to the :program:`configure` script. The main collection of Python argument to the :program:`configure` script. The main collection of Python
library modules is installed in the directory :file:`{prefix}/lib/python{X.Y}`` library modules is installed in the directory :file:`{prefix}/lib/python{X.Y}``
while the platform independent header files (all except :file:`pyconfig.h`) are while the platform independent header files (all except :file:`pyconfig.h`) are
stored in :file:`{prefix}/include/python{X.Y}``, where *X.Y* is the version stored in :file:`{prefix}/include/python{X.Y}`, where *X.Y* is the version
number of Python, for example ``2.7``. number of Python, for example ``2.7``.
......
...@@ -129,7 +129,7 @@ identifier. Python currently uses eight paths: ...@@ -129,7 +129,7 @@ identifier. Python currently uses eight paths:
one may call this function and get the default value. one may call this function and get the default value.
If *scheme* is provided, it must be a value from the list returned by If *scheme* is provided, it must be a value from the list returned by
:func:`get_path_names`. Otherwise, the default scheme for the current :func:`get_scheme_names`. Otherwise, the default scheme for the current
platform is used. platform is used.
If *vars* is provided, it must be a dictionary of variables that will update If *vars* is provided, it must be a dictionary of variables that will update
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,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:
......
...@@ -25,9 +25,6 @@ decryption of encrypted files in ZIP archives, but it currently cannot ...@@ -25,9 +25,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
......
...@@ -19,9 +19,7 @@ order. This documentation doesn't attempt to cover all of the permutations; ...@@ -19,9 +19,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:
......
...@@ -541,7 +541,8 @@ These environment variables influence Python's behavior. ...@@ -541,7 +541,8 @@ These environment variables influence Python's behavior.
.. envvar:: PYTHONDONTWRITEBYTECODE .. envvar:: PYTHONDONTWRITEBYTECODE
If this is set, Python won't try to write ``.pyc`` or ``.pyo`` files on the If this is set, Python won't try to write ``.pyc`` or ``.pyo`` files on the
import of source modules. import of source modules. This is equivalent to specifying the :option:`-B`
option.
.. versionadded:: 2.6 .. versionadded:: 2.6
......
...@@ -1451,7 +1451,7 @@ class TextIOWrapper(TextIOBase): ...@@ -1451,7 +1451,7 @@ class TextIOWrapper(TextIOBase):
enabled. With this enabled, on input, the lines endings '\n', '\r', enabled. With this enabled, on input, the lines endings '\n', '\r',
or '\r\n' are translated to '\n' before being returned to the or '\r\n' are translated to '\n' before being returned to the
caller. Conversely, on output, '\n' is translated to the system caller. Conversely, on output, '\n' is translated to the system
default line seperator, os.linesep. If newline is any other of its default line separator, os.linesep. If newline is any other of its
legal values, that newline becomes the newline when the file is read legal values, that newline becomes the newline when the file is read
and it is returned untranslated. On output, '\n' is converted to the and it is returned untranslated. On output, '\n' is converted to the
newline. newline.
......
"""HTTP cookie handling for web clients. r"""HTTP cookie handling for web clients.
This module has (now fairly distant) origins in Gisle Aas' Perl module This module has (now fairly distant) origins in Gisle Aas' Perl module
HTTP::Cookies, from the libwww-perl library. HTTP::Cookies, from the libwww-perl library.
......
...@@ -379,16 +379,28 @@ class bdist_rpm (Command): ...@@ -379,16 +379,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))
# run() # run()
def _dist_path(self, path): def _dist_path(self, path):
......
"""Tests for distutils.command.bdist_dumb.""" """Tests for distutils.command.bdist_dumb."""
import unittest
import sys
import os import os
import sys
import zipfile
import unittest
from test.test_support import run_unittest
# zlib is not used here, but if it's not available # zlib is not used here, but if it's not available
# test_simple_built will fail # test_simple_built will fail
...@@ -11,8 +13,6 @@ try: ...@@ -11,8 +13,6 @@ try:
except ImportError: except ImportError:
zlib = None zlib = None
from test.test_support import run_unittest
from distutils.core import Distribution from distutils.core import Distribution
from distutils.command.bdist_dumb import bdist_dumb from distutils.command.bdist_dumb import bdist_dumb
from distutils.tests import support from distutils.tests import support
...@@ -73,15 +73,23 @@ class BuildDumbTestCase(support.TempdirManager, ...@@ -73,15 +73,23 @@ class BuildDumbTestCase(support.TempdirManager,
# see what we have # see what we have
dist_created = os.listdir(os.path.join(pkg_dir, 'dist')) dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
base = "%s.%s" % (dist.get_fullname(), cmd.plat_name) base = "%s.%s.zip" % (dist.get_fullname(), cmd.plat_name)
if os.name == 'os2': if os.name == 'os2':
base = base.replace(':', '-') base = base.replace(':', '-')
wanted = ['%s.zip' % base] self.assertEqual(dist_created, [base])
self.assertEqual(dist_created, wanted)
# now let's check what we have in the zip file # now let's check what we have in the zip file
# XXX to be done fp = zipfile.ZipFile(os.path.join('dist', base))
try:
contents = fp.namelist()
finally:
fp.close()
contents = sorted(os.path.basename(fn) for fn in contents)
wanted = ['foo-0.1-py%s.%s.egg-info' % sys.version_info[:2],
'foo.py', 'foo.pyc']
self.assertEqual(contents, sorted(wanted))
def test_finalize_options(self): def test_finalize_options(self):
pkg_dir, dist = self.create_dist() pkg_dir, dist = self.create_dist()
......
...@@ -79,6 +79,10 @@ class BuildRpmTestCase(support.TempdirManager, ...@@ -79,6 +79,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
...@@ -118,6 +122,11 @@ class BuildRpmTestCase(support.TempdirManager, ...@@ -118,6 +122,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():
......
...@@ -86,19 +86,17 @@ class InstallTestCase(support.TempdirManager, ...@@ -86,19 +86,17 @@ class InstallTestCase(support.TempdirManager,
self.old_expand = os.path.expanduser self.old_expand = os.path.expanduser
os.path.expanduser = _expanduser os.path.expanduser = _expanduser
try: def cleanup():
# this is the actual test
self._test_user_site()
finally:
site.USER_BASE = self.old_user_base site.USER_BASE = self.old_user_base
site.USER_SITE = self.old_user_site site.USER_SITE = self.old_user_site
install_module.USER_BASE = self.old_user_base install_module.USER_BASE = self.old_user_base
install_module.USER_SITE = self.old_user_site install_module.USER_SITE = self.old_user_site
os.path.expanduser = self.old_expand os.path.expanduser = self.old_expand
def _test_user_site(self): self.addCleanup(cleanup)
for key in ('nt_user', 'unix_user', 'os2_home'): for key in ('nt_user', 'unix_user', 'os2_home'):
self.assertTrue(key in INSTALL_SCHEMES) self.assertIn(key, INSTALL_SCHEMES)
dist = Distribution({'name': 'xx'}) dist = Distribution({'name': 'xx'})
cmd = install(dist) cmd = install(dist)
...@@ -106,14 +104,14 @@ class InstallTestCase(support.TempdirManager, ...@@ -106,14 +104,14 @@ class InstallTestCase(support.TempdirManager,
# making sure the user option is there # making sure the user option is there
options = [name for name, short, lable in options = [name for name, short, lable in
cmd.user_options] cmd.user_options]
self.assertTrue('user' in options) self.assertIn('user', options)
# setting a value # setting a value
cmd.user = 1 cmd.user = 1
# user base and site shouldn't be created yet # user base and site shouldn't be created yet
self.assertTrue(not os.path.exists(self.user_base)) self.assertFalse(os.path.exists(self.user_base))
self.assertTrue(not os.path.exists(self.user_site)) self.assertFalse(os.path.exists(self.user_site))
# let's run finalize # let's run finalize
cmd.ensure_finalized() cmd.ensure_finalized()
...@@ -122,8 +120,8 @@ class InstallTestCase(support.TempdirManager, ...@@ -122,8 +120,8 @@ class InstallTestCase(support.TempdirManager,
self.assertTrue(os.path.exists(self.user_base)) self.assertTrue(os.path.exists(self.user_base))
self.assertTrue(os.path.exists(self.user_site)) self.assertTrue(os.path.exists(self.user_site))
self.assertTrue('userbase' in cmd.config_vars) self.assertIn('userbase', cmd.config_vars)
self.assertTrue('usersite' in cmd.config_vars) self.assertIn('usersite', cmd.config_vars)
def test_handle_extra_path(self): def test_handle_extra_path(self):
dist = Distribution({'name': 'xx', 'extra_path': 'path,dirs'}) dist = Distribution({'name': 'xx', 'extra_path': 'path,dirs'})
...@@ -176,15 +174,16 @@ class InstallTestCase(support.TempdirManager, ...@@ -176,15 +174,16 @@ class InstallTestCase(support.TempdirManager,
def test_record(self): def test_record(self):
install_dir = self.mkdtemp() install_dir = self.mkdtemp()
project_dir, dist = self.create_dist(scripts=['hello']) project_dir, dist = self.create_dist(py_modules=['hello'],
self.addCleanup(os.chdir, os.getcwd()) scripts=['sayhi'])
os.chdir(project_dir) os.chdir(project_dir)
self.write_file('hello', "print('o hai')") self.write_file('hello.py', "def main(): print 'o hai'")
self.write_file('sayhi', 'from hello import main; main()')
cmd = install(dist) cmd = install(dist)
dist.command_obj['install'] = cmd dist.command_obj['install'] = cmd
cmd.root = install_dir cmd.root = install_dir
cmd.record = os.path.join(project_dir, 'RECORD') cmd.record = os.path.join(project_dir, 'filelist')
cmd.ensure_finalized() cmd.ensure_finalized()
cmd.run() cmd.run()
...@@ -195,7 +194,7 @@ class InstallTestCase(support.TempdirManager, ...@@ -195,7 +194,7 @@ class InstallTestCase(support.TempdirManager,
f.close() f.close()
found = [os.path.basename(line) for line in content.splitlines()] found = [os.path.basename(line) for line in content.splitlines()]
expected = ['hello', expected = ['hello.py', 'hello.pyc', 'sayhi',
'UNKNOWN-0.0.0-py%s.%s.egg-info' % sys.version_info[:2]] 'UNKNOWN-0.0.0-py%s.%s.egg-info' % sys.version_info[:2]]
self.assertEqual(found, expected) self.assertEqual(found, expected)
...@@ -203,7 +202,6 @@ class InstallTestCase(support.TempdirManager, ...@@ -203,7 +202,6 @@ class InstallTestCase(support.TempdirManager,
install_dir = self.mkdtemp() install_dir = self.mkdtemp()
project_dir, dist = self.create_dist(ext_modules=[ project_dir, dist = self.create_dist(ext_modules=[
Extension('xx', ['xxmodule.c'])]) Extension('xx', ['xxmodule.c'])])
self.addCleanup(os.chdir, os.getcwd())
os.chdir(project_dir) os.chdir(project_dir)
support.copy_xxmodule_c(project_dir) support.copy_xxmodule_c(project_dir)
...@@ -215,7 +213,7 @@ class InstallTestCase(support.TempdirManager, ...@@ -215,7 +213,7 @@ class InstallTestCase(support.TempdirManager,
dist.command_obj['install'] = cmd dist.command_obj['install'] = cmd
dist.command_obj['build_ext'] = buildextcmd dist.command_obj['build_ext'] = buildextcmd
cmd.root = install_dir cmd.root = install_dir
cmd.record = os.path.join(project_dir, 'RECORD') cmd.record = os.path.join(project_dir, 'filelist')
cmd.ensure_finalized() cmd.ensure_finalized()
cmd.run() cmd.run()
...@@ -241,6 +239,7 @@ class InstallTestCase(support.TempdirManager, ...@@ -241,6 +239,7 @@ class InstallTestCase(support.TempdirManager,
install_module.DEBUG = False install_module.DEBUG = False
self.assertTrue(len(self.logs) > old_logs_len) self.assertTrue(len(self.logs) > old_logs_len)
def test_suite(): def test_suite():
return unittest.makeSuite(InstallTestCase) return unittest.makeSuite(InstallTestCase)
......
...@@ -6,6 +6,7 @@ import warnings ...@@ -6,6 +6,7 @@ import warnings
import zipfile import zipfile
from os.path import join from os.path import join
from textwrap import dedent from textwrap import dedent
from test.test_support import captured_stdout, check_warnings, run_unittest
# zlib is not used here, but if it's not available # zlib is not used here, but if it's not available
# the tests that use zipfile may fail # the tests that use zipfile may fail
...@@ -21,7 +22,6 @@ try: ...@@ -21,7 +22,6 @@ try:
except ImportError: except ImportError:
UID_GID_SUPPORT = False UID_GID_SUPPORT = False
from test.test_support import captured_stdout, check_warnings, run_unittest
from distutils.command.sdist import sdist, show_formats from distutils.command.sdist import sdist, show_formats
from distutils.core import Distribution from distutils.core import Distribution
...@@ -375,7 +375,7 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -375,7 +375,7 @@ class SDistTestCase(PyPIRCCommandTestCase):
# the following tests make sure there is a nice error message instead # the following tests make sure there is a nice error message instead
# of a traceback when parsing an invalid manifest template # of a traceback when parsing an invalid manifest template
def _test_template(self, content): def _check_template(self, content):
dist, cmd = self.get_cmd() dist, cmd = self.get_cmd()
os.chdir(self.tmp_dir) os.chdir(self.tmp_dir)
self.write_file('MANIFEST.in', content) self.write_file('MANIFEST.in', content)
...@@ -386,17 +386,17 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -386,17 +386,17 @@ class SDistTestCase(PyPIRCCommandTestCase):
self.assertEqual(len(warnings), 1) self.assertEqual(len(warnings), 1)
def test_invalid_template_unknown_command(self): def test_invalid_template_unknown_command(self):
self._test_template('taunt knights *') self._check_template('taunt knights *')
def test_invalid_template_wrong_arguments(self): def test_invalid_template_wrong_arguments(self):
# this manifest command takes one argument # this manifest command takes one argument
self._test_template('prune') self._check_template('prune')
@unittest.skipIf(os.name != 'nt', 'test relevant for Windows only') @unittest.skipIf(os.name != 'nt', 'test relevant for Windows only')
def test_invalid_template_wrong_path(self): def test_invalid_template_wrong_path(self):
# on Windows, trailing slashes are not allowed # on Windows, trailing slashes are not allowed
# this used to crash instead of raising a warning: #8286 # this used to crash instead of raising a warning: #8286
self._test_template('include examples/') self._check_template('include examples/')
@unittest.skipUnless(zlib, "requires zlib") @unittest.skipUnless(zlib, "requires zlib")
def test_get_file_list(self): def test_get_file_list(self):
......
"""HTTP/1.1 client library r"""HTTP/1.1 client library
<intro stuff goes here> <intro stuff goes here>
<other stuff, too> <other stuff, too>
......
...@@ -7,7 +7,7 @@ This file is automatically generated; please don't muck it up! ...@@ -7,7 +7,7 @@ This file is automatically generated; please don't muck it up!
To update the symbols in this file, 'cd' to the top directory of To update the symbols in this file, 'cd' to the top directory of
the python source tree after building the interpreter and run: the python source tree after building the interpreter and run:
python Lib/keyword.py ./python Lib/keyword.py
""" """
__all__ = ["iskeyword", "kwlist"] __all__ = ["iskeyword", "kwlist"]
......
...@@ -1581,8 +1581,7 @@ locale_alias = { ...@@ -1581,8 +1581,7 @@ locale_alias = {
# to include every locale up to Windows Vista. # to include every locale up to Windows Vista.
# #
# NOTE: this mapping is incomplete. If your language is missing, please # NOTE: this mapping is incomplete. If your language is missing, please
# submit a bug report to Python bug manager, which you can find via: # submit a bug report to the Python bug tracker at http://bugs.python.org/
# http://www.python.org/dev/
# Make sure you include the missing language identifier and the suggested # Make sure you include the missing language identifier and the suggested
# locale code. # locale code.
# #
......
...@@ -303,7 +303,7 @@ class Integral(Rational): ...@@ -303,7 +303,7 @@ class Integral(Rational):
raise NotImplementedError raise NotImplementedError
def __index__(self): def __index__(self):
"""index(self)""" """Called whenever an index is needed, such as in slicing"""
return long(self) return long(self)
@abstractmethod @abstractmethod
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# To update the symbols in this file, 'cd' to the top directory of # To update the symbols in this file, 'cd' to the top directory of
# the python source tree after building the interpreter and run: # the python source tree after building the interpreter and run:
# #
# python Lib/symbol.py # ./python Lib/symbol.py
#--start constants-- #--start constants--
single_input = 256 single_input = 256
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# To update the symbols in this file, 'cd' to the top directory of # To update the symbols in this file, 'cd' to the top directory of
# the python source tree after building the interpreter and run: # the python source tree after building the interpreter and run:
# #
# python Lib/token.py # ./python Lib/token.py
#--start constants-- #--start constants--
ENDMARKER = 0 ENDMARKER = 0
......
...@@ -709,6 +709,7 @@ Vlad Riscutia ...@@ -709,6 +709,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
......
...@@ -98,6 +98,8 @@ Core and Builtins ...@@ -98,6 +98,8 @@ Core and Builtins
Library Library
------- -------
- Issue #2945: Make the distutils upload command aware of bdist_rpm products.
- Issue #13447: Add a test file to host regression tests for bugs in the - Issue #13447: Add a test file to host regression tests for bugs in the
scripts found in the Tools directory. scripts found in the Tools directory.
......
...@@ -459,7 +459,7 @@ Main website: http://www.python.org/ ...@@ -459,7 +459,7 @@ Main website: http://www.python.org/
.br .br
Documentation: http://docs.python.org/ Documentation: http://docs.python.org/
.br .br
Developer resources: http://www.python.org/dev/ Developer resources: http://docs.python.org/devguide/
.br .br
Downloads: http://python.org/download/ Downloads: http://python.org/download/
.br .br
......
...@@ -58,7 +58,7 @@ PyDoc_STRVAR(module_doc, ...@@ -58,7 +58,7 @@ PyDoc_STRVAR(module_doc,
"\n" "\n"
"At the top of the I/O hierarchy is the abstract base class IOBase. It\n" "At the top of the I/O hierarchy is the abstract base class IOBase. It\n"
"defines the basic interface to a stream. Note, however, that there is no\n" "defines the basic interface to a stream. Note, however, that there is no\n"
"seperation between reading and writing to streams; implementations are\n" "separation between reading and writing to streams; implementations are\n"
"allowed to throw an IOError if they do not support a given operation.\n" "allowed to throw an IOError if they do not support a given operation.\n"
"\n" "\n"
"Extending IOBase is RawIOBase which deals simply with the reading and\n" "Extending IOBase is RawIOBase which deals simply with the reading and\n"
......
...@@ -627,7 +627,7 @@ PyDoc_STRVAR(textiowrapper_doc, ...@@ -627,7 +627,7 @@ PyDoc_STRVAR(textiowrapper_doc,
"enabled. With this enabled, on input, the lines endings '\\n', '\\r',\n" "enabled. With this enabled, on input, the lines endings '\\n', '\\r',\n"
"or '\\r\\n' are translated to '\\n' before being returned to the\n" "or '\\r\\n' are translated to '\\n' before being returned to the\n"
"caller. Conversely, on output, '\\n' is translated to the system\n" "caller. Conversely, on output, '\\n' is translated to the system\n"
"default line seperator, os.linesep. If newline is any other of its\n" "default line separator, os.linesep. If newline is any other of its\n"
"legal values, that newline becomes the newline when the file is read\n" "legal values, that newline becomes the newline when the file is read\n"
"and it is returned untranslated. On output, '\\n' is converted to the\n" "and it is returned untranslated. On output, '\\n' is converted to the\n"
"newline.\n" "newline.\n"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment