New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python 3.6.4, python@2 2.7.14 (new formula) #24604

Closed
wants to merge 89 commits into
base: master
from

Conversation

Projects
None yet
6 participants
@ilovezfs
Contributor

ilovezfs commented Feb 27, 2018

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

@methane

This comment has been minimized.

Contributor

methane commented Feb 27, 2018

What is this mean for vim?

depends_on "python" => :recommended
depends_on "gettext" => :optional
depends_on "lua" => :optional
depends_on "luajit" => :optional
depends_on "python3" => :optional
depends_on :x11 if build.with? "client-server"

@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Feb 27, 2018

@methane it means the default will switch to Python 3.

@ilovezfs ilovezfs referenced this pull request Feb 27, 2018

Merged

language/python: handle python@* in each_python #3848

5 of 6 tasks complete
@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Feb 27, 2018

@DomT4 some extra 👀 on this would be helpful if you have a chance, please.

@methane

This comment has been minimized.

Contributor

methane commented Feb 28, 2018

Thank you, I'm very happy about moving to Python 3.
Mixing Python 2 and 3 is pain and moving to Python 3 is the right way to fix the pain.

@DomT4

This comment has been minimized.

Contributor

DomT4 commented Feb 28, 2018

@DomT4 some extra 👀 on this would be helpful if you have a chance, please.

Sure, will look it over a little later today.

@@ -3,6 +3,7 @@ class Gwyddion < Formula
homepage "http://gwyddion.net/"
url "http://gwyddion.net/download/2.50/gwyddion-2.50.tar.gz"
sha256 "f3834dae31d9bf696e8d59e2aa79a373a30d5f6caa6033601d2f9d57afa154f3"
revision 1

This comment has been minimized.

@DomT4

DomT4 Mar 1, 2018

Contributor

This formula seems to require further changes. Probably just shunting to python@2 here.

checking for a Python interpreter with version >= 2.4... python2
checking for python2... /usr/local/opt/python/bin/python2
checking for python2 version... 2.7
checking for python2 platform... darwin
checking for python2 script directory... ${prefix}/lib/python2.7/site-packages
checking for python2 extension module directory... ${exec_prefix}/lib/python2.7/site-packages
checking size of pid_t... 4
checking for python2.7-config... /usr/local/opt/python/bin/python2.7-config
checking if we can link a test Python program... yes

Edit - This was fixed by a more recent push.

EOS
end
end
test do
ENV.prepend_path "PATH", Formula["python"].opt_libexec/"bin"
# Simple test to check if MacVim was linked to Python version in $PATH
if build.with? "python"
system_framework_path = `python-config --exec-prefix`.chomp

This comment has been minimized.

@DomT4

DomT4 Mar 1, 2018

Contributor

Minor thing but system_framework_path no longer makes quite as much sense as a reference given the system doesn't ship any kind of python3. I guess it still kinda works but.

@@ -14,7 +15,7 @@ class Pastebinit < Formula
end
depends_on "docbook2x" => :build
depends_on "python3"
depends_on "python"

This comment has been minimized.

@DomT4

DomT4 Mar 1, 2018

Contributor

The inreplace below needs fixing to match this change.

This comment has been minimized.

@DomT4

DomT4 Mar 1, 2018

Contributor

It'll work because of the alias, as far as I can see, but seems sensible to make the change to avoid confusion?

Edit - This was fixed by a more recent push.

@@ -14,7 +14,7 @@ class Pygobject < Formula
depends_on "pkg-config" => :build
depends_on "glib"
depends_on "python"
depends_on "python@2"

This comment has been minimized.

@DomT4

DomT4 Mar 1, 2018

Contributor

Does the test need tweaking here? As far as I can see in the bottles the new python@2 formula ships no vanilla python executable. It should work either way as the bindings shouldn't be tied to one specific python and the system's python isn't going anywhere anytime soon, but the intention here seems to be to test against the Python it was built against? Maybe? 😓.

