File: utils.py

package info (click to toggle)
tomahawk 0.7.1-2.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 484 kB
  • sloc: python: 1,921; makefile: 153; sh: 3
file content (13 lines) | stat: -rw-r--r-- 445 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
import os

def get_home_dir(file):
    abspath = os.path.abspath(file)
    parent, dir = None, None
    if abspath.find('internal') != -1 or abspath.find('external') != -1:
        parent, dir = os.path.split(os.path.dirname(os.path.dirname(os.path.abspath(file))))
    else:
        parent, dir = os.path.split(os.path.dirname(os.path.abspath(file)))
    return parent

def get_bin_dir(file):
    return os.path.join(get_home_dir(file), 'bin')