From 17b6053f45027de86f099ccb71c2cbb4e99b6a40 Mon Sep 17 00:00:00 2001 From: Dave Page Date: Wed, 15 Jun 2016 20:56:27 +0100 Subject: [PATCH] Support distro-specific configs, and include docs in the PIP wheel. A distro can now install a config_distro.py file alongside config.py in which distro-specific configuration settings can be set, overriding those in config.py. User settings in config_local.py will override all other settings. This is useful to allow packagers to config settings like the doc path, that may be specific to RPMs or Wheels etc. --- pkg/pip/build.sh | 22 ++++++++++++++++++++++ web/config.py | 6 ++++++ 2 files changed, 28 insertions(+) diff --git a/pkg/pip/build.sh b/pkg/pip/build.sh index 7cbb03538..54ca202d2 100755 --- a/pkg/pip/build.sh +++ b/pkg/pip/build.sh @@ -46,6 +46,7 @@ if [ -d pip-build/pgadmin4 ]; then fi mkdir pip-build/pgadmin4 +mkdir pip-build/pgadmin4/docs # Build the clean tree cd web @@ -56,6 +57,22 @@ do tar cf - $FILE | (cd ../pip-build/pgadmin4; tar xf -) done +cd ../docs +for FILE in `git ls-files` +do + echo Adding $FILE + # We use tar here to preserve the path, as Mac (for example) doesn't support cp --parents + tar cf - $FILE | (cd ../pip-build/pgadmin4/docs; tar xf -) +done + +for DIR in `ls -d ??_??/` +do + if [ -d $DIR/_build/html ]; then + mkdir -p ../pip-build/pgadmin4/docs/$DIR/_build + cp -R $DIR/_build/html ../pip-build/pgadmin4/docs/$DIR/_build + fi +done + cd ../ for FILE in LICENSE README libraries.txt do @@ -64,6 +81,11 @@ do tar cf - $FILE | (cd pip-build/pgadmin4; tar xf -) done +# Create the distro config +echo Creating distro config... +echo HELP_PATH = \'../../docs/en_US/_build/html/\' > pip-build/pgadmin4/config_distro.py +echo MINIFY_HTML = False >> pip-build/pgadmin4/config_distro.py + # Create the manifest echo Creating manifest... echo recursive-include pgadmin4 \* > pip-build/MANIFEST.in diff --git a/web/config.py b/web/config.py index 8545addbd..870d70ed1 100644 --- a/web/config.py +++ b/web/config.py @@ -250,6 +250,12 @@ THREADED_MODE = True # Local config settings ########################################################################## +# Load distribution-specific config overrides +try: + from config_distro import * +except ImportError: + pass + # Load local config overrides try: from config_local import *