Commit d874ccae authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 791fd2da
...@@ -263,7 +263,9 @@ setup( ...@@ -263,7 +263,9 @@ setup(
# TODO install wcfs exe along wcfs/ py package. # TODO install wcfs exe along wcfs/ py package.
entry_points= {'console_scripts': [ entry_points= {'console_scripts': [
# start wcfs # start wcfs for zurl
# XXX name -> wcfs_serve? (it is confusing to have 2
# wcfs with different behaviour)
'wcfs = wendelin.wcfs:main', 'wcfs = wendelin.wcfs:main',
# demo to test # demo to test
......
...@@ -60,10 +60,11 @@ class Conn(object): ...@@ -60,10 +60,11 @@ class Conn(object):
# #
# it is an error if wcfs was already started. # it is an error if wcfs was already started.
# #
# XXX optv
# if exec_ is True, wcfs is not spawned, but executed into. # if exec_ is True, wcfs is not spawned, but executed into.
# #
# serve(zurl, exec_=False). # serve(zurl, exec_=False).
def serve(zurl, exec_=False): def serve(zurl, optv, exec_=False):
mntpt = _mntpt_4zurl(zurl) mntpt = _mntpt_4zurl(zurl)
# try opening .wcfs - it is an error if we can do it. # try opening .wcfs - it is an error if we can do it.
...@@ -79,7 +80,7 @@ def serve(zurl, exec_=False): ...@@ -79,7 +80,7 @@ def serve(zurl, exec_=False):
# seems to be ok to start # seems to be ok to start
# XXX race window if something starts after ^^^ check # XXX race window if something starts after ^^^ check
argv = [_wcfs_exe(), zurl, mntpt] argv = [_wcfs_exe()] + list(optv) + [zurl, mntpt]
if not exec_: if not exec_:
subprocess.check_call(argv, close_fds=True) subprocess.check_call(argv, close_fds=True)
else: else:
...@@ -122,6 +123,7 @@ def join(zurl, autostart=_default_autostart()): ...@@ -122,6 +123,7 @@ def join(zurl, autostart=_default_autostart()):
# start wcfs with telling it to automatically exit when there is no client activity. # start wcfs with telling it to automatically exit when there is no client activity.
# XXX extra opts -> join args -> test + -v=1 if running py.test -v # XXX extra opts -> join args -> test + -v=1 if running py.test -v
# XXX ^^^ check log level?
return _start(zurl, "-autoexit", '-d', '-alsologtostderr', '-v=1') return _start(zurl, "-autoexit", '-d', '-alsologtostderr', '-v=1')
...@@ -186,7 +188,6 @@ def _start(zurl, *optv): ...@@ -186,7 +188,6 @@ def _start(zurl, *optv):
if e.errno != ENOENT: if e.errno != ENOENT:
raise raise
else: else:
# TODO read .wcfs and verify it = zurl
res = f res = f
dotwcfs = f.read() dotwcfs = f.read()
if dotwcfs != zurl: if dotwcfs != zurl:
...@@ -289,6 +290,10 @@ def _mkdir_p(path): ...@@ -289,6 +290,10 @@ def _mkdir_p(path):
# if called as main just -> serve(argv[1]) # if called as main just -> serve()
def main(): def main():
serve(sys.argv[1], exec_=True) argv = sys.argv[1:]
# XXX usage
zurl = argv[-1] # -a -b zurl -> zurl
optv = argv[:-1] # -a -b zurl -> -a -b
serve(zurl, optv, exec_=True)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment