[tor-commits] [nyx/master] Allow the data directory to be set

atagar at torproject.org atagar at torproject.org
Wed Oct 26 16:16:54 UTC 2016


commit cb63919b6b19d83c686f5df8b550ed2acf1b2143
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Oct 22 11:59:30 2016 -0700

    Allow the data directory to be set
    
    Our 'startup.data_directory' nyxrc option was no longer wired up. Allowing
    users to set it. Presently this is only used for the manual info cache but
    we'll likely cache more there later.
---
 nyx/__init__.py     | 2 +-
 nyx/arguments.py    | 4 ++--
 nyx/panel/config.py | 5 +++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/nyx/__init__.py b/nyx/__init__.py
index 740685d..75dde99 100644
--- a/nyx/__init__.py
+++ b/nyx/__init__.py
@@ -85,7 +85,7 @@ CONFIG = stem.util.conf.config_dict('nyx', {
 NYX_INTERFACE = None
 TOR_CONTROLLER = None
 BASE_DIR = os.path.sep.join(__file__.split(os.path.sep)[:-1])
-DATA_DIR = os.path.expanduser('~/.nyx')
+DEFAULT_DATA_DIR = os.path.expanduser('~/.nyx')
 TESTING = False
 
 # technically can change but we use this query a *lot* so needs to be cached
diff --git a/nyx/arguments.py b/nyx/arguments.py
index bb0939e..9b53e35 100644
--- a/nyx/arguments.py
+++ b/nyx/arguments.py
@@ -14,7 +14,7 @@ import nyx.log
 
 import stem.util.connection
 
-from nyx import DATA_DIR, msg
+from nyx import DEFAULT_DATA_DIR, msg
 
 DEFAULT_ARGS = {
   'control_address': '127.0.0.1',
@@ -22,7 +22,7 @@ DEFAULT_ARGS = {
   'user_provided_port': False,
   'control_socket': '/var/run/tor/control',
   'user_provided_socket': False,
-  'config': os.path.join(DATA_DIR, 'nyxrc'),
+  'config': os.path.join(DEFAULT_DATA_DIR, 'nyxrc'),
   'debug_path': None,
   'logged_events': 'NOTICE,WARN,ERR,NYX_NOTICE,NYX_WARNING,NYX_ERROR',
   'print_version': False,
diff --git a/nyx/panel/config.py b/nyx/panel/config.py
index 3c0cc18..8390ac5 100644
--- a/nyx/panel/config.py
+++ b/nyx/panel/config.py
@@ -19,7 +19,7 @@ import stem.util.connection
 
 from nyx.curses import WHITE, NORMAL, BOLD, HIGHLIGHT
 from nyx.menu import MenuItem, Submenu
-from nyx import DATA_DIR, tor_controller, input_prompt, show_message
+from nyx import DEFAULT_DATA_DIR, tor_controller, input_prompt, show_message
 
 from stem.util import conf, enum, log, str_tools
 
@@ -41,6 +41,7 @@ CONFIG = conf.config_dict('nyx', {
   'features.config.order': [SortAttr.MAN_PAGE_ENTRY, SortAttr.NAME, SortAttr.IS_SET],
   'features.config.state.showPrivateOptions': False,
   'features.config.state.showVirtualOptions': False,
+  'startup.data_directory': DEFAULT_DATA_DIR,
 }, conf_handler)
 
 
@@ -130,7 +131,7 @@ class ConfigPanel(nyx.panel.Panel):
     self._sort_order = CONFIG['features.config.order']
     self._show_all = False  # show all options, or just the important ones
 
-    cached_manual_path = os.path.join(DATA_DIR, 'manual')
+    cached_manual_path = os.path.join(CONFIG['startup.data_directory'], 'manual')
 
     if os.path.exists(cached_manual_path):
       manual = stem.manual.Manual.from_cache(cached_manual_path)





More information about the tor-commits mailing list