File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -109,16 +109,17 @@ def main():
109109 'https://github.com/sio2project/sinol-make/#reporting-bugs-and-contributing-code' )
110110 finally :
111111 if new_version is not None :
112+ install_method = 'pipx' if util .is_probably_installed_by_pipx () else 'pip'
112113 if not util .is_dev (new_version ):
113114 print (util .warning (
114115 f'New version of sinol-make is available (your version: { __version__ } , available version: '
115116 f'{ new_version } ).\n '
116117 f'Changelog can be found at https://github.com/sio2project/sinol-make/releases.\n '
117- f'You can update sinol-make by running `pip install sinol-make --upgrade`.' ))
118+ f'You can update sinol-make by running `{ install_method } install sinol-make --upgrade`.' ))
118119 elif util .is_dev (new_version ):
119120 print (util .warning (
120121 f'New development version of sinol-make is available (your version: { __version__ } , available '
121122 f'version: { new_version } ).\n '
122123 f'Changelog can be found at https://github.com/sio2project/sinol-make/releases.\n '
123- f'You can update sinol-make by running `pip install sinol-make --pre --upgrade`.'
124+ f'You can update sinol-make by running `{ install_method } install sinol-make --pre --upgrade`.'
124125 ))
Original file line number Diff line number Diff line change @@ -431,3 +431,18 @@ def exit_with_error(text, func=None):
431431
432432def has_sanitizer_error (output , exit_code ):
433433 return ('ELF_ET_DYN_BASE' in output or 'ASan' in output ) and exit_code != 0
434+
435+
436+ def is_running_in_virtualenv ():
437+ return (
438+ hasattr (sys , 'real_prefix' ) or
439+ (hasattr (sys , 'base_prefix' ) and sys .base_prefix != sys .prefix )
440+ )
441+
442+ def is_probably_installed_by_pipx ():
443+ if not is_running_in_virtualenv ():
444+ return False
445+
446+ # Pipx installs into ~/.local/pipx/venvs/
447+ venv_path = sys .prefix
448+ return 'pipx' in venv_path or 'pipx' in os .path .abspath (venv_path )
You can’t perform that action at this time.
0 commit comments