Skip to content

Commit

Permalink
Merge pull request Homebrew#155482 from chenrui333/fred-std_pip_args
Browse files Browse the repository at this point in the history
fred: use `std_pip_args`
  • Loading branch information
BrewTestBot authored Nov 25, 2023
2 parents 348bb24 + 61432ec commit ccdb1c7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 33 deletions.
48 changes: 16 additions & 32 deletions Formula/f/fred.rb
Original file line number Diff line number Diff line change
@@ -1,55 +1,39 @@
class Fred < Formula
include Language::Python::Virtualenv

desc "Fully featured FRED Command-line Interface & Python API wrapper"
homepage "https://fred.stlouisfed.org/docs/api/fred/"
url "https://files.pythonhosted.org/packages/dd/2c/51a14730b2091563018e948bf4f5c3600298a966c50862cd9ef98bee836c/fred-py-api-1.1.1.tar.gz"
sha256 "e2689366a92f194f8f85db15463153a2116f241459ffc07d0bb5bbd5fb00837e"
license "MIT"

bottle do
sha256 cellar: :any_skip_relocation, arm64_sonoma: "3a50e24059e5934931b624416a8629772d499ffc3ad87fd038dc250ed9ae85b3"
sha256 cellar: :any_skip_relocation, arm64_ventura: "b9c8ce83fdc21f6f7ae542d188e370f36c4a0830735722f992f038c11156e0bc"
sha256 cellar: :any_skip_relocation, arm64_monterey: "c8ed5e8c7178e4deaf8a9b75e5329e01330c2001fb0c521db8d4095ca69e8fb2"
sha256 cellar: :any_skip_relocation, sonoma: "8ff09f3adcd41215e36e142743f417a1b52935033259bdf58ad59e47da6633af"
sha256 cellar: :any_skip_relocation, ventura: "61f9d966633b1e39cc0a6a9297a76c63a817b1df16895855695ad503dd13814c"
sha256 cellar: :any_skip_relocation, monterey: "faa44d84025d387c65798b6cd14fd7e0014afe3b4c0ec3d438919ac5a864ca22"
sha256 cellar: :any_skip_relocation, x86_64_linux: "dcd60b0e6fca55d04551575b3497c4c3d0baa9c21c488d6db57308783f455143"
rebuild 1
sha256 cellar: :any_skip_relocation, arm64_sonoma: "4f4bbcf117467983ab0d2b9792a533762e0732d949a208b623dc936e2a6b0719"
sha256 cellar: :any_skip_relocation, arm64_ventura: "b5785396e15e4f499a3762b14f75e5388cb428e0548fd0303a996eac33c2c5a7"
sha256 cellar: :any_skip_relocation, arm64_monterey: "9096419d5c681481ca0cd2614ac7f534ada6343e3dbe078ad31207d20ad95f37"
sha256 cellar: :any_skip_relocation, sonoma: "fec38be17de92195374f254437ed0567ec86f8c810e260693caf2b5a87526412"
sha256 cellar: :any_skip_relocation, ventura: "f2d6678b7efef07768d6b345cde9f987540e9410edecb20c5213c74c789673ad"
sha256 cellar: :any_skip_relocation, monterey: "0c0affe7ff545c9474e442027d344a281fc7a8aac875e6cf1b1923630d7f3414"
sha256 cellar: :any_skip_relocation, x86_64_linux: "2402469d3fb97d6acd5f0ed30b58c12cd2f75d5028c540eca30010fd98ba72c5"
end

depends_on "python-certifi"
depends_on "python-setuptools" => :build
depends_on "python-click"
depends_on "python-requests"
depends_on "[email protected]"

resource "charset-normalizer" do
url "https://files.pythonhosted.org/packages/63/09/c1bc53dab74b1816a00d8d030de5bf98f724c52c1635e07681d312f20be8/charset-normalizer-3.3.2.tar.gz"
sha256 "f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"
end

resource "idna" do
url "https://files.pythonhosted.org/packages/8b/e1/43beb3d38dba6cb420cefa297822eac205a277ab43e5ba5d5c46faf96438/idna-3.4.tar.gz"
sha256 "814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"
end

resource "requests" do
url "https://files.pythonhosted.org/packages/9d/be/10918a2eac4ae9f02f6cfe6414b7a155ccd8f7f9d4380d62fd5b955065c3/requests-2.31.0.tar.gz"
sha256 "942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"
end

resource "urllib3" do
url "https://files.pythonhosted.org/packages/36/dd/a6b232f449e1bc71802a5b7950dc3675d32c6dbc2a1bd6d71f065551adb6/urllib3-2.1.0.tar.gz"
sha256 "df7aa8afb0148fa78488e7899b2c59b5f4ffcfa82e6c54ccb9dd37c1d7b52d54"
def python3
"python3.12"
end

def install
virtualenv_install_with_resources
system python3, "-m", "pip", "install", *std_pip_args, "."
end

test do
# assert output & ensure exit code is 2
# NOTE: this makes an API request to FRED with a purposely invalid API key
assert_match \
shell_output("#{bin}/fred --api-key sqwer1234asdfasdfqwer1234asdfsdf categories get-category -i 15", 2), \
"Bad Request. The value for variable api_key is not registered."
invalid_api_key = "sqwer1234asdfasdfqwer1234asdfsdf"
output = shell_output("#{bin}/fred --api-key #{invalid_api_key} categories get-category -i 15 2>&1", 2)
assert_match "Bad Request. The value for variable api_key is not registered.", output
end
end
2 changes: 1 addition & 1 deletion pypi_formula_mappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@
"exclude_packages": ["packaging"]
},
"fred": {
"exclude_packages": ["certifi", "click"]
"exclude_packages": ["requests", "click"]
},
"gallery-dl": {
"exclude_packages": ["certifi"]
Expand Down

0 comments on commit ccdb1c7

Please sign in to comment.