From b9891eea1f981fa51682f2c94f8e04f047f3dec4 Mon Sep 17 00:00:00 2001
From: Victor Stinner <vstinner@redhat.com>
Date: Mon, 8 Jan 2018 15:20:36 +0100
Subject: [PATCH] Fix Python3 get_python_exec_prefix on Fedora 27

On Fedora 27, the default Pytho 3 install prefix changed from /usr
to /usr/local:
https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe

Closes-Bug: #1741901
Change-Id: Id40620efdf173189df053b5d380a801092933f83
---
 inc/python | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/inc/python b/inc/python
index 2e4eff02ea..e074ea498f 100644
--- a/inc/python
+++ b/inc/python
@@ -49,7 +49,11 @@ function get_python_exec_prefix {
     fi
     $xtrace
 
-    if is_fedora || is_suse; then
+    if python3_enabled && [ "$os_VENDOR" = "Fedora" -a $os_RELEASE -gt 26 ]; then
+        # Default Python 3 install prefix changed to /usr/local in Fedora 27:
+        # https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe
+        echo "/usr/local/bin"
+    elif is_fedora || is_suse; then
         echo "/usr/bin"
     else
         echo "/usr/local/bin"