[libvirt] [PATCH] travis: force install of python2 into $PATH on macOS

Daniel P. Berrangé posted 1 patch 6 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180305121902.20647-1-berrange@redhat.com
Test syntax-check passed
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt] [PATCH] travis: force install of python2 into $PATH on macOS
Posted by Daniel P. Berrangé 6 years ago
The homebrew formula's ignored Python PEP-0394 recommendations and
changed the plain python binary in /usr/local/bin to point to Python 3
instead of Python 2. Python 2 is not even installed into a location that
is in $PATH by default anymore. The homebrew packages print a message
to stderr claiming to provide a way to fix this

[quote]
  This formula installs a python2 executable to /usr/local/opt/python@2/bin

  If you wish to have this formula's python executable in your PATH then add

  the following to ~/.bash_profile:

    export PATH="/usr/local/opt/python@2/libexec/bin:$PATH"
[/quote]

When trying to update $PATH are suggested we find out this message is a
lie and /usr/local/opt/python@2 does not even exist, instead Python
seems to end up in /usr/local/Cellar/python@2/2.7.14_1

Rather than hardcoding this version specific directory in our travis
config, we change to run "brew link --force python@2", to make it create
symlinks in /usr/local/bin for the python2 binary.

The original change triggering this problem was

  https://github.com/Homebrew/homebrew-core/pull/24604#issue-171653084

There are countless bug reports against homebrew-core that are closed
without fixes, so it seems they are determined to ignore the Python
PEP 0394 recommendations on this.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index 44f680ad07..699e4bf33a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -97,7 +97,7 @@ env:
     - VIR_TEST_DEBUG=1
 
 before_install:
-  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update && brew upgrade && brew install rpcgen yajl xz; fi
+  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update && brew upgrade && brew install rpcgen yajl xz && brew link --force python@2 ; fi
 
 before_script:
   - ./autogen.sh --prefix=$(pwd)/install-root
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] travis: force install of python2 into $PATH on macOS
Posted by Andrea Bolognani 6 years ago
On Mon, 2018-03-05 at 12:19 +0000, Daniel P. Berrangé wrote:
> The homebrew formula's ignored Python PEP-0394 recommendations and
> changed the plain python binary in /usr/local/bin to point to Python 3
> instead of Python 2. Python 2 is not even installed into a location that
> is in $PATH by default anymore. The homebrew packages print a message
> to stderr claiming to provide a way to fix this
> 
> [quote]
>   This formula installs a python2 executable to /usr/local/opt/python@2/bin
> 
>   If you wish to have this formula's python executable in your PATH then add
> 
>   the following to ~/.bash_profile:
> 
>     export PATH="/usr/local/opt/python@2/libexec/bin:$PATH"
> [/quote]
> 
> When trying to update $PATH are suggested we find out this message is a
> lie and /usr/local/opt/python@2 does not even exist, instead Python
> seems to end up in /usr/local/Cellar/python@2/2.7.14_1
> 
> Rather than hardcoding this version specific directory in our travis
> config, we change to run "brew link --force python@2", to make it create
> symlinks in /usr/local/bin for the python2 binary.
> 
> The original change triggering this problem was
> 
>   https://github.com/Homebrew/homebrew-core/pull/24604#issue-171653084
> 
> There are countless bug reports against homebrew-core that are closed
> without fixes, so it seems they are determined to ignore the Python
> PEP 0394 recommendations on this.

https://www.youtube.com/watch?v=KZh_ouQ8XEw&t=4s

[...]
>  before_install:
> -  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update && brew upgrade && brew install rpcgen yajl xz; fi
> +  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update && brew upgrade && brew install rpcgen yajl xz && brew link --force python@2 ; fi

Please drop the space between python@2 and the semicolon.

With that fixed, and assuming you've already performed a
successful test build on Travis,

  Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list