chg: Store the source files in the home directory
parent
28ef7b2ecc
commit
3512290cc2
|
@ -12,6 +12,9 @@ import time
|
||||||
|
|
||||||
|
|
||||||
def get_config_path():
|
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'
|
return Path(sys.modules['bgpranking'].__file__).parent / 'config'
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
from bgpranking.archive import DeepArchive
|
from bgpranking.archive import DeepArchive
|
||||||
import logging
|
import logging
|
||||||
from pathlib import Path
|
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
|
from pid import PidFile, PidFileError
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class ModulesArchiver():
|
||||||
if not config_dir:
|
if not config_dir:
|
||||||
config_dir = get_config_path()
|
config_dir = get_config_path()
|
||||||
if not storage_directory:
|
if not storage_directory:
|
||||||
self.storage_directory = get_list_storage_path()
|
self.storage_directory = get_homedir()
|
||||||
modules_config = config_dir / 'modules'
|
modules_config = config_dir / 'modules'
|
||||||
modules_paths = [modulepath for modulepath in modules_config.glob('*.json')]
|
modules_paths = [modulepath for modulepath in modules_config.glob('*.json')]
|
||||||
self.modules = [DeepArchive(path, self.storage_directory, loglevel) for path in modules_paths]
|
self.modules = [DeepArchive(path, self.storage_directory, loglevel) for path in modules_paths]
|
||||||
|
|
|
@ -8,7 +8,7 @@ import aiohttp
|
||||||
|
|
||||||
from bgpranking.abstractmanager import AbstractManager
|
from bgpranking.abstractmanager import AbstractManager
|
||||||
from bgpranking.modulesfetcher import Fetcher
|
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',
|
logging.basicConfig(format='%(asctime)s %(name)s %(levelname)s:%(message)s',
|
||||||
level=logging.INFO, datefmt='%I:%M:%S')
|
level=logging.INFO, datefmt='%I:%M:%S')
|
||||||
|
@ -21,7 +21,7 @@ class ModulesManager(AbstractManager):
|
||||||
if not config_dir:
|
if not config_dir:
|
||||||
config_dir = get_config_path()
|
config_dir = get_config_path()
|
||||||
if not storage_directory:
|
if not storage_directory:
|
||||||
storage_directory = get_list_storage_path()
|
storage_directory = get_homedir()
|
||||||
modules_config = config_dir / 'modules'
|
modules_config = config_dir / 'modules'
|
||||||
modules_paths = [modulepath for modulepath in modules_config.glob('*.json')]
|
modules_paths = [modulepath for modulepath in modules_config.glob('*.json')]
|
||||||
self.modules = [Fetcher(path, storage_directory, loglevel) for path in modules_paths]
|
self.modules = [Fetcher(path, storage_directory, loglevel) for path in modules_paths]
|
||||||
|
|
|
@ -6,7 +6,7 @@ from pathlib import Path
|
||||||
|
|
||||||
from bgpranking.abstractmanager import AbstractManager
|
from bgpranking.abstractmanager import AbstractManager
|
||||||
from bgpranking.parser import RawFilesParser
|
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',
|
logging.basicConfig(format='%(asctime)s %(name)s %(levelname)s:%(message)s',
|
||||||
level=logging.INFO, datefmt='%I:%M:%S')
|
level=logging.INFO, datefmt='%I:%M:%S')
|
||||||
|
@ -19,7 +19,7 @@ class ParserManager(AbstractManager):
|
||||||
if not config_dir:
|
if not config_dir:
|
||||||
config_dir = get_config_path()
|
config_dir = get_config_path()
|
||||||
if not storage_directory:
|
if not storage_directory:
|
||||||
storage_directory = get_list_storage_path()
|
storage_directory = get_homedir()
|
||||||
modules_config = config_dir / 'modules'
|
modules_config = config_dir / 'modules'
|
||||||
modules_paths = [modulepath for modulepath in modules_config.glob('*.json')]
|
modules_paths = [modulepath for modulepath in modules_config.glob('*.json')]
|
||||||
self.modules = [RawFilesParser(path, storage_directory, loglevel) for path in modules_paths]
|
self.modules = [RawFilesParser(path, storage_directory, loglevel) for path in modules_paths]
|
||||||
|
|
Loading…
Reference in New Issue