How to use configure_base method in pyresttest

Best Python code snippet using pyresttest_python

preconfigure.py

Source:preconfigure.py Github

copy

Full Screen

1#!/usr/bin/env python2## \file configure.py3# \brief An extended configuration script.4# \author T. Albring5# \version 7.0.6 "Blackbird"6#7# SU2 Project Website: https://su2code.github.io8# 9# The SU2 Project is maintained by the SU2 Foundation 10# (http://su2foundation.org)11#12# Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md)13#14# SU2 is free software; you can redistribute it and/or15# modify it under the terms of the GNU Lesser General Public16# License as published by the Free Software Foundation; either17# version 2.1 of the License, or (at your option) any later version.18# 19# SU2 is distributed in the hope that it will be useful,20# but WITHOUT ANY WARRANTY; without even the implied warranty of21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU22# Lesser General Public License for more details.23#24# You should have received a copy of the GNU Lesser General Public25# License along with SU2. If not, see <http://www.gnu.org/licenses/>.26from __future__ import print_function, division, absolute_import27from optparse import OptionParser, BadOptionError28import sys,time, os, subprocess, os.path, glob, re, shutil, fileinput29from subprocess import call30# "Pass-through" option parsing -- an OptionParser that ignores31# unknown options and lets them pile up in the leftover argument32# list. Useful to pass unknown arguments to the automake configure.33class PassThroughOptionParser(OptionParser):34 def _process_long_opt(self, rargs, values):35 try:36 OptionParser._process_long_opt(self, rargs, values)37 except BadOptionError as err:38 self.largs.append(err.opt_str)39 def _process_short_opts(self, rargs, values):40 try:41 OptionParser._process_short_opts(self, rargs, values)42 except BadOptionError as err:43 self.largs.append(err.opt_str)44def main():45 # Command Line Options46 usage = './preconfigure.py [options]' \47 '\nNote: Options not listed below are passed to the automake configure.' \48 '\n Compiler flags must be set with \'export CFLAGS=...\' or \'export CXXFLAGS=...\' ' \49 '\n before calling this script.'50 parser = PassThroughOptionParser(usage = usage)51 parser.add_option("--enable-direct-diff", action="store_true",52 help="Enable direct differentiation mode support", dest="directdiff", default=False)53 parser.add_option("--enable-autodiff", action="store_true",54 help="Enable Automatic Differentiation support", dest="ad_support", default=False)55 parser.add_option("--with-ad", action="store", type = "string", help="AD Tool, CODI/ADOLC", default="CODI", dest="adtool")56 parser.add_option("--enable-mpi", action="store_true",57 help="Enable mpi support", dest="mpi_enabled", default=False)58 parser.add_option("--enable-PY_WRAPPER", action="store_true",59 help="Enable Python wrapper compilation", dest="py_wrapper_enabled", default=False)60 parser.add_option("--disable-tecio", action="store_true",61 help="Disable Tecplot binary support", dest="tecio_disabled", default=False)62 parser.add_option("--disable-normal", action="store_true",63 help="Disable normal mode support", dest="normal_mode", default=False)64 parser.add_option("-c" , "--check", action="store_true",65 help="Check the source code for potential problems", dest="check", default=False)66 parser.add_option("-r" , "--replace", action="store_true",67 help="Do a search and replace of necessary symbols. Creates back up of source files.", dest="replace", default=False)68 parser.add_option("-d" , "--delete", action="store_true",69 help="Removes the back up files.", dest="remove", default=False)70 parser.add_option("-v" , "--revert", action="store_true",71 help="Revert files to original state.", dest="revert", default=False)72 parser.add_option("-u", "--update", action="store_true",73 help="Update and recompile submodules.", dest="update", default=False)74 (options, args)=parser.parse_args()75 options.adtool = options.adtool.upper()76 if options.directdiff == False:77 adtool_dd = ""78 else:79 adtool_dd = options.adtool80 if options.ad_support == False:81 adtool_da = ""82 else:83 adtool_da = options.adtool84 conf_environ = os.environ85 made_adolc = False86 made_codi = False87 header()88 modes = {'SU2_BASE' : not options.normal_mode == True,89 'SU2_DIRECTDIFF' : adtool_dd ,90 'SU2_AD' : adtool_da }91 # Create a dictionary from the arguments92 argument_dict = dict(zip(args[::2],args[1::2]))93 # Set the default installation path (if not set with --prefix)94 argument_dict['--prefix'] = argument_dict.get('--prefix', os.getcwd().rstrip())95 if not options.check:96 if any([modes["SU2_AD"] == 'CODI', modes["SU2_DIRECTDIFF"] == 'CODI']):97 conf_environ, made_codi = init_codi(argument_dict,modes,options.mpi_enabled, options.update)98 configure(argument_dict,99 conf_environ,100 options.mpi_enabled,101 options.py_wrapper_enabled,102 options.tecio_disabled,103 modes,104 made_adolc,105 made_codi)106 if options.check:107 prepare_source(options.replace, options.remove, options.revert)108def prepare_source(replace = False, remove = False, revert = False):109 # Directories containing the source code110 print('Preparing source code ...')111 dir_list = [ "Common",112 "SU2_CFD",113 "SU2_DEF",114 "SU2_DOT",115 "SU2_GEO",116 "SU2_SOL",117 "SU2_MSH"]118 file_list = ""119 exclude_dic_lines = {}120 exclude_dic_files = {}121 exclude_file_name = 'preconf.exclude'122# # Build the dictionaries for line and file excludes that123# # are defined in the exlude file 'preconf.exclude'.124# # Syntax:125# # PathTo/File[:Line1,Line2,...]126# if os.path.exists(exclude_file_name):127# print 'Reading \'' + exclude_file_name + '\' ...'128# with open(exclude_file_name, 'r') as exclude:129# for line in exclude:130# exclude_line = line.split(':')131# exclude_file = exclude_line[0].rstrip()132# if len(exclude_line) > 1:133# exclude_lines = exclude_line[1].split(',')134# for index,item in enumerate(exclude_lines):135# exclude_lines[index] = int(item.rstrip())136# exclude_dic_lines[exclude_line[0].rstrip()] = exclude_lines137# else:138# exclude_dic_files[exclude_line[0].rstrip()] = [-1]139# else:140# print('Exclude file \'' + exclude_file_name + '\' not found. Checking all files.')141 # Hardcoded files that will be skipped142 exclude_dic_files = { 'Common/include/datatype_structure.hpp' : [-1],143 'Common/include/datatype_structure.inl' : [-1],144 'Common/include/mpi_structure.hpp' : [-1],145 'Common/include/mpi_structure.inl' : [-1],146 'Common/src/datatype_structure.cpp': [-1],147 'Common/src/mpi_structure.cpp' : [-1] }148 str_double = 'double'149 regex_double = re.compile(r'(^|[^\w])('+str_double+')([^\w]|$)')150 replacement_double = r'\1su2double\3'151 simple_replacements = {'MPI_Reduce' : 'SU2_MPI::Reduce',152 'MPI_Allreduce' : 'SU2_MPI::Allreduce',153 'MPI_Gather' : 'SU2_MPI::Gather',154 'MPI_Allgather' : 'SU2_MPI::Allgather',155 'MPI_Isend' : 'SU2_MPI::Isend',156 'MPI_Irecv' : 'SU2_MPI::Irecv',157 'MPI_Send' : 'SU2_MPI::Send',158 'MPI_Wait' : 'SU2_MPI::Wait',159 'MPI_Waitall' : 'SU2_MPI::Waitall',160 'MPI_Waitany' : 'SU2_MPI::Waitany',161 'MPI_Bsend' : 'SU2_MPI::Bsend' ,162 'MPI_Bcast' : 'SU2_MPI::Bcast',163 'MPI_Sendrecv' : 'SU2_MPI::Sendrecv',164 'MPI_Init' : 'SU2_MPI::Init',165 'MPI_Recv' : 'SU2_MPI::Recv',166 'MPI_Comm_size' : 'SU2_MPI::Comm_size',167 'MPI_Comm_rank' : 'SU2_MPI::Comm_rank',168 'MPI_Init' : 'SU2_MPI::Init',169 'MPI_Barrier' : 'SU2_MPI::Barrier',170 'MPI_Abort' : 'SU2_MPI::Abort',171 'MPI_Request' : 'SU2_MPI::Request',172 'MPI_Get_count' : 'SU2_MPI::Get_count',173 'MPI_Finalize' : 'SU2_MPI::Finalize',174 'MPI_Buffer_detach': 'SU2_MPI::Buffer_detach',175 'MPI_Buffer_attach': 'SU2_MPI::Buffer_attach',176 'MPI_Status' : 'SU2_MPI::Status',177 'sprintf' : 'SPRINTF'}178 regex_cast_1 = re.compile(r'(^|[^\w|^\\])(int)(\s*\()')179 replacement_cast_1 = r'\1SU2_TYPE::Int\3'180 regex_cast_2 = re.compile(r'\(int\)\s*')181 logfile = open ('preconf.log','w')182 backup_ext = '.orig'183 print('Checking for problems...')184 # Test each source file for the occurrence of missing replacements185 # and print the respective lines.186 for dir in dir_list:187 file_list = glob.glob(dir+os.path.sep+'*[src,include]'+os.path.sep+'*[.cpp,.hpp,.inl]')188 for file in file_list:189 if not file in exclude_dic_files.keys():190 if all([not replace, revert]):191 # Check if back up file exists192 if os.path.isfile(file + backup_ext):193 os.remove(file);194 shutil.copy(file + backup_ext, file)195 else:196 print('Cannot find backup file ' + file + backup_ext)197 # Remove backup files if requested198 if all([not replace, remove]):199 if os.path.isfile(file + backup_ext):200 print('Removing' + file + backup_ext)201 os.remove(file + backup_ext)202 if all([not remove, not revert]):203 num_found = 0204 found_line = ""205 ignore_line = ""206 new_line = ""207 for line in fileinput.input(file, inplace = 1, backup = backup_ext):208 new_line = line.rstrip('\n')209 if any([re.findall(regex_double, line), find_all(line, simple_replacements), re.findall(regex_cast_1, line)]):210 if not fileinput.lineno() in exclude_dic_lines.get(file,[]):211 if replace:212 new_line = replace_all(new_line, simple_replacements)213 new_line = re.sub(regex_double, replacement_double, new_line)214 new_line = re.sub(regex_cast_1, replacement_cast_1, new_line)215 found_line = found_line + '\tLine ' + str(fileinput.lineno()) +': ' + line.rstrip() + '\n\t\t => ' + new_line.rstrip() + '\n'216 else:217 found_line = found_line + '\tLine ' + str(fileinput.lineno()) +': ' + line.rstrip() + '\n'218 num_found = num_found + 1219 else:220 ignore_line = ignore_line + 'Ignoring line ' + str(fileinput.lineno()) + ' in ' + file + ' (' + line.rstrip() + ')\n'221 print(new_line)222 if num_found > 0:223 if replace:224 print('Solved ' + str(num_found) + ' potential problem(s) in ' + file + '.')225 logfile.write('Solved ' + str(num_found) + ' potential problem(s) in ' + file + ':\n')226 else:227 print('Found ' + str(num_found) + ' potential problem(s) in ' + file + '.')228 logfile.write('Found ' + str(num_found) + ' potential problem(s) in ' + file + ':\n')229 logfile.write( found_line )230 else:231 os.remove(file + backup_ext)232 if not ignore_line == "":233 print(ignore_line.rstrip())234 else:235 print('Ignoring file ' + file)236 print('\nPlease check preconf.log to get more information about potential problems.')237def replace_all(text, dic):238 for i, j in dic.iteritems():239 text = text.replace(i, j)240 return text241def find_all(text, dic):242 for i,j in dic.iteritems():243 if not text.find(i) == -1:244 return True245 return False246def init_codi(argument_dict, modes, mpi_support = False, update = False):247 modules_failed = True248 249 # This information of the modules is used if projects was not cloned using git250 # The sha tag must be maintained manually to point to the correct commit251 sha_version_codi = 'bd4a639c2fe625a80946c8365bd2976a2868cf46'252 github_repo_codi = 'https://github.com/scicompkl/CoDiPack'253 sha_version_medi = '46a97e1d6e8fdd3cb42b06534cff6acad2a49693'254 github_repo_medi = 'https://github.com/SciCompKL/MeDiPack'255 medi_name = 'MeDiPack'256 codi_name = 'CoDiPack'257 alt_name_medi = 'externals/medi'258 alt_name_codi = 'externals/codi'259 # Some log and error files260 log = open( 'preconf.log', 'w' )261 err = open( 'preconf.err', 'w' )262 pkg_environ = os.environ263 codi_status = False264 ampi_status = False265 print("Checking the status of submodules")266 print('=====================================================================')267 # Remove modules if update is requested268 if update:269 if os.path.exists(alt_name_codi):270 print('Removing ' + alt_name_codi)271 shutil.rmtree(alt_name_codi)272 if os.path.exists(alt_name_medi):273 print('Removing ' + alt_name_medi)274 shutil.rmtree(alt_name_medi)275 submodule_check(codi_name, alt_name_codi, github_repo_codi, sha_version_codi, log, err, update)276 if mpi_support:277 submodule_check(medi_name, alt_name_medi, github_repo_medi, sha_version_medi, log, err, update)278 return pkg_environ, True279def submodule_check(name, alt_name, github_rep, sha_tag, log, err, update = False):280 try:281 status = submodule_status(alt_name, update)282 if status:283 print('Found correct version of ' + name + ' in ' + alt_name + '.')284 except RuntimeError:285 if all([os.path.exists(alt_name), not os.path.exists(alt_name + '/' + sha_tag)]):286 print('Found an old or unspecified version of ' + name + ' in ' + alt_name + '.\nUse -u to reset module.')287 sys.exit()288 if not os.path.exists(alt_name):289 print('\ngit command failed (either git is not installed or this is not a git repository).')290 print('\nUsing fall-back method to initialize submodule ' + name)291 download_module(name, alt_name, github_rep, sha_tag, log, err)292 else:293 print('Found correct version of ' + name + ' in ' + alt_name + '.')294def submodule_status(path, update):295 try:296 status = check_output('git submodule status ' + path).decode()297 except RuntimeError:298 raise RuntimeError299 status_indicator = status[0][0]300 if status_indicator == '+':301 sys.stderr.write('WARNING: the currently checked out submodule commit in ' + path + ' does not match the SHA-1 found in the index.\n')302 sys.stderr.write('Use \'git submodule update --init '+ path + '\' to reset the module if necessary.\n')303 return False304 elif any([status_indicator == '-', update]):305 print('Initialize submodule ' + path + ' using git ... ')306 subprocess.check_call('git submodule update --init ' + path, shell = True)307 return True308def download_module(name, alt_name, git_repo, commit_sha, logfile, errorfile):309 print('\nInitializing ' + name + ' \'' + commit_sha + '\'')310 print('=====================================================================')311 # Download package312 try:313 print('Downloading module from ' + git_repo)314 subprocess.check_call('wget -N ' + git_repo + '/archive/' + commit_sha + '.zip', stdout = logfile, stderr = errorfile, shell = True )315 except subprocess.CalledProcessError:316 print('Download of module ' + name + ' failed. See preconf.err for more information.')317 print('To download it manually, perform the following steps:')318 print('\t - Download the zip at \"' + git_repo + '/archive/' + commit_sha + '.zip\"')319 print('\t - Extract the archive to externals/' + alt_name)320 print('\t - Execute command \'touch externals/'+ alt_name + '/' + commit_sha + '\'')321 print('\t - Run preconfigure.py again')322 sys.exit()323 324 # Extract zip archive325 try:326 print('Extracting archive ...')327 subprocess.check_call('unzip -u ' + commit_sha + '.zip', stdout = logfile, stderr = errorfile, shell=True)328 except subprocess.CalledProcessError:329 print('Extraction of module ' + name + ' failed. See preconf.err for more information.')330 sys.exit()331 # Rename folder and create a file to identify the version332 try:333 print('Creating identifier ...')334 subprocess.check_call('mv '+ name + '-' + commit_sha + ' ' + alt_name + ' && touch ' + alt_name + '/' + commit_sha, stdout = logfile, stderr = errorfile, shell = True)335 except subprocess.CalledProcessError:336 print('Renaming of module ' + name + ' failed. See preconf.err for more information.')337 sys.exit()338 # Remove archive339 subprocess.check_call('rm ' + commit_sha + '.zip', shell=True)340def configure(argument_dict,341 conf_environ,342 mpi_support,343 py_wrapper,344 tecio,345 modes,346 made_adolc,347 made_codi):348 # Boostrap to generate Makefile.in349 bootstrap_command = './bootstrap'350 # Set the base command for running configure351 configure_base = '../configure'352 # Add the arguments to the configure command353 for arg in argument_dict:354 configure_base = configure_base + " " + arg + "=" + argument_dict[arg]355 configure_mode = ''356 if mpi_support:357 configure_base = configure_base + ' --enable-mpi'358 if py_wrapper:359 configure_base = configure_base + ' --enable-PY_WRAPPER'360 if tecio:361 configure_base = configure_base + ' --disable-tecio'362 build_dirs = ''363 364 print( '\nPreparing build environment\n' \365 '=====================================================================')366 run_command(bootstrap_command, 'bootstrap.log', 'bootstrap.err', conf_environ)367 # Create the commands for the different configurations and run configure368 for key in modes:369 if modes[key]:370 print('\nRunning configure in folder ' + key + ' ', end = '')371 if modes[key] == 'CODI':372 if key == 'SU2_DIRECTDIFF':373 configure_mode = '--enable-codi-forward'374 if key == 'SU2_AD':375 configure_mode = '--enable-codi-reverse'376 print('using ' + modes[key])377 elif modes[key] == 'ADOLC':378 if key == 'SU2_DIRECTDIFF':379 configure_mode = '--enable-adolc-forward'380 if key == 'SU2_AD':381 configure_mode = '--enable-adolc-reverse'382 print('using ' + modes[key])383 elif modes[key] == 'COMPLEX':384 configure_mode = '--enable-complex'385 print('using ' + modes[key])386 else:387 configure_mode = ''388 print('')389 print('=====================================================================')390 log = os.getcwd().rstrip() + '/conf_'+ key+'.log'391 err = os.getcwd().rstrip() + '/conf_'+ key+'.err'392 if not os.path.exists(key):393 os.mkdir(key)394 os.chdir(key)395 run_command(configure_base + ' ' + configure_mode, log, err, conf_environ)396 os.chdir(os.pardir)397 build_dirs += key + ' '398 write_makefile(build_dirs)399 print('\nPre-configuration Summary:\n' \400 '=====================================================================\n'\401 '\tConfiguration sets: '+ build_dirs + '\n')402 print('\tUse "make <install>" to compile (and install) all configured binaries:\n')403 if modes['SU2_BASE']:404 print('\tSU2_CFD -> General solver for direct, cont. adjoint and linearized equations.\n' \405 '\tSU2_DOT -> Gradient Projection Code.\n' \406 '\tSU2_DEF -> Mesh Deformation Code.\n' \407 '\tSU2_MSH -> Mesh Adaption Code.\n' \408 '\tSU2_SOL -> Solution Export Code.\n' \409 '\tSU2_GEO -> Geometry Definition Code.\n')410 if modes['SU2_AD']:411 print('\tSU2_CFD_AD -> Discrete Adjoint Solver and general AD support.')412 print('\tSU2_DOT_AD -> Mesh sensitivity computation and general AD support.')413 if modes['SU2_DIRECTDIFF']:414 print('\tSU2_CFD_DIRECTDIFF -> Direct Differentation Mode.')415 print('\n')416 print('\tPlease be sure to add the $SU2_HOME and $SU2_RUN environment variables,\n' \417 '\tand update your $PATH (and $PYTHONPATH if applicable) with $SU2_RUN.\n' \418 '\n' \419 '\tBased on the input to this configuration, add these lines to your .bashrc file: \n' \420 '\n' \421 '\texport SU2_RUN="'+argument_dict['--prefix']+'/bin"\n' \422 '\texport SU2_HOME="'+os.getcwd().rstrip()+'"\n' \423 '\texport PATH=$PATH:$SU2_RUN\n' \424 '\texport PYTHONPATH=$PYTHONPATH:$SU2_RUN\n')425def run_command(command, log, err, env):426 try:427 logfile = open(log, 'w')428 errfile = open(err, 'w')429 print('Command: ' + command)430 subprocess.check_call(command, env = env, stdout = logfile, stderr = errfile, shell=True)431 print('Logfile written to ' + log)432 logfile.close()433 errfile.close()434 except subprocess.CalledProcessError:435 errfile = open(err, 'r')436 print('\nThere was an error while running command \'' + command + '\'.')437 print('=== Error Log ===')438 print(errfile.read())439 errfile.close()440 sys.exit(1)441def check_output(cmd):442 std, err = subprocess.Popen([cmd], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell = True).communicate()443 if err:444 raise RuntimeError(err)445 return std446def write_makefile(build_dirs):447 print('\nCreating Makefile ...\n')448 makefile = open('Makefile', 'w')449 makefile.writelines(['# This file is auto-generated by preconfigure.py\n',450 'SUBDIRS = '+ build_dirs + '\n',451 'INSTALLDIRS = $(SUBDIRS:%=install-%)\n',452 'CLEANDIRS = $(SUBDIRS:%=clean-%)\n',453 '\n',454 'subdirs: $(SUBDIRS)\n',455 '\n',456 '$(SUBDIRS):\n',457 '\t$(MAKE) -C $@\n',458 '\n',459 'install: $(INSTALLDIRS)\n',460 '$(INSTALLDIRS):\n',461 '\t$(MAKE) -C $(@:install-%=%) install\n',462 '\n',463 'clean: $(CLEANDIRS)\n',464 '$(CLEANDIRS):\n',465 '\t$(MAKE) -C $(@:clean-%=%) clean\n',466 '\n',467 '.PHONY: subdirs $(SUBDIRS)\n',468 '.PHONY: subdirs $(INSTALLDIRS)\n',469 '.PHONY: subdirs $(CLEANDIRS)\n',470 '.PHONY: install\n'])471 makefile.close()472def header():473 print('-------------------------------------------------------------------------\n'\474 '| ___ _ _ ___ | \n'\475 '| / __| | | |_ ) Release 7.0.2 \'Blackbird\' | \n'\476 '| \__ \ |_| |/ / | \n'\477 '| |___/\___//___| Pre-configuration Script | \n'\478 '| | \n'\479 '------------------------------------------------------------------------- \n'\480 '| The current SU2 release has been coordinated by the | \n'\481 '| SU2 International Developers Society <www.su2devsociety.org> | \n'\482 '| with selected contributions from the open-source community. | \n'\483 '------------------------------------------------------------------------- \n'\484 '| The main research teams contributing to the current release are: | \n'\485 '| - Prof. Juan J. Alonso\'s group at Stanford University. | \n'\486 '| - Prof. Piero Colonna\'s group at Delft University of Technology. | \n'\487 '| - Prof. Nicolas R. Gauger\'s group at Kaiserslautern U. of Technology. | \n'\488 '| - Prof. Alberto Guardone\'s group at Polytechnic University of Milan. | \n'\489 '| - Prof. Rafael Palacios\' group at Imperial College London. | \n'\490 '| - Prof. Vincent Terrapon\'s group at the University of Liege. | \n'\491 '| - Prof. Edwin van der Weide\'s group at the University of Twente. | \n'\492 '| - Lab. of New Concepts in Aeronautics at Tech. Inst. of Aeronautics. | \n'\493 '------------------------------------------------------------------------- \n'\494 '| Copyright 2012-2020, Francisco D. Palacios, Thomas D. Economon, | \n'\495 '| Tim Albring, and the SU2 contributors. | \n'\496 '| | \n'\497 '| SU2 is free software; you can redistribute it and/or | \n'\498 '| modify it under the terms of the GNU Lesser General Public | \n'\499 '| License as published by the Free Software Foundation; either | \n'\500 '| version 2.1 of the License, or (at your option) any later version. | \n'\501 '| | \n'\502 '| SU2 is distributed in the hope that it will be useful, | \n'\503 '| but WITHOUT ANY WARRANTY; without even the implied warranty of | \n'\504 '| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | \n'\505 '| Lesser General Public License for more details. | \n'\506 '| | \n'\507 '| You should have received a copy of the GNU Lesser General Public | \n'\508 '| License along with SU2. If not, see <http://www.gnu.org/licenses/>. | \n'\509 '------------------------------------------------------------------------- \n')510# -------------------------------------------------------------------511# Run Main Program512# -------------------------------------------------------------------513# this is only accessed if running from command prompt514if __name__ == '__main__':...

