Slightly clarify the initialization code in redo.py.
This commit is contained in:
parent
12983bd88d
commit
700873a90f
1 changed files with 10 additions and 12 deletions
22
redo.py
22
redo.py
|
|
@ -22,9 +22,16 @@ if opt.verbose:
|
||||||
if opt.shuffle:
|
if opt.shuffle:
|
||||||
os.environ['REDO_SHUFFLE'] = '1'
|
os.environ['REDO_SHUFFLE'] = '1'
|
||||||
|
|
||||||
is_root = False
|
is_root = not os.environ.get('REDO_BASE', '')
|
||||||
if not os.environ.get('REDO_BASE', ''):
|
|
||||||
is_root = True
|
if is_root:
|
||||||
|
# toplevel call to redo
|
||||||
|
exenames = [os.path.abspath(sys.argv[0]), os.path.realpath(sys.argv[0])]
|
||||||
|
if exenames[0] == exenames[1]:
|
||||||
|
exenames = [exenames[0]]
|
||||||
|
dirnames = [os.path.dirname(p) for p in exenames]
|
||||||
|
os.environ['PATH'] = ':'.join(dirnames) + ':' + os.environ['PATH']
|
||||||
|
|
||||||
base = os.path.commonprefix([os.path.abspath(os.path.dirname(t))
|
base = os.path.commonprefix([os.path.abspath(os.path.dirname(t))
|
||||||
for t in targets] + [os.getcwd()])
|
for t in targets] + [os.getcwd()])
|
||||||
bsplit = base.split('/')
|
bsplit = base.split('/')
|
||||||
|
|
@ -45,15 +52,6 @@ from helpers import err
|
||||||
if is_root:
|
if is_root:
|
||||||
state.init()
|
state.init()
|
||||||
|
|
||||||
|
|
||||||
if not vars.DEPTH:
|
|
||||||
# toplevel call to redo
|
|
||||||
exenames = [os.path.abspath(sys.argv[0]), os.path.realpath(sys.argv[0])]
|
|
||||||
if exenames[0] == exenames[1]:
|
|
||||||
exenames = [exenames[0]]
|
|
||||||
dirnames = [os.path.dirname(p) for p in exenames]
|
|
||||||
os.environ['PATH'] = ':'.join(dirnames) + ':' + os.environ['PATH']
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
j = atoi.atoi(opt.jobs or 1)
|
j = atoi.atoi(opt.jobs or 1)
|
||||||
if j < 1 or j > 1000:
|
if j < 1 or j > 1000:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue