for file in uploaded_files: # build file names asc = "%s.asc" % file abs_file = os.path.abspath(os.path.join(upload_dir, file)) abs_asc = os.path.abspath(os.path.join(upload_dir, asc)) sha_file = get_file_sha256(abs_file) # build links link_file = client.share(file, short_url=False) # if someone finds how to do this with the API, please tell me! link_file[u'url'] = link_file[u'url'].replace('?dl=0', '?dl=1') link_asc = client.share(asc, short_url=False) link_asc[u'url'] = link_asc[u'url'].replace('?dl=0', '?dl=1') if p1.match(file): osys, arch, lc = get_bundle_info(file, 'linux') elif p2.match(file): osys, arch, lc = get_bundle_info(file, 'windows') elif p3.match(file): osys, arch, lc = get_bundle_info(file, 'osx') link = "%s$%s$%s$" % (link_file[u'url'], link_asc[u'url'], sha_file) # note that you should only upload bundles for supported locales core.add_link('Dropbox', osys, lc, link) except (ValueError, RuntimeError) as e: print str(e) except dropbox.rest.ErrorResponse as e: print str(e)
for file in uploaded_files.keys(): # only run for tor browser installers if p4.match(file): continue asc = "%s.asc" % file abs_file = os.path.abspath(os.path.join(upload_dir, file)) abs_asc = os.path.abspath(os.path.join(upload_dir, asc)) sha_file = get_file_sha256(abs_file) # build links link_file = share_file(drive_service, uploaded_files[file]) link_asc = share_file(drive_service, uploaded_files["%s.asc" % file]) if p1.match(file): osys, arch, lc = get_bundle_info(file, 'linux') elif p2.match(file): osys, arch, lc = get_bundle_info(file, 'windows') elif p3.match(file): osys, arch, lc = get_bundle_info(file, 'osx') link = "%s$%s$%s$" % (link_file, link_asc, sha_file) # note that you should only upload bundles for supported locales core.add_link('Drive', osys, lc, link) except (ValueError, RuntimeError) as e: print str(e)
print('Uploading release, please wait, this might take a while!') # Upload the latest browser bundles to a new release release = upload_new_release(target_repo, version, tb_path) # Upload success, publish the release release.edit(draft=False) # Create the links file for this release core = gettor.core.Core(os.path.abspath('../core.cfg')) # Erase old links if any and create a new empty one core.create_links_file('GitHub', readable_fp) print("Creating links file") for asset in release.assets: url = asset.browser_download_url if url.endswith('.asc'): continue osys, arch, lc = get_bundle_info(asset.name) sha256 = get_file_sha256( os.path.abspath(os.path.join(tb_path, asset.name)) ) link = "{}${}${}$".format(url, url + ".asc", sha256) print("Adding {}".format(url)) core.add_link('GitHub', osys, lc, link) print "Github links updated!"
# Remove any drafts to clean broken uploads print('Uploading release, please wait, this might take a while!') # Upload the latest browser bundles to a new release release = upload_new_release(target_repo, version, tb_path) # Upload success, publish the release release.edit(draft=False) # Create the links file for this release core = gettor.core.Core(core_path) # Erase old links if any and create a new empty one core.create_links_file('GitHub', readable_fp) print("Creating links file") for asset in release.assets(): url = asset.browser_download_url if url.endswith('.asc'): continue osys, arch, lc = get_bundle_info(asset.name) sha256 = get_file_sha256( os.path.abspath(os.path.join(tb_path, asset.name))) link = "{}${}${}$".format(url, url + ".asc", sha256) print("Adding {}".format(url)) core.add_link('GitHub', osys, lc, link) print "Github links updated!"