synsci 2.0.83 → 2.0.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/synsci.mjs +15 -5
- package/package.json +1 -1
package/bin/synsci.mjs
CHANGED
|
@@ -233,20 +233,30 @@ function globalPackage(prefix) {
|
|
|
233
233
|
return null
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
function
|
|
237
|
-
if (process.arch !== "x64") return undefined
|
|
236
|
+
function sysctl(name) {
|
|
238
237
|
try {
|
|
239
|
-
|
|
238
|
+
return execFileSync("/usr/sbin/sysctl", ["-n", name], {
|
|
240
239
|
encoding: "utf-8",
|
|
241
240
|
stdio: ["ignore", "pipe", "ignore"],
|
|
242
241
|
timeout: 5000,
|
|
243
|
-
})
|
|
244
|
-
return value.toLowerCase().split(/\s+/).includes("avx2")
|
|
242
|
+
}).trim()
|
|
245
243
|
} catch {
|
|
246
244
|
return undefined
|
|
247
245
|
}
|
|
248
246
|
}
|
|
249
247
|
|
|
248
|
+
function avx2() {
|
|
249
|
+
if (process.arch !== "x64") return undefined
|
|
250
|
+
// hw.optional.avx2_0 answers 0/1 on every Mac, including x64 Node under
|
|
251
|
+
// Rosetta where machdep.cpu.leaf7_features is an unknown oid.
|
|
252
|
+
const optional = sysctl("hw.optional.avx2_0")
|
|
253
|
+
if (optional === "1") return true
|
|
254
|
+
if (optional === "0") return false
|
|
255
|
+
const leaf7 = sysctl("machdep.cpu.leaf7_features")
|
|
256
|
+
if (leaf7 === undefined) return undefined
|
|
257
|
+
return leaf7.toLowerCase().split(/\s+/).includes("avx2")
|
|
258
|
+
}
|
|
259
|
+
|
|
250
260
|
function globalMacBinary(root, version, dependencies) {
|
|
251
261
|
if (process.platform !== "darwin") return null
|
|
252
262
|
const base = `openscience-darwin-${process.arch}`
|