Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r13781 - main/trunk/pym/portage
Date: Sat, 04 Jul 2009 19:31:23
Message-Id: E1MNAxF-00067V-Ts@stork.gentoo.org
1 Author: zmedico
2 Date: 2009-07-04 19:31:21 +0000 (Sat, 04 Jul 2009)
3 New Revision: 13781
4
5 Modified:
6 main/trunk/pym/portage/util.py
7 Log:
8 Make code from previous commit safe for empty files.
9
10
11 Modified: main/trunk/pym/portage/util.py
12 ===================================================================
13 --- main/trunk/pym/portage/util.py 2009-07-04 19:25:42 UTC (rev 13780)
14 +++ main/trunk/pym/portage/util.py 2009-07-04 19:31:21 UTC (rev 13781)
15 @@ -368,7 +368,7 @@
16 # is triggered by a source statement at the end of the file without a
17 # trailing newline after the source statement
18 content = codecs.open(mycfg, mode='r', errors='replace').read()
19 - if content[-1] != u'\n':
20 + if content and content[-1] != u'\n':
21 content += u'\n'
22 f = StringIO(content)
23 except IOError, e: