[Python-checkins] r67944 - in python/branches/release26-maint: Lib/distutils/command/register.py Lib/distutils/config.py Lib/distutils/tests/test_config.py Lib/distutils/tests/test_register.py Misc/NEWS
tarek.ziade
python-checkins at python.org
Sat Dec 27 14:28:42 CET 2008
Author: tarek.ziade
Date: Sat Dec 27 14:28:42 2008
New Revision: 67944
Log:
Merged revisions 67926 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67926 | tarek.ziade | 2008-12-24 20:10:05 +0100 (Wed, 24 Dec 2008) | 1 line
fixed #4400 : distutils .pypirc default generated file was broken.
........
Added:
python/branches/release26-maint/Lib/distutils/tests/test_register.py
- copied unchanged from r67926, /python/trunk/Lib/distutils/tests/test_register.py
Modified:
python/branches/release26-maint/ (props changed)
python/branches/release26-maint/Lib/distutils/command/register.py
python/branches/release26-maint/Lib/distutils/config.py
python/branches/release26-maint/Lib/distutils/tests/test_config.py
python/branches/release26-maint/Misc/NEWS
Modified: python/branches/release26-maint/Lib/distutils/command/register.py
==============================================================================
--- python/branches/release26-maint/Lib/distutils/command/register.py (original)
+++ python/branches/release26-maint/Lib/distutils/command/register.py Sat Dec 27 14:28:42 2008
@@ -141,12 +141,14 @@
# get the user's login info
choices = '1 2 3 4'.split()
while choice not in choices:
- print '''We need to know who you are, so please choose either:
+ self.announce('''\
+We need to know who you are, so please choose either:
1. use your existing login,
2. register as a new user,
3. have the server generate a new password for you (and email it to you), or
4. quit
-Your selection [default 1]: ''',
+Your selection [default 1]: ''', log.INFO)
+
choice = raw_input()
if not choice:
choice = '1'
@@ -167,12 +169,16 @@
# send the info to the server and report the result
code, result = self.post_to_server(self.build_post_data('submit'),
auth)
- print 'Server response (%s): %s' % (code, result)
+ self.announce('Server response (%s): %s' % (code, result),
+ log.INFO)
# possibly save the login
if not self.has_config and code == 200:
- print 'I can store your PyPI login so future submissions will be faster.'
- print '(the login will be stored in %s)' % self._get_rc_file()
+ self.announce(('I can store your PyPI login so future '
+ 'submissions will be faster.'), log.INFO)
+ self.announce('(the login will be stored in %s)' % \
+ self._get_rc_file(), log.INFO)
+
choice = 'X'
while choice.lower() not in 'yn':
choice = raw_input('Save your login (y/N)?')
Modified: python/branches/release26-maint/Lib/distutils/config.py
==============================================================================
--- python/branches/release26-maint/Lib/distutils/config.py (original)
+++ python/branches/release26-maint/Lib/distutils/config.py Sat Dec 27 14:28:42 2008
@@ -10,8 +10,8 @@
from distutils.cmd import Command
DEFAULT_PYPIRC = """\
-[pypirc]
-servers =
+[distutils]
+index-servers =
pypi
[pypi]
Modified: python/branches/release26-maint/Lib/distutils/tests/test_config.py
==============================================================================
--- python/branches/release26-maint/Lib/distutils/tests/test_config.py (original)
+++ python/branches/release26-maint/Lib/distutils/tests/test_config.py Sat Dec 27 14:28:42 2008
@@ -5,6 +5,8 @@
from distutils.core import PyPIRCCommand
from distutils.core import Distribution
+from distutils.log import set_threshold
+from distutils.log import WARN
from distutils.tests import support
@@ -32,6 +34,17 @@
password:secret
"""
+WANTED = """\
+[distutils]
+index-servers =
+ pypi
+
+[pypi]
+username:tarek
+password:xxx
+"""
+
+
class PyPIRCCommandTestCase(support.TempdirManager, unittest.TestCase):
def setUp(self):
@@ -53,6 +66,7 @@
finalize_options = initialize_options
self._cmd = command
+ self.old_threshold = set_threshold(WARN)
def tearDown(self):
"""Removes the patch."""
@@ -62,6 +76,7 @@
os.environ['HOME'] = self._old_home
if os.path.exists(self.rc):
os.remove(self.rc)
+ set_threshold(self.old_threshold)
def test_server_registration(self):
# This test makes sure PyPIRCCommand knows how to:
@@ -98,6 +113,20 @@
('server', 'server-login'), ('username', 'tarek')]
self.assertEquals(config, waited)
+ def test_server_empty_registration(self):
+
+ cmd = self._cmd(self.dist)
+ rc = cmd._get_rc_file()
+ self.assert_(not os.path.exists(rc))
+
+ cmd._store_pypirc('tarek', 'xxx')
+
+ self.assert_(os.path.exists(rc))
+ content = open(rc).read()
+
+ self.assertEquals(content, WANTED)
+
+
def test_suite():
return unittest.makeSuite(PyPIRCCommandTestCase)
Modified: python/branches/release26-maint/Misc/NEWS
==============================================================================
--- python/branches/release26-maint/Misc/NEWS (original)
+++ python/branches/release26-maint/Misc/NEWS Sat Dec 27 14:28:42 2008
@@ -121,6 +121,8 @@
Library
-------
+- Issue #4400: .pypirc default generated file was broken in distutils.
+
- Issue #4163: Use unicode-friendly word splitting in the textwrap functions
when given an unicode string.
More information about the Python-checkins
mailing list