Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/sinol_make/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,17 @@ def main():
'https://github.com/sio2project/sinol-make/#reporting-bugs-and-contributing-code')
finally:
if new_version is not None:
install_method = 'pipx' if util.is_probably_installed_by_pipx() else 'pip'
if not util.is_dev(new_version):
print(util.warning(
f'New version of sinol-make is available (your version: {__version__}, available version: '
f'{new_version}).\n'
f'Changelog can be found at https://github.com/sio2project/sinol-make/releases.\n'
f'You can update sinol-make by running `pip install sinol-make --upgrade`.'))
f'You can update sinol-make by running `{install_method} install sinol-make --upgrade`.'))
elif util.is_dev(new_version):
print(util.warning(
f'New development version of sinol-make is available (your version: {__version__}, available '
f'version: {new_version}).\n'
f'Changelog can be found at https://github.com/sio2project/sinol-make/releases.\n'
f'You can update sinol-make by running `pip install sinol-make --pre --upgrade`.'
f'You can update sinol-make by running `{install_method} install sinol-make --pre --upgrade`.'
))
15 changes: 15 additions & 0 deletions src/sinol_make/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,3 +431,18 @@ def exit_with_error(text, func=None):

def has_sanitizer_error(output, exit_code):
return ('ELF_ET_DYN_BASE' in output or 'ASan' in output) and exit_code != 0


def is_running_in_virtualenv():
return (
hasattr(sys, 'real_prefix') or
(hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix)
)

def is_probably_installed_by_pipx():
if not is_running_in_virtualenv():
return False

# Pipx installs into ~/.local/pipx/venvs/
venv_path = sys.prefix
return 'pipx' in venv_path or 'pipx' in os.path.abspath(venv_path)
Loading