diff options
author | Waylan Limberg <waylan@gmail.com> | 2013-01-10 20:20:16 -0500 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2013-01-10 20:20:16 -0500 |
commit | 1d43f17d0503812c2ee215fcdda3ae4ba9332da6 (patch) | |
tree | f1691023c53b4b563d60e53d3bac68ef03b91ff4 | |
parent | 2fc427c7aa394a4dfa841f4c78b6393caa683dfd (diff) | |
download | markdown-1d43f17d0503812c2ee215fcdda3ae4ba9332da6.tar.gz markdown-1d43f17d0503812c2ee215fcdda3ae4ba9332da6.tar.bz2 markdown-1d43f17d0503812c2ee215fcdda3ae4ba9332da6.zip |
Github no longer offers Downloads - no need to upload any.
-rw-r--r-- | fabfile.py | 62 |
1 files changed, 0 insertions, 62 deletions
@@ -107,65 +107,3 @@ def deploy_release(): build_release() local('./setup.py register') local('./setup.py upload') - upload_to_github() - -def upload_to_github(): - """ Upload release to Github. """ - # We need github API v3 but no python lib exists yet. So do it manually. - import os - import urllib2 - import base64 - import simplejson - import getpass - # Setup Auth - url = 'https://api.github.com/repos/waylan/Python-Markdown/downloads' - user = prompt('Github username:', default=getpass.getuser()) - password = prompt('Github password:') - authstring = base64.encodestring('%s:%s' % (user, password)) - # Loop through files and upload - base = 'dist/' - for file in os.listdir(base): - file = os.path.join(base, file) - if os.path.isfile(file): - ans = prompt('Upload: %s' % file, default='Y') - if ans.lower() == 'y': - # Create document entry on github - desc = prompt('Description for %s:' % file) - data1 = simplejson.dumps({ - 'name': os.path.basename(file), - 'size': os.path.getsize(file), - 'description' : desc, - #'content_type': 'text/plain' # <- let github determine - }) - req = urllib2.Request(url, data1, - {'Content-type': 'application/json'}) - req.add_header('Authorization', 'Basic %s' % authstring) - try: - response = urllib2.urlopen(req) - except urllib2.HTTPError, e: - error = simplejson.loads(e.read()) - if error['errors'][0]['code'] == 'already_exists': - print 'Already_exists, skipping...' - continue - else: - print e.read() - raise - data2 = simplejson.loads(response.read()) - response.close() - # Upload document (using curl because it is easier) - data2['file'] = file - curl = """curl \\ - -F "key=%(path)s" \\ - -F "acl=%(acl)s" \\ - -F "success_action_status=201" \\ - -F "Filename=%(name)s" \\ - -F "AWSAccessKeyId=%(accesskeyid)s" \\ - -F "Policy=%(policy)s" \\ - -F "Signature=%(signature)s" \\ - -F "Content-Type=%(mime_type)s" \\ - -F "file=@%(file)s" \\ - %(s3_url)s""" % data2 - print 'Uploading...' - local(curl) - else: - print 'Skipping...' |