homebrew-core/Formula/pdm.rb

201 lines
9.6 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/44/6e/9c0bd169416f01fc37f29dc2c24df6dbdd13b940c0870d4426a0641f4626/pdm-2.0.0.tar.gz"
sha256 "36d1cf69efed0a901afd388c351802290c5a5daf2b0bf7949771d95e4cd03619"
license "MIT"
head "https://github.com/pdm-project/pdm.git", branch: "main"
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "f61db8ad72f3fbe30ffdae11744cefa0a25c38e17fe036b8f2170e70803e1a09"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "84a386af7a15310690cbcc9d4ee11e3f898375fe80e229fa5f0339b1b23b54cb"
sha256 cellar: :any_skip_relocation, monterey: "c42b0a6d868e8c84a7d186d25c88142ca0d5756cb3941ea492bd5f435f067fca"
sha256 cellar: :any_skip_relocation, big_sur: "9dc2e34a6dc56f2b720e3f435b8b80f3617fd28bc33b2a22ad40aa195bf3710d"
sha256 cellar: :any_skip_relocation, catalina: "fdcbdfa437bbe5f7daa09f48e324d56ac4a5426e230d1c28218ff50fe00681ee"
sha256 cellar: :any_skip_relocation, x86_64_linux: "72378d35e9482cda43971a00b226bbb0d2f291af7af51f650087c13a3f610b49"
end
depends_on "python@3.10"
depends_on "six"
resource "blinker" do
url "https://files.pythonhosted.org/packages/1b/51/e2a9f3b757eb802f61dc1f2b09c8c99f6eb01cf06416c0671253536517b6/blinker-1.4.tar.gz"
sha256 "471aee25f3992bd325afa3772f1063dbdbbca947a041b8b89466dc00d606f8b6"
end
resource "CacheControl" do
url "https://files.pythonhosted.org/packages/46/9b/34215200b0c2b2229d7be45c1436ca0e8cad3b10de42cfea96983bd70248/CacheControl-0.12.11.tar.gz"
sha256 "a5b9fcc986b184db101aa280b42ecdcdfc524892596f606858e0b7a8b4d9e144"
end
resource "certifi" do
url "https://files.pythonhosted.org/packages/cc/85/319a8a684e8ac6d87a1193090e06b6bbb302717496380e225ee10487c888/certifi-2022.6.15.tar.gz"
sha256 "84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d"
end
resource "charset-normalizer" do
url "https://files.pythonhosted.org/packages/93/1d/d9392056df6670ae2a29fcb04cfa5cee9f6fbde7311a1bb511d4115e9b7a/charset-normalizer-2.1.0.tar.gz"
sha256 "575e708016ff3a5e3681541cb9d79312c416835686d054a23accb873b254f413"
end
resource "commonmark" do
url "https://files.pythonhosted.org/packages/60/48/a60f593447e8f0894ebb7f6e6c1f25dafc5e89c5879fdc9360ae93ff83f0/commonmark-0.9.1.tar.gz"
sha256 "452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60"
end
resource "distlib" do
url "https://files.pythonhosted.org/packages/31/d5/e2aa0aa3918c8d88c4c8e4ebbc50a840e101474b98cd83d3c1712ffe5bb4/distlib-0.3.5.tar.gz"
sha256 "a7f75737c70be3b25e2bee06288cec4e4c221de18455b2dd037fe2a795cab2fe"
end
resource "filelock" do
url "https://files.pythonhosted.org/packages/f3/c7/5c1aef87f1197d2134a096c0264890969213c9cbfb8a4102087e8d758b5c/filelock-3.7.1.tar.gz"
sha256 "3a0fd85166ad9dbab54c9aec96737b744106dc5f15c0b09a6744a445299fcf04"
end
resource "findpython" do
url "https://files.pythonhosted.org/packages/17/16/7e7e7f6ae157e903c3285533f5d52f34fa8f25c8f4745699294b154e83fc/findpython-0.2.0.tar.gz"
sha256 "c2099ee0b71fc2714b64f68fd1f40bc0ee47f49dfe9547fb64d7cbcc02fe0871"
end
resource "idna" do
url "https://files.pythonhosted.org/packages/62/08/e3fc7c8161090f742f504f40b1bccbfc544d4a4e09eb774bf40aafce5436/idna-3.3.tar.gz"
sha256 "9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"
end
resource "installer" do
url "https://files.pythonhosted.org/packages/74/b7/9187323cd732840f1cddd6a9f05961406636b50c799eef37c920b63110c0/installer-0.5.1.tar.gz"
sha256 "f970995ec2bb815e2fdaf7977b26b2091e1e386f0f42eafd5ac811953dc5d445"
end
resource "lockfile" do
url "https://files.pythonhosted.org/packages/17/47/72cb04a58a35ec495f96984dddb48232b551aafb95bde614605b754fe6f7/lockfile-0.12.2.tar.gz"
sha256 "6aed02de03cba24efabcd600b30540140634fc06cfa603822d508d5361e9f799"
end
resource "msgpack" do
url "https://files.pythonhosted.org/packages/22/44/0829b19ac243211d1d2bd759999aa92196c546518b0be91de9cacc98122a/msgpack-1.0.4.tar.gz"
sha256 "f5d869c18f030202eb412f08b28d2afeea553d6613aee89e200d7aca7ef01f5f"
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/b8/f2/19376707a470ceeeff96fdeb7526adef4f692fb78fdb2eb19af6bd5f26f7/pdm-pep517-1.0.2.tar.gz"
sha256 "9d5a2aa5896f3733755097945ec2a751cd19ee3399306e099514014b1e49adf1"
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/ff/7b/3613df51e6afbf2306fc2465671c03390229b55e3ef3ab9dd3f846a53be6/platformdirs-2.5.2.tar.gz"
sha256 "58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19"
end
resource "Pygments" do
url "https://files.pythonhosted.org/packages/59/0f/eb10576eb73b5857bc22610cdfc59e424ced4004fe7132c8f2af2cc168d3/Pygments-2.12.0.tar.gz"
sha256 "5eb116118f9612ff1ee89ac96437bb6b49e8f04d8a13b514ba26f620208e26eb"
end
resource "pyparsing" do
url "https://files.pythonhosted.org/packages/71/22/207523d16464c40a0310d2d4d8926daffa00ac1f5b1576170a32db749636/pyparsing-3.0.9.tar.gz"
sha256 "2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb"
end
resource "python-dotenv" do
url "https://files.pythonhosted.org/packages/02/ee/43e1c862a3e7259a1f264958eaea144f0a2fac9f175c1659c674c34ea506/python-dotenv-0.20.0.tar.gz"
sha256 "b7e3b04a59693c42c36f9ab1cc2acc46fa5df8c78e178fc33a8d4cd05c8d498f"
end
resource "requests" do
url "https://files.pythonhosted.org/packages/a5/61/a867851fd5ab77277495a8709ddda0861b28163c4613b011bc00228cc724/requests-2.28.1.tar.gz"
sha256 "7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983"
end
resource "requests-toolbelt" do
url "https://files.pythonhosted.org/packages/28/30/7bf7e5071081f761766d46820e52f4b16c8a08fef02d2eb4682ca7534310/requests-toolbelt-0.9.1.tar.gz"
sha256 "968089d4584ad4ad7c171454f0a5c6dac23971e9472521ea3b6d49d610aa6fc0"
end
resource "resolvelib" do
url "https://files.pythonhosted.org/packages/ac/20/9541749d77aebf66dd92e2b803f38a50e3a5c76e7876f45eb2b37e758d82/resolvelib-0.8.1.tar.gz"
sha256 "c6ea56732e9fb6fca1b2acc2ccc68a0b6b8c566d8f3e78e0443310ede61dbd37"
end
resource "rich" do
url "https://files.pythonhosted.org/packages/bb/2d/c902484141330ded63c6c40d66a9725f8da5e818770f67241cf429eef825/rich-12.5.1.tar.gz"
sha256 "63a5c5ce3673d3d5fbbf23cd87e11ab84b6b451436f1b7f19ec54b6bc36ed7ca"
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/1e/81/93889ea6641154b22f26036bc4ef800b06df84fc647a6ded5abdc2f06dcf/tomlkit-0.11.1.tar.gz"
sha256 "61901f81ff4017951119cd0d1ed9b7af31c821d6845c8c477587bbdcd5e5854e"
end
resource "unearth" do
url "https://files.pythonhosted.org/packages/88/69/6d9052f35cccf9ec16c32c78b0fc17ebe000dbddaa052e39975c4483ab15/unearth-0.5.1.tar.gz"
sha256 "52c40d4880a4ca3b46f2e388b52b59acc7b30c1a931fea6e3dfd9966c9401507"
end
resource "urllib3" do
url "https://files.pythonhosted.org/packages/25/36/f056e5f1389004cf886bb7a8514077f24224238a7534497c014a6b9ac770/urllib3-1.26.10.tar.gz"
sha256 "879ba4d1e89654d9769ce13121e0f94310ea32e8d2f8cf587b77c08bbcdb30d6"
end
resource "virtualenv" do
url "https://files.pythonhosted.org/packages/a4/2f/05b77cb73501c01963de2cef343839f0803b64aab4d5476771ae303b97a6/virtualenv-20.15.1.tar.gz"
sha256 "288171134a2ff3bfb1a2f54f119e77cd1b81c29fc1265a2356f3e8d14c7d58c4"
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"
version = "1.0"
license = {text = "MIT"}
[build-system]
requires = ["pdm-pep517>=0.12.0"]
build-backend = "pdm.pep517.api"
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