2010-11-13 01:10:43 -08:00
|
|
|
import sys, os
|
2018-12-04 23:34:28 -05:00
|
|
|
import env, state
|
Raw logs contain @@REDO lines instead of formatted data.
This makes them more reliable to parse. redo-log can parse each line,
format and print it, then recurse if necessary. This got a little ugly
because I wanted 'redo --raw-logs' to work, which we want to format the
output nicely, but not call redo-log.
(As a result, --raw-logs has a different meaning to redo and
redo-log, which is kinda dumb. I should fix that.)
As an added bonus, redo-log now handles indenting of recursive logs, so
if the build was a -> a/b -> a/b/c, and you look at the log for a/b, it
can still start at the top level indentation.
2018-11-13 04:05:42 -05:00
|
|
|
from logs import err
|
2010-11-13 01:10:43 -08:00
|
|
|
|
|
|
|
|
|
2018-12-02 23:15:37 -05:00
|
|
|
def main():
|
|
|
|
|
try:
|
2018-12-05 01:07:16 -05:00
|
|
|
env.inherit()
|
|
|
|
|
me = os.path.join(env.v.STARTDIR,
|
|
|
|
|
os.path.join(env.v.PWD, env.v.TARGET))
|
2018-12-02 23:15:37 -05:00
|
|
|
f = state.File(name=me)
|
|
|
|
|
for t in sys.argv[1:]:
|
|
|
|
|
if not t:
|
|
|
|
|
err('cannot build the empty target ("").\n')
|
|
|
|
|
sys.exit(204)
|
|
|
|
|
if os.path.exists(t):
|
|
|
|
|
err('redo-ifcreate: error: %r already exists\n' % t)
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
else:
|
|
|
|
|
f.add_dep('c', t)
|
|
|
|
|
state.commit()
|
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
|
sys.exit(200)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
main()
|