def tar_path(): """This function returns tar binary path""" from winutils import is_windows if is_windows(): path_to_binaries = os.path.dirname(os.path.abspath(__file__)) return '{0}\\bin\\tar.exe'.format(path_to_binaries) tar = (get_executable_path('gnutar') or get_executable_path('gtar') or get_executable_path('tar')) if not tar: raise Exception('Please install gnu tar (gtar) as it is a ' 'mandatory requirement to use freezer.') return tar
def get_executable_path(binary): """ This function returns the executable path of a given binary if it is found in the system. :param binary: :type binary: str :rtype: str :return: Absoulte Path to the executable file """ from winutils import is_windows if is_windows(): path_to_binaries = os.path.dirname(os.path.abspath(__file__)) return '{0}\\bin\\{1}.exe'.format(path_to_binaries, binary) elif is_bsd(): return (distspawn.find_executable(binary) or distspawn.find_executable(binary, path=':'.join(sys.path))) else: return distspawn.find_executable(binary)
def openssl_path(): import winutils if winutils.is_windows(): return 'openssl' else: return find_executable('openssl')