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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
14 deletions
+32
-14
fs/commands/fsmount.py
+20
-8
fs/tempfs.py
+12
-6
fs/tests/test_expose.py
+0
-0
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
:
if
windows
:
try
:
try
:
mount_path
=
args
[
0
][:
1
]
mount_path
=
args
[
0
][:
1
]
except
IndexError
:
except
IndexError
:
self
.
error
(
'Mount path required
\n
'
)
self
.
error
(
'Driver letter
\n
'
)
return
1
return
1
if
windows
:
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
)
dokan
.
unmount
(
mount_path
)
dokan
.
unmount
(
mount_path
)
self
.
output
(
'unmounting
%
s:'
%
mount_path
,
True
)
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
self
.
output
(
'unmounting
%
s
\n
'
%
mount_path
,
True
)
fuse
.
unmount
(
mount_path
)
fuse
.
unmount
(
mount_path
)
self
.
output
(
'unmounting
%
s'
%
mount_path
,
True
)
return
return
try
:
try
:
...
@@ -82,8 +92,6 @@ Mounts a file system on a system path"""
...
@@ -82,8 +92,6 @@ 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
__getstate__
(
self
):
# If we are picking a TempFS, we want to preserve its contents,
# so we *don't* do the clean
state
=
super
(
TempFS
,
self
)
.
__getstate__
()
self
.
_cleaned
=
True
return
state
def
__setstate__
(
self
,
state
):
def
__setstate__
(
self
,
state
):
"""Pickle the TempFS. TempFS delted their contents when closed, so pickling
is not garanteed to preserve the directory contents"""
state
=
super
(
TempFS
,
self
)
.
__setstate__
(
state
)
state
=
super
(
TempFS
,
self
)
.
__setstate__
(
state
)
self
.
_temp_dir
=
tempfile
.
mkdtemp
(
self
.
identifier
or
"TempFS"
,
dir
=
self
.
temp_dir
)
self
.
_cleaned
=
False
super
(
TempFS
,
self
)
.
__init__
(
self
.
_temp_dir
,
#self._temp_dir = tempfile.mkdtemp(self.identifier or "TempFS", dir=self.temp_dir)
dir_mode
=
self
.
dir_mode
,
#super(TempFS, self).__init__(self._temp_dir,
thread_synchronize
=
self
.
thread_synchronize
)
# 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
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