Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python-markdown: use venv #175442

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 12 additions & 23 deletions Formula/p/python-markdown.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class PythonMarkdown < Formula
include Language::Python::Virtualenv

desc "Python implementation of Markdown"
homepage "https://python-markdown.github.io"
url "https://files.pythonhosted.org/packages/22/02/4785861427848cc11e452cc62bb541006a1087cf04a1de83aedd5530b948/Markdown-3.6.tar.gz"
Expand All @@ -7,37 +9,24 @@ class PythonMarkdown < Formula
head "https://github.com/Python-Markdown/markdown.git", branch: "master"

bottle do
sha256 cellar: :any_skip_relocation, all: "81a78ea79b6c4c44b860a38c8e08a0edb5a2a13ce2f0f2b5d0f4f95d8451cf95"
rebuild 1
sha256 cellar: :any_skip_relocation, arm64_sonoma: "d768ef8b25a991d85f25f9b54ccda3b0156a5f2a1ccd1b41a878f9dfb9143c89"
sha256 cellar: :any_skip_relocation, arm64_ventura: "d768ef8b25a991d85f25f9b54ccda3b0156a5f2a1ccd1b41a878f9dfb9143c89"
sha256 cellar: :any_skip_relocation, arm64_monterey: "d768ef8b25a991d85f25f9b54ccda3b0156a5f2a1ccd1b41a878f9dfb9143c89"
sha256 cellar: :any_skip_relocation, sonoma: "d768ef8b25a991d85f25f9b54ccda3b0156a5f2a1ccd1b41a878f9dfb9143c89"
sha256 cellar: :any_skip_relocation, ventura: "d768ef8b25a991d85f25f9b54ccda3b0156a5f2a1ccd1b41a878f9dfb9143c89"
sha256 cellar: :any_skip_relocation, monterey: "d768ef8b25a991d85f25f9b54ccda3b0156a5f2a1ccd1b41a878f9dfb9143c89"
sha256 cellar: :any_skip_relocation, x86_64_linux: "ee3a6fb9c640fd8b1bd6ec3fefd3f1741db6be5e754c35bd0e230c1c996a72e1"
end

depends_on "python-setuptools" => :build
depends_on "[email protected]" => [:build, :test]
depends_on "[email protected]" => [:build, :test]

def pythons
deps.map(&:to_formula).sort_by(&:version).filter { |f| f.name.start_with?("python@") }
end
depends_on "[email protected]"

def install
pythons.each do |python|
python_exe = python.opt_libexec/"bin/python"
system python_exe, "-m", "pip", "install", *std_pip_args, "."
end
end

def caveats
<<~EOS
To run `markdown_py`, you may need to `brew install #{pythons.last}`
EOS
virtualenv_install_with_resources
end

test do
(testpath/"test.md").write("# Hello World!")
assert_equal "<h1>Hello World!</h1>", shell_output(bin/"markdown_py test.md").strip

pythons.each do |python|
python_exe = python.opt_libexec/"bin/python"
system python_exe, "-c", "import markdown;"
end
end
end
Loading