Edit - This was fixed by a more recent push.

@@ -11,14 +11,15 @@ class Pygobject3 < Formula
sha256 "4c637d654502521ef19d7679a159ec353115df01d1afd3934ea43799d3b79b39" => :el_capitan
end
option "without-python", "Build without python2 support"
option "without-python@2", "Build without python2 support"

This comment has been minimized.

@DomT4

DomT4 Mar 1, 2018

Contributor

This is causing reinstall and upgrade failures for me as-is, having built my pygobject3 formula with python3 support.

pygobject3: stable 3.26.1 (bottled)
GNOME Python bindings (based on GObject Introspection)
https://live.gnome.org/PyGObject
/usr/local/Cellar/pygobject3/3.26.1 (159 files, 3.5MB) *
  Built from source on 2017-10-27 at 20:04:32 with: --with-python3
~> brew upgrade -s -v pygobject3
==> Upgrading 1 outdated package, with result:
pygobject3 3.26.1_1
==> Upgrading pygobject3
rm /usr/local/include/pygobject-3.0
rm /usr/local/lib/pkgconfig/pygobject-3.0.pc
rm /usr/local/lib/python2.7/site-packages/gi/__init__.py
rm /usr/local/lib/python2.7/site-packages/gi/_constants.py
rm /usr/local/lib/python2.7/site-packages/gi/_error.py
rm /usr/local/lib/python2.7/site-packages/gi/_gi.so
rm /usr/local/lib/python2.7/site-packages/gi/_gi_cairo.so
rm /usr/local/lib/python2.7/site-packages/gi/_option.py
rm /usr/local/lib/python2.7/site-packages/gi/_propertyhelper.py
rm /usr/local/lib/python2.7/site-packages/gi/_signalhelper.py
rm /usr/local/lib/python2.7/site-packages/gi/docstring.py
rm /usr/local/lib/python2.7/site-packages/gi/importer.py
rm /usr/local/lib/python2.7/site-packages/gi/module.py
rm /usr/local/lib/python2.7/site-packages/gi/overrides/GIMarshallingTests.py
rm /usr/local/lib/python2.7/site-packages/gi/overrides/GLib.py
rm /usr/local/lib/python2.7/site-packages/gi/overrides/GObject.py
rm /usr/local/lib/python2.7/site-packages/gi/overrides/Gdk.py
rm /usr/local/lib/python2.7/site-packages/gi/overrides/Gio.py
rm /usr/local/lib/python2.7/site-packages/gi/overrides/Gtk.py
rm /usr/local/lib/python2.7/site-packages/gi/overrides/Pango.py
rm /usr/local/lib/python2.7/site-packages/gi/overrides/__init__.py
rm /usr/local/lib/python2.7/site-packages/gi/overrides/keysyms.py
rm /usr/local/lib/python2.7/site-packages/gi/pygtkcompat.py
rm /usr/local/lib/python2.7/site-packages/gi/repository/__init__.py
rm /usr/local/lib/python2.7/site-packages/gi/types.py
rm /usr/local/lib/python2.7/site-packages/pygobject-3.26.1-py2.7.egg-info
rm /usr/local/lib/python2.7/site-packages/pygtkcompat/__init__.py
rm /usr/local/lib/python2.7/site-packages/pygtkcompat/generictreemodel.py
rm /usr/local/lib/python2.7/site-packages/pygtkcompat/pygtkcompat.py
rm /usr/local/lib/python3.6/site-packages/gi/__init__.py
rm /usr/local/lib/python3.6/site-packages/gi/_constants.py
rm /usr/local/lib/python3.6/site-packages/gi/_error.py
rm /usr/local/lib/python3.6/site-packages/gi/_gi.cpython-36m-darwin.so
rm /usr/local/lib/python3.6/site-packages/gi/_gi_cairo.cpython-36m-darwin.so
rm /usr/local/lib/python3.6/site-packages/gi/_option.py
rm /usr/local/lib/python3.6/site-packages/gi/_propertyhelper.py
rm /usr/local/lib/python3.6/site-packages/gi/_signalhelper.py
rm /usr/local/lib/python3.6/site-packages/gi/docstring.py
rm /usr/local/lib/python3.6/site-packages/gi/importer.py
rm /usr/local/lib/python3.6/site-packages/gi/module.py
rm /usr/local/lib/python3.6/site-packages/gi/overrides/GIMarshallingTests.py
rm /usr/local/lib/python3.6/site-packages/gi/overrides/GLib.py
rm /usr/local/lib/python3.6/site-packages/gi/overrides/GObject.py
rm /usr/local/lib/python3.6/site-packages/gi/overrides/Gdk.py
rm /usr/local/lib/python3.6/site-packages/gi/overrides/Gio.py
rm /usr/local/lib/python3.6/site-packages/gi/overrides/Gtk.py
rm /usr/local/lib/python3.6/site-packages/gi/overrides/Pango.py
rm /usr/local/lib/python3.6/site-packages/gi/overrides/__init__.py
rm /usr/local/lib/python3.6/site-packages/gi/overrides/keysyms.py
rm /usr/local/lib/python3.6/site-packages/gi/pygtkcompat.py
rm /usr/local/lib/python3.6/site-packages/gi/repository/__init__.py
rm /usr/local/lib/python3.6/site-packages/gi/types.py
rm /usr/local/lib/python3.6/site-packages/pygobject-3.26.1-py3.6.egg-info
rm /usr/local/lib/python3.6/site-packages/pygtkcompat/__init__.py
rm /usr/local/lib/python3.6/site-packages/pygtkcompat/generictreemodel.py
rm /usr/local/lib/python3.6/site-packages/pygtkcompat/pygtkcompat.py
rmdir /usr/local/lib/python3.6/site-packages/pygtkcompat/__pycache__
rmdir /usr/local/lib/python3.6/site-packages/pygtkcompat
rmdir /usr/local/lib/python3.6/site-packages/gi/repository/__pycache__
rmdir /usr/local/lib/python3.6/site-packages/gi/repository
rmdir /usr/local/lib/python3.6/site-packages/gi/overrides/__pycache__
rmdir /usr/local/lib/python3.6/site-packages/gi/overrides
rmdir /usr/local/lib/python2.7/site-packages/pygtkcompat
/usr/bin/sandbox-exec -f /tmp/homebrew20180301-42809-1xvjxwm.sb nice /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -W0 -I /usr/local/Homebrew/Library/Homebrew -- /usr/local/Homebrew/Library/Homebrew/build.rb /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/pygobject3.rb --verbose
==> Downloading https://download.gnome.org/sources/pygobject/3.26/pygobject-3.26.1.tar.xz
Already downloaded: /usr/local/var/homebrewcache/pygobject3-3.26.1.tar.xz
==> Verifying pygobject3-3.26.1.tar.xz checksum
tar xJf /usr/local/var/homebrewcache/pygobject3-3.26.1.tar.xz
ln -s ../Cellar/pygobject3/3.26.1/include/pygobject-3.0 pygobject-3.0
ln -s ../../Cellar/pygobject3/3.26.1/lib/pkgconfig/pygobject-3.0.pc pygobject-3.0.pc
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/__init__.py __init__.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/_constants.py _constants.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/_error.py _error.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/_gi.so _gi.so
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/_gi_cairo.so _gi_cairo.so
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/_option.py _option.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/_propertyhelper.py _propertyhelper.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/_signalhelper.py _signalhelper.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/docstring.py docstring.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/importer.py importer.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/module.py module.py
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/overrides/GIMarshallingTests.py GIMarshallingTests.py
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/overrides/GLib.py GLib.py
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/overrides/GObject.py GObject.py
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/overrides/Gdk.py Gdk.py
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/overrides/Gio.py Gio.py
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/overrides/Gtk.py Gtk.py
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/overrides/Pango.py Pango.py
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/overrides/__init__.py __init__.py
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/overrides/keysyms.py keysyms.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/pygtkcompat.py pygtkcompat.py
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/repository/__init__.py __init__.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/gi/types.py types.py
ln -s ../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/pygobject-3.26.1-py2.7.egg-info pygobject-3.26.1-py2.7.egg-info
mkdir -p /usr/local/lib/python2.7/site-packages/pygtkcompat
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/pygtkcompat/__init__.py __init__.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/pygtkcompat/generictreemodel.py generictreemodel.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python2.7/site-packages/pygtkcompat/pygtkcompat.py pygtkcompat.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/__init__.py __init__.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/_constants.py _constants.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/_error.py _error.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/_gi.cpython-36m-darwin.so _gi.cpython-36m-darwin.so
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/_gi_cairo.cpython-36m-darwin.so _gi_cairo.cpython-36m-darwin.so
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/_option.py _option.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/_propertyhelper.py _propertyhelper.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/_signalhelper.py _signalhelper.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/docstring.py docstring.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/importer.py importer.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/module.py module.py
mkdir -p /usr/local/lib/python3.6/site-packages/gi/overrides
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/overrides/GIMarshallingTests.py GIMarshallingTests.py
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/overrides/GLib.py GLib.py
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/overrides/GObject.py GObject.py
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/overrides/Gdk.py Gdk.py
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/overrides/Gio.py Gio.py
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/overrides/Gtk.py Gtk.py
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/overrides/Pango.py Pango.py
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/overrides/__init__.py __init__.py
mkdir -p /usr/local/lib/python3.6/site-packages/gi/overrides/__pycache__
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/overrides/keysyms.py keysyms.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/pygtkcompat.py pygtkcompat.py
mkdir -p /usr/local/lib/python3.6/site-packages/gi/repository
ln -s ../../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/repository/__init__.py __init__.py
mkdir -p /usr/local/lib/python3.6/site-packages/gi/repository/__pycache__
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/gi/types.py types.py
ln -s ../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/pygobject-3.26.1-py3.6.egg-info pygobject-3.26.1-py3.6.egg-info
mkdir -p /usr/local/lib/python3.6/site-packages/pygtkcompat
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/pygtkcompat/__init__.py __init__.py
mkdir -p /usr/local/lib/python3.6/site-packages/pygtkcompat/__pycache__
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/pygtkcompat/generictreemodel.py generictreemodel.py
ln -s ../../../../Cellar/pygobject3/3.26.1/lib/python3.6/site-packages/pygtkcompat/pygtkcompat.py pygtkcompat.py
Error: Empty installation
s.change_make_var! "LINKFORSHARED",
"-u _PyMac_Error $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)"
end
# Any .app get a " 3" attached, so it does not conflict with python 2.x.

