mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Separate the application name, branding & version information from the configuration file. #7187
This commit is contained in:
parent
c92e9c2953
commit
d09833744a
8
Make.bat
8
Make.bat
@ -63,13 +63,13 @@ REM Main build sequence Ends
|
|||||||
set "VCREDIST_FILE=vcredist_x64.exe"
|
set "VCREDIST_FILE=vcredist_x64.exe"
|
||||||
|
|
||||||
REM Set additional variables we need
|
REM Set additional variables we need
|
||||||
FOR /F "tokens=3" %%a IN ('findstr /C:"APP_RELEASE =" %WD%\web\config.py') DO SET APP_MAJOR=%%a
|
FOR /F "tokens=3" %%a IN ('findstr /C:"APP_RELEASE =" %WD%\web\version.py') DO SET APP_MAJOR=%%a
|
||||||
FOR /F "tokens=3" %%a IN ('findstr /C:"APP_REVISION =" %WD%\web\config.py') DO SET APP_MINOR=%%a
|
FOR /F "tokens=3" %%a IN ('findstr /C:"APP_REVISION =" %WD%\web\version.py') DO SET APP_MINOR=%%a
|
||||||
FOR /F "tokens=3" %%a IN ('findstr /C:"APP_SUFFIX =" %WD%\web\config.py') DO SET APP_VERSION_SUFFIX=%%a
|
FOR /F "tokens=3" %%a IN ('findstr /C:"APP_SUFFIX =" %WD%\web\version.py') DO SET APP_VERSION_SUFFIX=%%a
|
||||||
REM remove single quote from the string
|
REM remove single quote from the string
|
||||||
SET APP_VERSION_SUFFIX=%APP_VERSION_SUFFIX:'=%
|
SET APP_VERSION_SUFFIX=%APP_VERSION_SUFFIX:'=%
|
||||||
SET APP_NAME=""
|
SET APP_NAME=""
|
||||||
FOR /F "tokens=2* DELims='" %%a IN ('findstr /C:"APP_NAME =" web\config.py') DO SET APP_NAME=%%a
|
FOR /F "tokens=2* DELims='" %%a IN ('findstr /C:"APP_NAME =" web\branding.py') DO SET APP_NAME=%%a
|
||||||
FOR /f "tokens=1 DELims=." %%G IN ('%PGADMIN_PYTHON_DIR%/python.exe -c "print('%APP_NAME%'.lower().replace(' ', ''))"') DO SET APP_SHORTNAME=%%G
|
FOR /f "tokens=1 DELims=." %%G IN ('%PGADMIN_PYTHON_DIR%/python.exe -c "print('%APP_NAME%'.lower().replace(' ', ''))"') DO SET APP_SHORTNAME=%%G
|
||||||
SET APP_VERSION=%APP_MAJOR%.%APP_MINOR%
|
SET APP_VERSION=%APP_MAJOR%.%APP_MINOR%
|
||||||
SET INSTALLERNAME=%APP_SHORTNAME%-%APP_MAJOR%.%APP_MINOR%-%APP_VERSION_SUFFIX%-x64.exe
|
SET INSTALLERNAME=%APP_SHORTNAME%-%APP_MAJOR%.%APP_MINOR%-%APP_VERSION_SUFFIX%-x64.exe
|
||||||
|
6
Makefile
6
Makefile
@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
|
|
||||||
APP_NAME := $(shell grep ^APP_NAME web/config.py | awk -F"=" '{print $$NF}' | tr -d '[:space:]' | tr -d "'" | awk '{print tolower($$0)}')
|
APP_NAME := $(shell grep ^APP_NAME web/branding.py | awk -F"=" '{print $$NF}' | tr -d '[:space:]' | tr -d "'" | awk '{print tolower($$0)}')
|
||||||
APP_RELEASE := $(shell grep ^APP_RELEASE web/config.py | awk -F"=" '{print $$NF}' | tr -d '[:space:]')
|
APP_RELEASE := $(shell grep ^APP_RELEASE web/version.py | awk -F"=" '{print $$NF}' | tr -d '[:space:]')
|
||||||
APP_REVISION := $(shell grep ^APP_REVISION web/config.py | awk -F"=" '{print $$NF}' | tr -d '[:space:]')
|
APP_REVISION := $(shell grep ^APP_REVISION web/version.py | awk -F"=" '{print $$NF}' | tr -d '[:space:]')
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# High-level targets
|
# High-level targets
|
||||||
|
@ -10,11 +10,11 @@ _setup_env() {
|
|||||||
SERVERROOT=${BUILDROOT}/server
|
SERVERROOT=${BUILDROOT}/server
|
||||||
WEBROOT=${BUILDROOT}/web
|
WEBROOT=${BUILDROOT}/web
|
||||||
DISTROOT=$(realpath "${WD}/../../dist")
|
DISTROOT=$(realpath "${WD}/../../dist")
|
||||||
APP_RELEASE=$(grep "^APP_RELEASE" web/config.py | cut -d"=" -f2 | sed 's/ //g')
|
APP_RELEASE=$(grep "^APP_RELEASE" web/version.py | cut -d"=" -f2 | sed 's/ //g')
|
||||||
APP_REVISION=$(grep "^APP_REVISION" web/config.py | cut -d"=" -f2 | sed 's/ //g')
|
APP_REVISION=$(grep "^APP_REVISION" web/version.py | cut -d"=" -f2 | sed 's/ //g')
|
||||||
APP_NAME=$(grep "^APP_NAME" web/config.py | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //' | sed 's/ //g' | tr '[:upper:]' '[:lower:]')
|
APP_NAME=$(grep "^APP_NAME" web/branding.py | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //' | sed 's/ //g' | tr '[:upper:]' '[:lower:]')
|
||||||
APP_LONG_VERSION=${APP_RELEASE}.${APP_REVISION}
|
APP_LONG_VERSION=${APP_RELEASE}.${APP_REVISION}
|
||||||
APP_SUFFIX=$(grep "^APP_SUFFIX" web/config.py | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g")
|
APP_SUFFIX=$(grep "^APP_SUFFIX" web/version.py | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g")
|
||||||
if [ -n "${APP_SUFFIX}" ]; then
|
if [ -n "${APP_SUFFIX}" ]; then
|
||||||
APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
|
APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
|
||||||
fi
|
fi
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
_setup_env() {
|
_setup_env() {
|
||||||
FUNCS_DIR=$(cd "$(dirname "$0")" && pwd)/../..
|
FUNCS_DIR=$(cd "$(dirname "$0")" && pwd)/../..
|
||||||
APP_RELEASE=$(grep "^APP_RELEASE" "${FUNCS_DIR}/web/config.py" | cut -d"=" -f2 | sed 's/ //g')
|
APP_RELEASE=$(grep "^APP_RELEASE" "${FUNCS_DIR}/web/version.py" | cut -d"=" -f2 | sed 's/ //g')
|
||||||
APP_REVISION=$(grep "^APP_REVISION" "${FUNCS_DIR}/web/config.py" | cut -d"=" -f2 | sed 's/ //g')
|
APP_REVISION=$(grep "^APP_REVISION" "${FUNCS_DIR}/web/version.py" | cut -d"=" -f2 | sed 's/ //g')
|
||||||
APP_NAME=$(grep "^APP_NAME" "${FUNCS_DIR}/web/config.py" | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //')
|
APP_NAME=$(grep "^APP_NAME" "${FUNCS_DIR}/web/branding.py" | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //')
|
||||||
APP_LONG_VERSION=${APP_RELEASE}.${APP_REVISION}
|
APP_LONG_VERSION=${APP_RELEASE}.${APP_REVISION}
|
||||||
APP_SUFFIX=$(grep "^APP_SUFFIX" "${FUNCS_DIR}/web/config.py" | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g")
|
APP_SUFFIX=$(grep "^APP_SUFFIX" "${FUNCS_DIR}/web/version.py" | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g")
|
||||||
if [ -n "${APP_SUFFIX}" ]; then
|
if [ -n "${APP_SUFFIX}" ]; then
|
||||||
APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
|
APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
|
||||||
fi
|
fi
|
||||||
|
@ -21,11 +21,11 @@ if [ ! -d .git ] && [ ! -f .git/config ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the required package info
|
# Get the required package info
|
||||||
APP_RELEASE=$(grep "^APP_RELEASE" web/config.py | cut -d"=" -f2 | sed 's/ //g')
|
APP_RELEASE=$(grep "^APP_RELEASE" web/version.py | cut -d"=" -f2 | sed 's/ //g')
|
||||||
APP_REVISION=$(grep "^APP_REVISION" web/config.py | cut -d"=" -f2 | sed 's/ //g')
|
APP_REVISION=$(grep "^APP_REVISION" web/version.py | cut -d"=" -f2 | sed 's/ //g')
|
||||||
APP_NAME=$(grep "^APP_NAME" web/config.py | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //')
|
APP_NAME=$(grep "^APP_NAME" web/branding.py | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //')
|
||||||
APP_LONG_VERSION=${APP_RELEASE}.${APP_REVISION}
|
APP_LONG_VERSION=${APP_RELEASE}.${APP_REVISION}
|
||||||
APP_SUFFIX=$(grep "^APP_SUFFIX" web/config.py | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g")
|
APP_SUFFIX=$(grep "^APP_SUFFIX" web/version.py | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g")
|
||||||
if [ -n "${APP_SUFFIX}" ]; then
|
if [ -n "${APP_SUFFIX}" ]; then
|
||||||
export APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
|
export APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
|
||||||
fi
|
fi
|
||||||
|
@ -21,11 +21,11 @@ if [ ! -d .git ] && [ ! -f .git/config ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the required package info
|
# Get the required package info
|
||||||
APP_RELEASE=$(grep "^APP_RELEASE" web/config.py | cut -d"=" -f2 | sed 's/ //g')
|
APP_RELEASE=$(grep "^APP_RELEASE" web/version.py | cut -d"=" -f2 | sed 's/ //g')
|
||||||
APP_REVISION=$(grep "^APP_REVISION" web/config.py | cut -d"=" -f2 | sed 's/ //g')
|
APP_REVISION=$(grep "^APP_REVISION" web/version.py | cut -d"=" -f2 | sed 's/ //g')
|
||||||
APP_NAME=$(grep "^APP_NAME" web/config.py | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //')
|
APP_NAME=$(grep "^APP_NAME" web/branding.py | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //')
|
||||||
APP_LONG_VERSION=${APP_RELEASE}.${APP_REVISION}
|
APP_LONG_VERSION=${APP_RELEASE}.${APP_REVISION}
|
||||||
APP_SUFFIX=$(grep "^APP_SUFFIX" web/config.py | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g")
|
APP_SUFFIX=$(grep "^APP_SUFFIX" web/version.py | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g")
|
||||||
if [ -n "${APP_SUFFIX}" ]; then
|
if [ -n "${APP_SUFFIX}" ]; then
|
||||||
export APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
|
export APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
|
||||||
fi
|
fi
|
||||||
|
28
web/branding.py
Normal file
28
web/branding.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
##########################################################################
|
||||||
|
#
|
||||||
|
# pgAdmin 4 - PostgreSQL Tools
|
||||||
|
#
|
||||||
|
# Copyright (C) 2013 - 2024, The pgAdmin Development Team
|
||||||
|
# This software is released under the PostgreSQL Licence
|
||||||
|
#
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
##########################################################################
|
||||||
|
# Application branding
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
# Name of the application to display in the UI
|
||||||
|
APP_NAME = 'pgAdmin 4'
|
||||||
|
APP_ICON = 'pg-icon'
|
||||||
|
|
||||||
|
# To help define the configuration directory and data directory
|
||||||
|
APP_SHORT_NAME = 'pgadmin4'
|
||||||
|
APP_PATH = 'pgadmin'
|
||||||
|
APP_WIN_PATH = "pgAdmin"
|
||||||
|
|
||||||
|
# Copyright string for display in the app
|
||||||
|
APP_COPYRIGHT = 'Copyright (C) 2013 - 2024, The pgAdmin Development Team'
|
||||||
|
|
||||||
|
# User ID (email address) to use for the default user in desktop mode.
|
||||||
|
# The default should be fine here, as it's not exposed in the app.
|
||||||
|
APP_DEFAULT_EMAIL = 'pgadmin4@pgadmin.org'
|
@ -30,46 +30,10 @@ CONFIG_DATABASE_CONNECTION_POOL_SIZE = 5
|
|||||||
CONFIG_DATABASE_CONNECTION_MAX_OVERFLOW = 100
|
CONFIG_DATABASE_CONNECTION_MAX_OVERFLOW = 100
|
||||||
|
|
||||||
from pgadmin.utils import env, IS_WIN, fs_short_path
|
from pgadmin.utils import env, IS_WIN, fs_short_path
|
||||||
|
from version import APP_VERSION, APP_RELEASE, APP_REVISION, APP_SUFFIX, \
|
||||||
##########################################################################
|
APP_VERSION_INT
|
||||||
# Application settings
|
from branding import APP_NAME, APP_ICON, APP_COPYRIGHT, APP_PATH, \
|
||||||
##########################################################################
|
APP_WIN_PATH, APP_SHORT_NAME, APP_DEFAULT_EMAIL
|
||||||
|
|
||||||
# Name of the application to display in the UI
|
|
||||||
APP_NAME = 'pgAdmin 4'
|
|
||||||
APP_ICON = 'pg-icon'
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# Application settings
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
# NOTE!!!
|
|
||||||
# If you change any of APP_RELEASE, APP_REVISION or APP_SUFFIX, then you
|
|
||||||
# must also change APP_VERSION_INT to match.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Application version number components
|
|
||||||
APP_RELEASE = 8
|
|
||||||
APP_REVISION = 3
|
|
||||||
|
|
||||||
# Application version suffix, e.g. 'beta1', 'dev'. Usually an empty string
|
|
||||||
# for GA releases.
|
|
||||||
APP_SUFFIX = ''
|
|
||||||
|
|
||||||
# Numeric application version for upgrade checks. Should be in the format:
|
|
||||||
# [X]XYYZZ, where X is the release version, Y is the revision, with a leading
|
|
||||||
# zero if needed, and Z represents the suffix, with a leading zero if needed
|
|
||||||
APP_VERSION_INT = 80300
|
|
||||||
|
|
||||||
# DO NOT CHANGE!
|
|
||||||
# The application version string, constructed from the components
|
|
||||||
if not APP_SUFFIX:
|
|
||||||
APP_VERSION = '%s.%s' % (APP_RELEASE, APP_REVISION)
|
|
||||||
else:
|
|
||||||
APP_VERSION = '%s.%s-%s' % (APP_RELEASE, APP_REVISION, APP_SUFFIX)
|
|
||||||
|
|
||||||
# Copyright string for display in the app
|
|
||||||
APP_COPYRIGHT = 'Copyright (C) 2013 - 2024, The pgAdmin Development Team'
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# Misc stuff
|
# Misc stuff
|
||||||
@ -133,7 +97,7 @@ WTF_CSRF_HEADERS = ['X-pgA-CSRFToken']
|
|||||||
|
|
||||||
# User ID (email address) to use for the default user in desktop mode.
|
# User ID (email address) to use for the default user in desktop mode.
|
||||||
# The default should be fine here, as it's not exposed in the app.
|
# The default should be fine here, as it's not exposed in the app.
|
||||||
DESKTOP_USER = 'pgadmin4@pgadmin.org'
|
DESKTOP_USER = APP_DEFAULT_EMAIL
|
||||||
|
|
||||||
# This option allows the user to host the application on a LAN
|
# This option allows the user to host the application on a LAN
|
||||||
# Default hosting is on localhost (DEFAULT_SERVER='localhost').
|
# Default hosting is on localhost (DEFAULT_SERVER='localhost').
|
||||||
@ -250,18 +214,21 @@ APP_VERSION_EXTN = ('.css', '.js', '.html', '.svg', '.png', '.gif', '.ico')
|
|||||||
|
|
||||||
# Data directory for storage of config settings etc. This shouldn't normally
|
# Data directory for storage of config settings etc. This shouldn't normally
|
||||||
# need to be changed - it's here as various other settings depend on it.
|
# need to be changed - it's here as various other settings depend on it.
|
||||||
# On Windows, we always store data in %APPDATA%\pgAdmin. On other platforms,
|
# On Windows, we always store data in %APPDATA%\$(APP_WIN_PATH). On other
|
||||||
# if we're in server mode we use /var/lib/pgadmin, otherwise ~/.pgadmin
|
# platforms, if we're in server mode we use /var/lib/$(APP_PATH),
|
||||||
|
# otherwise ~/.$(APP_PATH)
|
||||||
if IS_WIN:
|
if IS_WIN:
|
||||||
# Use the short path on windows
|
# Use the short path on windows
|
||||||
DATA_DIR = os.path.realpath(
|
DATA_DIR = os.path.realpath(
|
||||||
os.path.join(fs_short_path(env('APPDATA')), "pgAdmin")
|
os.path.join(fs_short_path(env('APPDATA')), APP_WIN_PATH)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if SERVER_MODE:
|
if SERVER_MODE:
|
||||||
DATA_DIR = '/var/lib/pgadmin'
|
DATA_DIR = os.path.join('/var/lib/', APP_PATH)
|
||||||
else:
|
else:
|
||||||
DATA_DIR = os.path.realpath(os.path.expanduser('~/.pgadmin/'))
|
DATA_DIR = os.path.realpath(
|
||||||
|
os.path.expanduser('~/' + '.' + APP_PATH + '/')
|
||||||
|
)
|
||||||
|
|
||||||
# An optional login banner to show security warnings/disclaimers etc. at
|
# An optional login banner to show security warnings/disclaimers etc. at
|
||||||
# login and password recovery etc. HTML may be included for basic formatting,
|
# login and password recovery etc. HTML may be included for basic formatting,
|
||||||
@ -295,9 +262,9 @@ FILE_LOG_FORMAT = '%(asctime)s: %(levelname)s\t%(name)s:\t%(message)s'
|
|||||||
# Log file name. This goes in the data directory, except on non-Windows
|
# Log file name. This goes in the data directory, except on non-Windows
|
||||||
# platforms in server mode.
|
# platforms in server mode.
|
||||||
if SERVER_MODE and not IS_WIN:
|
if SERVER_MODE and not IS_WIN:
|
||||||
LOG_FILE = '/var/log/pgadmin/pgadmin4.log'
|
LOG_FILE = os.path.join('/var/log', APP_PATH, APP_SHORT_NAME + '.log')
|
||||||
else:
|
else:
|
||||||
LOG_FILE = os.path.join(DATA_DIR, 'pgadmin4.log')
|
LOG_FILE = os.path.join(DATA_DIR, APP_SHORT_NAME + '.log')
|
||||||
|
|
||||||
# Log rotation setting
|
# Log rotation setting
|
||||||
# Log file will be rotated considering values for LOG_ROTATION_SIZE
|
# Log file will be rotated considering values for LOG_ROTATION_SIZE
|
||||||
@ -341,7 +308,8 @@ CONFIG_DATABASE_URI = ''
|
|||||||
# The default path to the SQLite database used to store user accounts and
|
# The default path to the SQLite database used to store user accounts and
|
||||||
# settings. This default places the file in the same directory as this
|
# settings. This default places the file in the same directory as this
|
||||||
# config file, but generates an absolute path for use througout the app.
|
# config file, but generates an absolute path for use througout the app.
|
||||||
SQLITE_PATH = env('SQLITE_PATH') or os.path.join(DATA_DIR, 'pgadmin4.db')
|
SQLITE_PATH = env('SQLITE_PATH') or \
|
||||||
|
os.path.join(DATA_DIR, APP_SHORT_NAME + '.db')
|
||||||
|
|
||||||
# SQLITE_TIMEOUT will define how long to wait before throwing the error -
|
# SQLITE_TIMEOUT will define how long to wait before throwing the error -
|
||||||
# OperationError due to database lock. On slower system, you may need to change
|
# OperationError due to database lock. On slower system, you may need to change
|
||||||
|
37
web/version.py
Normal file
37
web/version.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
##########################################################################
|
||||||
|
#
|
||||||
|
# pgAdmin 4 - PostgreSQL Tools
|
||||||
|
#
|
||||||
|
# Copyright (C) 2013 - 2024, The pgAdmin Development Team
|
||||||
|
# This software is released under the PostgreSQL Licence
|
||||||
|
#
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
##########################################################################
|
||||||
|
# Application settings
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
# NOTE!!!
|
||||||
|
# If you change any of APP_RELEASE, APP_REVISION or APP_SUFFIX, then you
|
||||||
|
# must also change APP_VERSION_INT to match.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Application version number components
|
||||||
|
APP_RELEASE = 8
|
||||||
|
APP_REVISION = 3
|
||||||
|
|
||||||
|
# Application version suffix, e.g. 'beta1', 'dev'. Usually an empty string
|
||||||
|
# for GA releases.
|
||||||
|
APP_SUFFIX = ''
|
||||||
|
|
||||||
|
# Numeric application version for upgrade checks. Should be in the format:
|
||||||
|
# [X]XYYZZ, where X is the release version, Y is the revision, with a leading
|
||||||
|
# zero if needed, and Z represents the suffix, with a leading zero if needed
|
||||||
|
APP_VERSION_INT = 80300
|
||||||
|
|
||||||
|
# DO NOT CHANGE!
|
||||||
|
# The application version string, constructed from the components
|
||||||
|
if not APP_SUFFIX:
|
||||||
|
APP_VERSION = '%s.%s' % (APP_RELEASE, APP_REVISION)
|
||||||
|
else:
|
||||||
|
APP_VERSION = '%s.%s-%s' % (APP_RELEASE, APP_REVISION, APP_SUFFIX)
|
Loading…
Reference in New Issue
Block a user