Skip to content

Instantly share code, notes, and snippets.

@chenrui333
Created July 5, 2020 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chenrui333/cafafb9050e36c7f517542975d05b326 to your computer and use it in GitHub Desktop.
Save chenrui333/cafafb9050e36c7f517542975d05b326 to your computer and use it in GitHub Desktop.
Updated resource blocks
# from https://github.com/Homebrew/homebrew-core/pull/57500
# Updated resource blocks generated with: https://repl.it/repls/AnchoredCultivatedModem
require 'open-uri'
require 'json'
pnames = %w[
attrs
certifi
cffi
chardet
click
click_config_file
configobj
configparser
cookies
httplib2
idna
importlib_metadata
jsonschema
launchpadlib
lazr.restfulclient
lazr.uri
libnacl
more_itertools
mypy_extensions
oauthlib
pbr
petname
pylxd
progressbar33
pycparser
pyelftools
pymacaroons
PyNaCl
pyrsistent
pysha3
python-debian
pyxdg
PyYAML
raven
requests
requests-toolbelt
requests-unixsocket
responses
simplejson
six
tabulate
urllib3
wadllib
zipp
]
# pymacaroons-pynacl is hosted on github
resources = []
for pname in pnames
content = open("https://pypi.org/pypi/#{pname}/json").read
json = JSON.parse(content)
lversion = json["info"]["version"]
sdist = json["releases"][lversion].find { |pkg| pkg['packagetype'] == 'sdist' }
url = sdist['url']
sha = sdist['digests']['sha256']
puts <<-eos
resource "#{pname}" do
url "#{url}"
sha256 "#{sha}"
end
eos
puts ''
end
# puts resources[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment