Calling GNU/make from a Python Script

skip at pobox.com skip at pobox.com
Mon Oct 30 16:56:33 CET 2006


    Fredrik> build_dir = "path/to/makefile"

    Fredrik> cwd = os.getcwd() # get current directory
    Fredrik> try:
    Fredrik>      os.chdir(build_dir)
    Fredrik>      os.system("make")
    Fredrik> finally:
    Fredrik>      os.chdir(cwd)

Or even:

    os.system("make -C %s" % build_dir)

Skip



More information about the Python-list mailing list