Full Screen

Full Screen

setup_activity.py

Source:setup_activity.py Github

copy

Full Screen

...180 self._cache.configure_core('cmake-prefix-path', self.edit_cmake_prefix_path.text())181 self._cache.configure_core('pkg-config-path', self.edit_pkg_config_path.text())182 #183 # Meson args passed for (Base options)184 self._cache.configure_base('b_colorout', self.combo_b_colorout.currentText())185 self._cache.configure_base('b_coverage', self.combo_b_coverage.currentText())186 self._cache.configure_base('b_lundef', self.combo_b_lundef.currentText())187 self._cache.configure_base('b_ndebug', self.combo_b_ndebug.currentText())188 self._cache.configure_base('b_lto', self.combo_b_lto.currentText())189 self._cache.configure_base('b_pch', self.combo_b_pch.currentText())190 self._cache.configure_base('b_pgo', self.combo_b_pgo.currentText())191 self._cache.configure_base('b_pie', self.combo_b_pie.currentText())192 self._cache.configure_base('b_sanitize', self.combo_b_sanitize.currentText())193 self._cache.configure_base('b_staticpic', self.combo_b_staticpic.currentText())194 self._cache.configure_base('b_vscrt', self.combo_b_vscrt.currentText())195 #196 # Meson args passed for (Directory options)197 self._cache.configure_path('prefix', self.edit_prexif.text())198 self._cache.configure_path('bindir', self.edit_bindir.text())199 self._cache.configure_path('datadir', self.edit_datadir.text())200 self._cache.configure_path('includedir', self.edit_includedir.text())201 self._cache.configure_path('infodir', self.edit_infodir.text())202 self._cache.configure_path('libdir', self.edit_libdir.text())203 self._cache.configure_path('libexecdir', self.edit_libexecdir.text())204 self._cache.configure_path('localedir', self.edit_localedir.text())205 self._cache.configure_path('localstatedir', self.edit_localstatedir.text())206 self._cache.configure_path('mandir', self.edit_mandir.text())207 self._cache.configure_path('sbindir', self.edit_sbindir.text())208 self._cache.configure_path('sharedstatedir', self.edit_sharedstatedir.text())...

