Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions pappyproxy/pap.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,21 @@ def main():
msg_addr = args.dbgattach[0]
else:
msg_addr = None
try:
# Try to get the binary from GOPATH
gopath = os.environ["GOPATH"]
binloc = os.path.join(gopath, "bin", "puppy")
except:
# Try to get the binary from ~/.pappy/puppy
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")
exit(1)

binpaths = [
# Try to get the binary from GOPATH
os.path.join(os.getenv('GOPATH', '/usr/lib/go'), 'bin'),
# Try to get the binary from ~/.pappy/puppy
data_dir,
]

for binpath in binpaths:
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()
if not args.lite:
config.load("./config.json")
Expand Down