[Cryptech-Commits] [releng/alpha] 02/02: Better Homebrew fix: Just symlink our bindings into our vendor tree.

git at cryptech.is git at cryptech.is
Sat May 20 16:23:00 UTC 2017


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

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

commit 37e2720eec1ee0b6cbd7306b4d6fafb09684d140
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Sat May 20 12:17:44 2017 -0400

    Better Homebrew fix: Just symlink our bindings into our vendor tree.
    
    Homebrew reserves the right to decide on the fly which copy of the
    Python 2.7 interpreter (Apple's or Homebrew's) we should be using.
    This is mostly reasonable, but makes it tricky when a Homebrew package
    includes both a Python "application" and Python "bindings", because
    the bindings may be installed where the script doesn't see them.  So
    we symlink the bindings into the application's private library tree,
    just as if the bindings were a third-party library our application
    needed.  Silly, but it works (this week).
---
 scripts/build-homebrew-formula.py | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/scripts/build-homebrew-formula.py b/scripts/build-homebrew-formula.py
index d386142..a8e387c 100755
--- a/scripts/build-homebrew-formula.py
+++ b/scripts/build-homebrew-formula.py
@@ -30,25 +30,19 @@ template = '''\
 # Homebrew's hack to run our executable Python scripts with PYTHONPATH
 # pointing to our private library directory.  Our own Python library
 # code, however, is what Homebrew considers "bindings", so we install
-# those where user scripts as well as our own can find them.
+# 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.
 #
 # We have to build our own software before installing our Python code,
 # because at least one of the Python modules we install
 # (cryptech.py11.attribute_map) is generated during the build.
-
-# The declared dependency on "python" (NOT :python) is undocumented
-# Homebrew voodoo to force our scripts to use Homebrew's version of
-# Python so that they can see the libraries we install.  Not really
-# sure why this is necessary given what the documentation does say,
-# but without this, at least on Sierra, I end up with scripts using
-# /usr/bin/python trying to load libraries which were installed
-# under /usr/local/..., which doesn't work.
 #
-# Reference for all the Python documented voodoo:
+# Reference for all the documented Python Homebrew voodoo:
 #
 # http://docs.brew.sh/Python-for-Formula-Authors.html
 #
-# Reference for the undocuemnted Python voodoo:
+# Reference for undocumented Python Homebrew voodoo:
 #
 # /usr/local/Homebrew/Library/Homebrew/language/python.rb
 
@@ -62,8 +56,6 @@ class {classname} < Formula
 
 {conflicts}
 
-  depends_on "python"
-
   resource "pyserial" do
     url    "https://pypi.python.org/packages/3c/d8/a9fa247ca60b02b3bebbd61766b4f321393b57b13c53b18f6f62cf172c08/pyserial-3.1.1.tar.gz"
     sha256 "d657051249ce3cbd0446bcfb2be07a435e1029da4d63f53ed9b4cdde7373364c"
@@ -106,6 +98,8 @@ 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"
+
     share.install "cryptech-alpha-firmware.tar.gz"
     lib.install   "sw/pkcs11/libcryptech-pkcs11.dylib"
 



More information about the Commits mailing list