Skip to content

Commit

Permalink
Moving towards a whitelist approach for MANIFEST.in (apache#8109)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
craig-rueda authored and mistercrunch committed Aug 27, 2019
1 parent 7595d9e commit de6d963
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
.DS_Store
.eggs
.idea
.mypy_cache
.python-version
.tox
.vscode
Expand Down
16 changes: 8 additions & 8 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
19 changes: 16 additions & 3 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,22 @@
# 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
Expand Down

0 comments on commit de6d963

Please sign in to comment.