Kaydet (Commit) f46676d4 authored tarafından Éric Araujo's avatar Éric Araujo

Branch merge

......@@ -136,7 +136,7 @@ Good example (establishing confident knowledge in the effective use of the langu
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.
It is an unfortunate fact that making documentation longer can be an impediment
......@@ -198,7 +198,7 @@ Audience
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
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
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
unless the :program:`python` interpreter was started with the :option:`-S`
flag.
.. versionchanged:: 3.3
This function used to be called unconditionnally.
.. function:: addsitedir(sitedir, known_paths=None)
Adds a directory to sys.path and processes its pth files.
......
......@@ -124,7 +124,7 @@ class HTMLParser(_markupbase.ParserBase):
_markupbase.ParserBase.reset(self)
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
as you want (may include '\n').
......
......@@ -8,7 +8,7 @@ from types import ModuleType
__all__ = [
'get_importer', 'iter_importers', 'get_loader', 'find_loader',
'walk_packages', 'iter_modules',
'walk_packages', 'iter_modules', 'get_data',
'ImpImporter', 'ImpLoader', 'read_code', 'extend_path',
]
......
......@@ -658,11 +658,10 @@ def get_platform():
# to. This makes the compatibility story a bit more sane because the
# machine is going to compile and link as if it were
# MACOSX_DEPLOYMENT_TARGET.
#
cfgvars = get_config_vars()
macver = cfgvars.get('MACOSX_DEPLOYMENT_TARGET')
if 1:
if True:
# Always calculate the release of the running machine,
# needed to determine if we can build fat binaries or not.
......@@ -757,7 +756,7 @@ def _main():
print('Platform: "%s"' % get_platform())
print('Python version: "%s"' % get_python_version())
print('Current installation scheme: "%s"' % _get_default_scheme())
print('')
print()
_print_dict('Paths', get_paths())
print()
_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 sys
import os
......@@ -20,10 +14,10 @@ from sysconfig import (get_paths, get_platform, get_config_vars,
_get_default_scheme, _expand_vars,
get_scheme_names, get_config_var, _main)
class TestSysConfig(unittest.TestCase):
def setUp(self):
"""Make a copy of sys.path"""
super(TestSysConfig, self).setUp()
self.sys_path = sys.path[:]
# patching os.uname
......@@ -52,7 +46,6 @@ class TestSysConfig(unittest.TestCase):
self._added_envvars.append(var)
def tearDown(self):
"""Restore sys.path"""
sys.path[:] = self.sys_path
self._cleanup_testfn()
if self.uname is not None:
......@@ -142,8 +135,6 @@ class TestSysConfig(unittest.TestCase):
('Darwin Kernel Version 8.11.1: '
'Wed Oct 10 18:23:28 PDT 2007; '
'root:xnu-792.25.20~1/RELEASE_I386'), 'PowerPC'))
get_config_vars()['MACOSX_DEPLOYMENT_TARGET'] = '10.3'
get_config_vars()['CFLAGS'] = ('-fno-strict-aliasing -DNDEBUG -g '
......@@ -158,7 +149,6 @@ class TestSysConfig(unittest.TestCase):
finally:
sys.maxsize = maxint
self._set_uname(('Darwin', 'macziade', '8.11.1',
('Darwin Kernel Version 8.11.1: '
'Wed Oct 10 18:23:28 PDT 2007; '
......@@ -216,9 +206,9 @@ class TestSysConfig(unittest.TestCase):
get_config_vars()['CFLAGS'] = ('-arch %s -isysroot '
'/Developer/SDKs/MacOSX10.4u.sdk '
'-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
os.name = 'posix'
......@@ -286,7 +276,6 @@ class TestSysConfig(unittest.TestCase):
self.assertIn(ldflags, ldshared)
@unittest.skipUnless(sys.platform == "darwin", "test only relevant on MacOSX")
def test_platform_in_subprocess(self):
my_platform = sysconfig.get_platform()
......@@ -312,7 +301,6 @@ class TestSysConfig(unittest.TestCase):
self.assertEqual(status, 0)
self.assertEqual(my_platform, test_platform)
# Test with MACOSX_DEPLOYMENT_TARGET in the environment, and
# using a value that is unlikely to be the default one.
env = os.environ.copy()
......@@ -334,6 +322,7 @@ class TestSysConfig(unittest.TestCase):
class MakefileTests(unittest.TestCase):
@unittest.skipIf(sys.platform.startswith('win'),
'Test is not Windows compatible')
def test_get_makefile_filename(self):
......
......@@ -2,7 +2,7 @@
"""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"
......@@ -50,7 +50,7 @@ def has_correct_encoding(text, codec):
def needs_declaration(fullpath):
try:
infile = open(fullpath, 'rU')
infile = open(fullpath)
except IOError: # Oops, the file was removed - ignore it
return None
......
......@@ -42,7 +42,7 @@ def _open(fullpath):
return None
try:
return open(fullpath, 'rU')
return open(fullpath)
except IOError as err: # Access denied, or a special file - ignore it
print_debug("%s: access denied: %s" % (fullpath, err))
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