Commit f46676d4 authored by Éric Araujo's avatar Éric Araujo

Branch merge

parents 92236e56 aa1ef2d7
...@@ -136,7 +136,7 @@ Good example (establishing confident knowledge in the effective use of the langu ...@@ -136,7 +136,7 @@ Good example (establishing confident knowledge in the effective use of the langu
Economy of Expression Economy of Expression
--------------------- ---------------------
More documentation is not necessarily better documentation. Error on the side More documentation is not necessarily better documentation. Err on the side
of being succinct. of being succinct.
It is an unfortunate fact that making documentation longer can be an impediment It is an unfortunate fact that making documentation longer can be an impediment
...@@ -198,7 +198,7 @@ Audience ...@@ -198,7 +198,7 @@ Audience
The tone of the tutorial (and all the docs) needs to be respectful of the The tone of the tutorial (and all the docs) needs to be respectful of the
reader's intelligence. Don't presume that the readers are stupid. Lay out the reader's intelligence. Don't presume that the readers are stupid. Lay out the
relevant information, show motivating use cases, provide glossary links, and do relevant information, show motivating use cases, provide glossary links, and do
our best to connect-the-dots, but don't talk down to them or waste their time. your best to connect-the-dots, but don't talk down to them or waste their time.
The tutorial is meant for newcomers, many of whom will be using the tutorial to The tutorial is meant for newcomers, many of whom will be using the tutorial to
evaluate the language as a whole. The experience needs to be positive and not evaluate the language as a whole. The experience needs to be positive and not
......
...@@ -129,6 +129,10 @@ empty, and the path manipulations are skipped; however the import of ...@@ -129,6 +129,10 @@ empty, and the path manipulations are skipped; however the import of
unless the :program:`python` interpreter was started with the :option:`-S` unless the :program:`python` interpreter was started with the :option:`-S`
flag. flag.
.. versionchanged:: 3.3
This function used to be called unconditionnally.
.. function:: addsitedir(sitedir, known_paths=None) .. function:: addsitedir(sitedir, known_paths=None)
Adds a directory to sys.path and processes its pth files. Adds a directory to sys.path and processes its pth files.
......
...@@ -124,7 +124,7 @@ class HTMLParser(_markupbase.ParserBase): ...@@ -124,7 +124,7 @@ class HTMLParser(_markupbase.ParserBase):
_markupbase.ParserBase.reset(self) _markupbase.ParserBase.reset(self)
def feed(self, data): def feed(self, data):
"""Feed data to the parser. r"""Feed data to the parser.
Call this as often as you want, with as little or as much text Call this as often as you want, with as little or as much text
as you want (may include '\n'). as you want (may include '\n').
......
...@@ -8,7 +8,7 @@ from types import ModuleType ...@@ -8,7 +8,7 @@ from types import ModuleType
__all__ = [ __all__ = [
'get_importer', 'iter_importers', 'get_loader', 'find_loader', 'get_importer', 'iter_importers', 'get_loader', 'find_loader',
'walk_packages', 'iter_modules', 'walk_packages', 'iter_modules', 'get_data',
'ImpImporter', 'ImpLoader', 'read_code', 'extend_path', 'ImpImporter', 'ImpLoader', 'read_code', 'extend_path',
] ]
......
...@@ -658,11 +658,10 @@ def get_platform(): ...@@ -658,11 +658,10 @@ def get_platform():
# to. This makes the compatibility story a bit more sane because the # to. This makes the compatibility story a bit more sane because the
# machine is going to compile and link as if it were # machine is going to compile and link as if it were
# MACOSX_DEPLOYMENT_TARGET. # MACOSX_DEPLOYMENT_TARGET.
#
cfgvars = get_config_vars() cfgvars = get_config_vars()
macver = cfgvars.get('MACOSX_DEPLOYMENT_TARGET') macver = cfgvars.get('MACOSX_DEPLOYMENT_TARGET')
if 1: if True:
# Always calculate the release of the running machine, # Always calculate the release of the running machine,
# needed to determine if we can build fat binaries or not. # needed to determine if we can build fat binaries or not.
...@@ -757,7 +756,7 @@ def _main(): ...@@ -757,7 +756,7 @@ def _main():
print('Platform: "%s"' % get_platform()) print('Platform: "%s"' % get_platform())
print('Python version: "%s"' % get_python_version()) print('Python version: "%s"' % get_python_version())
print('Current installation scheme: "%s"' % _get_default_scheme()) print('Current installation scheme: "%s"' % _get_default_scheme())
print('') print()
_print_dict('Paths', get_paths()) _print_dict('Paths', get_paths())
print() print()
_print_dict('Variables', get_config_vars()) _print_dict('Variables', get_config_vars())
......
"""Tests for 'site'.
Tests assume the initial paths in sys.path once the interpreter has begun
executing have not been removed.
"""
import unittest import unittest
import sys import sys
import os import os
...@@ -20,10 +14,10 @@ from sysconfig import (get_paths, get_platform, get_config_vars, ...@@ -20,10 +14,10 @@ from sysconfig import (get_paths, get_platform, get_config_vars,
_get_default_scheme, _expand_vars, _get_default_scheme, _expand_vars,
get_scheme_names, get_config_var, _main) get_scheme_names, get_config_var, _main)
class TestSysConfig(unittest.TestCase): class TestSysConfig(unittest.TestCase):
def setUp(self): def setUp(self):
"""Make a copy of sys.path"""
super(TestSysConfig, self).setUp() super(TestSysConfig, self).setUp()
self.sys_path = sys.path[:] self.sys_path = sys.path[:]
# patching os.uname # patching os.uname
...@@ -52,7 +46,6 @@ class TestSysConfig(unittest.TestCase): ...@@ -52,7 +46,6 @@ class TestSysConfig(unittest.TestCase):
self._added_envvars.append(var) self._added_envvars.append(var)
def tearDown(self): def tearDown(self):
"""Restore sys.path"""
sys.path[:] = self.sys_path sys.path[:] = self.sys_path
self._cleanup_testfn() self._cleanup_testfn()
if self.uname is not None: if self.uname is not None:
...@@ -142,8 +135,6 @@ class TestSysConfig(unittest.TestCase): ...@@ -142,8 +135,6 @@ class TestSysConfig(unittest.TestCase):
('Darwin Kernel Version 8.11.1: ' ('Darwin Kernel Version 8.11.1: '
'Wed Oct 10 18:23:28 PDT 2007; ' 'Wed Oct 10 18:23:28 PDT 2007; '
'root:xnu-792.25.20~1/RELEASE_I386'), 'PowerPC')) 'root:xnu-792.25.20~1/RELEASE_I386'), 'PowerPC'))
get_config_vars()['MACOSX_DEPLOYMENT_TARGET'] = '10.3' get_config_vars()['MACOSX_DEPLOYMENT_TARGET'] = '10.3'
get_config_vars()['CFLAGS'] = ('-fno-strict-aliasing -DNDEBUG -g ' get_config_vars()['CFLAGS'] = ('-fno-strict-aliasing -DNDEBUG -g '
...@@ -158,7 +149,6 @@ class TestSysConfig(unittest.TestCase): ...@@ -158,7 +149,6 @@ class TestSysConfig(unittest.TestCase):
finally: finally:
sys.maxsize = maxint sys.maxsize = maxint
self._set_uname(('Darwin', 'macziade', '8.11.1', self._set_uname(('Darwin', 'macziade', '8.11.1',
('Darwin Kernel Version 8.11.1: ' ('Darwin Kernel Version 8.11.1: '
'Wed Oct 10 18:23:28 PDT 2007; ' 'Wed Oct 10 18:23:28 PDT 2007; '
...@@ -216,9 +206,9 @@ class TestSysConfig(unittest.TestCase): ...@@ -216,9 +206,9 @@ class TestSysConfig(unittest.TestCase):
get_config_vars()['CFLAGS'] = ('-arch %s -isysroot ' get_config_vars()['CFLAGS'] = ('-arch %s -isysroot '
'/Developer/SDKs/MacOSX10.4u.sdk ' '/Developer/SDKs/MacOSX10.4u.sdk '
'-fno-strict-aliasing -fno-common ' '-fno-strict-aliasing -fno-common '
'-dynamic -DNDEBUG -g -O3'%(arch,)) '-dynamic -DNDEBUG -g -O3' % arch)
self.assertEqual(get_platform(), 'macosx-10.4-%s'%(arch,)) self.assertEqual(get_platform(), 'macosx-10.4-%s' % arch)
# linux debian sarge # linux debian sarge
os.name = 'posix' os.name = 'posix'
...@@ -286,7 +276,6 @@ class TestSysConfig(unittest.TestCase): ...@@ -286,7 +276,6 @@ class TestSysConfig(unittest.TestCase):
self.assertIn(ldflags, ldshared) self.assertIn(ldflags, ldshared)
@unittest.skipUnless(sys.platform == "darwin", "test only relevant on MacOSX") @unittest.skipUnless(sys.platform == "darwin", "test only relevant on MacOSX")
def test_platform_in_subprocess(self): def test_platform_in_subprocess(self):
my_platform = sysconfig.get_platform() my_platform = sysconfig.get_platform()
...@@ -312,7 +301,6 @@ class TestSysConfig(unittest.TestCase): ...@@ -312,7 +301,6 @@ class TestSysConfig(unittest.TestCase):
self.assertEqual(status, 0) self.assertEqual(status, 0)
self.assertEqual(my_platform, test_platform) self.assertEqual(my_platform, test_platform)
# Test with MACOSX_DEPLOYMENT_TARGET in the environment, and # Test with MACOSX_DEPLOYMENT_TARGET in the environment, and
# using a value that is unlikely to be the default one. # using a value that is unlikely to be the default one.
env = os.environ.copy() env = os.environ.copy()
...@@ -334,6 +322,7 @@ class TestSysConfig(unittest.TestCase): ...@@ -334,6 +322,7 @@ class TestSysConfig(unittest.TestCase):
class MakefileTests(unittest.TestCase): class MakefileTests(unittest.TestCase):
@unittest.skipIf(sys.platform.startswith('win'), @unittest.skipIf(sys.platform.startswith('win'),
'Test is not Windows compatible') 'Test is not Windows compatible')
def test_get_makefile_filename(self): def test_get_makefile_filename(self):
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"""List all those Python files that require a coding directive """List all those Python files that require a coding directive
Usage: nocoding.py dir1 [dir2...] Usage: findnocoding.py dir1 [dir2...]
""" """
__author__ = "Oleg Broytmann, Georg Brandl" __author__ = "Oleg Broytmann, Georg Brandl"
...@@ -50,7 +50,7 @@ def has_correct_encoding(text, codec): ...@@ -50,7 +50,7 @@ def has_correct_encoding(text, codec):
def needs_declaration(fullpath): def needs_declaration(fullpath):
try: try:
infile = open(fullpath, 'rU') infile = open(fullpath)
except IOError: # Oops, the file was removed - ignore it except IOError: # Oops, the file was removed - ignore it
return None return None
......
...@@ -42,7 +42,7 @@ def _open(fullpath): ...@@ -42,7 +42,7 @@ def _open(fullpath):
return None return None
try: try:
return open(fullpath, 'rU') return open(fullpath)
except IOError as err: # Access denied, or a special file - ignore it except IOError as err: # Access denied, or a special file - ignore it
print_debug("%s: access denied: %s" % (fullpath, err)) print_debug("%s: access denied: %s" % (fullpath, err))
return None return None
......
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