summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/config.py
diff options
context:
space:
mode:
authorÉric Araujo <aeric@mtlpy.org>2012-12-09 03:47:03 (GMT)
committerÉric Araujo <aeric@mtlpy.org>2012-12-09 03:47:03 (GMT)
commit24457c9ad375239aca9bd176284d1e4f181e02f4 (patch)
treedebeb009292f1615d17ea061a3ad528b41bfec2d /Lib/distutils/config.py
parent62a0d6ea402d18f528629c6e84ed6f46e7c0912a (diff)
parent8b503c0a4e82ba5aadd60215bf493529ce6e1821 (diff)
downloadcpython-24457c9ad375239aca9bd176284d1e4f181e02f4.zip
cpython-24457c9ad375239aca9bd176284d1e4f181e02f4.tar.gz
cpython-24457c9ad375239aca9bd176284d1e4f181e02f4.tar.bz2
Branch merge
Diffstat (limited to 'Lib/distutils/config.py')
-rw-r--r--Lib/distutils/config.py11
1 files changed, 1 insertions, 10 deletions
diff --git a/Lib/distutils/config.py b/Lib/distutils/config.py
index 5b625f3..1fd5334 100644
--- a/Lib/distutils/config.py
+++ b/Lib/distutils/config.py
@@ -4,7 +4,6 @@ Provides the PyPIRCCommand class, the base class for the command classes
that uses .pypirc in the distutils.command package.
"""
import os
-import sys
from configparser import ConfigParser
from distutils.cmd import Command
@@ -43,16 +42,8 @@ class PyPIRCCommand(Command):
def _store_pypirc(self, username, password):
"""Creates a default .pypirc file."""
rc = self._get_rc_file()
- f = open(rc, 'w')
- try:
+ with os.fdopen(os.open(rc, os.O_CREAT | os.O_WRONLY, 0o600), 'w') as f:
f.write(DEFAULT_PYPIRC % (username, password))
- finally:
- f.close()
- try:
- os.chmod(rc, 0o600)
- except OSError:
- # should do something better here
- pass
def _read_pypirc(self):
"""Reads the .pypirc file."""