LoginSignup
1
0

More than 5 years have passed since last update.

homebrew の git logを確認して Python 3.6.5のインストールしてみる。

Last updated at Posted at 2018-08-16

概要

Homebrewのpythonバージョンが 3.7.0になりました。依存バッケージが対応してないとかリリースしたばっかりで心理的に安心感がないなど様々の理由で 3.6を入れたい方もいらっしゃると思います。

下記のようにググってみれば、stackoverflowとか、他のQiitaで結果だけは出てくると思います。

bash
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb

バージョンが変わったときにいつもググってもいいんですが、自分から調べてインストールしてみるのもたまにはいい経験だと思い調べ始めた記録のメモです。

事前確認

  • brewの情報
bash
$ brew config
HOMEBREW_VERSION: 1.7.1
ORIGIN: https://github.com/Homebrew/brew
HEAD: d6a245c05110c240e680da594c2cc6038998b82e
Last commit: 3 weeks ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 5914336caa74a9731228e401f5b034bc9ff6e558
Core tap last commit: 2 hours ago
HOMEBREW_PREFIX: /usr/local
... 省略 ...

$ ls /usr/local/
Frameworks  bin     etc     lib     sbin        var
Cellar      Homebrew    include     opt     share

HOMEBREW_PREFIX: /usr/localの情報からls /usr/local/からリストを確認し/usr/local/Homebrewにイントールされていることを確認しました。

  • pythonの情報
bash
$ brew info python
python: stable 3.7.0 (bottled), HEAD
Interpreted, interactive, object-oriented programming language
https://www.python.org/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/python.rb
==> Dependencies
... 省略 ...

pythonのバージョンは3.7.0、インストールファイルはhttps://github.com/Homebrew/homebrew-core/blob/master/Formula/python.rbであることを確認できる

logから情報を掘り下げる

  • 先にローカルのpython.rbを見つてログを確認する。
bash
$ find /usr/local/Homebrew -name "python.rb"
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/python.rb
/usr/local/Homebrew/Library/Homebrew/language/python.rb

確認場所は/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/python.rb

  • 移動して確認
bash
$ cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/
$ git log -- Formula/python.rb
commit 0d2de897ce45ab8134d82806198ef94352beca6c
Author: BrewTestBot <brew-test-bot@googlegroups.com>
Date:   Mon Jul 23 22:22:12 2018 +0000

    python: update 3.7.0 bottle.

commit 6ddeb47ef4f7dab1a3a14924bad57218ccff77b4
Author: Chongyu Zhu <i@lembacon.com>
Date:   Tue Jul 24 01:42:55 2018 +0800

    python: update resources

commit 95e6e4671eb28cc783b9c0082547701829bbba9f (grafted)
Author: BrewTestBot <brew-test-bot@googlegroups.com>
Date:   Sun Jul 8 10:23:42 2018 +0000

    cython: update 0.28.4 bottle.

logが3件(自分のローカル上)出力して(grafted)それ以上のログが出て来ない。。
理由は git clone時すべてのコミット履歴(depth)ではなく、Homebrewをインストールした時点からアップグレードした分を保持しているからだと思います。

  • depthを取得して確認する
$ git fetch --depth 10000
$ git log -- Formula/python.rb
commit 0d2de897ce45ab8134d82806198ef94352beca6c
Author: BrewTestBot <brew-test-bot@googlegroups.com>
Date:   Mon Jul 23 22:22:12 2018 +0000

    python: update 3.7.0 bottle.

commit 6ddeb47ef4f7dab1a3a14924bad57218ccff77b4
Author: Chongyu Zhu <i@lembacon.com>
Date:   Tue Jul 24 01:42:55 2018 +0800

    python: update resources

commit 6aa3259abc04f5079b008844eacbe5a181cc69a8
Author: BrewTestBot <brew-test-bot@googlegroups.com>
Date:   Sat Jun 30 06:22:00 2018 +0000

    python: update 3.7.0 bottle.

commit e23247ec179ba32f277857e89b7ae8e70b3e177c
Author: Aleks Bunin <github@compuix.com>
Date:   Wed Jun 27 19:55:02 2018 -0400

    python 3.7.0

commit f2a764ef944b1080be64bd88dca9a1d80130c558    <-- ここです。
Author: BrewTestBot <brew-test-bot@googlegroups.com>
Date:   Sun Jun 17 13:24:46 2018 +0000

    python: update 3.6.5_1 bottle.

commit b60c0325575ed4c3c90ba061880a79bc0c208cf0
Author: commitay <commitay@users.noreply.github.com>
Date:   Sun Jun 17 18:01:44 2018 +1000

    python: revision for gdbm

    Also, update `setuptools` and `wheel` resources

commit c1f561a772a747d711657afa2644287aa0cc9a40
Author: commitay <commitay@users.noreply.github.com>
Date:   Wed Jun 13 19:26:30 2018 +1000

    python 3.7.0rc1 (devel) (#28975)

コミットIDは確認できました。

RawのURLを取得する

Githubpython.rbを開き、rawのurlを取得する

アドレスバーから取得したURLhttps://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/python.rbです。

URLのmasterをコミットIDに書き換えるとPython 3.6.5_1のRawのURLになります。

https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb

自分で調べたアドレスでインストル(ググったコマンドと変わらない)

bash
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb

以上です。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0