File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import { callInstallerScript } from './get-platformio';
1313import crypto from 'crypto' ;
1414import fs from 'fs' ;
1515import got from 'got' ;
16+ import os from 'os' ;
1617import path from 'path' ;
1718import { promisify } from 'util' ;
1819import semver from 'semver' ;
@@ -61,6 +62,13 @@ export async function installPortablePython(destinationDir) {
6162 if ( ! archivePath ) {
6263 throw new Error ( 'Could not download portable Python' ) ;
6364 }
65+ try {
66+ await fs . promises . rmdir ( destinationDir , {
67+ recursive : true ,
68+ } ) ;
69+ } catch ( err ) {
70+ console . warn ( err ) ;
71+ }
6472 await extractTarGz ( archivePath , destinationDir ) ;
6573 await ensurePythonExeExists ( destinationDir ) ;
6674 return destinationDir ;
@@ -88,6 +96,20 @@ async function getRegistryFile() {
8896}
8997
9098function isVersionSystemCompatible ( version , systype ) {
99+ // ignore Python >=3.9 on <= Win7
100+ try {
101+ const originVersion = parseInt ( version . name . split ( '.' ) [ 1 ] ) ;
102+ if (
103+ proc . IS_WINDOWS &&
104+ originVersion >= 30900 &&
105+ semver . satisfies ( os . release ( ) , '<=6.1' )
106+ ) {
107+ return false ;
108+ }
109+ } catch ( err ) {
110+ console . warn ( err ) ;
111+ }
112+
91113 for ( const item of version . files ) {
92114 if ( item . system . includes ( systype ) ) {
93115 return true ;
You can’t perform that action at this time.
0 commit comments