This comment has been minimized.

@DomT4

DomT4 Mar 1, 2018

Contributor

Isn't linkapps pretty much dead now, rendering anything regarding app versioning redundant? If not, should possibly be the other way around, with the new keg_only python@2 formula getting the versioned apps and this formula the standard names?

%r{('LINKFORSHARED': .*?)'(Python.framework/Versions/3.\d+/Python)'}m,
"\\1'#{opt_prefix}/Frameworks/\\2'"
# A fix, because python and python3 both want to install Python.framework

This comment has been minimized.

@DomT4

DomT4 Mar 1, 2018

Contributor

Irrelevant with python@2 becoming keg_only, no?

This comment has been minimized.

@ilovezfs

ilovezfs Mar 1, 2018

Contributor

brew link -f python@2 should not require --overwrite.

# Set the sys.executable to use the opt_prefix
sys.executable = '#{opt_bin}/python2.7'
sys.executable = '#{opt_bin}/python#{xy}'

This comment has been minimized.

@DomT4

DomT4 Mar 1, 2018

Contributor

Not just #{opt_bin}/python?

This comment has been minimized.

@ilovezfs

ilovezfs Mar 1, 2018

Contributor

probably not since it was using python2.7 not python previously

end
def install
ENV.permit_weak_imports

This comment has been minimized.

