commit: c495b6f6745317f2b4c8d51b64ddfcc328806f3e
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 2 12:05:29 2021 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Mar 2 12:38:48 2021 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=c495b6f6
setup.py: prefix repos.conf paths for venv
Prefix repos.conf location and sync-openpgp-key-path values for venv. There
is no intention to do this for normal EPREFIX. This behavior is intended
only when create_entry_points is True, so that if emerge --sync runs in a
venv, the operation will not accidentally modify paths outside of sys.prefix.
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
setup.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/setup.py b/setup.py
index c1408fac5..311f66dfd 100755
--- a/setup.py
+++ b/setup.py
@@ -423,6 +423,22 @@ class x_install_data(install_data):
('subst_paths', 'paths'))
def run(self):
+ def re_sub_file(path, pattern, repl):
+ print('Rewriting %s' % path)
+ with codecs.open(path, 'r', 'utf-8') as f:
+ data = f.read()
+ data = re.sub(pattern, repl, data, flags=re.MULTILINE)
+ with codecs.open(path, 'w', 'utf-8') as f:
+ f.write(data)
+
+ if create_entry_points:
+ # Prefix location and sync-openpgp-key-path for venv.
There
+ # is no intention to do this for normal EPREFIX. This
behavior
+ # is intended only when create_entry_points is True, so
that
+ # if emerge --sync runs in a venv, the operation will
not
+ # accidentally modify paths outside of sys.prefix.
+ re_sub_file('cnf/repos.conf', r'= /', '=
{}/'.format(eprefix))
+
self.run_command('build_man')
def process_data_files(df):