Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
8fd9d48c
Commit
8fd9d48c
authored
Jun 27, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6d86fb8e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
wcfs/__init__.py
wcfs/__init__.py
+19
-6
No files found.
wcfs/__init__.py
View file @
8fd9d48c
...
...
@@ -23,10 +23,11 @@
XXX doc
"""
import
os
,
sys
,
hashlib
,
tempfile
,
subprocess
,
errno
,
time
import
os
,
sys
,
hashlib
,
tempfile
,
subprocess
,
time
import
logging
as
log
from
os.path
import
dirname
from
golang
import
go
,
chan
,
select
,
default
from
errno
import
ENOENT
,
EEXIST
from
ZODB.FileStorage
import
FileStorage
...
...
@@ -61,7 +62,7 @@ def serve(zurl, exec_=False):
try
:
f
=
open
(
mntpt
+
"/.wcfs"
)
except
IOError
as
e
:
if
e
.
errno
!=
errno
.
ENOENT
:
if
e
.
errno
!=
ENOENT
:
raise
else
:
f
.
close
()
...
...
@@ -91,7 +92,7 @@ def join(zurl, autostart=None):
try
:
f
=
open
(
mntpt
+
"/.wcfs"
)
except
IOError
as
e
:
if
e
.
errno
!=
errno
.
ENOENT
:
if
e
.
errno
!=
ENOENT
:
raise
else
:
# already have it
...
...
@@ -156,7 +157,7 @@ def _start(zurl):
try
:
f
=
open
(
"%s/.wcfs"
%
mntpt
)
except
IOError
as
e
:
if
e
.
errno
!=
errno
.
ENOENT
:
if
e
.
errno
!=
ENOENT
:
raise
else
:
res
=
f
...
...
@@ -216,12 +217,24 @@ def _wcfs_exe():
return
'%s/wcfs'
%
dirname
(
__file__
)
# _mntpt_4zurl returns wcfs should-be mountpoint for ZODB @ zurl.
#
# it also makes sure the mountpoint exists.
def
_mntpt_4zurl
(
zurl
):
# XXX stub.
# XXX what is zurl is zconfig://... ? -> then we have to look inside?
m
=
hashlib
.
sha1
()
m
.
update
(
zurl
)
return
"%s/wcfs/%s"
%
(
tempfile
.
gettempdir
(),
m
.
hexdigest
())
mntpt
=
"%s/wcfs/%s"
%
(
tempfile
.
gettempdir
(),
m
.
hexdigest
())
_mkdir_p
(
mntpt
)
return
mntpt
# mkdir -p
def
_mkdir_p
(
path
):
try
:
os
.
makedirs
(
path
)
except
OSError
as
e
:
if
e
.
errno
!=
EEXIST
:
raise
# _zstor_2zurl converts a ZODB storage to URL to access it.
...
...
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