示例#1
0
文件: build.py 项目: Zaita/DevOpsTest
def start():
	cli = CommandLineInterface()
	if not cli.parse():
  		cli.print_usage()
  		return False;
      
	print( "*************************************************************************")
	print( "*************************************************************************")
	print( "--> Starting " + Globals.build_target_ + " Build")
	build_target = Globals.build_target_
	if build_target in Globals.allowed_build_types_:
		code_builder = MainCode()
		return code_builder.start()
	elif build_target == "archive":	
		archive_builder = Archiver()
		return archive_builder.start(build_parameters)
	elif build_target == "thirdparty" or build_target == "thirdpartylean":
		code_builder = ThirdPartyLibraries()
		return code_builder.start()
	elif build_target == "documentation":
		documentation_builder = Documentation()
		return documentation_builder.start()
	elif build_target == "modelrunner":
		model_runner = ModelRunner()
		return model_runner.start()
	elif build_target == "clean":
		cleaner = Cleaner()
		return cleaner.clean()
	elif build_target == "cleanall":
		cleaner = Cleaner()
		return cleaner.clean_all()
	elif build_target == "rlibrary":
		"""
			r_path = '' 
			if Globals.operating_system_ == 'windows':
			print( "find windows R")
			r_path = system_info.find_exe_path('R.exe') 
			else:
			r_path = system_info.find_exe_path('R')  
			print( "R path = " + r_path  )
			if r_path == '':
			return Globals.PrintError("R is not in the current path please add R to your path.")  
		"""
		rlibrary = Rlibrary()
		return rlibrary.start()
	elif build_target == "installer":
		"""
			if Globals.operating_system_ == 'linux':
			return Globals.PrintError('Building Windows installer under linux is not supported')
		"""
		installer = Installer()
		return installer.start()
	elif build_target == "deb":
		"""
			if Globals.operating_system_ == 'windows':
			return Globals.PrintError('Building linux .deb under Windows is not supported')
		"""
		deb_builder = DebBuilder()
		return deb_builder.start(build_parameters)
	return False # Default return from this, we didn't find a run mode
示例#2
0
def start():
	cli = CommandLineInterface()
	if not cli.parse():
  		cli.print_usage()
  		return False;
      
	print( "*************************************************************************")
	print( "*************************************************************************")
	
	Globals.buildtools_directory_ = os.getcwd()
	Globals.root_directory_ = os.path.realpath(Globals.buildtools_directory_ + "/../")
	Globals.boost_source_directory_ = os.path.realpath(Globals.root_directory_ + "/Boost")
	Globals.build_directory_ = os.path.realpath(Globals.root_directory_ + "/Build/" + Globals.operating_system_ )
	Globals.boost_directory_ = os.path.realpath(Globals.build_directory_ + "/Boost")
	
	print('--> Directory: ' + Globals.root_directory_)

	if not os.path.exists(Globals.build_directory_):
		if not os.path.exists(Globals.root_directory_ + "/Build"):
			os.mkdir(Globals.root_directory_ + "/Build")
		os.mkdir(Globals.build_directory_)
	
	print( "--> Starting " + Globals.build_target_ + " Build")
	build_target = Globals.build_target_
	if build_target == "release":
		code_builder = Release()
		return code_builder.start()
	elif build_target == "archive":	
		archive_builder = Archiver()
		return archive_builder.start()
	elif build_target == "boost":
		code_builder = Boost()
		return code_builder.start()
	elif build_target == "documentation":
		documentation_builder = Documentation()
		return documentation_builder.start()
	elif build_target == "unittests":
		unit_tests = UnitTests()
		return unit_tests.start()
	elif build_target == "examples":
		examples = Examples()
		return examples.start()
	elif build_target == "clean":
		cleaner = Cleaner()
		return cleaner.clean()
	elif build_target == "rlibrary":
		rlibrary = RLibrary()
		return rlibrary.start()
	elif build_target == "rinstall":
		Globals.install_r_library = "true"
		rlibrary = RLibrary()
		return rlibrary.start()
	elif build_target == "installer":
		installer = Installer()
		return installer.start()
