Created
July 7, 2016 07:58
-
-
Save iolloyd/9468c5c4ef1b400c272b6447ed1659d6 to your computer and use it in GitHub Desktop.
package control for sublime text 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
import os | |
import urllib.request | |
pf = 'Package Control.sublime-package' | |
packages_path = sublime.installed_packages_path() | |
proxy_handler = urllib.request.ProxyHandler() | |
opener = urllib.request.build_opener(proxy_handler) | |
urllib.request.install_opener(opener) | |
by = urllib.request.urlopen('http://packagecontrol.io/{}'.format(pf.replace(' ', '%20').read())) | |
hex_digest = hashlib.sha256(by).hexdigest() | |
h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88' | |
if hex_digest == h | |
open(os.path.join( ipp, pf), 'wb' ).write(by):%s a m | |
else | |
print('Error validating download. Got {0} instead of {1}. Please try installing manually'.format(dh, h) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment