apenwarr-redo/redo/cmd_ifcreate.py
Avery Pennarun bd8dbfb487 Switch to module-relative import syntax.
Now that the python scripts are all in a "redo" python module, we can
use the "new style" (ahem) package-relative imports.  This appeases
pylint, plus avoids confusion in case more than one package has
similarly-named modules.
2018-12-05 02:34:36 -05:00

27 lines
688 B
Python

import sys, os
from . import env, state
from .logs import err
def main():
try:
env.inherit()
me = os.path.join(env.v.STARTDIR,
os.path.join(env.v.PWD, env.v.TARGET))
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()