Python os.path 模块,ismount() 实例源码

我们从Python开源项目中,提取了以下10个代码示例,用于说明如何使用os.path.ismount()

项目:enigma2    作者:OpenLD    | 项目源码 | 文件源码
def runBackup(self, result):
        if result:
            if path.ismount(MountPoints[self.backup.location.value]):
                self.createBackupfolders()
                d = localtime()
                dt = date(d.tm_year, d.tm_mon, d.tm_mday)
                self.path = BackupPath[self.backup.location.value]
                if self.backup.type.value == "settings":
                    print "Backup Mode: Settings"
                    self.session.open(Console, title = "Backup running", cmdlist = ["tar -czvf " + self.path + "/" + str(dt) + "_settings_backup.tar.gz /etc/enigma2/ /etc/network/interfaces /etc/wpa_supplicant.conf"])
                elif self.backup.type.value == "var":
                    print "Backup Mode: var"
                    self.session.open(Console, title = "Backup running", cmdlist = [ "tar -czvf " + self.path + "/" + str(dt) + "_var_backup.tar.gz /var/"])
                elif self.backup.type.value == "skin":
                    print "Backup Mode: skin"
                    self.session.open(Console, title ="Backup running", cmdlist = [ "tar -czvf " + self.path + "/" + str(dt) + "_skin_backup.tar.gz /usr/share/enigma2/"])
            else:
                self.session.open(MessageBox, _("Sorry your Backup destination does not exist\n\nPlease choose an other one."), MessageBox.TYPE_INFO)
项目:enigma2    作者:OpenLD    | 项目源码 | 文件源码
def getCoverPath():
    blockList = ['hdd', 'net', 'mmc', 'cf', 'usb', 'upnp', 'sdcard', 'uSDextra']
    dirList = os_listdir("/media")
    coverPaths = ['/usr/share/enigma2/cover/', '/data/cover/', '/media/cf/cover/', '/media/usb/cover/', '/media/upnp/cover/', '/media/sdcard/cover/', '/media/hdd/cover/', '/media/net/cover/', '/media/mmc/cover/', '/media/uSDextra/cover/']

    if fileExists("/proc/mounts"):
        mountsFile = open("/proc/mounts" ,"r")
        for line in mountsFile:
            entry = line.split()
            if entry[2] in ["nfs", "nfs4", "smbfs", "cifs", "djmount"]:
                if entry[1].startswith("/media/"):
                    blockList.append(entry[1][7:])
        mountsFile.close()

    for dir in dirList:
        if dir in blockList:
            print dir, blockList
            continue
        if os_path.ismount("/media/%s" %(dir)) or (os_path.islink("/media/%s" %(dir)) and os_path.ismount(os_path.realpath("/media/%s" %(dir)))):
            path = "/media/%s/cover/" % (dir)
            coverPaths.append(path)
    return coverPaths
项目:crossplatform_iptvplayer    作者:j00zek    | 项目源码 | 文件源码
def __init__(self):
        self.hdd = []
        self.cd = ''
        self.partitions = []
        self.devices_scanned_on_init = []
        self.on_partition_list_change = CList()
        self.enumerateBlockDevices()
        p = (('/media/hdd', _('Harddisk')),
         ('/media/card', _('Card')),
         ('/media/cf', _('Compact Flash')),
         ('/media/mmc1', _('MMC Card')),
         ('/media/net', _('Network Mount')),
         ('/media/net1', _('Network Mount') + ' 1'),
         ('/media/net2', _('Network Mount') + ' 2'),
         ('/media/net3', _('Network Mount') + ' 3'),
         ('/media/ram', _('Ram Disk')),
         ('/media/usb', _('USB Stick')),
         ('/', _('Internal Flash')))
        known = set([ path.normpath(a.mountpoint) for a in self.partitions if a.mountpoint ])
        for m, d in p:
            if m not in known and path.ismount(m):
                self.partitions.append(Partition(mountpoint=m, description=d))
项目:pipeline    作者:liorbenhorin    | 项目源码 | 文件源码
def find_mount_point(path):
    # Even if something's wrong, "/" is a mount point, so the loop will exit.
    # Use realpath in case it's a symlink
    path = op.realpath(path) # Required to avoid infinite loop
    while not op.ismount(path):
        path = op.split(path)[0]
    return path
项目:FileManager    作者:math2001    | 项目源码 | 文件源码
def find_mount_point(path):
    # Even if something's wrong, "/" is a mount point, so the loop will exit.
    # Use realpath in case it's a symlink
    path = op.realpath(path) # Required to avoid infinite loop
    while not op.ismount(path):
        path = op.split(path)[0]
    return path
项目:NoDialogs    作者:maximsmol    | 项目源码 | 文件源码
def find_mount_point(path):
    # Even if something's wrong, "/" is a mount point, so the loop will exit.
    # Use realpath in case it's a symlink
    path = op.realpath(path) # Required to avoid infinite loop
    while not op.ismount(path):
        path = op.split(path)[0]
    return path
项目:.sublime    作者:cxdongjack    | 项目源码 | 文件源码
def find_mount_point(path):
    # Even if something's wrong, "/" is a mount point, so the loop will exit.
    # Use realpath in case it's a symlink
    path = op.realpath(path) # Required to avoid infinite loop
    while not op.ismount(path):
        path = op.split(path)[0]
    return path
项目:ansible-provider-docs    作者:alibaba    | 项目源码 | 文件源码
def tests(self):
        return {
            # file testing
            'is_dir': isdir,
            'is_file': isfile,
            'is_link': islink,
            'exists': exists,
            'link_exists': lexists,

            # path testing
            'is_abs': isabs,
            'is_same_file': samefile,
            'is_mount': ismount,
        }
项目:crossplatform_iptvplayer    作者:j00zek    | 项目源码 | 文件源码
def findMountPoint(path):
    """Example: findMountPoint("/media/hdd/some/file") returns "/media/hdd"""
    path = os.path.abspath(path)
    while not os.path.ismount(path):
        path = os.path.dirname(path)

    return path
项目:DevOps    作者:YoLoveLife    | 项目源码 | 文件源码
def tests(self):
        return {
            # file testing
            'is_dir'  : isdir,
            'is_file' : isfile,
            'is_link' : islink,
            'exists' : exists,
            'link_exists' : lexists,

            # path testing
            'is_abs' : isabs,
            'is_same_file' : samefile,
            'is_mount' : ismount,
        }