-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For GNU Radio, we need jsonschema, which in turn depends on rpds-py, which in turn depends on Rust. It seemed desirable to move that dependency (since it's generally useful and doesn't need to be rebuilt for every GNU Radio build) into its own formula. See GH #201049. This supersedes #178716. Unlike that, it uses the existing maturin formula instead of doing a pypi-based source build. Signed-off-by: Marcus Müller <[email protected]>
- Loading branch information
1 parent
34b2b81
commit 20bb67d
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2611,6 +2611,7 @@ rospo | |
roswell | ||
rover | ||
roxctl | ||
rpds-py | ||
rpg-cli | ||
rpki-client | ||
rpl | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
class RpdsPy < Formula | ||
include Language::Python::Virtualenv | ||
|
||
desc "Python bindings to Rust's persistent data structures" | ||
homepage "https://rpds.readthedocs.io/en/latest/" | ||
url "https://files.pythonhosted.org/packages/01/80/cce854d0921ff2f0a9fa831ba3ad3c65cee3a46711addf39a2af52df2cfd/rpds_py-0.22.3.tar.gz" | ||
sha256 "e32fee8ab45d3c2db6da19a5323bc3362237c8b653c70194414b892fd06a080d" | ||
license "MIT" | ||
|
||
depends_on "maturin" => :build | ||
depends_on "[email protected]" => [:build, :test] | ||
depends_on "[email protected]" => [:build, :test] | ||
depends_on "rust" => :build | ||
|
||
resource "semantic-version" do | ||
url "https://files.pythonhosted.org/packages/7d/31/f2289ce78b9b473d582568c234e104d2a342fd658cc288a7553d83bb8595/semantic_version-2.10.0.tar.gz" | ||
sha256 "bdabb6d336998cbb378d4b9db3a4b56a1e3235701dc05ea2690d9a997ed5041c" | ||
end | ||
|
||
resource "setuptools" do | ||
url "https://files.pythonhosted.org/packages/43/54/292f26c208734e9a7f067aea4a7e282c080750c4546559b58e2e45413ca0/setuptools-75.6.0.tar.gz" | ||
sha256 "8199222558df7c86216af4f84c30e9b34a61d8ba19366cc914424cdbd28252f6" | ||
end | ||
|
||
resource "setuptools-rust" do | ||
url "https://files.pythonhosted.org/packages/d3/6b/99a1588d826ceb108694ba00f78bc6afda10ed5d72d550ae8f256af1f7b4/setuptools_rust-1.10.2.tar.gz" | ||
sha256 "5d73e7eee5f87a6417285b617c97088a7c20d1a70fcea60e3bdc94ff567c29dc" | ||
end | ||
|
||
def pythons | ||
deps.map(&:to_formula) | ||
.select { |f| f.name.start_with?("python@") } | ||
.map { |f| f.opt_libexec/"bin/python" } | ||
end | ||
|
||
def install | ||
ENV.append_path "PATH", buildpath/"bin" | ||
pythons.each do |python3| | ||
ENV.append_path "PYTHONPATH", buildpath/Language::Python.site_packages(python3) | ||
|
||
deps = %w[setuptools setuptools-rust semantic-version] | ||
deps.each do |r| | ||
resource(r).stage do | ||
system python3, "-m", "pip", "install", *std_pip_args(prefix: buildpath), "." | ||
end | ||
end | ||
|
||
system python3, "-m", "pip", "install", *std_pip_args, "." | ||
end | ||
end | ||
|
||
test do | ||
(testpath/"test.py").write <<~EOS | ||
from rpds import HashTrieMap, HashTrieSet, List | ||
m = HashTrieMap({"foo": "bar", "baz": "quux"}) | ||
assert m.insert("spam", 37) == HashTrieMap({"foo": "bar", "baz": "quux", "spam": 37}) | ||
assert m.remove("foo") == HashTrieMap({"baz": "quux"}) | ||
s = HashTrieSet({"foo", "bar", "baz", "quux"}) | ||
assert s.insert("spam") == HashTrieSet({"foo", "bar", "baz", "quux", "spam"}) | ||
assert s.remove("foo") == HashTrieSet({"bar", "baz", "quux"}) | ||
L = List([1, 3, 5]) | ||
assert L.push_front(-1) == List([-1, 1, 3, 5]) | ||
assert L.rest == List([3, 5]) | ||
EOS | ||
|
||
pythons.each do |python3| | ||
system python3, "test.py" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters