Moving towards a whitelist approach for MANIFEST.in (#8109)

* Moving towards a whitelist approach for MANIFEST.in when it comes to static resources

* Tuning static exclude

* Fix for fetching version string from package.json, which no longer exists

* Adding package.json fallback for unit tests
This commit is contained in:
Craig Rueda 2019-08-27 14:51:35 -07:00 committed by Maxime Beauchemin
parent 7595d9e5fd
commit de6d963432
3 changed files with 25 additions and 11 deletions

1
.gitignore vendored
View File

@ -24,6 +24,7 @@
.DS_Store
.eggs
.idea
.mypy_cache
.python-version
.tox
.vscode

View File

@ -20,15 +20,15 @@ graft licenses/
include README.md
recursive-include superset/examples *
recursive-include superset/migrations *
recursive-include superset/static *
recursive-exclude superset/static/assets/docs *
recursive-exclude superset/static/assets/images/viz_thumbnails_large *
recursive-exclude superset/static/docs *
recursive-exclude superset/static/spec *
recursive-exclude superset/static/assets/src *
recursive-include superset/static/assets/src/visualizations/CountryMap/ *
# Whitelist anything that needs to be added to the static bundle
recursive-exclude superset/static *
recursive-include superset/static/assets/branding *
recursive-include superset/static/assets/dist *
recursive-include superset/static/assets/images *
recursive-exclude superset/static/images/viz_thumbnails_large *
recursive-exclude superset/static/assets/node_modules *
recursive-include superset/static/assets/stylesheets *
recursive-include superset/templates *
recursive-include superset/translations *
recursive-exclude tests *

View File

@ -49,9 +49,22 @@ else:
# Superset specific config
# ---------------------------------------------------------
PACKAGE_DIR = os.path.join(BASE_DIR, "static", "assets")
PACKAGE_FILE = os.path.join(PACKAGE_DIR, "package.json")
with open(PACKAGE_FILE) as package_file:
VERSION_STRING = json.load(package_file)["version"]
VERSION_INFO_FILE = os.path.join(PACKAGE_DIR, "version_info.json")
PACKAGE_JSON_FILE = os.path.join(PACKAGE_DIR, "package.json")
#
# Depending on the context in which this config is loaded, the version_info.json file
# may or may not be available, as it is generated on install via setup.py. In the event
# that we're actually running Superset, we will have already installed, therefore it WILL
# exist. When unit tests are running, however, it WILL NOT exist, so we fall
# back to reading package.json
#
try:
with open(VERSION_INFO_FILE) as version_file:
VERSION_STRING = json.load(version_file)["version"]
except Exception:
with open(PACKAGE_JSON_FILE) as version_file:
VERSION_STRING = json.load(version_file)["version"]
ROW_LIMIT = 50000
VIZ_ROW_LIMIT = 10000