@@ -59,27 +59,35 @@ export async function setupPython(
5959async function setupPipx ( foundPython : string ) {
6060 try {
6161 if ( ! ( await hasPipxModule ( foundPython ) ) ) {
62+ // install pipx for the system-wide python
6263 try {
63- // first try with the system-wide pipx
6464 await setupPipPackSystem ( "pipx" , isArch ( ) )
65- // then install with the system-wide pipx
66- await setupPipPackWithPython ( foundPython , "pipx" , undefined , { upgrade : true , usePipx : false } )
6765 } catch ( err ) {
68- throw new Error ( `pipx was not installed completely: ${ err } ` )
66+ notice ( `pipx was not installed completely for the system-wide python: ${ err } ` )
67+ }
68+
69+ // install pipx for the given python if the system-wide pipx is different for the given python
70+ try {
71+ if ( ! ( await hasPipxModule ( foundPython ) ) ) {
72+ await setupPipPackWithPython ( foundPython , "pipx" , undefined , { upgrade : true , usePipx : false } )
73+ }
74+ } catch ( err ) {
75+ notice ( `pipx was not installed completely for ${ foundPython } : ${ err } ` )
6976 }
7077 }
78+
79+ // install ensurepath for the given python
7180 if ( await hasPipxModule ( foundPython ) ) {
7281 await execa ( foundPython , [ "-m" , "pipx" , "ensurepath" ] , { stdio : "inherit" } )
73- return
7482 } else if ( await hasPipxBinary ( ) ) {
75- notice ( "pipx module not found. Trying to install with pipx binary..." )
83+ // install ensurepath with the pipx binary
84+ notice ( `pipx module not found for ${ foundPython } . Trying to install with pipx binary...` )
7685 await execa ( "pipx" , [ "ensurepath" ] , { stdio : "inherit" } )
77- return
7886 } else {
7987 throw new Error ( "pipx module or pipx binary not found. Corrput pipx installation." )
8088 }
8189 } catch ( err ) {
82- notice ( `Failed to install pipx: ${ ( err as Error ) . toString ( ) } . Ignoring...` )
90+ notice ( `Failed to install pipx completely for ${ foundPython } : ${ ( err as Error ) . toString ( ) } . Ignoring...` )
8391 }
8492}
8593
0 commit comments