aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-07-04 03:28:58 -0400
committerRob Austein <sra@hactrn.net>2016-07-04 03:28:58 -0400
commit05e0309001db74e343832a7afc4b4c8d23896c73 (patch)
tree4e88b2f8108b9d69197ed48f559c871c8d3e178a
parent2d4f18558898417ee03e0b702aa9de758166f427 (diff)
Fix Homebrew Python voodoo so that PySerial loads correctly.
-rwxr-xr-xbuild-homebrew-formula.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/build-homebrew-formula.py b/build-homebrew-formula.py
index 26a587c..e82c1a5 100755
--- a/build-homebrew-formula.py
+++ b/build-homebrew-formula.py
@@ -40,22 +40,34 @@ class CryptechAlpha < Formula
end
def install
- # Homebrew voodoo for installing Python dependencies without depending on pip.
- # In theory, this handles any number of (Python) resource specifications.
+ # Installation is a bit complex due to the way Homebrew handles
+ # Python library dependencies and due to our stuff being a mix of
+ # Python and C.
+
+ # Set PYTHONPATH to point to our private library location.
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages"
+
+ # Add all resources (and assume they are all Python, be careful...).
resources.each do |r|
r.stage do
system "python", *Language::Python.setup_install_args(libexec/"vendor")
end
end
+ # Build everything.
ohai "Building PKCS #11 code (including crypto and bignum libraries) from source, this is slow, sorry..."
ENV.deparallelize
system "make", "-C", "sw/pkcs11"
+
+ # Install the Python script(s) then replace them with stubs which
+ # set PYTHONPATH before calling the real script(s).
+ sbin.install "sw/stm32/projects/hsm/cryptech_upload"
+ sbin.env_script_all_files(libexec/"sbin", :PYTHONPATH => ENV["PYTHONPATH"])
+
+ # Install other (non-Python) stuff, then we are done.
share.install "cryptech-alpha-firmware.tar.gz"
lib.install "sw/pkcs11/libpkcs11.dylib"
sbin.install "sw/pkcs11/p11util"
- sbin.install "sw/stm32/projects/hsm/cryptech_upload"
end
end