From 54259007c1cb4ba0d41a19f6cb32e923c29b8b74 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 13 May 2013 17:30:05 -0700 Subject: [PATCH] env_update: ensure_dirs, encode filename --- pym/portage/util/env_update.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py index cf95467af..e9c06c5d0 100644 --- a/pym/portage/util/env_update.py +++ b/pym/portage/util/env_update.py @@ -1,4 +1,4 @@ -# Copyright 2010-2012 Gentoo Foundation +# Copyright 2010-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 __all__ = ['env_update'] @@ -210,8 +210,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, # Update prelink.conf if we are prelink-enabled if prelink_capable: prelink_d = os.path.join(eroot, 'etc', 'prelink.conf.d') - if not os.path.isdir(prelink_d): - os.makedirs(prelink_d) + ensure_dirs(prelink_d) newprelink = atomic_ofstream(os.path.join(prelink_d, 'portage.conf')) newprelink.write("# prelink.conf autogenerated by env-update; make all changes to\n") newprelink.write("# contents of /etc/env.d directory\n") @@ -247,7 +246,8 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, # point it to the new stuff until the prelink package re-installs. prelink_conf = os.path.join(eroot, 'etc', 'prelink.conf') try: - with open(prelink_conf, 'rb') as f: + with open(_unicode_encode(prelink_conf, + encoding=_encodings['fs'], errors='strict'), 'rb') as f: if f.readline() == b'# prelink.conf autogenerated by env-update; make all changes to\n': f = atomic_ofstream(prelink_conf) f.write('-c /etc/prelink.conf.d/*.conf\n') -- 2.26.2