aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2009-08-07 17:23:13 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2009-08-07 17:23:13 (GMT)
commit2bcce0964b8010ab7c0b53c3afc058f843f8d581 (patch)
treedcdc020aa0d5e259101f9c0e19e2a4bd60dd40a0
parent2ee7285b793055bf1b463ad9793440a66f444fe9 (diff)
downloadfusearchive-2bcce0964b8010ab7c0b53c3afc058f843f8d581.zip
fusearchive-2bcce0964b8010ab7c0b53c3afc058f843f8d581.tar.gz
fusearchive-2bcce0964b8010ab7c0b53c3afc058f843f8d581.tar.bz2
Moved everything to main() so we can run the profiler again
-rwxr-xr-xfusearchive.py72
1 files changed, 38 insertions, 34 deletions
diff --git a/fusearchive.py b/fusearchive.py
index 04e2b16..696c666 100755
--- a/fusearchive.py
+++ b/fusearchive.py
@@ -21,49 +21,53 @@ if enable_psyco:
except ImportError:
pass
-if enable_stats:
- import hotshot
- prof = hotshot.Profile( "fusearchive_stats" )
- prof.runcall()
- prof.close()
+def main():
+ usage = """
+ Userspace filesystem that uses chunks to eliminate multiple copies of parts
+ of files for long term storage
+
+ """ + fuse.Fuse.fusage
-usage = """
-Userspace filesystem that uses chunks to eliminate multiple copies of parts
-of files for long term storage
+ server = FuseArchive.FileSystem(version="%prog " + fuse.__version__,
+ usage=usage,
+ dash_s_do='setsingle')
-""" + fuse.Fuse.fusage
+ server.multithreaded = False
-server = FuseArchive.FileSystem(version="%prog " + fuse.__version__,
- usage=usage,
- dash_s_do='setsingle')
+ server.parse(values=server, errex=1)
-server.multithreaded = False
+ if server.parser.largs == None or len(server.parser.largs) != 2:
+ print "Usage: " + sys.argv[0] + " storageDirectory mountDirectory"
+ sys.exit(1)
-server.parse(values=server, errex=1)
+ log_level = logging.WARNING
+ # If debug is in the assembed opts then enable our debug too
+ if server.fuse_args.assemble()[ -1 ].find( 'debug' ) != -1:
+ log_level = logging.DEBUG
-if server.parser.largs == None or len(server.parser.largs) != 2:
- print "Usage: " + sys.argv[0] + " storageDirectory mountDirectory"
- sys.exit(1)
+ logging.basicConfig( level = log_level,
+ format = '%(asctime)s %(levelname)s %(filename)s:%(lineno)d %(module)s:%(funcName)s() %(message)s',
+ stream = sys.stderr,
+ filemode = 'w' )
-log_level = logging.WARNING
-# If debug is in the assembed opts then enable our debug too
-if server.fuse_args.assemble()[ -1 ].find( 'debug' ) != -1:
- log_level = logging.DEBUG
+ # Get backing store directory
+ server.root = server.parser.largs[0]
-logging.basicConfig( level = log_level,
- format = '%(asctime)s %(levelname)s %(filename)s:%(lineno)d %(module)s:%(funcName)s() %(message)s',
- stream = sys.stderr,
- filemode = 'w' )
+ try:
+ if server.fuse_args.mount_expected():
+ os.chdir(server.root)
+ except OSError:
+ print >> sys.stderr, "can't enter root of underlying filesystem"
+ sys.exit(1)
-# Get backing store directory
-server.root = server.parser.largs[0]
+ server.main()
-try:
- if server.fuse_args.mount_expected():
- os.chdir(server.root)
-except OSError:
- print >> sys.stderr, "can't enter root of underlying filesystem"
- sys.exit(1)
+if enable_stats:
+ import hotshot
+ prof = hotshot.Profile( "fusearchive_stats" )
+ prof.runcall(main)
+ prof.close()
+else:
+ main()
-server.main()