Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
24bae94e
Commit
24bae94e
authored
Apr 22, 2014
by
willmcgugan@gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for exception message
parent
c8f36c66
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
51 deletions
+49
-51
fs/commands/fsmount.py
+37
-39
fs/s3fs.py
+12
-12
No files found.
fs/commands/fsmount.py
View file @
24bae94e
...
@@ -8,8 +8,9 @@ import os.path
...
@@ -8,8 +8,9 @@ import os.path
platform
=
platform
.
system
()
platform
=
platform
.
system
()
class
FSMount
(
Command
):
class
FSMount
(
Command
):
if
platform
==
"Windows"
:
if
platform
==
"Windows"
:
usage
=
"""fsmount [OPTIONS]... [FS] [DRIVE LETTER]
usage
=
"""fsmount [OPTIONS]... [FS] [DRIVE LETTER]
or fsmount -u [DRIVER LETTER]
or fsmount -u [DRIVER LETTER]
...
@@ -20,58 +21,57 @@ or fsmount -u [SYSTEM PATH]
...
@@ -20,58 +21,57 @@ or fsmount -u [SYSTEM PATH]
Mounts a file system on a system path"""
Mounts a file system on a system path"""
version
=
"1.0"
version
=
"1.0"
def
get_optparse
(
self
):
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
,
optparse
.
add_option
(
'-f'
,
'--foreground'
,
dest
=
'foreground'
,
action
=
"store_true"
,
default
=
False
,
help
=
"run the mount process in the foreground"
,
metavar
=
"FOREGROUND"
)
help
=
"run the mount process in the foreground"
,
metavar
=
"FOREGROUND"
)
optparse
.
add_option
(
'-u'
,
'--unmount'
,
dest
=
'unmount'
,
action
=
"store_true"
,
default
=
False
,
optparse
.
add_option
(
'-u'
,
'--unmount'
,
dest
=
'unmount'
,
action
=
"store_true"
,
default
=
False
,
help
=
"unmount path"
,
metavar
=
"UNMOUNT"
)
help
=
"unmount path"
,
metavar
=
"UNMOUNT"
)
optparse
.
add_option
(
'-n'
,
'--nocache'
,
dest
=
'nocache'
,
action
=
"store_true"
,
default
=
False
,
optparse
.
add_option
(
'-n'
,
'--nocache'
,
dest
=
'nocache'
,
action
=
"store_true"
,
default
=
False
,
help
=
"do not cache network filesystems"
,
metavar
=
"NOCACHE"
)
help
=
"do not cache network filesystems"
,
metavar
=
"NOCACHE"
)
return
optparse
return
optparse
def
do_run
(
self
,
options
,
args
):
def
do_run
(
self
,
options
,
args
):
windows
=
platform
==
"Windows"
windows
=
platform
==
"Windows"
if
options
.
unmount
:
if
options
.
unmount
:
if
windows
:
if
windows
:
try
:
try
:
mount_path
=
args
[
0
][:
1
]
mount_path
=
args
[
0
][:
1
]
except
IndexError
:
except
IndexError
:
self
.
error
(
'Driver letter required
\n
'
)
self
.
error
(
'Driver letter required
\n
'
)
return
1
return
1
from
fs.expose
import
dokan
from
fs.expose
import
dokan
mount_path
=
mount_path
[:
1
]
.
upper
()
mount_path
=
mount_path
[:
1
]
.
upper
()
self
.
output
(
'unmounting
%
s:...
\n
'
%
mount_path
,
True
)
self
.
output
(
'unmounting
%
s:...
\n
'
%
mount_path
,
True
)
dokan
.
unmount
(
mount_path
)
dokan
.
unmount
(
mount_path
)
return
return
else
:
else
:
try
:
try
:
mount_path
=
args
[
0
]
mount_path
=
args
[
0
]
except
IndexError
:
except
IndexError
:
self
.
error
(
self
.
usage
+
'
\n
'
)
self
.
error
(
self
.
usage
+
'
\n
'
)
return
1
return
1
from
fs.expose
import
fuse
from
fs.expose
import
fuse
self
.
output
(
'unmounting
%
s...
\n
'
%
mount_path
,
True
)
self
.
output
(
'unmounting
%
s...
\n
'
%
mount_path
,
True
)
fuse
.
unmount
(
mount_path
)
fuse
.
unmount
(
mount_path
)
return
return
try
:
try
:
fs_url
=
args
[
0
]
fs_url
=
args
[
0
]
except
IndexError
:
except
IndexError
:
self
.
error
(
self
.
usage
+
'
\n
'
)
self
.
error
(
self
.
usage
+
'
\n
'
)
return
1
return
1
try
:
try
:
mount_path
=
args
[
1
]
mount_path
=
args
[
1
]
except
IndexError
:
except
IndexError
:
if
windows
:
if
windows
:
...
@@ -79,62 +79,61 @@ Mounts a file system on a system path"""
...
@@ -79,62 +79,61 @@ Mounts a file system on a system path"""
self
.
error
(
self
.
usage
+
'
\n
'
)
self
.
error
(
self
.
usage
+
'
\n
'
)
else
:
else
:
self
.
error
(
self
.
usage
+
'
\n
'
)
self
.
error
(
self
.
usage
+
'
\n
'
)
return
1
return
1
fs
,
path
=
self
.
open_fs
(
fs_url
,
create_dir
=
True
)
fs
,
path
=
self
.
open_fs
(
fs_url
,
create_dir
=
True
)
if
path
:
if
path
:
if
not
fs
.
isdir
(
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
return
1
fs
=
fs
.
opendir
(
path
)
fs
=
fs
.
opendir
(
path
)
path
=
'/'
path
=
'/'
if
not
options
.
nocache
:
if
not
options
.
nocache
:
fs
.
cache_hint
(
True
)
fs
.
cache_hint
(
True
)
if
windows
:
if
windows
:
from
fs.expose
import
dokan
from
fs.expose
import
dokan
if
len
(
mount_path
)
>
1
:
if
len
(
mount_path
)
>
1
:
self
.
error
(
'Driver letter should be one character'
)
self
.
error
(
'Driver letter should be one character'
)
return
1
return
1
self
.
output
(
"Mounting
%
s on
%
s:
\n
"
%
(
fs
,
mount_path
),
True
)
self
.
output
(
"Mounting
%
s on
%
s:
\n
"
%
(
fs
,
mount_path
),
True
)
flags
=
dokan
.
DOKAN_OPTION_REMOVABLE
flags
=
dokan
.
DOKAN_OPTION_REMOVABLE
if
options
.
debug
:
if
options
.
debug
:
flags
|=
dokan
.
DOKAN_OPTION_DEBUG
|
dokan
.
DOKAN_OPTION_STDERR
flags
|=
dokan
.
DOKAN_OPTION_DEBUG
|
dokan
.
DOKAN_OPTION_STDERR
mp
=
dokan
.
mount
(
fs
,
mp
=
dokan
.
mount
(
fs
,
mount_path
,
mount_path
,
numthreads
=
5
,
numthreads
=
5
,
foreground
=
options
.
foreground
,
foreground
=
options
.
foreground
,
flags
=
flags
,
flags
=
flags
,
volname
=
str
(
fs
))
volname
=
str
(
fs
))
else
:
else
:
if
not
os
.
path
.
exists
(
mount_path
):
if
not
os
.
path
.
exists
(
mount_path
):
try
:
try
:
os
.
makedirs
(
mount_path
)
os
.
makedirs
(
mount_path
)
except
:
except
:
pass
pass
from
fs.expose
import
fuse
from
fs.expose
import
fuse
self
.
output
(
"Mounting
%
s on
%
s
\n
"
%
(
fs
,
mount_path
),
True
)
self
.
output
(
"Mounting
%
s on
%
s
\n
"
%
(
fs
,
mount_path
),
True
)
if
options
.
foreground
:
if
options
.
foreground
:
fuse_process
=
fuse
.
mount
(
fs
,
fuse_process
=
fuse
.
mount
(
fs
,
mount_path
,
mount_path
,
foreground
=
True
)
foreground
=
True
)
else
:
else
:
if
not
os
.
fork
():
if
not
os
.
fork
():
mp
=
fuse
.
mount
(
fs
,
mp
=
fuse
.
mount
(
fs
,
mount_path
,
mount_path
,
foreground
=
True
)
foreground
=
True
)
else
:
else
:
fs
.
close
=
lambda
:
None
fs
.
close
=
lambda
:
None
def
run
():
def
run
():
return
FSMount
()
.
run
()
return
FSMount
()
.
run
()
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
sys
.
exit
(
run
())
sys
.
exit
(
run
())
\ No newline at end of file
fs/s3fs.py
View file @
24bae94e
...
@@ -59,18 +59,18 @@ class S3FS(FS):
...
@@ -59,18 +59,18 @@ class S3FS(FS):
or flushed.
or flushed.
"""
"""
_meta
=
{
'thread_safe'
:
True
,
_meta
=
{
'thread_safe'
:
True
,
'virtual'
:
False
,
'virtual'
:
False
,
'read_only'
:
False
,
'read_only'
:
False
,
'unicode_paths'
:
True
,
'unicode_paths'
:
True
,
'case_insensitive_paths'
:
False
,
'case_insensitive_paths'
:
False
,
'network'
:
True
,
'network'
:
True
,
'atomic.move'
:
True
,
'atomic.move'
:
True
,
'atomic.copy'
:
True
,
'atomic.copy'
:
True
,
'atomic.makedir'
:
True
,
'atomic.makedir'
:
True
,
'atomic.rename'
:
False
,
'atomic.rename'
:
False
,
'atomic.setconetns'
:
True
'atomic.setcontent'
:
True
}
}
class
meta
:
class
meta
:
PATH_MAX
=
None
PATH_MAX
=
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment