From 37af7254104ca741bee40a56cee9ed79dd947118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20M=C3=BCller?= Date: Sat, 14 Dec 2024 11:53:05 +0100 Subject: [PATCH] rpds-py 0.22.3 (new formula) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .github/autobump.txt | 1 + Formula/r/rpds-py.rb | 73 ++++++++++++++++++++++++++++++++++++++ pypi_formula_mappings.json | 3 ++ 3 files changed, 77 insertions(+) create mode 100644 Formula/r/rpds-py.rb diff --git a/.github/autobump.txt b/.github/autobump.txt index f3a4b83d87c521..51e0ea4cc93daf 100644 --- a/.github/autobump.txt +++ b/.github/autobump.txt @@ -2611,6 +2611,7 @@ rospo roswell rover roxctl +rpds-py rpg-cli rpki-client rpl diff --git a/Formula/r/rpds-py.rb b/Formula/r/rpds-py.rb new file mode 100644 index 00000000000000..ae406bfff8fb35 --- /dev/null +++ b/Formula/r/rpds-py.rb @@ -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 "python@3.11" => [:build, :test] + depends_on "python@3.12" => [:build, :test] + depends_on "maturin" => :build + 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 diff --git a/pypi_formula_mappings.json b/pypi_formula_mappings.json index 0ff8210764a2b5..afaa5c46e87495 100644 --- a/pypi_formula_mappings.json +++ b/pypi_formula_mappings.json @@ -740,6 +740,9 @@ "extra_packages": ["robotframework-archivelibrary", "robotframework-selenium2library", "robotframework-sshlibrary"], "exclude_packages": ["certifi", "cryptography"] }, + "rpds-py": { + "extra_packages": ["setuptools-rust"] + }, "ruff-lsp": { "exclude_packages": ["ruff"] },