From 1d43f17d0503812c2ee215fcdda3ae4ba9332da6 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Thu, 10 Jan 2013 20:20:16 -0500 Subject: Github no longer offers Downloads - no need to upload any. --- fabfile.py | 62 -------------------------------------------------------------- 1 file changed, 62 deletions(-) diff --git a/fabfile.py b/fabfile.py index f9333e0..b50f007 100644 --- a/fabfile.py +++ b/fabfile.py @@ -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...' -- cgit v1.2.3