File: bash_functions

package info (click to toggle)
python-mitogen 0.3.36-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,708 kB
  • sloc: python: 24,457; sh: 198; makefile: 74; perl: 19; ansic: 18
file content (13 lines) | stat: -rw-r--r-- 383 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
# shellcheck shell=bash

# Tox environment name -> Python executable name (e.g. py312-m_mtg -> python3.12)
toxenv-python() {
    local pattern='^py([23])([0-9]{1,2}).*'
    if [[ $1 =~ $pattern ]]; then
        echo "python${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
        return
    else
        echo "${FUNCNAME[0]}: $1: environment name not recognised" >&2
        return 1
    fi
}