Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- from os.path import *
- import sys
- from sys import argv
- package = "."
- for package_argv_index, arg in enumerate(argv[1:], start=1):
- if arg == "--":
- break
- if not arg.startswith('-'):
- package = arg
- break
- import os
- import tempfile
- GOBIN = tempfile.gettempdir()
- os.environ['GOBIN'] = GOBIN
- import subprocess
- GOEXE = subprocess.check_output('go env GOEXE', shell=True).decode().strip()
- exe = join(GOBIN, basename(realpath(package))) + GOEXE
- args = ['go', 'install']+argv[1:package_argv_index]+[package]
- rc = subprocess.call(args)
- if rc != 0:
- sys.exit(rc)
- args = [exe]+argv[package_argv_index+1:]
- print(exe, args)
- os.execv(exe, args)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement