1 |
On Sat, May 11, 2013 at 12:45 PM, Mike Frysinger <vapier@g.o> wrote: |
2 |
> + # Migration code path. If /etc/prelink.conf was generated by us, then |
3 |
> + # point it to the new stuff until the prelink package re-installs. |
4 |
> + prelink_conf = os.path.join(eroot, 'etc', 'prelink.conf') |
5 |
> + if os.path.exists(prelink_conf): |
6 |
> + if open(prelink_conf).readline() == '# prelink.conf autogenerated by env-update; make all changes to\n': |
7 |
|
8 |
I would do it like this: |
9 |
|
10 |
with open(prelink_conf, 'rb') as f: |
11 |
if f.readline() == b'# prelink.conf autogenerated by |
12 |
env-update; make all changes to\n': |
13 |
|
14 |
The "with" block prevents resource warning messages with python3, and |
15 |
using binary mode side-steps potential unicode decode errors. |
16 |
|
17 |
Other than that, the patch looks good to me. |