-
Notifications
You must be signed in to change notification settings - Fork 1
/
PythonRoutine.cmake.in
36 lines (32 loc) · 1.73 KB
/
PythonRoutine.cmake.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#---------------------------------------------------------------------------
# Copyright 2011 The Open Source Electronic Health Record Agent
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#---------------------------------------------------------------------------
include(@VISTA_SOURCE_DIR@/CommonFunctions.cmake)
if(@NumberRoutines@ EQUAL 0)
message("No routines to test in @package_name@, XINDEX test passes.")
return()
endif()
#define a variable to store the final log file name & path
set(LOGFILENAME "@VISTA_BINARY_DIR@/Testing/Temporary/@[email protected]")
#Execute the python script
execute_process(COMMAND "@PYTHON_EXECUTABLE@" "@VISTA_SOURCE_DIR@/XINDEXScript.py" ${LOGFILENAME} "@send_commands@" "@INSTANCE@" "@NAMESPACE@" "@USERNAME@" "@PASSWORD@" "@VISTA_SOURCE_DIR@" RESULT_VARIABLE return ERROR_VARIABLE ERROR)
if(NOT return EQUAL 0)
file(READ ${LOGFILENAME} contents)
message(FATAL_ERROR "Error running Python:\nReturn Value = ${return}\n${contents}\n${ERROR}")
endif()
file(STRINGS "${LOGFILENAME}" OUTPUT)
string(REPLACE "[" "{" OUTPUT "${OUTPUT}" )
string(REPLACE "]" "}" OUTPUT "${OUTPUT}" )
ReportXINDEXResult(@package_file_name@ @VISTA_SOURCE_DIR@/XindexException/@VENDER_NAME@ "${OUTPUT}" @USE_XINDEX_WARNINGS_AS_FAILURES@)