def main(argv=None):

    bootstrap_script_path = Path( sys.argv[0] ).toabs()
    alembic_src_dir = bootstrap_script_path.dirname().join( os.pardir,
                                                            os.pardir )
    # bootstrap_dir = alembic_src_dir.join( "build", "bootstrap" )

    parser = makeParser( str( bootstrap_script_path ) )

    options, args = parser.parse_args()

    build_root = None

    if args:
        build_root = Path( args[0] ).toabs()

    build_root = configure_build_root( alembic_src_dir, build_root )

    cmakecache = CMakeCache( build_root + "CMakeCache.txt" )

    os.chdir( str( build_root ) )
    print
    print "Now running in %s" % build_root


    print "%s\n" % ( "-" * 80 )
    print "Using Alembic source from %s\n" % alembic_src_dir

    ### RUN BOOTSTRAP ####
    # initial silent run to init build dir and cmake cache
    runCMake( options, alembic_src_dir )

    ranBootstrap = runBootstrap( options, alembic_src_dir, cmakecache )

    ### RUN CMAKE ####

    # args passed from command line
    runCMake( options, alembic_src_dir, ranBootstrap )

    return 0
def main(argv=None):

    bootstrap_script_path = Path(sys.argv[0]).toabs()
    alembic_src_dir = bootstrap_script_path.dirname().join(
        os.pardir, os.pardir)
    # bootstrap_dir = alembic_src_dir.join( "build", "bootstrap" )

    parser = makeParser(str(bootstrap_script_path))

    options, args = parser.parse_args()

    build_root = None

    if args:
        build_root = Path(args[0]).toabs()

    build_root = configure_build_root(alembic_src_dir, build_root)

    cmakecache = CMakeCache(build_root + "CMakeCache.txt")

    os.chdir(str(build_root))
    print
    print "Now running in %s" % build_root

    print "%s\n" % ("-" * 80)
    print "Using Alembic source from %s\n" % alembic_src_dir

    ### RUN BOOTSTRAP ####
    # initial silent run to init build dir and cmake cache
    runCMake(options, alembic_src_dir)

    ranBootstrap = runBootstrap(options, alembic_src_dir, cmakecache)

    ### RUN CMAKE ####

    # args passed from command line
    runCMake(options, alembic_src_dir, ranBootstrap)

    return 0