From ae8030c9302ef47744e39bcabdec6a7be44c65bb Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Fri, 2 Nov 2018 17:18:04 +0100 Subject: [PATCH] Homebrew formula for v1.0.0 --- extras/get-homebrew-formula-vars.py | 11 +++-- extras/httpie.rb | 63 ++++++++++++++++++----------- 2 files changed, 47 insertions(+), 27 deletions(-) diff --git a/extras/get-homebrew-formula-vars.py b/extras/get-homebrew-formula-vars.py index af44f156..2e28d3eb 100755 --- a/extras/get-homebrew-formula-vars.py +++ b/extras/get-homebrew-formula-vars.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Generate URLs and file hashes to be included in the Homebrew formula after a new release of HTTPie has been published on PyPi. @@ -12,8 +12,13 @@ import requests PACKAGES = [ 'httpie', - 'requests', 'pygments', + 'requests', + 'certifi', + 'urllib3', + 'idna', + 'chardet', + 'PySocks', ] @@ -50,7 +55,7 @@ def main(): print(' url "{url}"'.format(url=dep_meta['url'])) print(' sha256 "{sha256}"'.format(sha256=dep_meta['sha256'])) print(' end') - print() + print('') if __name__ == '__main__': diff --git a/extras/httpie.rb b/extras/httpie.rb index bc323fa1..1258b378 100644 --- a/extras/httpie.rb +++ b/extras/httpie.rb @@ -5,40 +5,55 @@ # https://github.com/Homebrew/homebrew-core/blob/master/Formula/httpie.rb # class Httpie < Formula + include Language::Python::Virtualenv + desc "User-friendly cURL replacement (command-line HTTP client)" homepage "https://httpie.org/" - - url "https://pypi.python.org/packages/85/95/7ccea3ae7fd1185e21629f6d14fa9c896d6250bb15fb492efa91edc741a2/httpie-0.9.8.tar.gz" - sha256 "515870b15231530f56fe2164190581748e8799b66ef0fe36ec9da3396f0df6e1" - head "https://github.com/jakubroztocil/httpie.git" - depends_on :python3 + url "https://files.pythonhosted.org/packages/44/ee/7177b743400d7f82a69bf30cb3c24ea4bb1f4aea68878bc540f732bf4940/httpie-1.0.0.tar.gz" + sha256 "1650342d2eca2622092196bf106ab8f68ea2dbb2ed265d37191185618e159a25" - resource "requests" do - url "https://pypi.python.org/packages/d9/03/155b3e67fe35fe5b6f4227a8d9e96a14fda828b18199800d161bcefc1359/requests-2.12.3.tar.gz" - sha256 "de5d266953875e9647e37ef7bfe6ef1a46ff8ddfe61b5b3652edf7ea717ee2b2" - end + depends_on "python" resource "pygments" do - url "https://pypi.python.org/packages/b8/67/ab177979be1c81bc99c8d0592ef22d547e70bb4c6815c383286ed5dec504/Pygments-2.1.3.tar.gz" - sha256 "88e4c8a91b2af5962bfa5ea2447ec6dd357018e86e94c7d14bd8cacbc5b55d81" + url "https://files.pythonhosted.org/packages/71/2a/2e4e77803a8bd6408a2903340ac498cb0a2181811af7c9ec92cb70b0308a/Pygments-2.2.0.tar.gz" + sha256 "dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc" end + resource "requests" do + url "https://files.pythonhosted.org/packages/97/10/92d25b93e9c266c94b76a5548f020f3f1dd0eb40649cb1993532c0af8f4c/requests-2.20.0.tar.gz" + sha256 "99dcfdaaeb17caf6e526f32b6a7b780461512ab3f1d992187801694cba42770c" + end + + resource "certifi" do + url "https://files.pythonhosted.org/packages/41/b6/4f0cefba47656583217acd6cd797bc2db1fede0d53090fdc28ad2c8e0716/certifi-2018.10.15.tar.gz" + sha256 "6d58c986d22b038c8c0df30d639f23a3e6d172a05c3583e766f4c0b785c0986a" + end + + resource "urllib3" do + url "https://files.pythonhosted.org/packages/a5/74/05ffd00b4b5c08306939c485869f5dc40cbc27357195b0a98b18e4c48893/urllib3-1.24.tar.gz" + sha256 "41c3db2fc01e5b907288010dec72f9d0a74e37d6994e6eb56849f59fea2265ae" + end + + resource "idna" do + url "https://files.pythonhosted.org/packages/65/c4/80f97e9c9628f3cac9b98bfca0402ede54e0563b56482e3e6e45c43c4935/idna-2.7.tar.gz" + sha256 "684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16" + end + + resource "chardet" do + url "https://files.pythonhosted.org/packages/fc/bb/a5768c230f9ddb03acc9ef3f0d4a3cf93462473795d18e9535498c8f929d/chardet-3.0.4.tar.gz" + sha256 "84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae" + end + + resource "PySocks" do + url "https://files.pythonhosted.org/packages/53/12/6bf1d764f128636cef7408e8156b7235b150ea31650d0260969215bb8e7d/PySocks-1.6.8.tar.gz" + sha256 "3fe52c55890a248676fd69dc9e3c4e811718b777834bcaab7a8125cf9deac672" + end + + def install - pyver = Language::Python.major_minor_version "python3" - ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python#{pyver}/site-packages" - %w[pygments requests].each do |r| - resource(r).stage do - system "python3", *Language::Python.setup_install_args(libexec/"vendor") - end - end - - ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python#{pyver}/site-packages" - system "python3", *Language::Python.setup_install_args(libexec) - - bin.install Dir["#{libexec}/bin/*"] - bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"]) + virtualenv_install_with_resources end test do