You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2022/01/24 19:45:36 UTC
[superset] branch master updated: chore: use pkg_resources for cleaner config (#18130)
This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new fa104fe chore: use pkg_resources for cleaner config (#18130)
fa104fe is described below
commit fa104fee9a20dbd2175f60c50043886b8b8f7408
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Mon Jan 24 11:44:15 2022 -0800
chore: use pkg_resources for cleaner config (#18130)
---
superset/config.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/superset/config.py b/superset/config.py
index b9a98c4..1e74173 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -32,6 +32,7 @@ from collections import OrderedDict
from datetime import date, timedelta
from typing import Any, Callable, Dict, List, Optional, Type, TYPE_CHECKING, Union
+import pkg_resources
from cachelib.base import BaseCache
from celery.schedules import crontab
from dateutil import tz
@@ -64,17 +65,21 @@ EVENT_LOGGER = DBEventLogger()
SUPERSET_LOG_VIEW = True
-BASE_DIR = os.path.abspath(os.path.dirname(__file__))
+BASE_DIR = pkg_resources.resource_filename("superset", "")
if "SUPERSET_HOME" in os.environ:
DATA_DIR = os.environ["SUPERSET_HOME"]
else:
- DATA_DIR = os.path.join(os.path.expanduser("~"), ".superset")
+ DATA_DIR = os.path.expanduser("~/.superset")
# ---------------------------------------------------------
# Superset specific config
# ---------------------------------------------------------
-VERSION_INFO_FILE = os.path.join(BASE_DIR, "static", "version_info.json")
-PACKAGE_JSON_FILE = os.path.join(BASE_DIR, "static", "assets", "package.json")
+VERSION_INFO_FILE = pkg_resources.resource_filename(
+ "superset", "static/version_info.json"
+)
+PACKAGE_JSON_FILE = pkg_resources.resource_filename(
+ "superset", "static/assets/package.json"
+)
# Multiple favicons can be specified here. The "href" property
# is mandatory, but "sizes," "type," and "rel" are optional.