commit:     0706d3d3fe6268560efbe4f422b07f2155923168
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 24 17:48:15 2023 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct 24 17:48:39 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=0706d3d3

env-update: multiprocessing spawn compat

Bug: https://bugs.gentoo.org/916240
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/env-update | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/bin/env-update b/bin/env-update
index 6ba80c3ef9..487bd80e48 100755
--- a/bin/env-update
+++ b/bin/env-update
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 import errno
@@ -37,11 +37,12 @@ import portage
 
 portage._internal_caller = True
 
-try:
-    portage.env_update(makelinks)
-except OSError as e:
-    if e.errno == errno.EACCES:
-        print("env-update: Need superuser access")
-        sys.exit(1)
-    else:
-        raise
+if __name__ == "__main__":
+    try:
+        portage.env_update(makelinks)
+    except OSError as e:
+        if e.errno == errno.EACCES:
+            print("env-update: Need superuser access")
+            sys.exit(1)
+        else:
+            raise

Reply via email to