[Python-checkins] cpython (merge default -> default): Merge.

stefan.krah python-checkins at python.org
Mon Mar 5 17:51:47 CET 2012


http://hg.python.org/cpython/rev/d85f419eda77
changeset: 75441:d85f419eda77
parent: 75440:9f7d06a9eabe
parent: 75439:f282d9041ac7
user: Stefan Krah <skrah at bytereef.org>
date: Mon Mar 05 17:48:21 2012 +0100
summary:
 Merge.
files:
 Doc/howto/advocacy.rst | 3 +-
 Doc/howto/cporting.rst | 4 +-
 Doc/howto/regex.rst | 4 +-
 Doc/library/markup.rst | 4 +-
 Doc/library/packaging.database.rst | 45 +++++++--
 Lib/distutils/command/bdist_msi.py | 2 +-
 Lib/distutils/tests/test_bdist_msi.py | 19 +++-
 Lib/packaging/command/bdist_msi.py | 2 +-
 Lib/packaging/database.py | 1 +
 Lib/packaging/tests/test_command_bdist_msi.py | 13 ++-
 Lib/xmlrpc/server.py | 2 +-
 Misc/NEWS | 3 +
 Objects/frameobject.c | 1 -
 13 files changed, 72 insertions(+), 31 deletions(-)
diff --git a/Doc/howto/advocacy.rst b/Doc/howto/advocacy.rst
--- a/Doc/howto/advocacy.rst
+++ b/Doc/howto/advocacy.rst
@@ -264,8 +264,7 @@
 
 **What are the restrictions on Python's use?**
 
-They're practically nonexistent. Consult the :file:`Misc/COPYRIGHT` file in the
-source distribution, or the section :ref:`history-and-license` for the full
+They're practically nonexistent. Consult :ref:`history-and-license` for the full
 language, but it boils down to three conditions:
 
 * You have to leave the copyright notice on the software; if you don't include
diff --git a/Doc/howto/cporting.rst b/Doc/howto/cporting.rst
--- a/Doc/howto/cporting.rst
+++ b/Doc/howto/cporting.rst
@@ -261,8 +261,8 @@
 copy as you see fit.)
 
 You can find :file:`capsulethunk.h` in the Python source distribution
-in the :file:`Doc/includes` directory. We also include it here for
-your reference; here is :file:`capsulethunk.h`:
+as :source:`Doc/includes/capsulethunk.h`. We also include it here for
+your convenience:
 
 .. literalinclude:: ../includes/capsulethunk.h
 
diff --git a/Doc/howto/regex.rst b/Doc/howto/regex.rst
--- a/Doc/howto/regex.rst
+++ b/Doc/howto/regex.rst
@@ -360,7 +360,7 @@
 
 You can learn about this by interactively experimenting with the :mod:`re`
 module. If you have :mod:`tkinter` available, you may also want to look at
-:file:`Tools/demo/redemo.py`, a demonstration program included with the
+:source:`Tools/demo/redemo.py`, a demonstration program included with the
 Python distribution. It allows you to enter REs and strings, and displays
 whether the RE matches or fails. :file:`redemo.py` can be quite useful when
 trying to debug a complicated RE. Phil Schwartz's `Kodos
@@ -495,7 +495,7 @@
 the same ones in several locations, then it might be worthwhile to collect all
 the definitions in one place, in a section of code that compiles all the REs
 ahead of time. To take an example from the standard library, here's an extract
-from the now deprecated :file:`xmllib.py`::
+from the now-defunct Python 2 standard :mod:`xmllib` module::
 
 ref = re.compile( ... )
 entityref = re.compile( ... )
diff --git a/Doc/library/markup.rst b/Doc/library/markup.rst
--- a/Doc/library/markup.rst
+++ b/Doc/library/markup.rst
@@ -23,7 +23,7 @@
 html.rst
 html.parser.rst
 html.entities.rst
- pyexpat.rst
+ xml.etree.elementtree.rst
 xml.dom.rst
 xml.dom.minidom.rst
 xml.dom.pulldom.rst
@@ -31,4 +31,4 @@
 xml.sax.handler.rst
 xml.sax.utils.rst
 xml.sax.reader.rst
