Python os.path.ismount() Examples

The following are code examples for showing how to use os.path.ismount(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the ones you don't like. You can also save this page to your account.

Example 1
Project: enigma2   Author: OpenLD   File: plugin.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 2
Project: enigma2   Author: OpenLD   File: SearchCovers.py    (license) View Source Project 6 votes vote down vote up
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 
Example 3
Project: crossplatform_iptvplayer   Author: j00zek   File: Harddisk.py    (license) View Source Project 6 votes vote down vote up
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)) 
Example 4
Project: pipeline   Author: liorbenhorin   File: plat_other.py    (license) View Source Project 5 votes vote down vote up
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 
Example 5
Project: FileManager   Author: math2001   File: plat_other.py    (license) View Source Project 5 votes vote down vote up
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 
Example 6
Project: NoDialogs   Author: maximsmol   File: plat_other.py    (license) View Source Project 5 votes vote down vote up
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 
Example 7
Project: .sublime   Author: cxdongjack   File: plat_other.py    (license) View Source Project 5 votes vote down vote up
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 
Example 8
Project: ansible-provider-docs   Author: alibaba   File: files.py    (license) View Source Project 5 votes vote down vote up
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,
        } 
Example 9
Project: crossplatform_iptvplayer   Author: j00zek   File: Harddisk.py    (license) View Source Project 5 votes vote down vote up
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 
Example 10
Project: DevOps   Author: YoLoveLife   File: files.py    (license) View Source Project 4 votes vote down vote up
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,
        }