@DomT4

DomT4 Mar 1, 2018

Contributor

A good opportunity to get rid of this IMO. I'd be surprised if we ever dug permit_weak_imports out of its coffin in future by this point.

# even if homebrew is not a /usr/local/lib. Try this with:
# `brew install enchant && pip2 install pyenchant`
inreplace "./Lib/ctypes/macholib/dyld.py" do |f|
f.gsub! "DEFAULT_LIBRARY_FALLBACK = [", "DEFAULT_LIBRARY_FALLBACK = [ '#{HOMEBREW_PREFIX}/lib',"

This comment has been minimized.

@DomT4

DomT4 Mar 1, 2018

Contributor

Should these not point to the Cellar paths now this is keg_only? Unless I'm missing something here?

This comment has been minimized.

@ilovezfs

ilovezfs Mar 1, 2018

Contributor

probably opt paths

frameworks/"Python.framework/Versions/Current/lib/pkgconfig/python-2.7.pc"],
prefix, opt_prefix
# Symlink the pkgconfig files into HOMEBREW_PREFIX so they're accessible.

This comment has been minimized.

@DomT4

DomT4 Mar 1, 2018

Contributor

into HOMEBREW_PREFIX is no longer normally true.

end
def caveats; <<~EOS
This formula installs a python2 executable to #{HOMEBREW_PREFIX}/bin.

