chg: Store the source files in the home directory

pull/12/head
Raphaël Vinot 2018-04-01 18:15:44 +02:00
parent 28ef7b2ecc
commit 3512290cc2
4 changed files with 9 additions and 6 deletions

View File

@ -12,6 +12,9 @@ import time
def get_config_path():
if Path('bgpranking', 'config').exists():
# Running from the repository
return Path('bgpranking', 'config')
return Path(sys.modules['bgpranking'].__file__).parent / 'config'

View File

@ -4,7 +4,7 @@
from bgpranking.archive import DeepArchive
import logging
from pathlib import Path
from bgpranking.libs.helpers import get_config_path, get_list_storage_path
from bgpranking.libs.helpers import get_config_path, get_homedir
from pid import PidFile, PidFileError
@ -22,7 +22,7 @@ class ModulesArchiver():
if not config_dir:
config_dir = get_config_path()
if not storage_directory:
self.storage_directory = get_list_storage_path()
self.storage_directory = get_homedir()
modules_config = config_dir / 'modules'
modules_paths = [modulepath for modulepath in modules_config.glob('*.json')]
self.modules = [DeepArchive(path, self.storage_directory, loglevel) for path in modules_paths]

View File

@ -8,7 +8,7 @@ import aiohttp
from bgpranking.abstractmanager import AbstractManager
from bgpranking.modulesfetcher import Fetcher
from bgpranking.libs.helpers import get_config_path, get_list_storage_path
from bgpranking.libs.helpers import get_config_path, get_homedir
logging.basicConfig(format='%(asctime)s %(name)s %(levelname)s:%(message)s',
level=logging.INFO, datefmt='%I:%M:%S')
@ -21,7 +21,7 @@ class ModulesManager(AbstractManager):
if not config_dir:
config_dir = get_config_path()
if not storage_directory:
storage_directory = get_list_storage_path()
storage_directory = get_homedir()
modules_config = config_dir / 'modules'
modules_paths = [modulepath for modulepath in modules_config.glob('*.json')]
self.modules = [Fetcher(path, storage_directory, loglevel) for path in modules_paths]

View File

@ -6,7 +6,7 @@ from pathlib import Path
from bgpranking.abstractmanager import AbstractManager
from bgpranking.parser import RawFilesParser
from bgpranking.libs.helpers import get_config_path, get_list_storage_path
from bgpranking.libs.helpers import get_config_path, get_homedir
logging.basicConfig(format='%(asctime)s %(name)s %(levelname)s:%(message)s',
level=logging.INFO, datefmt='%I:%M:%S')
@ -19,7 +19,7 @@ class ParserManager(AbstractManager):
if not config_dir:
config_dir = get_config_path()
if not storage_directory:
storage_directory = get_list_storage_path()
storage_directory = get_homedir()
modules_config = config_dir / 'modules'
modules_paths = [modulepath for modulepath in modules_config.glob('*.json')]
self.modules = [RawFilesParser(path, storage_directory, loglevel) for path in modules_paths]