#	elif build_target == "deb":
#		deb_builder = DebBuilder()
#		return deb_builder.start(build_parameters)
	elif build_target == "version":
		version = Version()
		return version.create_version_header()
	return False # Default return from this, we didn't find a run mode
示例#3
0
def start():
  print '-- Checking for dateutil Python module'
  if 'dateutil' not in sys.modules:
    return Globals.PrintError("Python requires the module dateutil for the build system to work")
  print '-- Checking for datetime Python module'
  if 'datetime' not in sys.modules:
    return Globals.PrintError("Python requires the module datetime for the build system to work")
  print '-- Checking for re Python module'
  if 're' not in sys.modules:
    return Globals.PrintError("Python requires the module re for the build system to work")
  print '-- Checking for distutils Python module'
  if 'distutils' not in sys.modules:
    return Globals.PrintError("Python requires the module distutils for the build system to work")
  
  build_target = ""
  build_parameters = ""
  
  """
  Handle build information already passed in
  """
  if len(sys.argv) > 1 and len(str(sys.argv[1])) > 1:
      build_target = sys.argv[1]
  if len(sys.argv) > 2 and len(str(sys.argv[2])) > 1:
      build_parameters = sys.argv[2] 

  if build_target == "":
    return Globals.PrintError('Please provide a valid build target. Use doBuild help to see list');
  if not build_target.lower() in Globals.allowed_build_targets_:
    return Globals.PrintError(build_target + " is not a valid build target")
    
  build_target = build_target.lower()    
  if build_target == "help":
    print_usage()
    return True
  if build_target == "check":
	print "--> All checks completed successfully"
	return True 

  if build_parameters != "": 
    build_parameters = build_parameters.lower()
  
  Globals.build_target_ = build_target
  Globals.build_parameters_ = build_parameters
  
  print " -- Build target: " + Globals.build_target_
  print " -- Build parameters: " + Globals.build_parameters_
  print ""
  
  if build_target in Globals.allowed_build_types_:      
    if not build_parameters in Globals.allowed_build_parameters_:
      return Globals.PrintError("Build parameter " + build_parameters + " is not valid")
    
    print "*************************************************************************"
    print "*************************************************************************"
    print "--> Starting " + Globals.build_target_ + " Build"
    code_builder = MainCode()
    if not code_builder.start(False):
      return False
  if build_target == "thirdparty" or build_target == "thirdpartylean":
    print "*************************************************************************"
    print "*************************************************************************"
    print "--> Starting " + Globals.build_target_ + " Build"
    code_builder = ThirdPartyLibraries()
    if not code_builder.start():
      return False
  elif build_target == "clean":
    print "*************************************************************************"
    print "*************************************************************************"
    print "--> Cleaning all IBM built files"
    cleaner = Cleaner()
    if not cleaner.clean():
      return False
  elif build_target == "modelrunner":
    print "*************************************************************************"
    print "*************************************************************************"
    print "--> Starting " + Globals.build_target_ + " Build"
    model_runner = ModelRunner()
    if not model_runner.start():
      return False      
  elif build_target == "documentation":
    print "*************************************************************************"
    print "*************************************************************************"
    print "--> Starting " + Globals.build_target_ + " Build"
    documentation_builder = Documentation()
    if not documentation_builder.start():
      return False	  
  elif build_target == "cleanall":
    print "*************************************************************************"
    print "*************************************************************************"
    print "--> Cleaning all IBM built files, including third party headers and libs"
    cleaner = Cleaner()
    if not cleaner.clean_all():
      return False

  return True
