@@ -65,8 +65,8 @@ function colorizeOutput (color, string) {
65
65
}
66
66
67
67
//! on windows debug running with locale cmd (e. g. chcp 866) encoding
68
- // to avoid that uncoment next lines
69
- // locale encdoings couse issues. See run func for more info
68
+ // to avoid that uncomment next lines
69
+ // locale encodings cause issues. See run func for more info
70
70
// this lines only for testing
71
71
// win ? cp.execSync("chcp 65001") : null
72
72
// log.level = "silly";
@@ -78,7 +78,7 @@ class PythonFinder {
78
78
/**
79
79
*
80
80
* @param {string } configPython force setted from terminal or npm config python path
81
- * @param {(err:Error, found:string) => void } callback succsed /error callback from where result
81
+ * @param {(err:Error, found:string) => void } callback succeed /error callback from where result
82
82
* is available
83
83
*/
84
84
constructor ( configPython , callback ) {
@@ -137,7 +137,7 @@ class PythonFinder {
137
137
}
138
138
139
139
/**
140
- * Getting list of checks which should be cheked
140
+ * Getting list of checks which should be checked
141
141
*
142
142
* @private
143
143
* @returns {check[] }
@@ -284,7 +284,7 @@ class PythonFinder {
284
284
* @argument {check[]} checks
285
285
*/
286
286
async runChecks ( checks ) {
287
- // using this flag becouse Fail is happen when ALL checks fail
287
+ // using this flag because Fail is happen when ALL checks fail
288
288
let fail = true
289
289
290
290
for ( const check of checks ) {
@@ -347,7 +347,7 @@ class PythonFinder {
347
347
let args = this . argsExecutable
348
348
let shell = false
349
349
if ( this . win ) {
350
- // Arguments have to be manually quoted to avoid bugs with spaces in pathes
350
+ // Arguments have to be manually quoted to avoid bugs with spaces in paths
351
351
exec = `"${ exec } "`
352
352
args = args . map ( ( a ) => `"${ a } "` )
353
353
shell = true
@@ -382,8 +382,8 @@ class PythonFinder {
382
382
383
383
/**
384
384
*
385
- * Check if a getted path is correct and
386
- * Python executable hase the correct version to use.
385
+ * Check if a gotten path is correct and
386
+ * Python executable has the correct version to use.
387
387
*
388
388
* @private
389
389
* @argument {string} execPath path to check
@@ -398,7 +398,7 @@ class PythonFinder {
398
398
this . run ( execPath , this . argsVersion , false )
399
399
. then ( ( ver ) => {
400
400
// ? may be better code for version check
401
- // ? may be move log messgaes to catchError func
401
+ // ? may be move log messages to catchError func
402
402
const range = new semver . Range ( this . semverRange )
403
403
let valid = false
404
404
@@ -426,7 +426,7 @@ class PythonFinder {
426
426
colorizeOutput ( RED , 'THIS VERSION OF PYTHON IS NOT SUPPORTED' )
427
427
)
428
428
// object with error passed for conveniences
429
- // (becouse we may want to pass also stderr or some additional stuff )
429
+ // (because we may also want to pass stderr or other variables )
430
430
// eslint-disable-next-line prefer-promise-reject-errors
431
431
reject ( {
432
432
err : new Error ( `Found unsupported Python version ${ ver } ` )
@@ -471,27 +471,26 @@ class PythonFinder {
471
471
)
472
472
this . log . silly ( 'execFile: opts = ' , JSON . stringify ( opts , null , 2 ) )
473
473
474
- //* prosible outcomes with error messages on windows (err.message, error.stack?, stderr)
474
+ //* possible outcomes with error messages on Windows (err.message, error.stack?, stderr)
475
475
// issue of encoding (garbage in terminal ) when 866 or any other locale code
476
476
// page is setted
477
477
// possible solutions:
478
- // 1. let it be as it is and just warn user that it should use utf8
479
- // (already done in this.catchErros 's info statement)
480
- // 2. somehow determine user's terminal encdoing and use utils.TextDecoder
481
- // with getting raw buffer from execFile.
482
- // Requires to correct error.message becouse garbage persists there
483
- // 3. Forse user's terminal to use utf8 encoding via e.g. run "chcp 65001". May broke some user's programs
484
- // 4. use "cmd" command with flag "/U" and "/C" (for more informatiom run "help cmd")
478
+ // 1. leave it as is and just warn the user that it should use utf8
479
+ // (already done in this.catchError 's info statement)
480
+ // 2. somehow determine the user's terminal encoding and use utils.TextDecoder
481
+ // with the raw buffer from execFile.
482
+ // Requires to correct error.message because garbage persists there
483
+ // 3. Force the user's terminal to use utf8 encoding via e.g. run "chcp 65001". May break user's programs
484
+ // 4. use "cmd" command with flag "/U" and "/C" (for more information run "help cmd")
485
485
// which "Causes the output of
486
486
// internal commands ... to be Unicode" (utf16le)
487
487
//* note: find-python-script.py already send output in utf8 then may become necessary
488
488
//* to reencode string with Buffer.from(stderr).toString() or something
489
489
//* similar (if needed)
490
- // for this solution all execFile call should look like execFile("cmd /U /C", [command to run, arg1, arg2, ...])
491
- //* all pathes/commands and each argument must be in quotes becouse if they have
492
- //* spaces inside they will broke everything
490
+ // for this solution all execFile call should look like execFile("cmd", ["/U", "/C", command to run, arg1, arg2, ...])
491
+ //* all paths/commands and each argument must be in quotes if they contain spaces
493
492
494
- //* assume that user use utf8 compatible terminal
493
+ //* assume we have a utf8 compatible terminal
495
494
this . execFile ( exec , args , opts , execFileCallback . bind ( this ) )
496
495
497
496
/**
@@ -506,13 +505,13 @@ class PythonFinder {
506
505
( err && err . stack ) || err
507
506
)
508
507
509
- // executed script shouldn't pass anythong to stderr if successful
508
+ // executed script shouldn't pass anything to stderr if successful
510
509
if ( err || stderr ) {
511
510
reject ( { err : err || null , stderr : stderr || null } )
512
511
} else {
513
- // trim() function remove string endings that break string comparsion
514
- const stdoutTrimed = stdout . trim ( )
515
- resolve ( stdoutTrimed )
512
+ // trim() function removes string endings that would break string comparison
513
+ const stdoutTrimmed = stdout . trim ( )
514
+ resolve ( stdoutTrimmed )
516
515
}
517
516
}
518
517
} . bind ( this )
@@ -537,7 +536,7 @@ class PythonFinder {
537
536
// array of error codes (type of errors) that we handling
538
537
const catchedErrorsCods = [ 'ENOENT' , 9009 ]
539
538
540
- // dont know type of terminal errors
539
+ // don't know type of terminal errors
541
540
// @ts -ignore
542
541
if ( catchedErrorsCods . includes ( err ? err . code : undefined ) ) {
543
542
// @ts -ignore
@@ -624,7 +623,7 @@ class PythonFinder {
624
623
process . nextTick (
625
624
this . callback . bind (
626
625
null ,
627
- // if changing error message dont forget also change it test file too
626
+ // if changing error message don't forget also change it test file too
628
627
new Error ( 'Could not find any Python installation to use' )
629
628
)
630
629
)
@@ -634,7 +633,7 @@ class PythonFinder {
634
633
/**
635
634
*
636
635
* @param {string } configPython force setted from terminal or npm config python path
637
- * @param {(err:Error, found:string)=> void } callback succsed /error callback from where result
636
+ * @param {(err:Error, found:string)=> void } callback succeed /error callback from where result
638
637
* is available
639
638
*/
640
639
function findPython ( configPython , callback ) {
0 commit comments