pap.py: Try to locate puppy in /usr/lib/go/ if GOPATH is not set

master
Jan Holthuis 6 years ago
parent e1bb049ef0
commit d26b96dcc5
  1. 25
      pappyproxy/pap.py

@ -74,16 +74,21 @@ def main():
msg_addr = args.dbgattach[0] msg_addr = args.dbgattach[0]
else: else:
msg_addr = None msg_addr = None
try:
# Try to get the binary from GOPATH binpaths = [
gopath = os.environ["GOPATH"] # Try to get the binary from GOPATH
binloc = os.path.join(gopath, "bin", "puppy") os.path.join(os.getenv('GOPATH', '/usr/lib/go'), 'bin'),
except: # Try to get the binary from ~/.pappy/puppy
# Try to get the binary from ~/.pappy/puppy data_dir,
binloc = os.path.join(data_dir, "puppy") ]
if not os.path.exists(binloc):
print("Could not find puppy binary in GOPATH or ~/.pappy. Please ensure that it has been compiled, or pass in the binary location from the command line") for binpath in binpaths:
exit(1) binloc = os.path.join(binpath, 'puppy')
if os.path.exists(binloc):
break
else:
print('Could not find puppy binary in GOPATH or ~/.pappy. Please ensure that it has been compiled, or pass in the binary location from the command line')
exit(1)
config = ProxyConfig() config = ProxyConfig()
if not args.lite: if not args.lite:
config.load("./config.json") config.load("./config.json")

Loading…
Cancel
Save