__init__.py 512 Bytes
Newer Older
André's avatar
André committed
1
import subprocess
André's avatar
André committed
2 3
import sys
from pathlib import Path
André's avatar
André committed
4

Philipp Hörist's avatar
1.3.1  
Philipp Hörist committed
5
__version__ = "1.3.1"
André's avatar
André committed
6

André's avatar
André committed
7
IS_FLATPAK = Path('/app/share/run-as-flatpak').exists()
8

André's avatar
André committed
9 10
portable_path = Path(sys.executable).parent / 'is_portable'
IS_PORTABLE = portable_path.exists()
11

André's avatar
André committed
12
try:
André's avatar
André committed
13
    p = subprocess.Popen('git rev-parse --short=12 HEAD', shell=True,
14
                         stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
André's avatar
André committed
15
    node = p.communicate()[0]
André's avatar
André committed
16
    if node:
André's avatar
André committed
17
        __version__ += '+' + node.decode('utf-8').strip()
André's avatar
André committed
18 19
except Exception:
    pass