diff options
author | Rob Austein <sra@hactrn.net> | 2020-07-12 18:25:56 -0400 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2020-07-12 18:25:56 -0400 |
commit | 9e6b0d1117e21f2e6d092e337c5c522726016467 (patch) | |
tree | cc4eb37125fc6f1c3a173d5e17a0ec14ab58555f /scripts/build-homebrew-formula.py | |
parent | 37329250395aa3ac724fca99bbd2de01efea10e1 (diff) |
Attempt to go Python3-only
Ubuntu 20.04 no longer really supports Python 2, so we'd have to fork
the packaging code if we wanted to keep support for Python 2
elsewhere. Given that Python 3 has been around for a more than a
decade and that Python 2 was formally EOLed more than six months ago
as of this writing, this seems like an unnecessary complication.
The biggest change is rewriting the Homebrew formula for Python 3.
Diffstat (limited to 'scripts/build-homebrew-formula.py')
-rwxr-xr-x | scripts/build-homebrew-formula.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/build-homebrew-formula.py b/scripts/build-homebrew-formula.py index 54cdcae..852b4b6 100755 --- a/scripts/build-homebrew-formula.py +++ b/scripts/build-homebrew-formula.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Yes, this is a Python program writing a Ruby program. @@ -32,7 +32,7 @@ template = '''\ # code, however, is what Homebrew considers "bindings", so we install # those where user scripts as well as our own can find them...then we # add a symlink so that our scripts can find our bindings regardless -# of which copy of Python 2.7 Homebrew decides we should use this week. +# of which copy of Python Homebrew decides we should use this week. # # We have to build our own software before installing our Python code, # because at least one of the Python modules we install @@ -54,6 +54,8 @@ class {classname} < Formula url "{url}" sha256 "{sha256}" + depends_on "python@3.8" + {conflicts} resource "pyserial" do @@ -88,11 +90,13 @@ class {classname} < Formula def install - ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages" + xy = Language::Python.major_minor_version "python3" + + ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python#{xy}/site-packages" resources.each do |r| r.stage do - system "python", *Language::Python.setup_install_args(libexec/"vendor") + system "python3", *Language::Python.setup_install_args(libexec/"vendor") end end @@ -103,7 +107,7 @@ class {classname} < Formula system "python", *Language::Python.setup_install_args(prefix) bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"]) - ln_s lib/"python2.7/site-packages/cryptech", libexec/"vendor/lib/python2.7/site-packages/cryptech" + ln_s lib/"python#{xy}/site-packages/cryptech", libexec/"vendor/lib/python#{xy}/site-packages/cryptech" share.install "cryptech-alpha-firmware.tar.gz" lib.install "sw/pkcs11/libcryptech-pkcs11.dylib" |