This comment has been minimized.

@DomT4

DomT4 Mar 1, 2018

Contributor

installs a python2 executable to #{HOMEBREW_PREFIX}/bin

"Fake News" 😉.

@DomT4

This comment has been minimized.

Contributor

DomT4 commented Mar 1, 2018

The sheer scale of the changes here makes missing stuff inevitable but hopefully some of that review is helpful.

@DomT4

This comment has been minimized.

Contributor

DomT4 commented Mar 1, 2018

We might need to look at scons too. It uses #! /usr/bin/env python as the hashbang, but is being built using the system "/usr/bin/python", so after this as things stand it'll be built using python2 but running python3.

Full list for me locally:

~> grep -H "/usr/bin/env python" *
KateDJ:#!/usr/bin/env python
g-ir-annotation-tool:#!/usr/bin/env python
g-ir-scanner:#!/usr/bin/env python
gcovr:#!/usr/bin/env python
gtk-builder-convert:#!/usr/bin/env python
Binary file ninja matches
nodeenv:#!/usr/bin/env python
onetime:#!/usr/bin/env python
scons:#! /usr/bin/env python
scons-configure-cache:#! /usr/bin/env python
scons-time:#!/usr/bin/env python
sconsign:#! /usr/bin/env python
uninstall_ndiff:#!/usr/bin/env python
uninstall_zenmap:#!/usr/bin/env python
Binary file youtube-dl matches
@methane

This comment has been minimized.

Contributor

methane commented Mar 1, 2018

It seems we should avoid symlink python => python3 for this time?

@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 1, 2018

@methane that is quite intentional. brew install python will lead to a python being in your PATH, and that python will be Python 3.

@methane

This comment has been minimized.

Contributor

methane commented Mar 1, 2018

@ilovezfs I'm very happy about " python being in your PATH, and that python will be Python 3."

But when I read the announcement, I didn't expect it happen on this time.
I expected only (1) brew install python installs python 3, and (2) Some Formulas including vim start using Python 3 instead of Python 2.
Since macOS doesn't provide /usr/bin/python2, I think there are many shebang #! /usr/bin/env python. I'm worrying this change breaks many such scripts...

But while the announcement was unclear about it, the painful change should be happen at some time.
I'm -0 about do it today.

@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 1, 2018

Since macOS doesn't provide /usr/bin/python2, I think there are many shebang #! /usr/bin/env python. I'm worrying this change breaks many such scripts...