Full Screen

Full Screen

app_dns.py

Source:app_dns.py Github

copy

Full Screen

...19 @click.group(name='app-dns')20 def appdns():21 """Manage Treadmill App DNS configuration.22 """23 def configure_base(name, cell, pattern, endpoints, alias, scope, id_group):24 """Create, modify or get Treadmill App DNS entry"""25 restapi = context.GLOBAL.admin_api()26 url = _REST_PATH + name27 data = {}28 if cell:29 data['cells'] = cell30 if pattern is not None:31 data['pattern'] = pattern32 if endpoints is not None:33 data['endpoints'] = endpoints34 if alias is not None:35 data['alias'] = alias36 if scope is not None:37 data['scope'] = scope38 if id_group is not None:39 data['identity-group'] = id_group40 if data:41 try:42 _LOGGER.debug('Trying to create app-dns entry %s', name)43 restclient.post(restapi, url, data)44 except restclient.AlreadyExistsError:45 _LOGGER.debug('Updating app-dns entry %s', name)46 restclient.put(restapi, url, data)47 _LOGGER.debug('Retrieving App DNS entry %s', name)48 app_dns_entry = restclient.get(restapi, url).json()49 cli.out(formatter(app_dns_entry))50 @appdns.command()51 @click.argument('name', nargs=1, required=True)52 @click.option('--cell', help='List of cells',53 type=cli.LIST)54 @click.option('--pattern', help='App pattern')55 @click.option('--endpoints', help='Endpoints to be included in SRV rec',56 type=cli.LIST)57 @click.option('--alias', help='App DNS alias')58 @click.option('--scope', help='DNS scope')59 @cli.handle_exceptions(restclient.CLI_REST_EXCEPTIONS)60 def configure(name, cell, pattern, endpoints, alias, scope):61 """Create, modify or get DNS SRV entry"""62 configure_base(name, cell, pattern, endpoints, alias, scope, None)63 @appdns.group(name='cname')64 def cname():65 """Manage DNS CNAME configuration.66 """67 @cname.command(name='configure')68 @click.argument('name', nargs=1, required=True)69 @click.option('--cell', help='List of cells',70 type=cli.LIST)71 @click.option('--pattern', help='App pattern')72 @click.option('--alias', help='App DNS alias')73 @click.option('--scope', help='DNS scope')74 @click.option('--identity-group', 'id_group', help='Identity group to '75 'create alias(es) pointing to the instances\' hosts')76 @cli.handle_exceptions(restclient.CLI_REST_EXCEPTIONS)77 def configure_cname(name, cell, pattern, alias, scope, id_group):78 """Create, modify or get DNS CNAME configuration"""79 configure_base(name, cell, pattern, None, alias, scope, id_group)80 @appdns.group(name='srv')81 def srv():82 """Manage DNS SRV configuration.83 """84 @srv.command(name='configure')85 @click.argument('name', nargs=1, required=True)86 @click.option('--cell', help='List of cells',87 type=cli.LIST)88 @click.option('--pattern', help='App pattern')89 @click.option('--endpoints', help='Endpoints to be included in SRV rec',90 type=cli.LIST)91 @click.option('--alias', help='App DNS alias')92 @click.option('--scope', help='DNS scope')93 @cli.handle_exceptions(restclient.CLI_REST_EXCEPTIONS)94 def configure_srv(name, cell, pattern, endpoints, alias, scope):95 """Create, modify or get DNS SRV entry"""96 configure_base(name, cell, pattern, endpoints, alias, scope, None)97 @appdns.command()98 @click.argument('name', nargs=1, required=True)99 @click.option('--add', help='Cells to to add.', type=cli.LIST)100 @click.option('--remove', help='Cells to to remove.', type=cli.LIST)101 @cli.handle_exceptions(restclient.CLI_REST_EXCEPTIONS)102 def cells(add, remove, name):103 """Add or remove cells from the app-dns."""104 url = _REST_PATH + name105 restapi = context.GLOBAL.admin_api()106 existing = restclient.get(restapi, url).json()107 cells = set(existing['cells'])108 if add:109 cells.update(add)110 if remove:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pyresttest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful