[Cryptech-Commits] [user/sra/alpha-releng/omnibus] branch master updated: Fix Homebrew Python voodoo so that PySerial loads correctly.

git at cryptech.is git at cryptech.is
Mon Jul 4 07:29:07 UTC 2016


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch master
in repository user/sra/alpha-releng/omnibus.

The following commit(s) were added to refs/heads/master by this push:
       new  05e0309   Fix Homebrew Python voodoo so that PySerial loads correctly.
05e0309 is described below

commit 05e0309001db74e343832a7afc4b4c8d23896c73
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Mon Jul 4 03:28:58 2016 -0400

    Fix Homebrew Python voodoo so that PySerial loads correctly.
---
 build-homebrew-formula.py | 18 +++++++++++++++---
 1 file 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

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Commits mailing list