mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Merged revisions 68167,68276,68292-68293,68344 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r68167 | vinay.sajip | 2009-01-02 12:53:04 -0600 (Fri, 02 Jan 2009) | 1 line Minor documentation changes relating to NullHandler, the module used for handlers and references to ConfigParser. ........ r68276 | tarek.ziade | 2009-01-03 18:04:49 -0600 (Sat, 03 Jan 2009) | 1 line fixed #1702551: distutils sdist was not pruning VCS directories under win32 ........ r68292 | skip.montanaro | 2009-01-04 04:36:58 -0600 (Sun, 04 Jan 2009) | 3 lines If user configures --without-gcc give preference to $CC instead of blindly assuming the compiler will be "cc". ........ r68293 | tarek.ziade | 2009-01-04 04:37:52 -0600 (Sun, 04 Jan 2009) | 1 line using clearer syntax ........ r68344 | marc-andre.lemburg | 2009-01-05 13:43:35 -0600 (Mon, 05 Jan 2009) | 7 lines Fix #4846 (Py_UNICODE_ISSPACE causes linker error) by moving the declaration into the extern "C" section. Add a few more comments and apply some minor edits to make the file contents fit the original structure again. ........
This commit is contained in:
parent
3563153793
commit
960cf0fd9b
5 changed files with 171 additions and 29 deletions
|
@ -1608,11 +1608,15 @@ for use by library developers.
|
||||||
|
|
||||||
This method does nothing.
|
This method does nothing.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WatchedFileHandler
|
WatchedFileHandler
|
||||||
^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
.. module:: logging.handlers
|
.. module:: logging.handlers
|
||||||
|
|
||||||
|
.. module:: logging.handlers
|
||||||
|
|
||||||
The :class:`WatchedFileHandler` class, located in the :mod:`logging.handlers`
|
The :class:`WatchedFileHandler` class, located in the :mod:`logging.handlers`
|
||||||
module, is a :class:`FileHandler` which watches the file it is logging to. If
|
module, is a :class:`FileHandler` which watches the file it is logging to. If
|
||||||
the file changes, it is closed and reopened using the file name.
|
the file changes, it is closed and reopened using the file name.
|
||||||
|
@ -2286,7 +2290,7 @@ in :mod:`logging` itself) and defining handlers which are declared either in
|
||||||
.. function:: fileConfig(fname[, defaults])
|
.. function:: fileConfig(fname[, defaults])
|
||||||
|
|
||||||
Reads the logging configuration from a :mod:`configparser`\-format file named
|
Reads the logging configuration from a :mod:`configparser`\-format file named
|
||||||
*fname*. This function can be called several times from an application,
|
*fname*. This function can be called several times from an application,
|
||||||
allowing an end user the ability to select from various pre-canned
|
allowing an end user the ability to select from various pre-canned
|
||||||
configurations (if the developer provides a mechanism to present the choices
|
configurations (if the developer provides a mechanism to present the choices
|
||||||
and load the chosen configuration). Defaults to be passed to the ConfigParser
|
and load the chosen configuration). Defaults to be passed to the ConfigParser
|
||||||
|
@ -2320,20 +2324,18 @@ in :mod:`logging` itself) and defining handlers which are declared either in
|
||||||
Configuration file format
|
Configuration file format
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The configuration file format understood by :func:`fileConfig` is
|
The configuration file format understood by :func:`fileConfig` is based on
|
||||||
based on :mod:`configparser` functionality. The file must contain
|
:mod:`configparser` functionality. The file must contain sections called
|
||||||
sections called ``[loggers]``, ``[handlers]`` and ``[formatters]``
|
``[loggers]``, ``[handlers]`` and ``[formatters]`` which identify by name the
|
||||||
which identify by name the entities of each type which are defined in
|
entities of each type which are defined in the file. For each such entity, there
|
||||||
the file. For each such entity, there is a separate section which
|
is a separate section which identifies how that entity is configured. Thus, for
|
||||||
identifies how that entity is configured. Thus, for a logger named
|
a logger named ``log01`` in the ``[loggers]`` section, the relevant
|
||||||
``log01`` in the ``[loggers]`` section, the relevant configuration
|
configuration details are held in a section ``[logger_log01]``. Similarly, a
|
||||||
details are held in a section ``[logger_log01]``. Similarly, a handler
|
handler called ``hand01`` in the ``[handlers]`` section will have its
|
||||||
called ``hand01`` in the ``[handlers]`` section will have its
|
configuration held in a section called ``[handler_hand01]``, while a formatter
|
||||||
configuration held in a section called ``[handler_hand01]``, while a
|
called ``form01`` in the ``[formatters]`` section will have its configuration
|
||||||
formatter called ``form01`` in the ``[formatters]`` section will have
|
specified in a section called ``[formatter_form01]``. The root logger
|
||||||
its configuration specified in a section called
|
configuration must be specified in a section called ``[logger_root]``.
|
||||||
``[formatter_form01]``. The root logger configuration must be
|
|
||||||
specified in a section called ``[logger_root]``.
|
|
||||||
|
|
||||||
Examples of these sections in the file are given below. ::
|
Examples of these sections in the file are given below. ::
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,10 @@ typedef unsigned int Py_UCS4;
|
||||||
typedef unsigned long Py_UCS4;
|
typedef unsigned long Py_UCS4;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Py_UNICODE is the native Unicode storage format (code unit) used by
|
||||||
|
Python and represents a single Unicode element in the Unicode
|
||||||
|
type. */
|
||||||
|
|
||||||
typedef PY_UNICODE_TYPE Py_UNICODE;
|
typedef PY_UNICODE_TYPE Py_UNICODE;
|
||||||
|
|
||||||
/* --- UCS-2/UCS-4 Name Mangling ------------------------------------------ */
|
/* --- UCS-2/UCS-4 Name Mangling ------------------------------------------ */
|
||||||
|
@ -369,12 +373,12 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* Since splitting on whitespace is an important use case, and whitespace
|
/* Since splitting on whitespace is an important use case, and
|
||||||
in most situations is solely ASCII whitespace, we optimize for the common
|
whitespace in most situations is solely ASCII whitespace, we
|
||||||
case by using a quick look-up table with an inlined check.
|
optimize for the common case by using a quick look-up table
|
||||||
*/
|
_Py_ascii_whitespace (see below) with an inlined check.
|
||||||
PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[];
|
|
||||||
|
|
||||||
|
*/
|
||||||
#define Py_UNICODE_ISSPACE(ch) \
|
#define Py_UNICODE_ISSPACE(ch) \
|
||||||
((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch))
|
((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch))
|
||||||
|
|
||||||
|
@ -409,13 +413,14 @@ PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[];
|
||||||
#define Py_UNICODE_COPY(target, source, length) \
|
#define Py_UNICODE_COPY(target, source, length) \
|
||||||
Py_MEMCPY((target), (source), (length)*sizeof(Py_UNICODE))
|
Py_MEMCPY((target), (source), (length)*sizeof(Py_UNICODE))
|
||||||
|
|
||||||
#define Py_UNICODE_FILL(target, value, length) do\
|
#define Py_UNICODE_FILL(target, value, length) \
|
||||||
{Py_ssize_t i_; Py_UNICODE *t_ = (target); Py_UNICODE v_ = (value);\
|
do {Py_ssize_t i_; Py_UNICODE *t_ = (target); Py_UNICODE v_ = (value);\
|
||||||
for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\
|
for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* check if substring matches at given offset. the offset must be
|
/* Check if substring matches at given offset. the offset must be
|
||||||
valid, and the substring must not be empty */
|
valid, and the substring must not be empty */
|
||||||
|
|
||||||
#define Py_UNICODE_MATCH(string, offset, substring) \
|
#define Py_UNICODE_MATCH(string, offset, substring) \
|
||||||
((*((string)->str + (offset)) == *((substring)->str)) && \
|
((*((string)->str + (offset)) == *((substring)->str)) && \
|
||||||
((*((string)->str + (offset) + (substring)->length-1) == *((substring)->str + (substring)->length-1))) && \
|
((*((string)->str + (offset) + (substring)->length-1) == *((substring)->str + (substring)->length-1))) && \
|
||||||
|
@ -425,8 +430,6 @@ PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[];
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyUnicode_ClearFreeList(void);
|
|
||||||
|
|
||||||
/* --- Unicode Type ------------------------------------------------------- */
|
/* --- Unicode Type ------------------------------------------------------- */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -641,6 +644,17 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_AsWideChar(
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal);
|
PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal);
|
||||||
|
|
||||||
|
/* --- Free-list management ----------------------------------------------- */
|
||||||
|
|
||||||
|
/* Clear the free list used by the Unicode implementation.
|
||||||
|
|
||||||
|
This can be used to release memory used for objects on the free
|
||||||
|
list back to the Python memory allocator.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyUnicode_ClearFreeList(void);
|
||||||
|
|
||||||
/* === Builtin Codecs =====================================================
|
/* === Builtin Codecs =====================================================
|
||||||
|
|
||||||
Many of these APIs take two arguments encoding and errors. These
|
Many of these APIs take two arguments encoding and errors. These
|
||||||
|
@ -1477,6 +1491,10 @@ PyAPI_FUNC(int) _PyUnicode_InsertThousandsGrouping(Py_UNICODE *buffer,
|
||||||
|
|
||||||
/* === Characters Type APIs =============================================== */
|
/* === Characters Type APIs =============================================== */
|
||||||
|
|
||||||
|
/* Helper array used by Py_UNICODE_ISSPACE(). */
|
||||||
|
|
||||||
|
PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[];
|
||||||
|
|
||||||
/* These should not be used directly. Use the Py_UNICODE_IS* and
|
/* These should not be used directly. Use the Py_UNICODE_IS* and
|
||||||
Py_UNICODE_TO* macros instead.
|
Py_UNICODE_TO* macros instead.
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,10 @@ Implements the Distutils 'sdist' command (create a source distribution)."""
|
||||||
|
|
||||||
__revision__ = "$Id$"
|
__revision__ = "$Id$"
|
||||||
|
|
||||||
import sys, os
|
import os
|
||||||
|
import string
|
||||||
|
import sys
|
||||||
|
from types import *
|
||||||
from glob import glob
|
from glob import glob
|
||||||
from distutils.core import Command
|
from distutils.core import Command
|
||||||
from distutils import dir_util, dep_util, file_util, archive_util
|
from distutils import dir_util, dep_util, file_util, archive_util
|
||||||
|
@ -332,9 +335,18 @@ class sdist (Command):
|
||||||
|
|
||||||
self.filelist.exclude_pattern(None, prefix=build.build_base)
|
self.filelist.exclude_pattern(None, prefix=build.build_base)
|
||||||
self.filelist.exclude_pattern(None, prefix=base_dir)
|
self.filelist.exclude_pattern(None, prefix=base_dir)
|
||||||
self.filelist.exclude_pattern(r'(^|/)(RCS|CVS|\.svn|\.hg|\.git|\.bzr|_darcs)/.*', is_regex=1)
|
|
||||||
|
|
||||||
def write_manifest(self):
|
if sys.platform == 'win32':
|
||||||
|
seps = r'/|\\'
|
||||||
|
else:
|
||||||
|
seps = '/'
|
||||||
|
|
||||||
|
vcs_dirs = ['RCS', 'CVS', r'\.svn', r'\.hg', r'\.git', r'\.bzr',
|
||||||
|
'_darcs']
|
||||||
|
vcs_ptrn = r'(^|%s)(%s)(%s).*' % (seps, '|'.join(vcs_dirs), seps)
|
||||||
|
self.filelist.exclude_pattern(vcs_ptrn, is_regex=1)
|
||||||
|
|
||||||
|
def write_manifest (self):
|
||||||
"""Write the file list in 'self.filelist' (presumably as filled in
|
"""Write the file list in 'self.filelist' (presumably as filled in
|
||||||
by 'add_defaults()' and 'read_template()') to the manifest file
|
by 'add_defaults()' and 'read_template()') to the manifest file
|
||||||
named by 'self.manifest'.
|
named by 'self.manifest'.
|
||||||
|
|
110
Lib/distutils/tests/test_sdist.py
Normal file
110
Lib/distutils/tests/test_sdist.py
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
"""Tests for distutils.command.sdist."""
|
||||||
|
import os
|
||||||
|
import unittest
|
||||||
|
import shutil
|
||||||
|
import zipfile
|
||||||
|
from os.path import join
|
||||||
|
|
||||||
|
from distutils.command.sdist import sdist
|
||||||
|
from distutils.core import Distribution
|
||||||
|
from distutils.tests.test_config import PyPIRCCommandTestCase
|
||||||
|
|
||||||
|
CURDIR = os.path.dirname(__file__)
|
||||||
|
TEMP_PKG = join(CURDIR, 'temppkg')
|
||||||
|
|
||||||
|
SETUP_PY = """
|
||||||
|
from distutils.core import setup
|
||||||
|
import somecode
|
||||||
|
|
||||||
|
setup(name='fake')
|
||||||
|
"""
|
||||||
|
|
||||||
|
MANIFEST_IN = """
|
||||||
|
recursive-include somecode *
|
||||||
|
"""
|
||||||
|
|
||||||
|
class sdistTestCase(PyPIRCCommandTestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
PyPIRCCommandTestCase.setUp(self)
|
||||||
|
self.old_path = os.getcwd()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
os.chdir(self.old_path)
|
||||||
|
if os.path.exists(TEMP_PKG):
|
||||||
|
shutil.rmtree(TEMP_PKG)
|
||||||
|
PyPIRCCommandTestCase.tearDown(self)
|
||||||
|
|
||||||
|
def _write(self, path, content):
|
||||||
|
f = open(path, 'w')
|
||||||
|
try:
|
||||||
|
f.write(content)
|
||||||
|
finally:
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
def test_prune_file_list(self):
|
||||||
|
# this test creates a package with some vcs dirs in it
|
||||||
|
# and launch sdist to make sure they get pruned
|
||||||
|
# on all systems
|
||||||
|
if not os.path.exists(TEMP_PKG):
|
||||||
|
os.mkdir(TEMP_PKG)
|
||||||
|
os.mkdir(join(TEMP_PKG, 'somecode'))
|
||||||
|
|
||||||
|
# creating a MANIFEST, a package, and a README
|
||||||
|
self._write(join(TEMP_PKG, 'MANIFEST.in'), MANIFEST_IN)
|
||||||
|
self._write(join(TEMP_PKG, 'README'), 'xxx')
|
||||||
|
self._write(join(TEMP_PKG, 'somecode', '__init__.py'), '#')
|
||||||
|
self._write(join(TEMP_PKG, 'setup.py'), SETUP_PY)
|
||||||
|
|
||||||
|
# creating VCS directories with some files in them
|
||||||
|
os.mkdir(join(TEMP_PKG, 'somecode', '.svn'))
|
||||||
|
self._write(join(TEMP_PKG, 'somecode', '.svn', 'ok.py'), 'xxx')
|
||||||
|
|
||||||
|
os.mkdir(join(TEMP_PKG, 'somecode', '.hg'))
|
||||||
|
self._write(join(TEMP_PKG, 'somecode', '.hg',
|
||||||
|
'ok'), 'xxx')
|
||||||
|
|
||||||
|
os.mkdir(join(TEMP_PKG, 'somecode', '.git'))
|
||||||
|
self._write(join(TEMP_PKG, 'somecode', '.git',
|
||||||
|
'ok'), 'xxx')
|
||||||
|
|
||||||
|
os.chdir(TEMP_PKG)
|
||||||
|
|
||||||
|
# now building a sdist
|
||||||
|
dist = Distribution()
|
||||||
|
dist.script_name = 'setup.py'
|
||||||
|
dist.metadata.name = 'fake'
|
||||||
|
dist.metadata.version = '1.0'
|
||||||
|
dist.metadata.url = 'http://xxx'
|
||||||
|
dist.metadata.author = dist.metadata.author_email = 'xxx'
|
||||||
|
dist.packages = ['somecode']
|
||||||
|
dist.include_package_data = True
|
||||||
|
cmd = sdist(dist)
|
||||||
|
cmd.manifest = 'MANIFEST'
|
||||||
|
cmd.template = 'MANIFEST.in'
|
||||||
|
cmd.dist_dir = 'dist'
|
||||||
|
|
||||||
|
# zip is available universally
|
||||||
|
# (tar might not be installed under win32)
|
||||||
|
cmd.formats = ['zip']
|
||||||
|
cmd.run()
|
||||||
|
|
||||||
|
# now let's check what we have
|
||||||
|
dist_folder = join(TEMP_PKG, 'dist')
|
||||||
|
files = os.listdir(dist_folder)
|
||||||
|
self.assertEquals(files, ['fake-1.0.zip'])
|
||||||
|
|
||||||
|
zip_file = zipfile.ZipFile(join(dist_folder, 'fake-1.0.zip'))
|
||||||
|
try:
|
||||||
|
content = zip_file.namelist()
|
||||||
|
finally:
|
||||||
|
zip_file.close()
|
||||||
|
|
||||||
|
# making sure everything has been pruned correctly
|
||||||
|
self.assertEquals(len(content), 4)
|
||||||
|
|
||||||
|
def test_suite():
|
||||||
|
return unittest.makeSuite(sdistTestCase)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main(defaultTest="test_suite")
|
|
@ -387,7 +387,7 @@ AC_ARG_WITH(gcc,
|
||||||
AC_HELP_STRING(--without-gcc,never use gcc),
|
AC_HELP_STRING(--without-gcc,never use gcc),
|
||||||
[
|
[
|
||||||
case $withval in
|
case $withval in
|
||||||
no) CC=cc
|
no) CC=${CC:-cc}
|
||||||
without_gcc=yes;;
|
without_gcc=yes;;
|
||||||
yes) CC=gcc
|
yes) CC=gcc
|
||||||
without_gcc=no;;
|
without_gcc=no;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue