[Python-checkins] cpython (merge default -> default): Branch merge
eric.araujo
python-checkins at python.org
Sun May 29 18:14:36 CEST 2011
http://hg.python.org/cpython/rev/cd38e4ed1649
changeset: 70497:cd38e4ed1649
parent: 70476:c65e1a422bc3
parent: 70490:24cb2fab8c89
user: Éric Araujo <merwok at netwok.org>
date: Sun May 29 18:08:34 2011 +0200
summary:
Branch merge
files:
Doc/distutils/apiref.rst | 584 +++++----
Doc/distutils/extending.rst | 4 +-
Doc/glossary.rst | 2 +-
Doc/library/crypt.rst | 32 +-
Doc/library/functions.rst | 2 +-
Lib/distutils/tests/test_build_py.py | 15 +-
Lib/packaging/tests/test_command_build_ext.py | 2 +-
Lib/packaging/tests/test_command_build_py.py | 9 +-
8 files changed, 327 insertions(+), 323 deletions(-)
diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst
--- a/Doc/distutils/apiref.rst
+++ b/Doc/distutils/apiref.rst
@@ -21,7 +21,7 @@
.. function:: setup(arguments)
The basic do-everything function that does most everything you could ever ask
- for from a Distutils method. See XXXXX
+ for from a Distutils method.
The setup function takes a large number of arguments. These are laid out in the
following table.
@@ -147,11 +147,11 @@
In addition, the :mod:`distutils.core` module exposed a number of classes that
live elsewhere.
-* :class:`Extension` from :mod:`distutils.extension`
-
-* :class:`Command` from :mod:`distutils.cmd`
-
-* :class:`Distribution` from :mod:`distutils.dist`
+* :class:`~distutils.extension.Extension` from :mod:`distutils.extension`
+
+* :class:`~distutils.cmd.Command` from :mod:`distutils.cmd`
+
+* :class:`~distutils.dist.Distribution` from :mod:`distutils.dist`
A short description of each of these follows, but see the relevant module for
the full reference.
@@ -1678,8 +1678,8 @@
===================================================================
.. module:: distutils.cmd
- :synopsis: This module provides the abstract base class Command. This class is subclassed
- by the modules in the distutils.command subpackage.
+ :synopsis: This module provides the abstract base class Command. This class
+ is subclassed by the modules in the distutils.command subpackage.
This module supplies the abstract base class :class:`Command`.
@@ -1689,291 +1689,38 @@
Abstract base class for defining command classes, the "worker bees" of the
Distutils. A useful analogy for command classes is to think of them as
- subroutines with local variables called *options*. The options are declared in
- :meth:`initialize_options` and defined (given their final values) in
- :meth:`finalize_options`, both of which must be defined by every command class.
- The distinction between the two is necessary because option values might come
- from the outside world (command line, config file, ...), and any options
- dependent on other options must be computed after these outside influences have
- been processed --- hence :meth:`finalize_options`. The body of the subroutine,
- where it does all its work based on the values of its options, is the
- :meth:`run` method, which must also be implemented by every command class.
-
- The class constructor takes a single argument *dist*, a :class:`Distribution`
+ subroutines with local variables called *options*. The options are declared
+ in :meth:`initialize_options` and defined (given their final values) in
+ :meth:`finalize_options`, both of which must be defined by every command
+ class. The distinction between the two is necessary because option values
+ might come from the outside world (command line, config file, ...), and any
+ options dependent on other options must be computed after these outside
+ influences have been processed --- hence :meth:`finalize_options`. The body
+ of the subroutine, where it does all its work based on the values of its
+ options, is the :meth:`run` method, which must also be implemented by every
+ command class.
+
+ The class constructor takes a single argument *dist*, a :class:`Distribution`
instance.
-:mod:`distutils.command` --- Individual Distutils commands
-==========================================================
-
-.. module:: distutils.command
- :synopsis: This subpackage contains one module for each standard Distutils command.
-
-
-.. % \subsubsection{Individual Distutils commands}
-.. % todo
-
-
-:mod:`distutils.command.bdist` --- Build a binary installer
-===========================================================
-
-.. module:: distutils.command.bdist
- :synopsis: Build a binary installer for a package
-
-
-.. % todo
-
-
-:mod:`distutils.command.bdist_packager` --- Abstract base class for packagers
-=============================================================================
-
-.. module:: distutils.command.bdist_packager
- :synopsis: Abstract base class for packagers
-
-
-.. % todo
-
-
-:mod:`distutils.command.bdist_dumb` --- Build a "dumb" installer
-================================================================
-
-.. module:: distutils.command.bdist_dumb
- :synopsis: Build a "dumb" installer - a simple archive of files
-
-
-.. % todo
-
-
-:mod:`distutils.command.bdist_msi` --- Build a Microsoft Installer binary package
-=================================================================================
-
-.. module:: distutils.command.bdist_msi
- :synopsis: Build a binary distribution as a Windows MSI file
-
-.. class:: bdist_msi(Command)
-
- Builds a `Windows Installer`_ (.msi) binary package.
-
- .. _Windows Installer: http://msdn.microsoft.com/en-us/library/cc185688(VS.85).aspx
-
- In most cases, the ``bdist_msi`` installer is a better choice than the
- ``bdist_wininst`` installer, because it provides better support for
- Win64 platforms, allows administrators to perform non-interactive
- installations, and allows installation through group policies.
-
-
-:mod:`distutils.command.bdist_rpm` --- Build a binary distribution as a Redhat RPM and SRPM
-===========================================================================================
-
-.. module:: distutils.command.bdist_rpm
- :synopsis: Build a binary distribution as a Redhat RPM and SRPM
-
-
-.. % todo
-
-
-:mod:`distutils.command.bdist_wininst` --- Build a Windows installer
-====================================================================
-
-.. module:: distutils.command.bdist_wininst
- :synopsis: Build a Windows installer
-
-
-.. % todo
-
-
-:mod:`distutils.command.sdist` --- Build a source distribution
-==============================================================
-
-.. module:: distutils.command.sdist
- :synopsis: Build a source distribution
-
-
-.. % todo
-
-
-:mod:`distutils.command.build` --- Build all files of a package
-===============================================================
-
-.. module:: distutils.command.build
- :synopsis: Build all files of a package
-
-
-.. % todo
-
-
-:mod:`distutils.command.build_clib` --- Build any C libraries in a package
-==========================================================================
-
-.. module:: distutils.command.build_clib
- :synopsis: Build any C libraries in a package
-
-
-.. % todo
-
-
-:mod:`distutils.command.build_ext` --- Build any extensions in a package
-========================================================================
-
-.. module:: distutils.command.build_ext
- :synopsis: Build any extensions in a package
-
-
-.. % todo
-
-
-:mod:`distutils.command.build_py` --- Build the .py/.pyc files of a package
-===========================================================================
-
-.. module:: distutils.command.build_py
- :synopsis: Build the .py/.pyc files of a package
-
-
-.. class:: build_py(Command)
-
-.. class:: build_py_2to3(build_py)
-
- Alternative implementation of build_py which also runs the
- 2to3 conversion library on each .py file that is going to be
- installed. To use this in a setup.py file for a distribution
- that is designed to run with both Python 2.x and 3.x, add::
-
- try:
- from distutils.command.build_py import build_py_2to3 as build_py
- except ImportError:
- from distutils.command.build_py import build_py
-
- to your setup.py, and later::
-
- cmdclass = {'build_py': build_py}
-
- to the invocation of setup().
-
-
-:mod:`distutils.command.build_scripts` --- Build the scripts of a package
-=========================================================================
-
-.. module:: distutils.command.build_scripts
- :synopsis: Build the scripts of a package
-
-
-.. % todo
-
-
-:mod:`distutils.command.clean` --- Clean a package build area
-=============================================================
-
-.. module:: distutils.command.clean
- :synopsis: Clean a package build area
-
-
-.. % todo
-
-
-:mod:`distutils.command.config` --- Perform package configuration
-=================================================================
-
-.. module:: distutils.command.config
- :synopsis: Perform package configuration
-
-
-.. % todo
-
-
-:mod:`distutils.command.install` --- Install a package
-======================================================
-
-.. module:: distutils.command.install
- :synopsis: Install a package
-
-
-.. % todo
-
-
-:mod:`distutils.command.install_data` --- Install data files from a package
-===========================================================================
-
-.. module:: distutils.command.install_data
- :synopsis: Install data files from a package
-
-
-.. % todo
-
-
-:mod:`distutils.command.install_headers` --- Install C/C++ header files from a package
-======================================================================================
-
-.. module:: distutils.command.install_headers
- :synopsis: Install C/C++ header files from a package
-
-
-.. % todo
-
-
-:mod:`distutils.command.install_lib` --- Install library files from a package
-=============================================================================
-
-.. module:: distutils.command.install_lib
- :synopsis: Install library files from a package
-
-
-.. % todo
-
-
-:mod:`distutils.command.install_scripts` --- Install script files from a package
-================================================================================
-
-.. module:: distutils.command.install_scripts
- :synopsis: Install script files from a package
-
-
-.. % todo
-
-
-:mod:`distutils.command.register` --- Register a module with the Python Package Index
-=====================================================================================
-
-.. module:: distutils.command.register
- :synopsis: Register a module with the Python Package Index
-
-
-The ``register`` command registers the package with the Python Package Index.
-This is described in more detail in :pep:`301`.
-
-.. % todo
-
-:mod:`distutils.command.check` --- Check the meta-data of a package
-===================================================================
-
-.. module:: distutils.command.check
- :synopsis: Check the metadata of a package
-
-
-The ``check`` command performs some tests on the meta-data of a package.
-For example, it verifies that all required meta-data are provided as
-the arguments passed to the :func:`setup` function.
-
-.. % todo
-
-
Creating a new Distutils command
================================
This section outlines the steps to create a new Distutils command.
A new command lives in a module in the :mod:`distutils.command` package. There
-is a sample template in that directory called :file:`command_template`. Copy
+is a sample template in that directory called :file:`command_template`. Copy
this file to a new module with the same name as the new command you're
-implementing. This module should implement a class with the same name as the
-module (and the command). So, for instance, to create the command
+implementing. This module should implement a class with the same name as the
+module (and the command). So, for instance, to create the command
``peel_banana`` (so that users can run ``setup.py peel_banana``), you'd copy
-:file:`command_template` to :file:`distutils/command/peel_banana.py`, then edit
+:file:`command_template` to :file:`distutils/command/peel_banana.py`, then edit
it so that it's implementing the class :class:`peel_banana`, a subclass of
:class:`distutils.cmd.Command`.
Subclasses of :class:`Command` must define the following methods.
-
.. method:: Command.initialize_options()
Set default values for all the options that this command supports. Note that
@@ -2001,16 +1748,273 @@
:meth:`finalize_options`. All terminal output and filesystem interaction should
be done by :meth:`run`.
-*sub_commands* formalizes the notion of a "family" of commands, eg. ``install``
-as the parent with sub-commands ``install_lib``, ``install_headers``, etc. The
-parent of a family of commands defines *sub_commands* as a class attribute; it's
-a list of 2-tuples ``(command_name, predicate)``, with *command_name* a string
-and *predicate* a function, a string or None. *predicate* is a method of
-the parent command that determines whether the corresponding command is
-applicable in the current situation. (Eg. we ``install_headers`` is only
-applicable if we have any C header files to install.) If *predicate* is None,
-that command is always applicable.
-
-*sub_commands* is usually defined at the \*end\* of a class, because predicates
-can be methods of the class, so they must already have been defined. The
-canonical example is the :command:`install` command.
+
+.. attribute:: Command.sub_commands
+
+ *sub_commands* formalizes the notion of a "family" of commands,
+ e.g. ``install`` as the parent with sub-commands ``install_lib``,
+ ``install_headers``, etc. The parent of a family of commands defines
+ *sub_commands* as a class attribute; it's a list of 2-tuples ``(command_name,
+ predicate)``, with *command_name* a string and *predicate* a function, a
+ string or ``None``. *predicate* is a method of the parent command that
+ determines whether the corresponding command is applicable in the current
+ situation. (E.g. ``install_headers`` is only applicable if we have any C
+ header files to install.) If *predicate* is ``None``, that command is always
+ applicable.
+
+ *sub_commands* is usually defined at the *end* of a class, because
+ predicates can be methods of the class, so they must already have been
+ defined. The canonical example is the :command:`install` command.
+
+
+:mod:`distutils.command` --- Individual Distutils commands
+==========================================================
+
+.. module:: distutils.command
+ :synopsis: This subpackage contains one module for each standard Distutils command.
+
+
+.. % \subsubsection{Individual Distutils commands}
+.. % todo
+
+
+:mod:`distutils.command.bdist` --- Build a binary installer
+===========================================================
+
+.. module:: distutils.command.bdist
+ :synopsis: Build a binary installer for a package
+
+
+.. % todo
+
+
+:mod:`distutils.command.bdist_packager` --- Abstract base class for packagers
+=============================================================================
+
+.. module:: distutils.command.bdist_packager
+ :synopsis: Abstract base class for packagers
+
+
+.. % todo
+
+
+:mod:`distutils.command.bdist_dumb` --- Build a "dumb" installer
+================================================================
+
+.. module:: distutils.command.bdist_dumb
+ :synopsis: Build a "dumb" installer - a simple archive of files
+
+
+.. % todo
+
+
+:mod:`distutils.command.bdist_msi` --- Build a Microsoft Installer binary package
+=================================================================================
+
+.. module:: distutils.command.bdist_msi
+ :synopsis: Build a binary distribution as a Windows MSI file
+
+.. class:: bdist_msi(Command)
+
+ Builds a `Windows Installer`_ (.msi) binary package.
+
+ .. _Windows Installer: http://msdn.microsoft.com/en-us/library/cc185688(VS.85).aspx
+
+ In most cases, the ``bdist_msi`` installer is a better choice than the
+ ``bdist_wininst`` installer, because it provides better support for
+ Win64 platforms, allows administrators to perform non-interactive
+ installations, and allows installation through group policies.
+
+
+:mod:`distutils.command.bdist_rpm` --- Build a binary distribution as a Redhat RPM and SRPM
+===========================================================================================
+
+.. module:: distutils.command.bdist_rpm
+ :synopsis: Build a binary distribution as a Redhat RPM and SRPM
+
+
+.. % todo
+
+
+:mod:`distutils.command.bdist_wininst` --- Build a Windows installer
+====================================================================
+
+.. module:: distutils.command.bdist_wininst
+ :synopsis: Build a Windows installer
+
+
+.. % todo
+
+
+:mod:`distutils.command.sdist` --- Build a source distribution
+==============================================================
+
+.. module:: distutils.command.sdist
+ :synopsis: Build a source distribution
+
+
+.. % todo
+
+
+:mod:`distutils.command.build` --- Build all files of a package
+===============================================================
+
+.. module:: distutils.command.build
+ :synopsis: Build all files of a package
+
+
+.. % todo
+
+
+:mod:`distutils.command.build_clib` --- Build any C libraries in a package
+==========================================================================
+
+.. module:: distutils.command.build_clib
+ :synopsis: Build any C libraries in a package
+
+
+.. % todo
+
+
+:mod:`distutils.command.build_ext` --- Build any extensions in a package
+========================================================================
+
+.. module:: distutils.command.build_ext
+ :synopsis: Build any extensions in a package
+
+
+.. % todo
+
+
+:mod:`distutils.command.build_py` --- Build the .py/.pyc files of a package
+===========================================================================
+
+.. module:: distutils.command.build_py
+ :synopsis: Build the .py/.pyc files of a package
+
+
+.. class:: build_py(Command)
+
+.. class:: build_py_2to3(build_py)
+
+ Alternative implementation of build_py which also runs the
+ 2to3 conversion library on each .py file that is going to be
+ installed. To use this in a setup.py file for a distribution
+ that is designed to run with both Python 2.x and 3.x, add::
+
+ try:
+ from distutils.command.build_py import build_py_2to3 as build_py
+ except ImportError:
+ from distutils.command.build_py import build_py
+
+ to your setup.py, and later::
+
+ cmdclass = {'build_py': build_py}
+
+ to the invocation of setup().
+
+
+:mod:`distutils.command.build_scripts` --- Build the scripts of a package
+=========================================================================
+
+.. module:: distutils.command.build_scripts
+ :synopsis: Build the scripts of a package
+
+
+.. % todo
+
+
+:mod:`distutils.command.clean` --- Clean a package build area
+=============================================================
+
+.. module:: distutils.command.clean
+ :synopsis: Clean a package build area
+
+
+.. % todo
+
+
+:mod:`distutils.command.config` --- Perform package configuration
+=================================================================
+
+.. module:: distutils.command.config
+ :synopsis: Perform package configuration
+
+
+.. % todo
+
+
+:mod:`distutils.command.install` --- Install a package
+======================================================
+
+.. module:: distutils.command.install
+ :synopsis: Install a package
+
+
+.. % todo
+
+
+:mod:`distutils.command.install_data` --- Install data files from a package
+===========================================================================
+
+.. module:: distutils.command.install_data
+ :synopsis: Install data files from a package
+
+
+.. % todo
+
+
+:mod:`distutils.command.install_headers` --- Install C/C++ header files from a package
+======================================================================================
+
+.. module:: distutils.command.install_headers
+ :synopsis: Install C/C++ header files from a package
+
+
+.. % todo
+
+
+:mod:`distutils.command.install_lib` --- Install library files from a package
+=============================================================================
+
+.. module:: distutils.command.install_lib
+ :synopsis: Install library files from a package
+
+
+.. % todo
+
+
+:mod:`distutils.command.install_scripts` --- Install script files from a package
+================================================================================
+
+.. module:: distutils.command.install_scripts
+ :synopsis: Install script files from a package
+
+
+.. % todo
+
+
+:mod:`distutils.command.register` --- Register a module with the Python Package Index
+=====================================================================================
+
+.. module:: distutils.command.register
+ :synopsis: Register a module with the Python Package Index
+
+
+The ``register`` command registers the package with the Python Package Index.
+This is described in more detail in :pep:`301`.
+
+.. % todo
+
+:mod:`distutils.command.check` --- Check the meta-data of a package
+===================================================================
+
+.. module:: distutils.command.check
+ :synopsis: Check the metadata of a package
+
+
+The ``check`` command performs some tests on the meta-data of a package.
+For example, it verifies that all required meta-data are provided as
+the arguments passed to the :func:`setup` function.
+
+.. % todo
diff --git a/Doc/distutils/extending.rst b/Doc/distutils/extending.rst
--- a/Doc/distutils/extending.rst
+++ b/Doc/distutils/extending.rst
@@ -15,8 +15,8 @@
should be copied into packages in addition to :file:`.py` files as a
convenience.
-Most distutils command implementations are subclasses of the :class:`Command`
-class from :mod:`distutils.cmd`. New commands may directly inherit from
+Most distutils command implementations are subclasses of the
+:class:`distutils.cmd.Command` class. New commands may directly inherit from
:class:`Command`, while replacements often derive from :class:`Command`
indirectly, directly subclassing the command they are replacing. Commands are
required to derive from :class:`Command`.
diff --git a/Doc/glossary.rst b/Doc/glossary.rst
--- a/Doc/glossary.rst
+++ b/Doc/glossary.rst
@@ -247,7 +247,7 @@
processing, remembering the location execution state (including local
variables and pending try-statements). When the generator resumes, it
picks-up where it left-off (in contrast to functions which start fresh on
- every invocation.
+ every invocation).
.. index:: single: generator expression
diff --git a/Doc/library/crypt.rst b/Doc/library/crypt.rst
--- a/Doc/library/crypt.rst
+++ b/Doc/library/crypt.rst
@@ -29,6 +29,8 @@
Hashing Methods
---------------
+.. versionadded:: 3.3
+
The :mod:`crypt` module defines the list of hashing methods (not all methods
are available on all platforms):
@@ -37,33 +39,26 @@
A Modular Crypt Format method with 16 character salt and 86 character
hash. This is the strongest method.
- .. versionadded:: 3.3
-
.. data:: METHOD_SHA256
Another Modular Crypt Format method with 16 character salt and 43
character hash.
- .. versionadded:: 3.3
-
.. data:: METHOD_MD5
Another Modular Crypt Format method with 8 character salt and 22
character hash.
- .. versionadded:: 3.3
-
.. data:: METHOD_CRYPT
The traditional method with a 2 character salt and 13 characters of
hash. This is the weakest method.
- .. versionadded:: 3.3
-
Module Attributes
-----------------
+.. versionadded:: 3.3
.. attribute:: methods
@@ -71,8 +66,6 @@
``crypt.METHOD_*`` objects. This list is sorted from strongest to
weakest, and is guaranteed to have at least ``crypt.METHOD_CRYPT``.
- .. versionadded:: 3.3
-
Module Functions
----------------
@@ -108,9 +101,8 @@
different sizes in the *salt*, it is recommended to use the full crypted
password as salt when checking for a password.
-.. versionchanged:: 3.3
- Before version 3.3, *salt* must be specified as a string and cannot
- accept ``crypt.METHOD_*`` values (which don't exist anyway).
+ .. versionchanged:: 3.3
+ Accept ``crypt.METHOD_*`` values in addition to strings for *salt*.
.. function:: mksalt(method=None)
@@ -124,25 +116,27 @@
16 random characters from the set ``[./a-zA-Z0-9]``, suitable for
passing as the *salt* argument to :func:`crypt`.
-.. versionadded:: 3.3
+ .. versionadded:: 3.3
Examples
--------
A simple example illustrating typical use::
- import crypt, getpass, pwd
+ import pwd
+ import crypt
+ import getpass
def login():
- username = input('Python login:')
+ username = input('Python login: ')
cryptedpasswd = pwd.getpwnam(username)[1]
if cryptedpasswd:
if cryptedpasswd == 'x' or cryptedpasswd == '*':
- raise "Sorry, currently no support for shadow passwords"
+ raise ValueError('no support for shadow passwords')
cleartext = getpass.getpass()
return crypt.crypt(cleartext, cryptedpasswd) == cryptedpasswd
else:
- return 1
+ return True
To generate a hash of a password using the strongest available method and
check it against the original::
@@ -151,4 +145,4 @@
hashed = crypt.crypt(plaintext)
if hashed != crypt.crypt(plaintext, hashed):
- raise "Hashed version doesn't validate against original"
+ raise ValueError("hashed version doesn't validate against original")
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -580,7 +580,7 @@
Two objects with non-overlapping lifetimes may have the same :func:`id`
value.
- .. impl-detail:: This is the address of the object.
+ .. impl-detail:: This is the address of the object in memory.
.. function:: input([prompt])
diff --git a/Lib/distutils/tests/test_build_py.py b/Lib/distutils/tests/test_build_py.py
--- a/Lib/distutils/tests/test_build_py.py
+++ b/Lib/distutils/tests/test_build_py.py
@@ -57,12 +57,15 @@
self.assertEqual(len(cmd.get_outputs()), 3)
pkgdest = os.path.join(destination, "pkg")
files = os.listdir(pkgdest)
- self.assertTrue("__init__.py" in files)
- if not sys.dont_write_bytecode:
- self.assertTrue("__init__.pyc" in files)
- self.assertTrue("README.txt" in files)
+ self.assertIn("__init__.py", files)
+ self.assertIn("README.txt", files)
+ # XXX even with -O, distutils writes pyc, not pyo; bug?
+ if sys.dont_write_bytecode:
+ self.assertNotIn("__init__.pyc", files)
+ else:
+ self.assertIn("__init__.pyc", files)
- def test_empty_package_dir (self):
+ def test_empty_package_dir(self):
# See SF 1668596/1720897.
cwd = os.getcwd()
@@ -110,7 +113,7 @@
finally:
sys.dont_write_bytecode = old_dont_write_bytecode
- self.assertTrue('byte-compiling is disabled' in self.logs[0][1])
+ self.assertIn('byte-compiling is disabled', self.logs[0][1])
def test_suite():
return unittest.makeSuite(BuildPyTestCase)
diff --git a/Lib/packaging/tests/test_command_build_ext.py b/Lib/packaging/tests/test_command_build_ext.py
--- a/Lib/packaging/tests/test_command_build_ext.py
+++ b/Lib/packaging/tests/test_command_build_ext.py
@@ -265,7 +265,7 @@
def test_get_outputs(self):
tmp_dir = self.mkdtemp()
c_file = os.path.join(tmp_dir, 'foo.c')
- self.write_file(c_file, 'void PyInit_foo(void) {};\n')
+ self.write_file(c_file, 'void PyInit_foo(void) {}\n')
ext = Extension('foo', [c_file], optional=False)
dist = Distribution({'name': 'xx',
'ext_modules': [ext]})
diff --git a/Lib/packaging/tests/test_command_build_py.py b/Lib/packaging/tests/test_command_build_py.py
--- a/Lib/packaging/tests/test_command_build_py.py
+++ b/Lib/packaging/tests/test_command_build_py.py
@@ -61,9 +61,12 @@
pkgdest = os.path.join(destination, "pkg")
files = os.listdir(pkgdest)
self.assertIn("__init__.py", files)
- if not sys.dont_write_bytecode:
+ self.assertIn("README.txt", files)
+ # XXX even with -O, distutils writes pyc, not pyo; bug?
+ if sys.dont_write_bytecode:
+ self.assertNotIn("__init__.pyc", files)
+ else:
self.assertIn("__init__.pyc", files)
- self.assertIn("README.txt", files)
def test_empty_package_dir(self):
# See SF 1668596/1720897.
@@ -93,7 +96,7 @@
try:
dist.run_commands()
- except PackagingFileError as e:
+ except PackagingFileError:
self.fail("failed package_data test when package_dir is ''")
finally:
# Restore state.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list