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
f5fca02f
Commit
f5fca02f
authored
Apr 23, 2012
by
btimby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Take advantage of MountFS.close(), allow turning auto_mount off.
parent
82cfcf09
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
fs/contrib/archivefs.py
+6
-5
No files found.
fs/contrib/archivefs.py
View file @
f5fca02f
...
@@ -195,15 +195,15 @@ class ArchiveFS(FS):
...
@@ -195,15 +195,15 @@ class ArchiveFS(FS):
class
ArchiveMountFS
(
mountfs
.
MountFS
):
class
ArchiveMountFS
(
mountfs
.
MountFS
):
'''A subclass of MountFS that automatically identifies archives. Once identified
'''A subclass of MountFS that automatically identifies archives. Once identified
archives are mounted in place of the archive file.'''
archives are mounted in place of the archive file.'''
def
__init__
(
self
,
rootfs
,
**
kwargs
):
def
__init__
(
self
,
rootfs
,
auto_mount
=
True
):
super
(
ArchiveMountFS
,
self
)
.
__init__
(
**
kwargs
)
self
.
auto_mount
=
auto_mount
super
(
ArchiveMountFS
,
self
)
.
__init__
(
auto_close
=
True
)
self
.
rootfs
=
rootfs
self
.
rootfs
=
rootfs
self
.
mountdir
(
'/'
,
rootfs
)
self
.
mountdir
(
'/'
,
rootfs
)
def
__del__
(
self
):
def
__del__
(
self
):
# Umount everything that we mounted.
# Close automatically.
for
mountpoint
in
self
.
mount_tree
.
keys
():
self
.
close
()
self
.
unmount
(
mountpoint
)
def
ismount
(
self
,
path
):
def
ismount
(
self
,
path
):
try
:
try
:
...
@@ -213,6 +213,7 @@ class ArchiveMountFS(mountfs.MountFS):
...
@@ -213,6 +213,7 @@ class ArchiveMountFS(mountfs.MountFS):
return
type
(
object
)
is
mountfs
.
MountFS
.
DirMount
return
type
(
object
)
is
mountfs
.
MountFS
.
DirMount
def
_delegate
(
self
,
path
):
def
_delegate
(
self
,
path
):
if
self
.
auto_mount
:
for
ppath
in
recursepath
(
path
)[
1
:]:
for
ppath
in
recursepath
(
path
)[
1
:]:
# Don't mount again...
# Don't mount again...
if
self
.
ismount
(
ppath
):
if
self
.
ismount
(
ppath
):
...
...
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