use os.environ[] instead of os.getenv/os.putenv.
Oddly, in python, os.putenv() does not make changes that os.getenv() can see.
This commit is contained in:
parent
f43187b73a
commit
45c6aad649
2 changed files with 12 additions and 12 deletions
14
redo.py
14
redo.py
|
|
@ -115,8 +115,8 @@ def stamp(t):
|
||||||
|
|
||||||
|
|
||||||
def _preexec(t):
|
def _preexec(t):
|
||||||
os.putenv('REDO_TARGET', t)
|
os.environ['REDO_TARGET'] = t
|
||||||
os.putenv('REDO_DEPTH', REDO_DEPTH + ' ')
|
os.environ['REDO_DEPTH'] = REDO_DEPTH + ' '
|
||||||
|
|
||||||
|
|
||||||
def build(t):
|
def build(t):
|
||||||
|
|
@ -157,15 +157,15 @@ def build(t):
|
||||||
|
|
||||||
|
|
||||||
if opt.debug:
|
if opt.debug:
|
||||||
os.putenv('REDO_DEBUG', '1')
|
os.environ['REDO_DEBUG'] = '1'
|
||||||
if opt.verbose:
|
if opt.verbose:
|
||||||
os.putenv('REDO_VERBOSE', '1')
|
os.environ['REDO_VERBOSE'] = '1'
|
||||||
assert(not (opt.ifchange and opt.ifcreate))
|
assert(not (opt.ifchange and opt.ifcreate))
|
||||||
|
|
||||||
if not os.getenv('REDO_BASE', ''):
|
if not os.environ.get('REDO_BASE', ''):
|
||||||
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])
|
for t in targets])
|
||||||
os.putenv('REDO_BASE', base)
|
os.environ['REDO_BASE'] = base
|
||||||
mkdirp('%s/.redo' % base)
|
mkdirp('%s/.redo' % base)
|
||||||
|
|
||||||
from vars import *
|
from vars import *
|
||||||
|
|
@ -176,7 +176,7 @@ if not REDO_DEPTH:
|
||||||
if exenames[0] == exenames[1]:
|
if exenames[0] == exenames[1]:
|
||||||
exenames = [exenames[0]]
|
exenames = [exenames[0]]
|
||||||
dirnames = [os.path.dirname(p) for p in exenames]
|
dirnames = [os.path.dirname(p) for p in exenames]
|
||||||
os.putenv('PATH', ':'.join(dirnames) + ':' + os.getenv('PATH'))
|
os.environ['PATH'] = ':'.join(dirnames) + ':' + os.environ['PATH']
|
||||||
|
|
||||||
for t in targets:
|
for t in targets:
|
||||||
if REDO_TARGET:
|
if REDO_TARGET:
|
||||||
|
|
|
||||||
10
vars.py
10
vars.py
|
|
@ -1,9 +1,9 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
REDO_TARGET = os.getenv('REDO_TARGET', '')
|
REDO_TARGET = os.environ.get('REDO_TARGET', '')
|
||||||
REDO_DEPTH = os.getenv('REDO_DEPTH', '')
|
REDO_DEPTH = os.environ.get('REDO_DEPTH', '')
|
||||||
REDO_DEBUG = os.getenv('REDO_DEBUG', '') and 1 or 0
|
REDO_DEBUG = os.environ.get('REDO_DEBUG', '') and 1 or 0
|
||||||
REDO_VERBOSE = os.getenv('REDO_VERBOSE', '') and 1 or 0
|
REDO_VERBOSE = os.environ.get('REDO_VERBOSE', '') and 1 or 0
|
||||||
REDO_BASE = os.path.abspath(os.getenv('REDO_BASE', ''))
|
REDO_BASE = os.path.abspath(os.environ['REDO_BASE'])
|
||||||
while REDO_BASE.endswith('/'):
|
while REDO_BASE.endswith('/'):
|
||||||
REDO_BASE = REDO_BASE[:-1]
|
REDO_BASE = REDO_BASE[:-1]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue