File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ fn find_site_packages() -> Result<Option<PathBuf>> {
141141 None
142142 }
143143 } else {
144- match process:: Command :: new ( "pipenv" ) . arg ( "--venv" ) . output ( ) {
144+ let pipenv_packages = match process:: Command :: new ( "pipenv" ) . arg ( "--venv" ) . output ( ) {
145145 Ok ( output) => {
146146 if output. status . success ( ) {
147147 let dir = Path :: new ( str:: from_utf8 ( & output. stdout ) ?. trim ( ) ) . join ( "lib" ) ;
@@ -157,24 +157,29 @@ fn find_site_packages() -> Result<Option<PathBuf>> {
157157 }
158158 } else {
159159 // `pipenv` is in `$PATH`, but this app does not appear to be using it
160- // Get site packages location using the `site` module in python
161- match process:: Command :: new ( "python3" )
162- . args ( [ "-c" , "import site; print(site.getsitepackages()[0])" ] )
163- . output ( )
164- {
165- Ok ( output) => {
166- let path =
167- Path :: new ( str:: from_utf8 ( & output. stdout ) ?. trim ( ) ) . to_path_buf ( ) ;
168- Some ( path)
169- }
170- Err ( _) => None ,
171- }
160+ None
172161 }
173162 }
174163 Err ( _) => {
175164 // `pipenv` is not in `$PATH -- assume this app isn't using it
176165 None
177166 }
167+ } ;
168+
169+ if pipenv_packages. is_some ( ) {
170+ pipenv_packages
171+ } else {
172+ // Get site packages location using the `site` module in python
173+ match process:: Command :: new ( "python3" )
174+ . args ( [ "-c" , "import site; print(site.getsitepackages()[0])" ] )
175+ . output ( )
176+ {
177+ Ok ( output) => {
178+ let path = Path :: new ( str:: from_utf8 ( & output. stdout ) ?. trim ( ) ) . to_path_buf ( ) ;
179+ Some ( path)
180+ }
181+ Err ( _) => None ,
182+ }
178183 }
179184 } )
180185}
You can’t perform that action at this time.
0 commit comments