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"
|
||||
|
||||
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_REVISION =" %WD%\web\config.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_RELEASE =" %WD%\web\version.py') DO SET APP_MAJOR=%%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\version.py') DO SET APP_VERSION_SUFFIX=%%a
|
||||
REM remove single quote from the string
|
||||
SET APP_VERSION_SUFFIX=%APP_VERSION_SUFFIX:'=%
|
||||
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
|
||||
SET APP_VERSION=%APP_MAJOR%.%APP_MINOR%
|
||||
SET INSTALLERNAME=%APP_SHORTNAME%-%APP_MAJOR%.%APP_MINOR%-%APP_VERSION_SUFFIX%-x64.exe
|
||||
|
6
Makefile
6
Makefile
@ -9,9 +9,9 @@
|
||||
|
||||
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_RELEASE := $(shell grep ^APP_RELEASE web/config.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_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/version.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
|
||||
|
@ -10,11 +10,11 @@ _setup_env() {
|
||||
SERVERROOT=${BUILDROOT}/server
|
||||
WEBROOT=${BUILDROOT}/web
|
||||
DISTROOT=$(realpath "${WD}/../../dist")
|
||||
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/^ //' | sed 's/ //g' | tr '[:upper:]' '[:lower:]')
|
||||
APP_RELEASE=$(grep "^APP_RELEASE" web/version.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/branding.py | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //' | sed 's/ //g' | tr '[:upper:]' '[:lower:]')
|
||||
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
|
||||
APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
|
||||
fi
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
_setup_env() {
|
||||
FUNCS_DIR=$(cd "$(dirname "$0")" && pwd)/../..
|
||||
APP_RELEASE=$(grep "^APP_RELEASE" "${FUNCS_DIR}/web/config.py" | cut -d"=" -f2 | sed 's/ //g')
|
||||
APP_REVISION=$(grep "^APP_REVISION" "${FUNCS_DIR}/web/config.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_RELEASE=$(grep "^APP_RELEASE" "${FUNCS_DIR}/web/version.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/branding.py" | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //')
|
||||
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
|
||||
APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
|
||||
fi
|
||||
|
@ -21,11 +21,11 @@ if [ ! -d .git ] && [ ! -f .git/config ]; then
|
||||
fi
|
||||
|
||||
# Get the required package info
|
||||
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/^ //')
|
||||
APP_RELEASE=$(grep "^APP_RELEASE" web/version.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/branding.py | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //')
|
||||
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
|
||||
export APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
|
||||
fi
|
||||
|
@ -21,11 +21,11 @@ if [ ! -d .git ] && [ ! -f .git/config ]; then
|
||||
fi
|
||||
|
||||
# Get the required package info
|
||||
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/^ //')
|
||||
APP_RELEASE=$(grep "^APP_RELEASE" web/version.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/branding.py | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //')
|
||||
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
|
||||
export APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
|
||||
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
|
||||
|
||||
from pgadmin.utils import env, IS_WIN, fs_short_path
|
||||
|
||||
##########################################################################
|
||||
# Application settings
|
||||
##########################################################################
|
||||
|
||||
# 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'
|
||||
from version import APP_VERSION, APP_RELEASE, APP_REVISION, APP_SUFFIX, \
|
||||
APP_VERSION_INT
|
||||
from branding import APP_NAME, APP_ICON, APP_COPYRIGHT, APP_PATH, \
|
||||
APP_WIN_PATH, APP_SHORT_NAME, APP_DEFAULT_EMAIL
|
||||
|
||||
##########################################################################
|
||||
# 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.
|
||||
# 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
|
||||
# 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
|
||||
# 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,
|
||||
# if we're in server mode we use /var/lib/pgadmin, otherwise ~/.pgadmin
|
||||
# On Windows, we always store data in %APPDATA%\$(APP_WIN_PATH). On other
|
||||
# platforms, if we're in server mode we use /var/lib/$(APP_PATH),
|
||||
# otherwise ~/.$(APP_PATH)
|
||||
if IS_WIN:
|
||||
# Use the short path on windows
|
||||
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:
|
||||
if SERVER_MODE:
|
||||
DATA_DIR = '/var/lib/pgadmin'
|
||||
DATA_DIR = os.path.join('/var/lib/', APP_PATH)
|
||||
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
|
||||
# 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
|
||||
# platforms in server mode.
|
||||
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:
|
||||
LOG_FILE = os.path.join(DATA_DIR, 'pgadmin4.log')
|
||||
LOG_FILE = os.path.join(DATA_DIR, APP_SHORT_NAME + '.log')
|
||||
|
||||
# Log rotation setting
|
||||
# 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
|
||||
# settings. This default places the file in the same directory as this
|
||||
# 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 -
|
||||
# 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