/usr/lib/python3/dist-packages/subuserlib/paths.py is in subuser 0.6.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | # -*- coding: utf-8 -*-
"""
Module used for determining non-user-configurable paths.
"""
#external imports
import os
import inspect
#internal imports
import subuserlib.executablePath as executablePath
home = os.path.expanduser("~")
def upNDirsInPath(path,n):
if n > 0:
return os.path.dirname(upNDirsInPath(path,n-1))
else:
return path
def getSubuserDir():
"""
Get the toplevel directory for subuser.
"""
pathToThisSourceFile = os.path.abspath(inspect.getfile(inspect.currentframe()))
return upNDirsInPath(pathToThisSourceFile,3)
def getSubuserExecutable():
executable = os.path.join(getSubuserDir(),"logic","subuser")
if not os.path.exists(executable):
executable = executablePath.which("subuser")
return executable
def getSubuserDataFile(filename):
dataFile = os.path.join(getSubuserDir(),"logic","subuserlib","data",filename)
if os.path.exists(dataFile):
return dataFile
else:
import pkg_resources
dataFile = pkg_resources.resource_filename("subuserlib",os.path.join("data",filename))
if not os.path.exists(dataFile):
exit("Data file does not exist:"+str(dataFile))
else:
return dataFile
|