예제 #1
0
def get_env_variables():
    env_dict = dict()
    username = get_username()
    base_command = "TERMCAP='' env"
    command = base_command + " | grep -v '_='"
    exclude_env_vars = [
        "XDG", "TERM", "SSH", "LS_COLORS", "MAIL", "PWD", "PS1", "SHLVL",
        "LESS", "USER", "LOGNAME", "STY", "WINDOW", "COLUMNS", "LINES"
    ]
    for ex_v in exclude_env_vars:
        command += (" | grep -v " + ex_v)
    for l in get_command_output(command).split("\n"):
        env_dict[l.split("=")[0]] = l.split("=")[1].replace(
            username, "GENERAL_USER")
    return env_dict
예제 #2
0
def get_board_name():
    command = "cat /sys/devices/virtual/dmi/id/board_name"
    return get_command_output(command)
예제 #3
0
def get_processor_name():
    command = "lscpu | grep name | awk -F ':' '{print $2}'"
    return get_command_output(command)
예제 #4
0
def get_graphics_name():
    gpu_dict = dict()
    command = "nvidia-smi --format=csv,noheader,nounits --query-gpu=index,name"
    for l in get_command_output(command).split("\n"):
        gpu_dict[int(l.split(",")[0])] = l.split(",")[1][1:]
    return gpu_dict
예제 #5
0
def get_os_name():
    command = "grep PRETTY_NAME /etc/os-release | awk -F '=' '{print $2}' | tr -d '\"'"
    return get_command_output(command)
예제 #6
0
def get_pip_packages():
    pip_dict = dict()
    command = "pip freeze | grep -v 'pkg-resources==0.0.0'"
    for pkg in get_command_output(command).split("\n"):
        pip_dict[pkg.split("==")[0]] = pkg.split("==")[1]
    return pip_dict
예제 #7
0
def get_python_release():
    command = "python -V | awk '{print $2}'"
    return get_command_output(command)
예제 #8
0
def get_loaded_shared_objects():
    pid = get_pid()
    base_command = "lsof -p " + str(pid) + " | awk '{print $9}'"
    command = base_command + " | grep .so | awk -F '/' '{print $NF}'"
    return get_command_output(command).split("\n")
예제 #9
0
def get_nvcc_release():
    command = "nvcc --version | tail -n1 | awk '{print $5}' | tr -d ','"
    return get_command_output(command)
예제 #10
0
def get_nv_driver_release():
    command = "head -n1 /proc/driver/nvidia/version | awk '{print $8}'"
    return get_command_output(command)
예제 #11
0
def get_gcc_release():
    command = "gcc --version | head -n1 | awk '{print $4}'"
    return get_command_output(command)
예제 #12
0
def get_kernel_release():
    command = "uname -r"
    return get_command_output(command)