- xml.etree.elementtree.rst
+ pyexpat.rst
diff --git a/Doc/library/packaging.database.rst b/Doc/library/packaging.database.rst
--- a/Doc/library/packaging.database.rst
+++ b/Doc/library/packaging.database.rst
@@ -15,6 +15,11 @@
 Most functions also provide an extra argument ``use_egg_info`` to take legacy
 distributions into account.
 
+For the purpose of this module, "installed" means that the distribution's
+:file:`.dist-info`, :file:`.egg-info` or :file:`egg` directory or file is found
+on :data:`sys.path`. For example, if the parent directory of a
+:file:`dist-info` directory is added to :envvar:`PYTHONPATH`, then it will be
+available in the database.
 
 Classes representing installed distributions
 --------------------------------------------
@@ -128,7 +133,7 @@
 for the first installed distribution matching *name*. Egg distributions are
 considered only if *use_egg_info* is true; if both a dist-info and an egg
 file are found, the dist-info prevails. The directories to be searched are
- given in *paths*, which defaults to :data:`sys.path`. Return ``None`` if no
+ given in *paths*, which defaults to :data:`sys.path`. Returns ``None`` if no
 matching distribution is found.
 
 .. FIXME param should be named use_egg
@@ -200,20 +205,23 @@
 Examples
 --------
 
-Print all information about a distribution
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Printing all information about a distribution
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-Given a path to a ``.dist-info`` distribution, we shall print out all
+Given the name of an installed distribution, we shall print out all
 information that can be obtained using functions provided in this module::
 
 import sys
 import packaging.database
 
- path = input()
+ try:
+ name = sys.argv[1]
+ except ValueError:
+ sys.exit('Not enough arguments')
+
 # first create the Distribution instance
- try:
- dist = packaging.database.Distribution(path)
- except FileNotFoundError:
+ dist = packaging.database.Distribution(path)
+ if dist is None:
 sys.exit('No such distribution')
 
 print('Information about %r' % dist.name)
@@ -244,7 +252,7 @@
 
 .. code-block:: sh
 
- $ echo /tmp/choxie/choxie-2.0.0.9.dist-info | python3 print_info.py
+ python print_info.py choxie
 
 we get the following output:
 
@@ -299,10 +307,23 @@
 * It was installed as a dependency
 
 
-Find out obsoleted distributions
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Getting metadata about a distribution
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-Now, we take tackle a different problem, we are interested in finding out
+Sometimes you're not interested about the packaging information contained in a
+full :class:`Distribution` object but just want to do something with its
+:attr:`~Distribution.metadata`::
+
+ >>> from packaging.database import get_distribution
+ >>> info = get_distribution('chocolate').metadata
+ >>> info['Keywords']
+ ['cooking', 'happiness']
+
+
+Finding out obsoleted distributions
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Now, we tackle a different problem, we are interested in finding out
 which distributions have been obsoleted. This can be easily done as follows::
 
 import packaging.database
diff --git a/Lib/distutils/command/bdist_msi.py b/Lib/distutils/command/bdist_msi.py
--- a/Lib/distutils/command/bdist_msi.py
+++ b/Lib/distutils/command/bdist_msi.py
@@ -260,7 +260,7 @@
 self.db.Commit()
 
 if hasattr(self.distribution, 'dist_files'):
- tup = 'bdist_msi', self.target_version or 'any', fullname
+ tup = 'bdist_msi', self.target_version or 'any', installer_name
 self.distribution.dist_files.append(tup)
 
 if not self.keep_temp:
diff --git a/Lib/distutils/tests/test_bdist_msi.py b/Lib/distutils/tests/test_bdist_msi.py
--- a/Lib/distutils/tests/test_bdist_msi.py
+++ b/Lib/distutils/tests/test_bdist_msi.py
@@ -1,12 +1,12 @@
 """Tests for distutils.command.bdist_msi."""
+import os
+import sys
 import unittest
-import sys
-
 from test.support import run_unittest
-
 from distutils.tests import support
 
- at unittest.skipUnless(sys.platform=="win32", "These tests are only for win32")
+
+ at unittest.skipUnless(sys.platform == 'win32', 'these tests require Windows')
 class BDistMSITestCase(support.TempdirManager,
 support.LoggingSilencer,
 unittest.TestCase):
@@ -14,9 +14,18 @@
 def test_minimal(self):
 # minimal test XXX need more tests
 from distutils.command.bdist_msi import bdist_msi
