【问题标题】:Simple homebrew formula for PythonPython的简单自制公式
【发布时间】:2015-07-27 18:23:19
【问题描述】:

我有一个简单的 python 应用程序,我想通过私人 Homebrew 水龙头进行分发。我在主仓库中有以下文件:

test/
  test.sh     # script that runs the python script below.
  main.py     # main script.

以下配置 (test.rb) 已提交到我的 Tap repo:

class Test < Formula
  desc "Test."
  url "https://github.com/..."
  version "0.0.1"

  def install
    bin.install "test.sh"
  end

  test do
  end
end

但是当我安装时 main.py 文件不可用。

  1. 如何分发(和引用)相关的源脚本?
  2. 我可以重命名在 /usr/local/bin 中创建的符号链接吗?
  3. 是否有比https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md 更完整的文档(例如,列出完整的命令语法?)

谢谢。

【问题讨论】:

    标签: homebrew


    【解决方案1】:

    上面的公式没有提到python文件,所以没有安装。您可以尝试以下方法:

    libexec.install "test.sh", "main.py"
    bin.install_symlink libexec/"test.sh" => "test"
    

    这里是完整的文档:https://github.com/Homebrew/homebrew/tree/master/share/doc/homebrew

    【讨论】:

    • 非常感谢 - 成功了。不过,从符号链接中找出脚本的路径是很棘手的。我得到了它的工作,但似乎我错过了什么? DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) SCRIPT=$(dirname $(readlink "$0")) ROOT=$DIR/$SCRIPT/../libexec python $ ROOT/main.py $@
    猜你喜欢
    • 2016-02-14
    • 1970-01-01
    • 2021-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多