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
ef583968
Commit
ef583968
authored
Aug 09, 2010
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dokan: remove silent-install functionality, it really doesn't belong in this framework
parent
f5751e45
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
103 deletions
+3
-103
fs/expose/dokan/__init__.py
+1
-1
fs/expose/dokan/installer.py
+0
-102
fs/osfs/watch_win32.py
+2
-0
No files found.
fs/expose/dokan/__init__.py
View file @
ef583968
...
...
@@ -72,7 +72,7 @@ from fs.functools import wraps
try
:
import
libdokan
except
NotImplementedError
:
except
(
NotImplementedError
,
EnvironmentError
)
:
raise
ImportError
(
"Dokan found but not usable"
)
...
...
fs/expose/dokan/installer.py
deleted
100644 → 0
View file @
f5751e45
import
os
import
shutil
import
subprocess
import
ctypes
kernel32
=
ctypes
.
windll
.
kernel32
def
GetSystemDirectory
():
buf
=
ctypes
.
create_unicode_buffer
(
260
)
if
not
kernel32
.
GetSystemDirectoryW
(
ctypes
.
byref
(
buf
),
260
):
raise
ctypes
.
WinError
()
return
buf
.
value
def
_tag2vertup
(
tag
):
bits
=
[]
for
bit
in
tag
.
split
(
"-"
):
for
bit2
in
bit
.
split
(
"."
):
try
:
bits
.
append
(
int
(
bit2
.
strip
()))
except
ValueError
:
pass
return
tuple
(
bits
)
def
install_dokan
(
release_dir
,
vendorid
=
"pyfilesystem"
):
"""Install dokan from the given release directory."""
reltag
=
os
.
path
.
basename
(
release_dir
)
newver
=
_tag2vertup
(
reltag
)
sysdir
=
GetSystemDirectory
()
pfdir
=
os
.
path
.
join
(
os
.
environ
[
"PROGRAMFILES"
],
"Dokan"
)
# Is Dokan already installed, and is it safe to upgrade?
old_reltag
=
None
if
os
.
path
.
exists
(
os
.
path
.
join
(
sysdir
,
"drivers"
,
"dokan.sys"
)):
for
nm
in
os
.
listdir
(
pfdir
):
if
nm
.
startswith
(
vendorid
):
old_reltag
=
nm
[
len
(
vendorid
)
+
1
:
-
4
]
oldver
=
_tag2vertup
(
old_reltag
)
if
oldver
>=
newver
:
raise
OSError
(
"dokan already at version "
+
reltag
)
break
else
:
raise
OSError
(
"dokan already installed from another source"
)
# Device what version to install based on windows version.
wver
=
sys
.
getwindowsversion
()
if
wver
<
(
5
,
1
):
raise
OSError
(
"windows is too old to install dokan"
)
if
wver
<
(
6
,
0
):
wtyp
=
"wxp"
elif
wver
<
(
6
,
1
):
wtyp
=
"wlh"
else
:
wtyp
=
"win7"
srcdir
=
os
.
path
.
join
(
release_dir
,
wtyp
)
# Terminate the existing install and remove it
if
old_reltag
:
uninstall_dokan
(
old_reltag
)
# Copy new files to the appropriate place
if
not
os
.
path
.
exists
(
pfdir
):
os
.
makedirs
(
pfdir
)
f
=
open
(
os
.
path
.
join
(
pfdir
,
vendorid
+
"-"
+
reltag
+
".txt"
),
"wt"
)
try
:
f
.
write
(
"Dokan automatically installed by "
+
vendorid
+
"
\n
"
)
finally
:
f
.
close
()
shutil
.
copy2
(
os
.
path
.
join
(
srcdir
,
"dll"
,
"dokan.dll"
),
os
.
path
.
join
(
sysdir
,
"dokan.dll"
))
shutil
.
copy2
(
os
.
path
.
join
(
srcdir
,
"sys"
,
"dokan.sys"
),
os
.
path
.
join
(
sysdir
,
"drivers"
,
"dokan.sys"
))
shutil
.
copy2
(
os
.
path
.
join
(
srcdir
,
"mounter"
,
"mounter.exe"
),
os
.
path
.
join
(
pfdir
,
"mounter.exe"
))
shutil
.
copy2
(
os
.
path
.
join
(
srcdir
,
"dokanctrl"
,
"dokanctl.exe"
),
os
.
path
.
join
(
pfdir
,
"dokanctl.exe"
))
# Invoke dokanctl to install the drivers
_dokanctl
(
pfdir
,
"/i"
,
"a"
)
def
uninstall_dokan
(
release_dir
):
reltag
=
os
.
path
.
basename
(
release_dir
)
newver
=
_tag2vertup
(
reltag
)
sysdir
=
GetSystemDirectory
()
pfdir
=
os
.
path
.
join
(
os
.
environ
[
"PROGRAMFILES"
],
"Dokan"
)
if
dokan_installed
:
_dokanctl
(
pfdir
,
"/r"
,
"a"
)
os
.
unlink
(
os
.
path
.
join
(
sysdir
,
"drivers"
,
"dokan.sys"
))
os
.
unlink
(
os
.
path
.
join
(
sysdir
,
"dokan.dll"
))
for
nm
in
os
.
listdir
(
pfdir
):
os
.
unlink
(
os
.
path
.
join
(
pfdir
,
nm
))
def
_dokanctl
(
pfdir
,
*
args
):
dokanctl
=
os
.
path
.
join
(
pfdir
,
"dokanctl.exe"
)
startupinfo
=
subprocess
.
STARTUPINFO
()
startupinfo
.
dwFlags
|=
subprocess
.
STARTF_USESHOWWINDOW
p
=
subprocess
.
Popen
([
dokanctl
]
+
list
(
args
),
startupinfo
=
startupinfo
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
if
p
.
wait
()
!=
0
:
raise
OSError
(
"dokanctl failed: "
+
p
.
stdout
.
read
())
if
__name__
==
"__main__"
:
import
sys
install_dokan
(
sys
.
argv
[
1
])
fs/osfs/watch_win32.py
View file @
ef583968
...
...
@@ -237,6 +237,8 @@ class WatchedDirectory(object):
pos
=
0
while
pos
<
len
(
buffer
):
jump
,
action
,
namelen
=
struct
.
unpack
(
"iii"
,
buffer
[
pos
:
pos
+
12
])
# TODO: this may return a shortname or a longname, with no way
# to tell which. Normalise them somehow?
name
=
buffer
[
pos
+
12
:
pos
+
12
+
namelen
]
.
decode
(
"utf16"
)
yield
(
name
,
action
)
if
not
jump
:
...
...
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