def main(dependencies, msvcr71_preparation, msys_preparation): """Build the dependencies according to the command line options.""" options, args = command_line() if options.arg_help: print_("These are the Pygame library dependencies:") for dep in dependencies: print_(" ", dep.name) return 0 try: chosen_deps = choose_dependencies(dependencies, options, args) except ChooseError: print_(helpers.geterror ()) return 1 if not chosen_deps: if not args: print_("No libraries specified.") elif options.build_all: print_("All libraries excluded") if options.msvcr71: chosen_deps.insert(0, msvcr71_preparation) if chosen_deps: chosen_deps.insert(0, msys_preparation) try: m = msys.Msys(options.msys_directory) except msys.MsysException: print_(helpers.geterror ()) return 1 start_time = None return_code = 1 set_environment_variables(m, options) try: configure(chosen_deps) except BuildError: print_("Build aborted: %s" % str (helpers.geterror ())) else: print_("\n=== Starting build ===") start_time = time.time() # For file timestamp checks. try: build(chosen_deps, m) except BuildError: print_("Build aborted: %s" % str (helpers.geterror ())) else: # A successful build! return_code = 0 summary(dependencies, m, start_time, chosen_deps) # MinGW configure file for setup.py (optional). try: import mingwcfg except ImportError: pass else: mingwcfg.write(m.mingw_root) return return_code
def configure(dependencies): """Find source directories of all dependencies""" success = True print_("Hunting for source directories...") for dep in dependencies: try: dep.configure(hunt_paths) except BuildError: print_(helpers.geterror ()) success = False else: if dep.path: print_("Source directory for", dep.name, ":", dep.path) if not success: raise BuildError("Not all source directories were found")
def input_msys_dir(): """Return user entered MSYS directory path May raise MsysException.""" while 1: dir_path = msys_raw_input("Enter the MSYS directory path,\n" "(or press [Enter] to quit):") dir_path = dir_path.strip() if not dir_path: raise MsysException("Input aborted by user") dir_path = os.path.abspath(dir_path) try: return find_msys_version_subdir(dir_path) except MsysException: msys_print(helpers.geterror ())
print ("\nThe following information will be used to build Pygame:") print ("\t System: %s" % buildsystem) print ("\t Python: %d.%d.%d" % helpers.getversion ()) print ("\t Compiler: %s" % compiler) if cfg.build['SDL']: print ("\t SDL: %s" % sdlversion) return buildsystem, builddefines, compiler if __name__ == "__main__": buildsystem = None buildcflags = None try: buildsystem, builddefines, compiler = run_checks () except: print (helpers.geterror ()) print (helpers.gettraceback ()) sys.exit (1) os.environ["CFLAGS"] = "" if "bdist_msi" in sys.argv: # hack the version name to a format msi doesn't have trouble with VERSION = VERSION.replace("-alpha", "a") VERSION = VERSION.replace("-rc", "r") if DEBUG and buildsystem in ("msys", "unix", "darwin") and \ compiler in ("unix", "cygwin", "mingw32", "mingw32-console"): os.environ["CFLAGS"] += " -W -Wall -Wimplicit-int " + \ "-Wimplicit-function-declaration " + \ "-Wimplicit -Wreturn-type -Wunused " + \