systeminformation 5.9.13 → 5.9.14
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/lib/osinfo.js +12 -7
- package/lib/util.js +22 -0
- package/package.json +1 -1
package/lib/osinfo.js
CHANGED
|
@@ -595,7 +595,7 @@ function versions(apps, callback) {
|
|
|
595
595
|
}
|
|
596
596
|
if ({}.hasOwnProperty.call(appsObj.versions, 'git')) {
|
|
597
597
|
if (_darwin) {
|
|
598
|
-
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/git');
|
|
598
|
+
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/git') || fs.existsSync('/opt/homebrew/bin/git');
|
|
599
599
|
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
|
600
600
|
exec('git --version', function (error, stdout) {
|
|
601
601
|
if (!error) {
|
|
@@ -780,9 +780,14 @@ function versions(apps, callback) {
|
|
|
780
780
|
}
|
|
781
781
|
if ({}.hasOwnProperty.call(appsObj.versions, 'python')) {
|
|
782
782
|
if (_darwin) {
|
|
783
|
-
const
|
|
784
|
-
|
|
785
|
-
|
|
783
|
+
const stdout = execSync('sw_vers');
|
|
784
|
+
const lines = stdout.toString().split('\n');
|
|
785
|
+
const osVersion = util.getValue(lines, 'ProductVersion', ':');
|
|
786
|
+
const gitHomebrewExists1 = fs.existsSync('/usr/local/Cellar/python');
|
|
787
|
+
const gitHomebrewExists2 = fs.existsSync('/opt/homebrew/bin/python');
|
|
788
|
+
if ((util.darwinXcodeExists() && util.semverCompare('12.0.1', osVersion) < 0) || gitHomebrewExists1 || gitHomebrewExists2) {
|
|
789
|
+
const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' : (gitHomebrewExists2 ? '/opt/homebrew/bin/python -V 2>&1' : 'python -V 2>&1');
|
|
790
|
+
exec(cmd, function (error, stdout) {
|
|
786
791
|
if (!error) {
|
|
787
792
|
const python = stdout.toString().split('\n')[0] || '';
|
|
788
793
|
appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
|
|
@@ -804,7 +809,7 @@ function versions(apps, callback) {
|
|
|
804
809
|
}
|
|
805
810
|
if ({}.hasOwnProperty.call(appsObj.versions, 'python3')) {
|
|
806
811
|
if (_darwin) {
|
|
807
|
-
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/python3');
|
|
812
|
+
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/python3') || fs.existsSync('/opt/homebrew/bin/python3');
|
|
808
813
|
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
|
809
814
|
exec('python3 -V 2>&1', function (error, stdout) {
|
|
810
815
|
if (!error) {
|
|
@@ -828,7 +833,7 @@ function versions(apps, callback) {
|
|
|
828
833
|
}
|
|
829
834
|
if ({}.hasOwnProperty.call(appsObj.versions, 'pip')) {
|
|
830
835
|
if (_darwin) {
|
|
831
|
-
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip');
|
|
836
|
+
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip') || fs.existsSync('/opt/homebrew/bin/pip');
|
|
832
837
|
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
|
833
838
|
exec('pip -V 2>&1', function (error, stdout) {
|
|
834
839
|
if (!error) {
|
|
@@ -854,7 +859,7 @@ function versions(apps, callback) {
|
|
|
854
859
|
}
|
|
855
860
|
if ({}.hasOwnProperty.call(appsObj.versions, 'pip3')) {
|
|
856
861
|
if (_darwin) {
|
|
857
|
-
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip3');
|
|
862
|
+
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip3') || fs.existsSync('/opt/homebrew/bin/pip3');
|
|
858
863
|
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
|
859
864
|
exec('pip3 -V 2>&1', function (error, stdout) {
|
|
860
865
|
if (!error) {
|
package/lib/util.js
CHANGED
|
@@ -1089,6 +1089,27 @@ function plistParser(xmlStr) {
|
|
|
1089
1089
|
}
|
|
1090
1090
|
}
|
|
1091
1091
|
|
|
1092
|
+
function semverCompare(v1, v2) {
|
|
1093
|
+
let res = 0;
|
|
1094
|
+
const parts1 = v1.split('.');
|
|
1095
|
+
const parts2 = v2.split('.');
|
|
1096
|
+
if (parts1[0] < parts2[0]) { res = 1; }
|
|
1097
|
+
else if (parts1[0] > parts2[0]) { res = -1; }
|
|
1098
|
+
else if (parts1[0] === parts2[0] && parts1.length >= 2 && parts2.length >= 2) {
|
|
1099
|
+
if (parts1[1] < parts2[1]) { res = 1; }
|
|
1100
|
+
else if (parts1[1] > parts2[1]) { res = -1; }
|
|
1101
|
+
else if (parts1[1] === parts2[1]) {
|
|
1102
|
+
if (parts1.length >= 3 && parts2.length >= 3) {
|
|
1103
|
+
if (parts1[2] < parts2[2]) { res = 1; }
|
|
1104
|
+
else if (parts1[2] > parts2[2]) { res = -1; }
|
|
1105
|
+
} else if (parts2.length >= 3) {
|
|
1106
|
+
res = 1;
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
return res;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1092
1113
|
function noop() { }
|
|
1093
1114
|
|
|
1094
1115
|
exports.toInt = toInt;
|
|
@@ -1134,3 +1155,4 @@ exports.stringStartWith = stringStartWith;
|
|
|
1134
1155
|
exports.mathMin = mathMin;
|
|
1135
1156
|
exports.WINDIR = WINDIR;
|
|
1136
1157
|
exports.getFilesInPath = getFilesInPath;
|
|
1158
|
+
exports.semverCompare = semverCompare;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.9.
|
|
3
|
+
"version": "5.9.14",
|
|
4
4
|
"description": "Advanced, lightweight system and OS information library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",
|