redo-if{change,create}: print a useful message if REDO isn't set.
Again, I forgot to make vars.py not crash if the variables aren't set, so we can print a useful error message. But this time I have the right solution: vars.py will do the checking for itself, and abort with a nice message.
This commit is contained in:
parent
501b534308
commit
dd937d6102
3 changed files with 6 additions and 8 deletions
|
|
@ -45,10 +45,6 @@ def should_build(t):
|
||||||
return not state.isbuilt(t) and dirty_deps(t, depth = '')
|
return not state.isbuilt(t) and dirty_deps(t, depth = '')
|
||||||
|
|
||||||
|
|
||||||
if not vars.TARGET:
|
|
||||||
err('redo-ifchange: error: must be run from inside a .do\n')
|
|
||||||
sys.exit(100)
|
|
||||||
|
|
||||||
rv = 202
|
rv = 202
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,6 @@ import vars, state
|
||||||
from helpers import err, mkdirp
|
from helpers import err, mkdirp
|
||||||
|
|
||||||
|
|
||||||
if not vars.TARGET:
|
|
||||||
err('redo-ifcreate: error: must be run from inside a .do\n')
|
|
||||||
sys.exit(100)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for t in sys.argv[1:]:
|
for t in sys.argv[1:]:
|
||||||
if os.path.exists(t):
|
if os.path.exists(t):
|
||||||
|
|
|
||||||
6
vars.py
6
vars.py
|
|
@ -1,6 +1,12 @@
|
||||||
import os
|
import os
|
||||||
import atoi
|
import atoi
|
||||||
|
|
||||||
|
if not os.environ.get('REDO'):
|
||||||
|
import sys
|
||||||
|
sys.stderr.write('%s: error: must be run from inside a .do\n'
|
||||||
|
% sys.argv[0])
|
||||||
|
sys.exit(100)
|
||||||
|
|
||||||
PWD = os.environ.get('REDO_PWD', '')
|
PWD = os.environ.get('REDO_PWD', '')
|
||||||
TARGET = os.environ.get('REDO_TARGET', '')
|
TARGET = os.environ.get('REDO_TARGET', '')
|
||||||
DEPTH = os.environ.get('REDO_DEPTH', '')
|
DEPTH = os.environ.get('REDO_DEPTH', '')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue