@@ -25,7 +25,7 @@ export class SysInfo implements NativeScriptDoctor.ISysInfo {
25
25
private npmVerCache : string ;
26
26
private nodeVerCache : string ;
27
27
private nodeGypVerCache : string ;
28
- private xCodeprojGemLocationCache : string ;
28
+ private xCodeprojLocationCache : string ;
29
29
private iTunesInstalledCache : boolean ;
30
30
private cocoaPodsVerCache : string ;
31
31
private osCache : string ;
@@ -38,6 +38,7 @@ export class SysInfo implements NativeScriptDoctor.ISysInfo {
38
38
private isCocoaPodsWorkingCorrectlyCache : boolean ;
39
39
private nativeScriptCliVersionCache : string ;
40
40
private xcprojInfoCache : NativeScriptDoctor . IXcprojInfo ;
41
+ private pythonInfoCache : NativeScriptDoctor . IPythonInfo ;
41
42
private isCocoaPodsUpdateRequiredCache : boolean ;
42
43
private shouldCache : boolean = true ;
43
44
private isAndroidSdkConfiguredCorrectlyCache : boolean ;
@@ -102,9 +103,9 @@ export class SysInfo implements NativeScriptDoctor.ISysInfo {
102
103
} ) ;
103
104
}
104
105
105
- public getXcodeprojGemLocation ( ) : Promise < string > {
106
- return this . getValueForProperty ( ( ) => this . xCodeprojGemLocationCache , async ( ) : Promise < string > => {
107
- const output = await this . execCommand ( "gem which xcodeproj" ) ;
106
+ public getXcodeprojLocation ( ) : Promise < string > {
107
+ return this . getValueForProperty ( ( ) => this . xCodeprojLocationCache , async ( ) : Promise < string > => {
108
+ const output = await this . execCommand ( "which xcodeproj" ) ;
108
109
return output ? output . trim ( ) : null ;
109
110
} ) ;
110
111
}
@@ -152,12 +153,13 @@ export class SysInfo implements NativeScriptDoctor.ISysInfo {
152
153
} ) ;
153
154
}
154
155
155
- public getAdbVersion ( ) : Promise < string > {
156
+ public getAdbVersion ( pathToAdb ?: string ) : Promise < string > {
156
157
return this . getValueForProperty ( ( ) => this . adbVerCache , async ( ) : Promise < string > => {
157
158
let output : IProcessInfo = null ;
158
- const pathToAdbFromAndroidHome = await this . androidToolsInfo . getPathToAdbFromAndroidHome ( ) ;
159
- if ( pathToAdbFromAndroidHome ) {
160
- output = await this . childProcess . spawnFromEvent ( pathToAdbFromAndroidHome , [ "version" ] , "close" , { ignoreError : true } ) ;
159
+
160
+ pathToAdb = pathToAdb || await this . androidToolsInfo . getPathToAdbFromAndroidHome ( ) ;
161
+ if ( pathToAdb ) {
162
+ output = await this . childProcess . spawnFromEvent ( pathToAdb , [ "version" ] , "close" , { ignoreError : true } ) ;
161
163
}
162
164
163
165
return output && output . stdout ? this . getVersionFromString ( output . stdout ) : null ;
@@ -213,7 +215,7 @@ export class SysInfo implements NativeScriptDoctor.ISysInfo {
213
215
} ) ;
214
216
}
215
217
216
- public getSysInfo ( ) : Promise < NativeScriptDoctor . ISysInfoData > {
218
+ public getSysInfo ( config ?: NativeScriptDoctor . ISysInfoConfig ) : Promise < NativeScriptDoctor . ISysInfoData > {
217
219
return this . getValueForProperty ( ( ) => this . sysInfoCache , async ( ) : Promise < NativeScriptDoctor . ISysInfoData > => {
218
220
const result : NativeScriptDoctor . ISysInfoData = Object . create ( null ) ;
219
221
@@ -231,10 +233,10 @@ export class SysInfo implements NativeScriptDoctor.ISysInfo {
231
233
result . dotNetVer = await this . hostInfo . dotNetVersion ( ) ;
232
234
result . javacVersion = await this . getJavaCompilerVersion ( ) ;
233
235
result . xcodeVer = await this . getXcodeVersion ( ) ;
234
- result . xcodeprojGemLocation = await this . getXcodeprojGemLocation ( ) ;
236
+ result . xcodeprojLocation = await this . getXcodeprojLocation ( ) ;
235
237
result . itunesInstalled = await this . isITunesInstalled ( ) ;
236
238
result . cocoaPodsVer = await this . getCocoaPodsVersion ( ) ;
237
- result . adbVer = await this . getAdbVersion ( ) ;
239
+ result . adbVer = await this . getAdbVersion ( config && config . androidToolsInfo && config . androidToolsInfo . pathToAdb ) ;
238
240
result . androidInstalled = await this . isAndroidInstalled ( ) ;
239
241
result . monoVer = await this . getMonoVersion ( ) ;
240
242
result . gitVer = await this . getGitVersion ( ) ;
@@ -246,6 +248,8 @@ export class SysInfo implements NativeScriptDoctor.ISysInfo {
246
248
result . isCocoaPodsUpdateRequired = await this . isCocoaPodsUpdateRequired ( ) ;
247
249
result . isAndroidSdkConfiguredCorrectly = await this . isAndroidSdkConfiguredCorrectly ( ) ;
248
250
251
+ result . pythonInfo = await this . getPythonInfo ( ) ;
252
+
249
253
return result ;
250
254
} ) ;
251
255
}
@@ -307,6 +311,27 @@ export class SysInfo implements NativeScriptDoctor.ISysInfo {
307
311
} ) ;
308
312
}
309
313
314
+ public getPythonInfo ( ) : Promise < NativeScriptDoctor . IPythonInfo > {
315
+ return this . getValueForProperty ( ( ) => this . pythonInfoCache , async ( ) : Promise < NativeScriptDoctor . IPythonInfo > => {
316
+ if ( this . hostInfo . isDarwin ) {
317
+ try {
318
+ await this . childProcess . exec ( `python -c "import six"` ) ;
319
+ } catch ( error ) {
320
+ // error.code = 1 so the Python is present, but we don't have six.
321
+ if ( error . code === 1 ) {
322
+ return { isInstalled : true , isSixPackageInstalled : false } ;
323
+ }
324
+
325
+ return { isInstalled : false , isSixPackageInstalled : false , installationErrorMessage : error . message } ;
326
+ }
327
+
328
+ return { isInstalled : true , isSixPackageInstalled : true } ;
329
+ }
330
+
331
+ return null ;
332
+ } ) ;
333
+ }
334
+
310
335
public isCocoaPodsUpdateRequired ( ) : Promise < boolean > {
311
336
return this . getValueForProperty ( ( ) => this . isCocoaPodsUpdateRequiredCache , async ( ) : Promise < boolean > => {
312
337
let xcprojInfo = await this . getXcprojInfo ( ) ;
0 commit comments