Added requirement for requests and modified upload_release to work with python 3.
This commit is contained in:
parent
80d143d5d2
commit
b6dcfc67e1
2 changed files with 8 additions and 7 deletions
|
|
@ -4,3 +4,4 @@ configobj
|
||||||
semantic_version
|
semantic_version
|
||||||
appdirs
|
appdirs
|
||||||
validators
|
validators
|
||||||
|
requests
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,12 @@ def main():
|
||||||
rel_id = None
|
rel_id = None
|
||||||
upload_url = None
|
upload_url = None
|
||||||
|
|
||||||
github_user = raw_input('Github user:')
|
github_user = input('Github user:')
|
||||||
|
|
||||||
password = getpass.getpass('Password:')
|
password = getpass.getpass('Password:')
|
||||||
|
|
||||||
if req.status_code == 200:
|
if req.status_code == 200:
|
||||||
print 'Found release:', version
|
print('Found release:', version)
|
||||||
json_data = json.loads(req.text)
|
json_data = json.loads(req.text)
|
||||||
tag = json_data.get('tag_name', '')
|
tag = json_data.get('tag_name', '')
|
||||||
cur_ver = Version(tag[1:-1])
|
cur_ver = Version(tag[1:-1])
|
||||||
|
|
@ -39,7 +39,7 @@ def main():
|
||||||
upload_url = json_data['upload_url'].replace('{?name,label}', '')
|
upload_url = json_data['upload_url'].replace('{?name,label}', '')
|
||||||
|
|
||||||
if not update:
|
if not update:
|
||||||
print 'Creating release:', version
|
print('Creating release:', version)
|
||||||
data = {'tag_name': version,
|
data = {'tag_name': version,
|
||||||
'target_commitish': 'master',
|
'target_commitish': 'master',
|
||||||
'name': 'Web2Executable ' + version}
|
'name': 'Web2Executable ' + version}
|
||||||
|
|
@ -49,21 +49,21 @@ def main():
|
||||||
upload_url = json_data['upload_url'].replace('{?name,label}', '')
|
upload_url = json_data['upload_url'].replace('{?name,label}', '')
|
||||||
rel_id = json_data['id']
|
rel_id = json_data['id']
|
||||||
else:
|
else:
|
||||||
print 'Authentication failed!'
|
print('Authentication failed!')
|
||||||
|
|
||||||
if rel_id:
|
if rel_id:
|
||||||
zip_files = glob('*.zip')
|
zip_files = glob('*.zip')
|
||||||
for zip_file in zip_files:
|
for zip_file in zip_files:
|
||||||
with open(zip_file, 'rb') as zipf:
|
with open(zip_file, 'rb') as zipf:
|
||||||
file_data = zipf.read()
|
file_data = zipf.read()
|
||||||
print 'Uploading file {}...'.format(zip_file)
|
print('Uploading file {}...'.format(zip_file))
|
||||||
data = {'name': zip_file}
|
data = {'name': zip_file}
|
||||||
headers = {'Content-Type': 'application/zip'}
|
headers = {'Content-Type': 'application/zip'}
|
||||||
r = requests.post(upload_url, params=data, data=file_data, headers=headers, auth=(github_user, password))
|
r = requests.post(upload_url, params=data, data=file_data, headers=headers, auth=(github_user, password))
|
||||||
if r.status_code == 201:
|
if r.status_code == 201:
|
||||||
print 'Success!'
|
print('Success!')
|
||||||
else:
|
else:
|
||||||
print 'Error:', r.text
|
print('Error:', r.text)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue