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
f64112a5
Commit
f64112a5
authored
Dec 23, 2010
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for fsmount
parent
a32a775d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
24 deletions
+42
-24
fs/commands/fsmount.py
+27
-15
fs/tempfs.py
+14
-8
fs/tests/test_expose.py
+1
-1
No files found.
fs/commands/fsmount.py
View file @
f64112a5
...
@@ -40,21 +40,31 @@ Mounts a file system on a system path"""
...
@@ -40,21 +40,31 @@ Mounts a file system on a system path"""
windows
=
platform
==
"Windows"
windows
=
platform
==
"Windows"
if
options
.
unmount
:
if
options
.
unmount
:
try
:
mount_path
=
args
[
0
][:
1
]
except
IndexError
:
self
.
error
(
'Mount path required
\n
'
)
return
1
if
windows
:
if
windows
:
try
:
mount_path
=
args
[
0
][:
1
]
except
IndexError
:
self
.
error
(
'Driver letter
\n
'
)
return
1
from
fs.expose
import
dokan
from
fs.expose
import
dokan
mount_path
=
mount_path
[:
1
]
.
upper
()
mount_path
=
mount_path
[:
1
]
.
upper
()
dokan
.
unmount
(
mount_path
)
self
.
output
(
'unmounting
%
s:
\n
'
%
mount_path
,
True
)
self
.
output
(
'unmounting
%
s:'
%
mount_path
,
True
)
dokan
.
unmount
(
mount_path
)
return
return
else
:
else
:
try
:
mount_path
=
args
[
0
]
except
IndexError
:
self
.
error
(
'Mount path required
\n
'
)
return
1
from
fs.expose
import
fuse
from
fs.expose
import
fuse
fuse
.
unmount
(
mount_path
)
self
.
output
(
'unmounting
%
s
\n
'
%
mount_path
,
True
)
self
.
output
(
'unmounting
%
s'
%
mount_path
,
True
)
fuse
.
unmount
(
mount_path
)
return
return
try
:
try
:
...
@@ -82,9 +92,7 @@ Mounts a file system on a system path"""
...
@@ -82,9 +92,7 @@ Mounts a file system on a system path"""
path
=
'/'
path
=
'/'
if
not
options
.
nocache
:
if
not
options
.
nocache
:
fs
.
cache_hint
(
True
)
fs
.
cache_hint
(
True
)
if
windows
and
not
os
.
path
.
exists
(
mount_path
):
os
.
makedirs
(
mount_path
)
if
windows
:
if
windows
:
from
fs.expose
import
dokan
from
fs.expose
import
dokan
...
@@ -92,7 +100,7 @@ Mounts a file system on a system path"""
...
@@ -92,7 +100,7 @@ Mounts a file system on a system path"""
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:"
%
(
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
...
@@ -105,8 +113,12 @@ Mounts a file system on a system path"""
...
@@ -105,8 +113,12 @@ Mounts a file system on a system path"""
volname
=
str
(
fs
))
volname
=
str
(
fs
))
else
:
else
:
if
not
os
.
path
.
exists
(
mount_path
):
os
.
makedirs
(
mount_path
)
from
fs.expose
import
fuse
from
fs.expose
import
fuse
self
.
output
(
"Mounting
%
s on
%
s"
%
(
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
,
...
...
fs/tempfs.py
View file @
f64112a5
...
@@ -56,14 +56,20 @@ class TempFS(OSFS):
...
@@ -56,14 +56,20 @@ class TempFS(OSFS):
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
u'<TempFS:
%
s>'
%
self
.
_temp_dir
return
u'<TempFS:
%
s>'
%
self
.
_temp_dir
def
__setstate__
(
self
,
state
):
def
__getstate__
(
self
):
"""Pickle the TempFS. TempFS delted their contents when closed, so pickling
# If we are picking a TempFS, we want to preserve its contents,
is not garanteed to preserve the directory contents"""
# so we *don't* do the clean
state
=
super
(
TempFS
,
self
)
.
__setstate__
(
state
)
state
=
super
(
TempFS
,
self
)
.
__getstate__
()
self
.
_temp_dir
=
tempfile
.
mkdtemp
(
self
.
identifier
or
"TempFS"
,
dir
=
self
.
temp_dir
)
self
.
_cleaned
=
True
super
(
TempFS
,
self
)
.
__init__
(
self
.
_temp_dir
,
return
state
dir_mode
=
self
.
dir_mode
,
thread_synchronize
=
self
.
thread_synchronize
)
def
__setstate__
(
self
,
state
):
state
=
super
(
TempFS
,
self
)
.
__setstate__
(
state
)
self
.
_cleaned
=
False
#self._temp_dir = tempfile.mkdtemp(self.identifier or "TempFS", dir=self.temp_dir)
#super(TempFS, self).__init__(self._temp_dir,
# dir_mode=self.dir_mode,
# thread_synchronize=self.thread_synchronize)
def
close
(
self
):
def
close
(
self
):
"""Removes the temporary directory.
"""Removes the temporary directory.
...
...
fs/tests/test_expose.py
View file @
f64112a5
...
@@ -121,7 +121,7 @@ else:
...
@@ -121,7 +121,7 @@ else:
class
TestFUSE
(
unittest
.
TestCase
,
FSTestCases
,
ThreadingTestCases
):
class
TestFUSE
(
unittest
.
TestCase
,
FSTestCases
,
ThreadingTestCases
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
temp_fs
=
TempFS
()
self
.
temp_fs
=
TempFS
()
self
.
temp_fs
.
makedir
(
"root"
)
self
.
temp_fs
.
makedir
(
"root"
)
self
.
temp_fs
.
makedir
(
"mount"
)
self
.
temp_fs
.
makedir
(
"mount"
)
self
.
mounted_fs
=
self
.
temp_fs
.
opendir
(
"root"
)
self
.
mounted_fs
=
self
.
temp_fs
.
opendir
(
"root"
)
...
...
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