summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwillmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f>2014-04-22 09:25:38 +0000
committerwillmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f>2014-04-22 09:25:38 +0000
commit8c7fd396b09377613246c994b6f7078bb9ed55bc (patch)
tree60e816e5b2c86d64e376af21c2495c845f5c2f50
parentd337a6df7243f0e8b5a7599afee5b57d5ece9986 (diff)
downloadpyfilesystem-8c7fd396b09377613246c994b6f7078bb9ed55bc.tar.gz
Fix for exception message
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@897 67cdc799-7952-0410-af00-57a81ceafa0f
-rw-r--r--fs/commands/fsmount.py75
-rw-r--r--fs/s3fs.py24
2 files changed, 49 insertions, 50 deletions
diff --git a/fs/commands/fsmount.py b/fs/commands/fsmount.py
index 8b249e2..824a1b1 100644
--- a/fs/commands/fsmount.py
+++ b/fs/commands/fsmount.py
@@ -8,8 +8,9 @@ import os.path
platform = platform.system()
+
class FSMount(Command):
-
+
if platform == "Windows":
usage = """fsmount [OPTIONS]... [FS] [DRIVE LETTER]
or fsmount -u [DRIVER LETTER]
@@ -20,58 +21,57 @@ or fsmount -u [SYSTEM PATH]
Mounts a file system on a system path"""
version = "1.0"
-
+
def get_optparse(self):
- optparse = super(FSMount, self).get_optparse()
+ optparse = super(FSMount, self).get_optparse()
optparse.add_option('-f', '--foreground', dest='foreground', action="store_true", default=False,
help="run the mount process in the foreground", metavar="FOREGROUND")
optparse.add_option('-u', '--unmount', dest='unmount', action="store_true", default=False,
help="unmount path", metavar="UNMOUNT")
optparse.add_option('-n', '--nocache', dest='nocache', action="store_true", default=False,
help="do not cache network filesystems", metavar="NOCACHE")
-
+
return optparse
-
-
+
def do_run(self, options, args):
-
+
windows = platform == "Windows"
-
+
if options.unmount:
if windows:
-
- try:
+
+ try:
mount_path = args[0][:1]
except IndexError:
self.error('Driver letter required\n')
return 1
-
+
from fs.expose import dokan
mount_path = mount_path[:1].upper()
self.output('unmounting %s:...\n' % mount_path, True)
- dokan.unmount(mount_path)
+ dokan.unmount(mount_path)
return
-
- else:
- try:
+
+ else:
+ try:
mount_path = args[0]
except IndexError:
self.error(self.usage + '\n')
- return 1
-
+ return 1
+
from fs.expose import fuse
self.output('unmounting %s...\n' % mount_path, True)
- fuse.unmount(mount_path)
+ fuse.unmount(mount_path)
return
-
+
try:
fs_url = args[0]
except IndexError:
self.error(self.usage + '\n')
return 1
-
- try:
+
+ try:
mount_path = args[1]
except IndexError:
if windows:
@@ -79,62 +79,61 @@ Mounts a file system on a system path"""
self.error(self.usage + '\n')
else:
self.error(self.usage + '\n')
- return 1
-
+ return 1
+
fs, path = self.open_fs(fs_url, create_dir=True)
if path:
if not fs.isdir(path):
- self.error('%s is not a directory on %s' % (fs_url. fs))
+ self.error('%s is not a directory on %s' % (fs_url, fs))
return 1
fs = fs.opendir(path)
path = '/'
if not options.nocache:
fs.cache_hint(True)
-
+
if windows:
from fs.expose import dokan
-
+
if len(mount_path) > 1:
self.error('Driver letter should be one character')
return 1
-
+
self.output("Mounting %s on %s:\n" % (fs, mount_path), True)
flags = dokan.DOKAN_OPTION_REMOVABLE
if options.debug:
flags |= dokan.DOKAN_OPTION_DEBUG | dokan.DOKAN_OPTION_STDERR
-
+
mp = dokan.mount(fs,
mount_path,
numthreads=5,
foreground=options.foreground,
flags=flags,
volname=str(fs))
-
- else:
+
+ else:
if not os.path.exists(mount_path):
try:
os.makedirs(mount_path)
except:
pass
-
+
from fs.expose import fuse
self.output("Mounting %s on %s\n" % (fs, mount_path), True)
-
+
if options.foreground:
fuse_process = fuse.mount(fs,
- mount_path,
- foreground=True)
+ mount_path,
+ foreground=True)
else:
if not os.fork():
mp = fuse.mount(fs,
mount_path,
foreground=True)
else:
- fs.close = lambda:None
-
+ fs.close = lambda: None
+
def run():
return FSMount().run()
-
+
if __name__ == "__main__":
sys.exit(run())
- \ No newline at end of file
diff --git a/fs/s3fs.py b/fs/s3fs.py
index 329c1e0..b72036b 100644
--- a/fs/s3fs.py
+++ b/fs/s3fs.py
@@ -59,18 +59,18 @@ class S3FS(FS):
or flushed.
"""
- _meta = { 'thread_safe' : True,
- 'virtual': False,
- 'read_only' : False,
- 'unicode_paths' : True,
- 'case_insensitive_paths' : False,
- 'network' : True,
- 'atomic.move' : True,
- 'atomic.copy' : True,
- 'atomic.makedir' : True,
- 'atomic.rename' : False,
- 'atomic.setconetns' : True
- }
+ _meta = {'thread_safe': True,
+ 'virtual': False,
+ 'read_only': False,
+ 'unicode_paths': True,
+ 'case_insensitive_paths': False,
+ 'network': True,
+ 'atomic.move': True,
+ 'atomic.copy': True,
+ 'atomic.makedir': True,
+ 'atomic.rename': False,
+ 'atomic.setcontent': True
+ }
class meta:
PATH_MAX = None