That is a feature. Those scripts need to be changed to #!/usr/bin/env python2.7 or #!/usr/bin/python

@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 1, 2018

@DomT4 PR refreshed.

@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 1, 2018

@BrewTestBot test this please

@DomT4

This comment has been minimized.

Contributor

DomT4 commented Mar 2, 2018

I think pygobject3 needs a deprecated_option between python3 and python here, but otherwise I'm not hitting any issues testing this PR a bit locally again. IMO if we're going hard on python3 we could just turn it on by default for pygobject3 but I think people have feelings about that one.

@ilovezfs ilovezfs closed this in b5eb79e Mar 2, 2018

@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 2, 2018

@DomT4 fixed while pulling.

@DomT4

This comment has been minimized.

Contributor

DomT4 commented Mar 2, 2018

Thanks Joe 👍.

@ilovezfs ilovezfs removed the do not merge label Mar 2, 2018

@DomT4

This comment has been minimized.

Contributor

DomT4 commented Mar 2, 2018

Heads up on some newly discovered issues:

==> Deleted Formulae
python3 ✔
==> Migrating python3 to python
==> Unlinking python3
==> Unlinking python
==> Moving python3 children
==> Linking python
Error: Error while executing `brew link` step on python
Could not symlink bin/easy_install
Target /usr/local/bin/easy_install
already exists. You may want to remove it:
  rm '/usr/local/bin/easy_install'

To force the link and overwrite all conflicting files:
  brew link --overwrite python

To list all files that would be deleted:
  brew link --overwrite --dry-run python

Possible conflicting files are:
/usr/local/bin/easy_install
Error: Error occurred while migrating.
Could not symlink bin/easy_install
Target /usr/local/bin/easy_install
already exists. You may want to remove it:
  rm '/usr/local/bin/easy_install'

To force the link and overwrite all conflicting files:
  brew link --overwrite python

To list all files that would be deleted:
  brew link --overwrite --dry-run python
Backing up...
==> Upgrading 9 outdated packages, with result:
boost-python3 1.66.0_1, vim 8.0.1553_1, diffoscope 90_2, python 3.6.4_3, certbot 0.21.1_1, sip 4.19.7_2, httpie 0.9.9_2, pyqt 5.10_1, py3cairo 1.16.3_1
==> /usr/local/Cellar/python/3.6.4_3/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/3.6.4_3/bin --install-lib=/usr/local/lib/pythonCurrent/site-packages --single-version-externally-managed --record=installed.txt
Traceback (most recent call last):
  File "setup.py", line 6, in <module>
    from setuptools import setup, find_packages
