CliFunction

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-01-22 00:00:00 +00:00
parent 3b0a343647
commit a5ec63dc28
39 changed files with 2630 additions and 2399 deletions

View File

@@ -16,15 +16,16 @@ import sys
import urllib.error
import common
from shell_helpers import LF
def main():
repo = common.github_repo_id
tag = 'sha-{}'.format(common.sha)
upload_path = common.release_zip_file
repo = kwargs['github_repo_id']
tag = 'sha-{}'.format(kwargs['sha'])
upload_path = kwargs['release_zip_file']
# Check the release already exists.
try:
_json = common.github_make_request(path='/releases/tags/' + tag)
_json = self.github_make_request(path='/releases/tags/' + tag)
except urllib.error.HTTPError as e:
if e.code == 404:
release_exists = False
@@ -36,7 +37,7 @@ def main():
# Create release if not yet created.
if not release_exists:
_json = common.github_make_request(
_json = self.github_make_request(
authenticate=True,
data=json.dumps({
'tag_name': tag,
@@ -50,12 +51,12 @@ def main():
asset_name = os.path.split(upload_path)[1]
# Clear the prebuilts for a upload.
_json = common.github_make_request(
_json = self.github_make_request(
path=('/releases/' + str(release_id) + '/assets'),
)
for asset in _json:
if asset['name'] == asset_name:
_json = common.github_make_request(
_json = self.github_make_request(
authenticate=True,
path=('/releases/assets/' + str(asset['id'])),
method='DELETE',
@@ -65,7 +66,7 @@ def main():
# Upload the prebuilt.
with open(upload_path, 'br') as myfile:
content = myfile.read()
_json = common.github_make_request(
_json = self.github_make_request(
authenticate=True,
data=content,
extra_headers={'Content-Type': 'application/zip'},