2016-06-15 11:09:05 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
#
|
|
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
|
|
#
|
2023-01-02 00:23:55 -06:00
|
|
|
# Copyright (C) 2013 - 2023, The pgAdmin Development Team
|
2016-06-15 11:09:05 -05:00
|
|
|
# This software is released under the PostgreSQL Licence
|
|
|
|
#
|
|
|
|
#########################################################################
|
|
|
|
|
|
|
|
# Runtime checks
|
2022-08-10 10:43:48 -05:00
|
|
|
if [ ! -d runtime ] && [ ! -d web ]; then
|
2016-06-15 11:09:05 -05:00
|
|
|
echo This script must be run from the top-level directory of the source tree.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-08-10 10:43:48 -05:00
|
|
|
if [ ! -d .git ] && [ ! -f .git/config ]; then
|
2016-06-15 11:09:05 -05:00
|
|
|
echo This script must be run from a git checkout of the source tree.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Get the required package info
|
2022-08-10 10:43:48 -05:00
|
|
|
APP_RELEASE=$(grep "^APP_RELEASE" web/config.py | cut -d"=" -f2 | sed 's/ //g')
|
|
|
|
APP_REVISION=$(grep "^APP_REVISION" web/config.py | cut -d"=" -f2 | sed 's/ //g')
|
|
|
|
APP_NAME=$(grep "^APP_NAME" web/config.py | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //')
|
2019-03-21 09:02:19 -05:00
|
|
|
APP_LONG_VERSION=${APP_RELEASE}.${APP_REVISION}
|
2022-08-10 10:43:48 -05:00
|
|
|
APP_SUFFIX=$(grep "^APP_SUFFIX" web/config.py | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g")
|
|
|
|
if [ -n "${APP_SUFFIX}" ]; then
|
2019-03-21 09:02:19 -05:00
|
|
|
export APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
|
2016-06-15 11:09:05 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Output basic details to show we're working
|
2022-08-10 10:43:48 -05:00
|
|
|
echo Building tarballs for "${APP_NAME}" version "${APP_LONG_VERSION}"...
|
2016-06-15 11:09:05 -05:00
|
|
|
|
|
|
|
# Create/clearout the build directory
|
|
|
|
echo Creating/cleaning required directories...
|
|
|
|
if [ ! -d pip-build ]; then
|
|
|
|
mkdir pip-build
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d pip-build/pgadmin4 ]; then
|
|
|
|
rm -rf pip-build/pgadmin4
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir pip-build/pgadmin4
|
2016-06-15 14:56:27 -05:00
|
|
|
mkdir pip-build/pgadmin4/docs
|
2016-06-15 11:09:05 -05:00
|
|
|
|
|
|
|
# Build the clean tree
|
2022-08-10 10:43:48 -05:00
|
|
|
cd web || exit
|
|
|
|
for FILE in $(git ls-files)
|
2016-06-15 11:09:05 -05:00
|
|
|
do
|
2022-08-10 10:43:48 -05:00
|
|
|
echo Adding "${FILE}"
|
2016-06-15 11:09:05 -05:00
|
|
|
# We use tar here to preserve the path, as Mac (for example) doesn't support cp --parents
|
2022-08-10 10:43:48 -05:00
|
|
|
# shellcheck disable=SC2164
|
|
|
|
tar cf - "${FILE}" | (cd ../pip-build/pgadmin4; tar xf -)
|
2016-06-15 11:09:05 -05:00
|
|
|
done
|
|
|
|
|
2017-06-12 10:51:54 -05:00
|
|
|
yarn install
|
|
|
|
yarn run bundle
|
|
|
|
|
2022-08-10 10:43:48 -05:00
|
|
|
for FILE in pgadmin/static/js/generated/*
|
2017-06-12 10:51:54 -05:00
|
|
|
do
|
2022-08-10 10:43:48 -05:00
|
|
|
echo Adding "${FILE}"
|
|
|
|
# shellcheck disable=SC2164
|
|
|
|
tar cf - "${FILE}" | (cd ../pip-build/pgadmin4; tar xf -)
|
2017-06-12 10:51:54 -05:00
|
|
|
done
|
|
|
|
|
2022-08-10 10:43:48 -05:00
|
|
|
cd ../docs || exit
|
|
|
|
for FILE in $(git ls-files)
|
2016-06-15 14:56:27 -05:00
|
|
|
do
|
2022-08-10 10:43:48 -05:00
|
|
|
echo Adding "${FILE}"
|
2016-06-15 14:56:27 -05:00
|
|
|
# We use tar here to preserve the path, as Mac (for example) doesn't support cp --parents
|
2022-08-10 10:43:48 -05:00
|
|
|
# shellcheck disable=SC2164
|
|
|
|
tar cf - "${FILE}" | (cd ../pip-build/pgadmin4/docs; tar xf -)
|
2016-06-15 14:56:27 -05:00
|
|
|
done
|
|
|
|
|
2022-08-10 10:43:48 -05:00
|
|
|
for DIR in ./??_??/
|
2016-06-15 14:56:27 -05:00
|
|
|
do
|
2022-08-10 10:43:48 -05:00
|
|
|
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"
|
2016-06-15 14:56:27 -05:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2016-06-15 11:09:05 -05:00
|
|
|
cd ../
|
2021-03-03 10:58:35 -06:00
|
|
|
for FILE in LICENSE DEPENDENCIES README.md
|
2016-06-15 11:09:05 -05:00
|
|
|
do
|
2019-03-21 09:02:19 -05:00
|
|
|
echo Adding ${FILE}
|
2016-06-15 11:09:05 -05:00
|
|
|
# We use tar here to preserve the path, as Mac (for example) doesn't support cp --parents
|
2022-08-10 10:43:48 -05:00
|
|
|
# shellcheck disable=SC2164
|
2019-03-21 09:02:19 -05:00
|
|
|
tar cf - ${FILE} | (cd pip-build/pgadmin4; tar xf -)
|
2016-06-15 11:09:05 -05:00
|
|
|
done
|
|
|
|
|
2016-06-15 14:56:27 -05:00
|
|
|
# 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
|
|
|
|
|
2016-06-15 11:09:05 -05:00
|
|
|
# Create the manifest
|
|
|
|
echo Creating manifest...
|
|
|
|
echo recursive-include pgadmin4 \* > pip-build/MANIFEST.in
|
|
|
|
|
|
|
|
# Run the build
|
|
|
|
echo Building wheel...
|
2022-08-10 10:43:48 -05:00
|
|
|
cd pip-build || exit
|
2020-04-30 02:21:58 -05:00
|
|
|
python ../pkg/pip/setup_pip.py bdist_wheel
|
2016-06-15 11:09:05 -05:00
|
|
|
cd ../
|
|
|
|
|
|
|
|
# Get the build
|
|
|
|
if [ ! -d dist ]; then
|
|
|
|
mkdir dist
|
|
|
|
fi
|
|
|
|
cp pip-build/dist/*.whl dist/
|