#!/usr/bin/env python

# Minimal waf script for projects that include waflib directly

import sys
import inspect
import os

submodule_help = "Are submodules up to date? Try 'git submodule update --init --recursive'\n"

try:
    from waflib import Context, Scripting
except Exception as e:
    sys.stderr.write ('error: Failed to import waf (%s)\n' % e)
    if os.path.exists ('.git'):
        sys.stderr.write (submodule_help)
    sys.exit(1)

def main():
    script_path = os.path.abspath(inspect.getfile(inspect.getmodule(main)))
    project_path = os.path.dirname(script_path)
    Scripting.waf_entry_point(os.getcwd(), Context.WAFVERSION, project_path)

if __name__ == '__main__':
    main()
