From 32c39d0fd062738b23cf8c45164996f1c4b467f0 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Fri, 8 Mar 2019 17:51:49 -0500 Subject: [PATCH] cleaner output dir spec in config --- archivebox/config.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/archivebox/config.py b/archivebox/config.py index 9c9cd795..6fc5d55e 100644 --- a/archivebox/config.py +++ b/archivebox/config.py @@ -44,14 +44,19 @@ WGET_BINARY = os.getenv('WGET_BINARY', 'wget') YOUTUBEDL_BINARY = os.getenv('YOUTUBEDL_BINARY', 'youtube-dl') CHROME_BINARY = os.getenv('CHROME_BINARY', None) -### Paths +try: + OUTPUT_DIR = os.path.abspath(os.getenv('OUTPUT_DIR')) +except Exception: + OUTPUT_DIR = None + + +# ****************************************************************************** +# **************************** Derived Settings ******************************** +# ****************************************************************************** + REPO_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) - -OUTPUT_DIR = os.path.abspath(os.getenv('OUTPUT_DIR', os.path.join(REPO_DIR, 'output'))) - -# ****************************************************************************** -# ********************** Do not edit below this point ************************** -# ****************************************************************************** +if not OUTPUT_DIR: + OUTPUT_DIR = os.path.join(REPO_DIR, 'output') ARCHIVE_DIR_NAME = 'archive' SOURCES_DIR_NAME = 'sources'