Skip to content

Commit 4fc33fd

Browse files
committed
CHI: CheckInstallation is now aware of the installation configuration saved
In a previous commit the installer saves now information on the configuration. This is now evaluated by CHI_CheckInstallation and the output is adapted accordingly. XOPs required for hardware support are not checked if the installation was without hardware.
1 parent 4d2b625 commit 4fc33fd

File tree

1 file changed

+46
-5
lines changed

1 file changed

+46
-5
lines changed

Packages/MIES/MIES_CheckInstallation.ipf

+46-5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ static StrConstant CHI_JSON_XOP_VERSION = "version-892-g9251933"
1616
static StrConstant CHI_TUF_XOP_VERSION = "version-163-g686effb"
1717
static StrConstant CHI_ITC_XOP_VERSION = "latest-174-gb9915a9"
1818

19+
static StrConstant CHI_INSTALLCONFIG_NAME = "installation_configuration.json"
20+
static Constant CHI_INSTALLEDWITHHARDWAREDEFAULT = 1
21+
1922
/// @brief Collection of counters used for installation checking
2023
static Structure CHI_InstallationState
2124
variable numErrors
@@ -135,6 +138,37 @@ static Function CHI_CheckXOP(string &list, string item, string name, STRUCT CHI_
135138
endswitch
136139
End
137140

141+
/// @return JSON id or NaN if configuration file does not exist
142+
static Function CHI_LoadInstallationConfiguration()
143+
144+
string folder, fullFilePath, txt
145+
146+
folder = ParseFilePath(1, FunctionPath(""), ":", 1, 1)
147+
fullFilePath = folder + CHI_INSTALLCONFIG_NAME
148+
if(!FileExists(fullFilePath))
149+
return NaN
150+
endif
151+
[txt, fullFilePath] = LoadTextFile(fullFilePath)
152+
return JSON_Parse(txt, ignoreErr = 1)
153+
End
154+
155+
/// @return 1 if MIES was installed with hardware support, 0 otherwise
156+
static Function CHI_IsMIESInstalledWithHardware()
157+
158+
variable jsonId, installedWithHW
159+
160+
jsonId = CHI_LoadInstallationConfiguration()
161+
if(IsNaN(jsonId))
162+
return CHI_INSTALLEDWITHHARDWAREDEFAULT
163+
endif
164+
165+
installedWithHW = JSON_GetVariable(jsonId, "/Installation/WithHardware", ignoreErr = 1)
166+
JSON_Release(jsonId)
167+
ASSERT(!IsNaN(installedWithHW), "Could not find key in installation configuration file.")
168+
169+
return installedWithHW
170+
End
171+
138172
/// @brief Check the installation and print the results to the history
139173
///
140174
/// Currently checks that all expected/optional XOPs are installed.
@@ -144,7 +178,7 @@ Function CHI_CheckInstallation()
144178

145179
string symbPath, allFiles, path, extName, info, igorBuild
146180
string allFilesSystem, allFilesUser, listOfXOPs
147-
variable aslrEnabled, archBits
181+
variable aslrEnabled, archBits, installedWithHW
148182

149183
symbPath = GetUniqueSymbolicPath()
150184
extName = GetIgorExtensionFolderName()
@@ -235,10 +269,15 @@ Function CHI_CheckInstallation()
235269
printf "Mies version info: Valid \"%s...\" (Nice!)\r", StringFromList(0, miesVersion, "\r")
236270
endif
237271

272+
installedWithHW = CHI_IsMIESInstalledWithHardware()
273+
printf "Installation with hardware: %s\r", ToTrueFalse(installedWithHW)
274+
238275
#ifdef WINDOWS
239-
CHI_CheckXOP(listOfXOPs, "itcxop2-64.xop", "ITC XOP", state)
240-
CHI_CheckXOP(listOfXOPs, "AxonTelegraph64.xop", "Axon Telegraph XOP", state)
241-
CHI_CheckXOP(listOfXOPs, "MultiClamp700xCommander64.xop", "Multi Clamp Commander XOP", state)
276+
if(installedWithHW)
277+
CHI_CheckXOP(listOfXOPs, "itcxop2-64.xop", "ITC XOP", state)
278+
CHI_CheckXOP(listOfXOPs, "AxonTelegraph64.xop", "Axon Telegraph XOP", state)
279+
CHI_CheckXOP(listOfXOPs, "MultiClamp700xCommander64.xop", "Multi Clamp Commander XOP", state)
280+
endif
242281
#endif // WINDOWS
243282

244283
// one operation/function of each non-hardware XOP needs to be called in CheckCompilation_IGNORE()
@@ -264,7 +303,9 @@ Function CHI_CheckInstallation()
264303
CHI_InitInstallationState(stateExtended)
265304
printf "\rChecking extended installation:\r"
266305

267-
CHI_CheckXOP(listOfXOPs, "NIDAQmx64.xop", "NI-DAQ MX XOP", stateExtended, expectedHash = CHI_NIDAQ_XOP_64_HASH)
306+
if(installedWithHW)
307+
CHI_CheckXOP(listOfXOPs, "NIDAQmx64.xop", "NI-DAQ MX XOP", stateExtended, expectedHash = CHI_NIDAQ_XOP_64_HASH)
308+
endif
268309

269310
printf "Results: %d checks, %d number of errors\r", stateExtended.numTries, stateExtended.numErrors
270311
#endif // WINDOWS

0 commit comments

Comments
 (0)