summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python/pypirc-secure.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/python/python/pypirc-secure.patch')
-rw-r--r--meta/recipes-devtools/python/python/pypirc-secure.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python/pypirc-secure.patch b/meta/recipes-devtools/python/python/pypirc-secure.patch
new file mode 100644
index 0000000000..8e2df677b6
--- /dev/null
+++ b/meta/recipes-devtools/python/python/pypirc-secure.patch
@@ -0,0 +1,35 @@
1# HG changeset patch
2# User Philip Jenvey <pjenvey@underboss.org>
3# Date 1322701507 28800
4# Branch 2.7
5# Node ID e7c20a8476a0e2ca18f8040864cbc400818d8f24
6# Parent 3ecddf168f1f554a17a047384fe0b02f2d688277
7create the .pypirc securely
8
9Upstream-Status: Backport
10
11Signed-off-by: Saul Wold <sgw@linux.intel.com>
12
13
14diff -r 3ecddf168f1f -r e7c20a8476a0 Lib/distutils/config.py
15--- a/Lib/distutils/config.py Tue Nov 29 00:53:09 2011 +0100
16+++ b/Lib/distutils/config.py Wed Nov 30 17:05:07 2011 -0800
17@@ -42,16 +42,8 @@
18 def _store_pypirc(self, username, password):
19 """Creates a default .pypirc file."""
20 rc = self._get_rc_file()
21- f = open(rc, 'w')
22- try:
23- f.write(DEFAULT_PYPIRC % (username, password))
24- finally:
25- f.close()
26- try:
27- os.chmod(rc, 0600)
28- except OSError:
29- # should do something better here
30- pass
31+ with os.fdopen(os.open(rc, os.O_CREAT | os.O_WRONLY, 0600), 'w') as fp:
32+ fp.write(DEFAULT_PYPIRC % (username, password))
33
34 def _read_pypirc(self):
35 """Reads the .pypirc file."""