forked from jaredweiss/numenta-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
62 lines (49 loc) · 1.42 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import logging
import os
import sys
import marshal
try:
import paver.tasks
except ImportError:
from os.path import exists
if exists("paver-minilib.zip"):
import sys
sys.path.insert(0, "paver-minilib.zip")
import paver.tasks
import psutil
g_log = logging.getLogger("grok.setup")
def logEntry():
""" Log command line and ancestor processes to help debug when something
unintended gets called
"""
proc = psutil.Process(os.getpid())
parent = proc.parent
parentPid = parent.pid
try:
parentCmdline = parent.cmdline
except Exception as e:
# Typically AccessDenied
parentCmdline = "ERROR: " + repr(e)
grandparent = parent.parent
if grandparent is not None:
grandparentPid = grandparent.pid
try:
grandparentCmdline = grandparent.cmdline
except Exception as e:
# Typically AccessDenied
grandparentCmdline = "N/A: " + repr(e)
else:
grandparentPid = None
grandparentCmdline = None
g_log.info("%s called: pid=%s, cmdline=%r; "
"parentPid=%s, parentCmdline=%r; "
"grandparentPid=%s, grandparentCmdline=%r",
sys.argv[0], proc.pid, proc.cmdline,
parentPid, parentCmdline,
grandparentPid, grandparentCmdline)
logEntry()
try:
paver.tasks.main()
except:
g_log.exception("paver.tasks.main() failed")
raise