refactor scripts/common.py: move _default_nodedir out to its own file
authorBrian Warner <warner@lothar.com>
Tue, 26 May 2015 15:06:06 +0000 (08:06 -0700)
committerBrian Warner <warner@lothar.com>
Tue, 26 May 2015 18:27:57 +0000 (11:27 -0700)
src/allmydata/scripts/common.py
src/allmydata/scripts/default_nodedir.py [new file with mode: 0644]

index 55cb3f08c031e090fa96688849128b5f78d763eb..2894d3dd77723c50d219c62e2dda4b691c16ef96 100644 (file)
@@ -5,21 +5,7 @@ from twisted.python import usage
 from allmydata.util.assertutil import precondition
 from allmydata.util.encodingutil import unicode_to_url, quote_output, \
     quote_local_unicode_path, argv_to_abspath
-from allmydata.util.fileutil import abspath_expanduser_unicode
-
-
-_default_nodedir = None
-if sys.platform == 'win32':
-    from allmydata.windows import registry
-    path = registry.get_base_dir_path()
-    if path:
-        precondition(isinstance(path, unicode), path)
-        _default_nodedir = abspath_expanduser_unicode(path)
-
-if _default_nodedir is None:
-    path = abspath_expanduser_unicode(u"~/.tahoe")
-    precondition(isinstance(path, unicode), path)
-    _default_nodedir = path
+from allmydata.scripts.default_nodedir import _default_nodedir
 
 def get_default_nodedir():
     return _default_nodedir
diff --git a/src/allmydata/scripts/default_nodedir.py b/src/allmydata/scripts/default_nodedir.py
new file mode 100644 (file)
index 0000000..4f390dd
--- /dev/null
@@ -0,0 +1,17 @@
+
+import sys
+from allmydata.util.assertutil import precondition
+from allmydata.util.fileutil import abspath_expanduser_unicode
+
+_default_nodedir = None
+if sys.platform == 'win32':
+    from allmydata.windows import registry
+    path = registry.get_base_dir_path()
+    if path:
+        precondition(isinstance(path, unicode), path)
+        _default_nodedir = abspath_expanduser_unicode(path)
+
+if _default_nodedir is None:
+    path = abspath_expanduser_unicode(u"~/.tahoe")
+    precondition(isinstance(path, unicode), path)
+    _default_nodedir = path