示例#4
0
文件: build.py 项目: largek/CASAL2
def start():
    print '-- Checking for dateutil Python module'
    if 'dateutil' not in sys.modules:
        return Globals.PrintError(
            "Python requires the module dateutil for the build system to work")
    print '-- Checking for datetime Python module'
    if 'datetime' not in sys.modules:
        return Globals.PrintError(
            "Python requires the module datetime for the build system to work")
    print '-- Checking for re Python module'
    if 're' not in sys.modules:
        return Globals.PrintError(
            "Python requires the module re for the build system to work")
    print '-- Checking for distutils Python module'
    if 'distutils' not in sys.modules:
        return Globals.PrintError(
            "Python requires the module distutils for the build system to work"
        )

    build_target = ""
    build_parameters = ""
    """
  Handle build information already passed in
  """
    if len(sys.argv) > 1 and len(str(sys.argv[1])) > 1:
        build_target = sys.argv[1]
    if len(sys.argv) > 2 and len(str(sys.argv[2])) > 1:
        build_parameters = sys.argv[2]

    if build_target == "":
        return Globals.PrintError(
            'Please provide a valid build target. Use doBuild help to see list'
        )
    if not build_target.lower() in Globals.allowed_build_targets_:
        return Globals.PrintError(build_target +
                                  " is not a valid build target")

    build_target = build_target.lower()
    if build_target == "help":
        print_usage()
        return True
    if build_target == "check":
        print "--> All checks completed successfully"
        return True

    if build_parameters != "":
        build_parameters = build_parameters.lower()

    Globals.build_target_ = build_target
    Globals.build_parameters_ = build_parameters

    print " -- Build target: " + Globals.build_target_
    print " -- Build parameters: " + Globals.build_parameters_
    print ""

    if build_target in Globals.allowed_build_types_:
        if not build_parameters in Globals.allowed_build_parameters_:
            return Globals.PrintError("Build parameter " + build_parameters +
                                      " is not valid")

        print "*************************************************************************"
        print "*************************************************************************"
        print "--> Starting " + Globals.build_target_ + " Build"
        code_builder = MainCode()
        if not code_builder.start(False):
            return False
    if build_target == "library":
        if not build_parameters in Globals.allowed_library_parameters_:
            return Globals.PrintError("Library build parameter" +
                                      build_parameters + " is not valid")
        print "*************************************************************************"
        print "*************************************************************************"
        print "--> Starting " + Globals.build_target_ + " Build"
        code_builder = MainCode()
        if not code_builder.start(True):
            return False
    elif build_target == "frontend":
        print "*************************************************************************"
        print "*************************************************************************"
        print "--> Starting " + Globals.build_target_ + " Build"
        code_builder = FrontEnd()
        if not code_builder.start():
            return False
    elif build_target == "archive":
        print "*************************************************************************"
        print "*************************************************************************"
        print "--> Starting " + Globals.build_target_ + " Build"
        archive_builder = Archiver()
        if not archive_builder.start(build_parameters):
            return False
    elif build_target == "thirdparty" or build_target == "thirdpartylean":
        print "*************************************************************************"
        print "*************************************************************************"
        print "--> Starting " + Globals.build_target_ + " Build"
        code_builder = ThirdPartyLibraries()
        if not code_builder.start():
            return False
    elif build_target == "documentation":
        print "*************************************************************************"
        print "*************************************************************************"
        print "--> Starting " + Globals.build_target_ + " Build"
        documentation_builder = Documentation()
        if not documentation_builder.start():
            return False
    elif build_target == "modelrunner":
        print "*************************************************************************"
        print "*************************************************************************"
        print "--> Starting " + Globals.build_target_ + " Build"
        model_runner = ModelRunner()
        if not model_runner.start():
            return False
    elif build_target == "clean":
        print "*************************************************************************"
        print "*************************************************************************"
        print "--> Cleaning all CASAL2 built files"
        cleaner = Cleaner()
        if not cleaner.clean():
            return False
    elif build_target == "cleanall":
        print "*************************************************************************"
        print "*************************************************************************"
        print "--> Cleaning all CASAL2 built files, including third party headers and libs"
        cleaner = Cleaner()
        if not cleaner.clean_all():
            return False
    elif build_target == "rlibrary":
        print "*************************************************************************"
        print "*************************************************************************"
        print "--> Starting " + Globals.build_target_ + " Build"
        r_path = ''
        if Globals.operating_system_ == 'windows':
            print "find windows R"
            r_path = system_info.find_exe_path('R.exe')
        else:
            r_path = system_info.find_exe_path('R')
        print "R path = " + r_path
        if r_path == '':
            return Globals.PrintError(
                "R is not in the current path please add R to your path.")
        rlibrary = Rlibrary()
        if not rlibrary.start():
            return False
    elif build_target == "installer":
        print "*************************************************************************"
        print "*************************************************************************"
        print "--> Building CASAL2 Installer"
        if Globals.operating_system_ == 'linux':
            return Globals.PrintError(
                'Building Windows installer under linux is not supported')
        installer = Installer()
        installer.start()
    elif build_target == "deb":
        print "*************************************************************************"
        print "*************************************************************************"
        print "--> Building CASAL2 .deb Installer"
        if Globals.operating_system_ == 'windows':
            return Globals.PrintError(
                'Building linux .deb under Windows is not supported')
        deb_builder = DebBuilder()
        if not deb_builder.start(build_parameters):
            return False

    return True
