From f0d9d8e2c0e07af35389e96ef509a1e386cb0c0c Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Sun, 19 Mar 2017 16:19:30 +0100 Subject: [PATCH] Remove scripts/bintray-upload-deb It doesn't work and termux-apt-repo is the new black. --- scripts/bintray-upload-deb | 81 -------------------------------------- 1 file changed, 81 deletions(-) delete mode 100755 scripts/bintray-upload-deb diff --git a/scripts/bintray-upload-deb b/scripts/bintray-upload-deb deleted file mode 100755 index f50e8e791..000000000 --- a/scripts/bintray-upload-deb +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env python - -import argparse, os, re, sys, requests - -USERNAME = os.environ["BINTRAY_USERNAME"] -API_KEY = os.environ["BINTRAY_API_KEY"] -API_BASE = os.environ.get("BINTRAY_URL", "https://api.bintray.com/content") -ORGANIZATION = os.environ.get("BINTRAY_ORGANIZATION") -ALLOWED_ARCH = ["all", "arm", "i686", "aarch64", "x86_64"] - -VERSION_RE = re.compile("^\d+(\.\d+)+([^\-]+)?\-([\da-z]+)$") -VERIFY_FORMAT = """ -Does this look correct? -- Name: {a.name} -- Version: {a.version} -- Architecture: {a.architecture} -- Distribution: {a.distribution} -- Component: {a.component} -- BinTray Repo: {a.org}/{a.repo} - -(Please enter y/n): """ - - -def main(): - parser = argparse.ArgumentParser(description="Upload BinTray package.") - parser.add_argument("package") - parser.add_argument("--name", "-n") - parser.add_argument("--no-confirm", action='store_true', default=False) - parser.add_argument("--repo", "-r", default="main") - parser.add_argument("--org", "-o", default=ORGANIZATION) - parser.add_argument("--component", "-c", default="main") - parser.add_argument("--distribution", "-d", default="stable") - - args = parser.parse_args() - basename = os.path.basename(args.package) - - if not os.path.isfile(args.package): - raise ValueError("File {0} is not valid / does not exist.".format(args.package)) - - if not args.org: - raise ValueError("Organization is missing.") - - # Determine name, version and architecture from file name: - base, _ = os.path.splitext(basename) - name, version, arch = base.split("_") - if arch not in ALLOWED_ARCH: raise ValueError("Architecture {0} not discoverable".format(arch)) - if not VERSION_RE.match(version): raise ValueError("Version not discoverable ({0})".format(version)) - - args.architecture = arch - args.version = version - args.name = args.name or name - - url = "{url}/{a.org}/{a.repo}/{a.name}/{a.version}/pool/{a.component}" \ - "/{a.name[0]}/{basename}?publish=1".format( - url=API_BASE, a=args, basename=basename) - - if not args.no_confirm: - sys.stdout.write(VERIFY_FORMAT.format(a=args)) - if not sys.stdin.readline().rstrip() == "y": - print("\nNot submitting package.") - return - - print("Submitting package...") - - parameters = {"publish": "1"} - headers = { - "X-Bintray-Debian-Distribution": args.distribution, - "X-Bintray-Debian-Architecture": args.architecture, - "X-Bintray-Debian-Component": args.component - } - - with open(args.package, "rb") as package_fp: - response = requests.put(url, auth=(USERNAME, API_KEY), params=parameters, headers=headers, data=package_fp) - - if response.status_code != 201: - raise Exception("Failed to submit package: {0}\n{1}".format(response.status_code, response.text)) - - print("Submitted successfully.") - -if __name__ == "__main__": - main()