ModuleNotFoundError: No module named 'setuptools'
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall python`
[snip]
~> cat /usr/local/var/homebrewcache/logs/python/post_install.02.python3
2018-03-02 05:50:11 +0000

/usr/local/Cellar/python/3.6.4_3/bin/python3
-s
setup.py
--no-user-cfg
install
--force
--verbose
--install-scripts=/usr/local/Cellar/python/3.6.4_3/bin
--install-lib=/usr/local/lib/pythonCurrent/site-packages
--single-version-externally-managed
--record=installed.txt

Traceback (most recent call last):
  File "setup.py", line 6, in <module>
    from setuptools import setup, find_packages
ModuleNotFoundError: No module named 'setuptools'
@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 2, 2018

Maybe you didn't have the migration step happen during brew update? I can't reproduce the issue yet.

@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 2, 2018

What does brew link --overwrite --dry-run python say? We can probably rm_f them in post_install if it's an issue.

@DomT4

This comment has been minimized.

Contributor

DomT4 commented Mar 2, 2018

Found the issue on the latter one.

@DomT4

This comment has been minimized.

Contributor

DomT4 commented Mar 2, 2018

diff --git a/Formula/python.rb b/Formula/python.rb
index c3d57fbeaa..c26e03afb2 100644
--- a/Formula/python.rb
+++ b/Formula/python.rb
@@ -211,7 +211,7 @@ class Python < Formula
   def post_install
     ENV.delete "PYTHONPATH"
 
-    xy = (prefix/"Frameworks/Python.framework/Versions").children.first.basename.to_s
+    xy = (prefix/"Frameworks/Python.framework/Versions").children.last.basename.to_s
     site_packages = HOMEBREW_PREFIX/"lib/python#{xy}/site-packages"
     site_packages_cellar = prefix/"Frameworks/Python.framework/Versions/#{xy}/lib/python#{xy}/site-packages"
 
@@ -281,7 +281,7 @@ class Python < Formula
   end
 
   def sitecustomize
-    xy = (prefix/"Frameworks/Python.framework/Versions").children.first.basename.to_s
+    xy = (prefix/"Frameworks/Python.framework/Versions").children.last.basename.to_s
 
     <<~EOS
       # This file is created by Homebrew and is executed on each python startup.
@@ -322,7 +322,7 @@ class Python < Formula
 
   def caveats
     if prefix.exist?
-      xy = (prefix/"Frameworks/Python.framework/Versions").children.first.basename.to_s
+      xy = (prefix/"Frameworks/Python.framework/Versions").children.last.basename.to_s
     else
       xy = version.to_s.slice(/(3\.\d)/) || "3.6"
     end
@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 2, 2018

That doesn't explain why I'm not seeing it.

@DomT4

This comment has been minimized.

Contributor

DomT4 commented Mar 2, 2018

APFS? Maybe? For me:

prefix = Pathname.new("/usr/local/Cellar/python/3.6.4_3")
=> #<Pathname:/usr/local/Cellar/python/3.6.4_3>

xy = (prefix/"Frameworks/Python.framework/Versions").children.first.basename.to_s
=> "Current"
@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 2, 2018

Yes that sounds likely, so probably sort.first?

@DomT4

This comment has been minimized.

Contributor

DomT4 commented Mar 2, 2018

I can't reproduce the linkage failure from a fresh install. I fairly regularly update my pip-installed stuff locally so it's possible I created something as part of that brew felt unable to overwrite given its cautious nature.

If you wanted to be safe I'd agree with getting liberal with rm_f in post_install but we could wait to see whether it's a widespread issue or not.

sort.first

Aye. That works locally:

xy = (prefix/"Frameworks/Python.framework/Versions").children.sort.first.basename.to_s
=> "3.6"
@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 2, 2018

Yeah, I see it on 10.13 but not 10.11. Want to open a PR?

@DomT4

This comment has been minimized.

Contributor

DomT4 commented Mar 2, 2018

Sure, incoming. Do you want the rm_f fun or do you want to wait & see on that?

@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 2, 2018

Let's wait on the rm_f for a bit, and see if anyone hits it who wasn't previously testing this PR.

@sjackman

This comment has been minimized.

Contributor

sjackman commented Mar 2, 2018

brew upgrade python failed for me during brew postinstall. See #24702

@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 2, 2018

@sjackman did you read the above?

@lembacon

This comment has been minimized.

Member

lembacon commented Mar 2, 2018

Those new bottles (at least those High Sierra bottles) for ipython, ipython@5 and jupyter have been opportunistically linked against zeromq. May need triggering a rebuild. 🙃

@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 2, 2018

@lembacon mind opening a PR adding it as a dependency and bumping the revision?

@lembacon

This comment has been minimized.

Member

lembacon commented Mar 2, 2018

@ilovezfs Sure.

@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 2, 2018

Thanks!

@Homebrew Homebrew locked and limited conversation to collaborators Mar 2, 2018

@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 2, 2018

I've locked this so that any further problems get handled via issue reports: https://github.com/Homebrew/homebrew-core/issues

ilovezfs referenced this pull request Mar 2, 2018

python 3.6.4
renamed from python3

Also, install unversioned symlinks "python", "python-config", "pip" etc.
pointing to "python3", "python3-config", "pip3" etc., respectively.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.