- pkg_pth, dist = self.create_dist()
+ project_dir, dist = self.create_dist()
 cmd = bdist_msi(dist)
 cmd.ensure_finalized()
+ cmd.run()
+
+ bdists = os.listdir(os.path.join(project_dir, 'dist'))
+ self.assertEqual(bdists, ['foo-0.1.msi'])
+
+ # bug #13719: upload ignores bdist_msi files
+ self.assertEqual(dist.dist_files,
+ [('bdist_msi', 'any', 'dist/foo-0.1.msi')])
+
 
 def test_suite():
 return unittest.makeSuite(BDistMSITestCase)
diff --git a/Lib/packaging/command/bdist_msi.py b/Lib/packaging/command/bdist_msi.py
--- a/Lib/packaging/command/bdist_msi.py
+++ b/Lib/packaging/command/bdist_msi.py
@@ -261,7 +261,7 @@
 self.db.Commit()
 
 if hasattr(self.distribution, 'dist_files'):
- tup = 'bdist_msi', self.target_version or 'any', fullname
+ tup = 'bdist_msi', self.target_version or 'any', installer_name
 self.distribution.dist_files.append(tup)
 
 if not self.keep_temp:
diff --git a/Lib/packaging/database.py b/Lib/packaging/database.py
--- a/Lib/packaging/database.py
+++ b/Lib/packaging/database.py
@@ -19,6 +19,7 @@
 'get_distributions', 'get_distribution', 'get_file_users',
 'provides_distribution', 'obsoletes_distribution',
 'enable_cache', 'disable_cache', 'clear_cache',
+ # XXX these functions' names look like get_file_users but are not related
 'get_file_path', 'get_file']
 
 
diff --git a/Lib/packaging/tests/test_command_bdist_msi.py b/Lib/packaging/tests/test_command_bdist_msi.py
--- a/Lib/packaging/tests/test_command_bdist_msi.py
+++ b/Lib/packaging/tests/test_command_bdist_msi.py
@@ -1,20 +1,29 @@
 """Tests for distutils.command.bdist_msi."""
+import os
 import sys
 
 from packaging.tests import unittest, support
 
 
+ at unittest.skipUnless(sys.platform == 'win32', 'these tests require Windows')
 class BDistMSITestCase(support.TempdirManager,
 support.LoggingCatcher,
 unittest.TestCase):
 
- @unittest.skipUnless(sys.platform == "win32", "runs only on win32")
 def test_minimal(self):
 # minimal test XXX need more tests
 from packaging.command.bdist_msi import bdist_msi
- pkg_pth, dist = self.create_dist()
+ project_dir, dist = self.create_dist()
 cmd = bdist_msi(dist)
 cmd.ensure_finalized()
+ cmd.run()
+
+ bdists = os.listdir(os.path.join(project_dir, 'dist'))
+ self.assertEqual(bdists, ['foo-0.1.msi'])
+
+ # bug #13719: upload ignores bdist_msi files
+ self.assertEqual(dist.dist_files,
+ [('bdist_msi', 'any', 'dist/foo-0.1.msi')])
 
 
 def test_suite():
diff --git a/Lib/xmlrpc/server.py b/Lib/xmlrpc/server.py
--- a/Lib/xmlrpc/server.py
+++ b/Lib/xmlrpc/server.py
@@ -1,4 +1,4 @@
-"""XML-RPC Servers.
+r"""XML-RPC Servers.
 
 This module can be used to create simple XML-RPC servers
 by creating a server and either installing functions, a
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -13,6 +13,9 @@
 Library
 -------
 
+- Issue #13719: Make the distutils and packaging upload commands aware of
+ bdist_msi products.
+
 - Issue #14007: Accept incomplete TreeBuilder objects (missing start, end,
 data or close method) for the Python implementation as well.
 Drop the no-op TreeBuilder().xml() method from the C implementation.
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -20,7 +20,6 @@
 {"f_builtins", T_OBJECT, OFF(f_builtins), READONLY},
 {"f_globals", T_OBJECT, OFF(f_globals), READONLY},
 {"f_lasti", T_INT, OFF(f_lasti), READONLY},
- {"f_yieldfrom", T_OBJECT, OFF(f_yieldfrom), READONLY},
 {NULL} /* Sentinel */
 };
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /