From e0854f9dbff33c941fc7897c6f1c44cadec9d2e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Fri, 27 May 2011 04:36:52 +0200 Subject: Add missing closing paren --- Doc/glossary.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst index 7431545..6a4daa5 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -242,7 +242,7 @@ Glossary 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 -- cgit v0.12 From f33de715147371c39713a1421fc8bdb01676902f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Fri, 27 May 2011 04:42:47 +0200 Subject: Minor doc addition for clarity --- Doc/library/functions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 1547f6d..42f2bc9 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -527,7 +527,7 @@ are always available. They are listed here in alphabetical order. 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]) -- cgit v0.12 From 489c8ff26b673553f568266c732182346ee74acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Sat, 28 May 2011 23:32:50 +0200 Subject: Fix test_build_py when sys.dont_write_bytecode is true (#9831). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tests now pass all combinations of -O/-OO and -B. See also #7071 and #6292 for previous variations on the same theme. test_versionpredicate needs a skip when sys.flags.optimize is true, but I don’t know how to make that work with a DocTestSuite. --- Lib/distutils/tests/test_build_py.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Lib/distutils/tests/test_build_py.py b/Lib/distutils/tests/test_build_py.py index da3232c..4e46339 100644 --- a/Lib/distutils/tests/test_build_py.py +++ b/Lib/distutils/tests/test_build_py.py @@ -57,11 +57,15 @@ class BuildPyTestCase(support.TempdirManager, self.assertEqual(len(cmd.get_outputs()), 3) pkgdest = os.path.join(destination, "pkg") files = os.listdir(pkgdest) - self.assertTrue("__init__.py" in files) - self.assertTrue("__init__.pyc" in files) - self.assertTrue("README.txt" in files) - - def test_empty_package_dir (self): + 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): # See SF 1668596/1720897. cwd = os.getcwd() @@ -109,7 +113,7 @@ class BuildPyTestCase(support.TempdirManager, 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) -- cgit v0.12 From 000893fab2c03c8947c9c34422e44086d88c9120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Sun, 29 May 2011 00:14:45 +0200 Subject: Minor touch-ups in distutils.cmd.Command doc --- Doc/distutils/apiref.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst index 81de1ad..74446bc 100644 --- a/Doc/distutils/apiref.rst +++ b/Doc/distutils/apiref.rst @@ -21,7 +21,7 @@ setup script). Indirectly provides the :class:`distutils.dist.Distribution` and .. 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. @@ -1759,7 +1759,7 @@ Subclasses of :class:`Command` must define the following methods. 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. we ``install_headers`` is only applicable if we have any C + 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. -- cgit v0.12 From 456ae893d7a0b40a5346cbba7771127aca2113e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Sun, 29 May 2011 00:22:06 +0200 Subject: Re-add missing doc stub for the distutils check command --- Doc/distutils/apiref.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst index 74446bc..712fffb 100644 --- a/Doc/distutils/apiref.rst +++ b/Doc/distutils/apiref.rst @@ -2006,3 +2006,17 @@ 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 -- cgit v0.12 From 7f9b37be4510e701184896dd22994412455e6e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Sun, 29 May 2011 02:59:52 +0200 Subject: =?UTF-8?q?Port=20r86353=20to=20packaging=20(#10359:=20=E2=80=9C;?= =?UTF-8?q?=E2=80=9D=20after=20function=20definition=20is=20invalid=20in?= =?UTF-8?q?=20ISO=20C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lib/packaging/tests/test_command_build_ext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/packaging/tests/test_command_build_ext.py b/Lib/packaging/tests/test_command_build_ext.py index fba27c7..a7856d2 100644 --- a/Lib/packaging/tests/test_command_build_ext.py +++ b/Lib/packaging/tests/test_command_build_ext.py @@ -265,7 +265,7 @@ class BuildExtTestCase(support.TempdirManager, 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]}) -- cgit v0.12 From bc57789dafaadd3652b7f02a2b17684b6c74055e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Sun, 29 May 2011 03:24:45 +0200 Subject: Improve example for crypt module. No string exceptions.. --- Doc/library/crypt.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Doc/library/crypt.rst b/Doc/library/crypt.rst index ec5a4b0..27236c1 100644 --- a/Doc/library/crypt.rst +++ b/Doc/library/crypt.rst @@ -131,18 +131,20 @@ 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 +153,4 @@ check it against the original:: 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") -- cgit v0.12 From f21563160e66069bac9c82186e17cfba7058ec52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Sun, 29 May 2011 03:27:48 +0200 Subject: Put version* directives at the right scope --- Doc/library/crypt.rst | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/Doc/library/crypt.rst b/Doc/library/crypt.rst index 27236c1..1ba2ed3 100644 --- a/Doc/library/crypt.rst +++ b/Doc/library/crypt.rst @@ -29,6 +29,8 @@ this module. 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 @@ are available on all platforms): 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 @@ Module Attributes ``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 @@ The :mod:`crypt` module defines the following functions: 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,7 +116,7 @@ The :mod:`crypt` module defines the following functions: 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 -------- -- cgit v0.12