homebrew-core/Formula/pdm.rb

130 lines
6.3 KiB
Ruby

class Pdm < Formula
include Language::Python::Virtualenv
desc "Modern Python package manager with PEP 582 support"
homepage "https://pdm.fming.dev"
url "https://files.pythonhosted.org/packages/78/2b/e8c84ddd43cb0fb350ee36f1cb11efdc0fa46c0e6537be379ed6d2287c1a/pdm-1.13.2.tar.gz"
sha256 "4d6c33a5f1053c91bcc7a6b494108602d3727bb5120889a897fcd1fb7b779033"
license "MIT"
head "https://github.com/pdm-project/pdm.git", branch: "main"
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "2201a2088099047134cacd6af31707c7d3856d364f5cf3e41a54a165e08fc855"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "2e174bd3652dd94a4f12b4feb21fa666093e18e7e8353bafbee988ed8d81b34b"
sha256 cellar: :any_skip_relocation, monterey: "72b9490962285b62e2024c9b1a91c5bc213008bd287fc5e0d7ccd7c699fa2fff"
sha256 cellar: :any_skip_relocation, big_sur: "a2551c624f39caf255ff179132276ffd619985c8bc0c2eede19975db11830725"
sha256 cellar: :any_skip_relocation, catalina: "65a4c08430e716774613b212ccb8e886f56c9ef95c0c9e75972d1f60f755179c"
sha256 cellar: :any_skip_relocation, x86_64_linux: "98ff3001c0b5a6cf9f3d39e6d123c8aabff83bde393f6efd59a58ff09e6ea0ba"
end
depends_on "python@3.10"
depends_on "six"
resource "attrs" do
url "https://files.pythonhosted.org/packages/d7/77/ebb15fc26d0f815839ecd897b919ed6d85c050feeb83e100e020df9153d2/attrs-21.4.0.tar.gz"
sha256 "626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd"
end
resource "blinker" do
url "https://files.pythonhosted.org/packages/1b/51/e2a9f3b757eb802f61dc1f2b09c8c99f6eb01cf06416c0671253536517b6/blinker-1.4.tar.gz"
sha256 "471aee25f3992bd325afa3772f1063dbdbbca947a041b8b89466dc00d606f8b6"
end
resource "cached-property" do
url "https://files.pythonhosted.org/packages/61/2c/d21c1c23c2895c091fa7a91a54b6872098fea913526932d21902088a7c41/cached-property-1.5.2.tar.gz"
sha256 "9fa5755838eecbb2d234c3aa390bd80fbd3ac6b6869109bfc1b499f7bd89a130"
end
resource "click" do
url "https://files.pythonhosted.org/packages/dd/cf/706c1ad49ab26abed0b77a2f867984c1341ed7387b8030a6aa914e2942a0/click-8.0.4.tar.gz"
sha256 "8458d7b1287c5fb128c90e23381cf99dcde74beaf6c7ff6384ce84d6fe090adb"
end
resource "installer" do
url "https://files.pythonhosted.org/packages/3c/b2/43a6ba5ca6d387adbb63a947a6123324e6f4a91932e0b2b739c3b8417610/installer-0.3.0.tar.gz"
sha256 "e7dc5ec8b737fe3fa7c1872a6ebe120d7abc7cf780aa39af669c382a0fcb6de7"
end
resource "packaging" do
url "https://files.pythonhosted.org/packages/df/9e/d1a7217f69310c1db8fdf8ab396229f55a699ce34a203691794c5d1cad0c/packaging-21.3.tar.gz"
sha256 "dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"
end
resource "pdm-pep517" do
url "https://files.pythonhosted.org/packages/d3/70/f312e27fed1ad25decefae7a8e125349669b86f96a8e135a5086f244e566/pdm-pep517-0.11.2.tar.gz"
sha256 "e000bab43502c191d71808a2630dd44ece301a319d26e002a1caea3a7307cd20"
end
resource "pep517" do
url "https://files.pythonhosted.org/packages/0a/65/6e656d49c679136edfba25f25791f45ffe1ea4ae2ec1c59fe9c35e061cd1/pep517-0.12.0.tar.gz"
sha256 "931378d93d11b298cf511dd634cf5ea4cb249a28ef84160b3247ee9afb4e8ab0"
end
resource "platformdirs" do
url "https://files.pythonhosted.org/packages/33/66/61da40aa546141b0d70b37fe6bb4ef1200b4b4cb98849f131b58faa9a5d2/platformdirs-2.5.1.tar.gz"
sha256 "7535e70dfa32e84d4b34996ea99c5e432fa29a708d0f4e394bbcb2a8faa4f16d"
end
resource "pyparsing" do
url "https://files.pythonhosted.org/packages/d6/60/9bed18f43275b34198eb9720d4c1238c68b3755620d20df0afd89424d32b/pyparsing-3.0.7.tar.gz"
sha256 "18ee9022775d270c55187733956460083db60b37d0d0fb357445f3094eed3eea"
end
resource "python-dotenv" do
url "https://files.pythonhosted.org/packages/49/62/4f25667e10561303a34cb89e3187c35985c0889b99f6f1468aaf17fbb03e/python-dotenv-0.19.2.tar.gz"
sha256 "a5de49a31e953b45ff2d2fd434bbc2670e8db5273606c1e737cc6b93eff3655f"
end
resource "pythonfinder" do
url "https://files.pythonhosted.org/packages/f9/25/958288d4748436b63622e41ef875ef84702488cdcbbce16849bc3e139d40/pythonfinder-1.2.10.tar.gz"
sha256 "ce2a1c2b313d605788173caf68d074f80c00b067364bc57047e68735bc9037d0"
end
resource "resolvelib" do
url "https://files.pythonhosted.org/packages/ac/20/9541749d77aebf66dd92e2b803f38a50e3a5c76e7876f45eb2b37e758d82/resolvelib-0.8.1.tar.gz"
sha256 "c6ea56732e9fb6fca1b2acc2ccc68a0b6b8c566d8f3e78e0443310ede61dbd37"
end
resource "shellingham" do
url "https://files.pythonhosted.org/packages/9c/c9/a3e3bc667c8372a74aa4b16649c3466364cd84f7aacb73453c51b0c2c8a7/shellingham-1.4.0.tar.gz"
sha256 "4855c2458d6904829bd34c299f11fdeed7cfefbf8a2c522e4caea6cd76b3171e"
end
resource "tomli" do
url "https://files.pythonhosted.org/packages/c0/3f/d7af728f075fb08564c5949a9c95e44352e23dee646869fa104a3b2060a3/tomli-2.0.1.tar.gz"
sha256 "de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"
end
resource "tomlkit" do
url "https://files.pythonhosted.org/packages/c7/f0/cc387a2ff7da8f9450d6af4c108bed1f9b7289695330b6b5f412ebc8d6aa/tomlkit-0.10.0.tar.gz"
sha256 "d99946c6aed3387c98b89d91fb9edff8f901bf9255901081266a84fb5604adcd"
end
resource "wheel" do
url "https://files.pythonhosted.org/packages/c0/6c/9f840c2e55b67b90745af06a540964b73589256cb10cc10057c87ac78fc2/wheel-0.37.1.tar.gz"
sha256 "e9a504e793efbca1b8e0e9cb979a249cf4a0a7b5b8c9e8b65a5e39d49529c1c4"
end
def install
virtualenv_install_with_resources
(bash_completion/"pdm").write Utils.safe_popen_read("#{bin}/pdm", "completion", "bash")
(zsh_completion/"_pdm").write Utils.safe_popen_read("#{bin}/pdm", "completion", "zsh")
(fish_completion/"pdm.fish").write Utils.safe_popen_read("#{bin}/pdm", "completion", "fish")
end
test do
(testpath/"pyproject.toml").write <<~EOS
[project]
name = "testproj"
requires-python = ">=3.9"
EOS
system bin/"pdm", "add", "requests==2.24.0"
assert_match "dependencies = [\n \"requests==2.24.0\",\n]", (testpath/"pyproject.toml").read
assert_predicate testpath/"pdm.lock", :exist?
assert_match "name = \"urllib3\"", (testpath/"pdm.lock").read
output = shell_output("#{bin}/pdm run python -c 'import requests;print(requests.__version__)'")
assert_equal "2.24.0", output.strip
end
end