示例#5
0
def start():
	cli = CommandLineInterface()
	if not cli.parse():
  		cli.print_usage()
  		return False
      
	print("*************************************************************************")
	print("*************************************************************************")
	print(f"--> Starting {Globals.build_target_} Build")
	build_target = Globals.build_target_
	build_parameters = Globals.build_parameters_

	# Build Version
	version = Version()
	version.create_version_header()

	if build_target == "version":
		version = Version()
		version.create_version_header(display_output=True)
	elif build_target in Globals.allowed_build_types_:
		code_builder = MainCode()
		return code_builder.start()
	elif build_target == "library":
		if not build_parameters in Globals.allowed_library_parameters_:
			return Globals.PrintError(f"Library build parameter {build_parameters} is not valid")
		print("--> Starting " + Globals.build_target_ + " Build")
		code_builder = MainCode()
		return code_builder.start(build_library=True)			
	elif build_target == "frontend":
		print("--> Starting " + Globals.build_target_ + " Build")
		code_builder = FrontEnd()
		return code_builder.start()
	elif build_target == "archive":	
		archive_builder = Archiver()
		return archive_builder.start(build_parameters)
	elif build_target == "thirdparty" or build_target == "thirdpartylean":
		code_builder = ThirdPartyLibraries()
		return code_builder.start()
	elif build_target == "documentation":
		documentation_builder = Documentation()
		return documentation_builder.start()
	elif build_target == "modelrunner":
		model_runner = ModelRunner()
		return model_runner.start()
	elif build_target == "unittests":
		unit_tests = UnitTests()
		return unit_tests.start()	
	elif build_target == "clean":
		cleaner = Cleaner()
		return cleaner.clean()	
	elif build_target == "cleancache":
		cleaner = Cleaner()
		return cleaner.clean_cache()
	elif build_target == "clean_all":
		cleaner = Cleaner()
		return cleaner.clean_all()
	elif build_target == "rlibrary":
		rlibrary = Rlibrary()
		return rlibrary.start()
	elif build_target == "installer":
		if Globals.operating_system_ == 'linux':
			return Globals.PrintError('Building Windows installer under linux is not supported')		
		installer = Installer()
		return installer.start()
	elif build_target == "deb":
		if Globals.operating_system_ == 'windows':
			return Globals.PrintError('Building linux .deb under Windows is not supported')
		deb_builder = DebBuilder()
		return deb_builder.start(build_parameters)
	return False # Default return from this, we didn't find a run mode