mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-12-24 08:00:09 -06:00
Cleanup Python detection in the runtime project file. Fixes #5444
This commit is contained in:
parent
908e156113
commit
94bd1f1680
2
Make.bat
2
Make.bat
@ -254,7 +254,7 @@ REM Main build sequence Ends
|
|||||||
CD "%WD%\runtime"
|
CD "%WD%\runtime"
|
||||||
|
|
||||||
ECHO Running qmake...
|
ECHO Running qmake...
|
||||||
CALL "%QMAKE%" || EXIT /B 1
|
CALL set "PGADMIN_PYTHON_DIR=%PYTHON_HOME%" && "%QMAKE%" || EXIT /B 1
|
||||||
|
|
||||||
ECHO Cleaning the build directory...
|
ECHO Cleaning the build directory...
|
||||||
CALL %MAKE% clean || EXIT /B 1
|
CALL %MAKE% clean || EXIT /B 1
|
||||||
|
60
README
60
README
@ -26,42 +26,46 @@ Building the Runtime
|
|||||||
|
|
||||||
To build the runtime, the following packages must be installed:
|
To build the runtime, the following packages must be installed:
|
||||||
|
|
||||||
- QT 4.6 or above (Use the VC++ build on Windows, not MinGW).
|
- QT 5 (Use the VC++ build on Windows, not MinGW).
|
||||||
- Python 3.4+
|
- Python 3.4+
|
||||||
|
|
||||||
Assuming both qmake and python-config are in the path:
|
An environment variable named PGADMIN_PYTHON_DIR must be set to the directory
|
||||||
|
in which Python has been installed, for example:
|
||||||
|
|
||||||
$ cd $PGADMIN4_SRC/runtime
|
- /usr
|
||||||
$ qmake
|
- /usr/local/python-3.8
|
||||||
Project MESSAGE: Building for QT5+...
|
- C:\Python38
|
||||||
Project MESSAGE: Building for Linux/Mac...
|
|
||||||
Project MESSAGE: Using /usr/bin/python-config
|
Assuming both qmake is in the path:
|
||||||
Project MESSAGE: Python3 detected.
|
|
||||||
$ make
|
dpage@hal:~/git/pgadmin4$ cd runtime
|
||||||
|
dpage@hal:~/git/pgadmin4/runtime$ export PGADMIN_PYTHON_DIR=/opt/local
|
||||||
|
dpage@hal:~/git/pgadmin4/runtime$ qmake
|
||||||
|
Project MESSAGE: ==================================
|
||||||
|
Project MESSAGE: Configuring the pgAdmin 4 runtime.
|
||||||
|
Project MESSAGE: ==================================
|
||||||
|
Project MESSAGE: Qt version: 5
|
||||||
|
Project MESSAGE: Platform: macOS
|
||||||
|
Project MESSAGE: Python executable: /opt/local/bin/python3
|
||||||
|
Project MESSAGE: Python version: 3.8 (38)
|
||||||
|
Project MESSAGE: Python config: /opt/local/bin/python3-config
|
||||||
|
Project MESSAGE: CXXFLAGS: -pipe -stdlib=libc++ -I/opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -I/opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8
|
||||||
|
Project MESSAGE: LDFLAGS: -stdlib=libc++ -L/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/config-3.8-darwin -ldl -framework CoreFoundation
|
||||||
|
Project MESSAGE: LIBS: -lpython3.8 -ldl -framework CoreFoundation
|
||||||
|
dpage@hal:~/git/pgadmin4/runtime$ make
|
||||||
...
|
...
|
||||||
|
|
||||||
To build the runtime in debug mode, use the option below with qmake
|
To build the runtime in debug mode, use the option below with qmake:
|
||||||
$ qmake CONFIG+=debug
|
$ qmake CONFIG+=debug
|
||||||
|
|
||||||
To build the runtime in release mode, use the option below with qmake
|
To build the runtime in release mode, use the option below with qmake:
|
||||||
$ qmake CONFIG+=release
|
$ qmake CONFIG+=release
|
||||||
|
|
||||||
By default, the runtime application will be built in release mode.
|
By default, the runtime application will be built in release mode.
|
||||||
|
|
||||||
On Linux, an executable called 'pgAdmin4' will be built, and on Mac OS X, an
|
On Linux, an executable called 'pgAdmin4' will be built, on Windows,
|
||||||
app bundle called pgAdmin4.app will be created.
|
'pgAdmin4.exe', and on Mac OS X, an app bundle called pgAdmin4.app will be
|
||||||
|
created.
|
||||||
To build the runtime on a Windows system, export PYTHON_HOME and PYTHON_VERSION
|
|
||||||
variables in the System environment. Specify the PYTHON_VERSION with the major
|
|
||||||
and minor number. Do not specify micro level version.
|
|
||||||
|
|
||||||
For example, given a Python version of A.B.C; A - Major number, B - Minor
|
|
||||||
number, C - Micro level (Bug fix releases).
|
|
||||||
|
|
||||||
If Python version is 3.8.2 than specify PYTHON_VERSION=38
|
|
||||||
|
|
||||||
e.g. PYTHON_HOME=C:\Python38\
|
|
||||||
PYTHON_VERSION=38
|
|
||||||
|
|
||||||
You can also use Qt Creator to build, develop and debug the runtime. Simply
|
You can also use Qt Creator to build, develop and debug the runtime. Simply
|
||||||
open the $PGADMIN4_SRC/runtime/pgAdmin4.pro project file in Qt Creator and
|
open the $PGADMIN4_SRC/runtime/pgAdmin4.pro project file in Qt Creator and
|
||||||
@ -319,7 +323,7 @@ http://www.jrsoftware.org/isdl.php
|
|||||||
|
|
||||||
A number of environment variables may need to be set to enable the build script
|
A number of environment variables may need to be set to enable the build script
|
||||||
to function. The defaults will usually work on a typical 64 bit system with
|
to function. The defaults will usually work on a typical 64 bit system with
|
||||||
Qt 5.5.1, Python 2.7 and Visual Studio 2013. The examples below are for a
|
Qt 5.14.2, Python 3.8 and Visual Studio 2013. The examples below are for a
|
||||||
similar 32 bit system:
|
similar 32 bit system:
|
||||||
|
|
||||||
INNOTOOL=C:\Program Files\Inno Setup 5
|
INNOTOOL=C:\Program Files\Inno Setup 5
|
||||||
@ -327,8 +331,8 @@ PGDIR=C:\Program Files\PostgreSQL\12
|
|||||||
PYTHON_DLL=C:\Python38\Python38.dll
|
PYTHON_DLL=C:\Python38\Python38.dll
|
||||||
PYTHON_HOME=C:\Python38
|
PYTHON_HOME=C:\Python38
|
||||||
PYTHON_VERSION=38
|
PYTHON_VERSION=38
|
||||||
QTDIR=C:\Qt\5.9\msvc2013
|
QTDIR=C:\Qt\5.14.2\msvc2015
|
||||||
VCDIR=C:\Program Files\Microsoft Visual Studio 12.0\VC
|
VCDIR=C:\Program Files\Microsoft Visual Studio 14.0\VC
|
||||||
|
|
||||||
To build the installer:
|
To build the installer:
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ New features
|
|||||||
Housekeeping
|
Housekeeping
|
||||||
************
|
************
|
||||||
|
|
||||||
|
| `Issue #5444 <https://redmine.postgresql.org/issues/5444>`_ - Cleanup Python detection in the runtime project file.
|
||||||
|
|
||||||
Bug fixes
|
Bug fixes
|
||||||
*********
|
*********
|
||||||
|
@ -107,9 +107,9 @@ _build_runtime() {
|
|||||||
make clean
|
make clean
|
||||||
fi
|
fi
|
||||||
if hash qmake-qt5 2>/dev/null; then
|
if hash qmake-qt5 2>/dev/null; then
|
||||||
qmake-qt5
|
PGADMIN_PYTHON_DIR=/usr qmake-qt5
|
||||||
else
|
else
|
||||||
qmake
|
PGADMIN_PYTHON_DIR=/usr qmake
|
||||||
fi
|
fi
|
||||||
make
|
make
|
||||||
mkdir -p "${DESKTOPROOT}/usr/${APP_NAME}/bin"
|
mkdir -p "${DESKTOPROOT}/usr/${APP_NAME}/bin"
|
||||||
|
@ -82,7 +82,7 @@ _cleanup() {
|
|||||||
rm -f ${DISTROOT}/pgadmin4*.dmg
|
rm -f ${DISTROOT}/pgadmin4*.dmg
|
||||||
}
|
}
|
||||||
|
|
||||||
_create_python_virtualenv() {
|
_create_venv() {
|
||||||
export PATH=${PGDIR}/bin:${PATH}
|
export PATH=${PGDIR}/bin:${PATH}
|
||||||
export LD_LIBRARY_PATH=${PGDIR}/lib:${LD_LIBRARY_PATH}
|
export LD_LIBRARY_PATH=${PGDIR}/lib:${LD_LIBRARY_PATH}
|
||||||
test -d ${BUILDROOT} || mkdir ${BUILDROOT} || exit 1
|
test -d ${BUILDROOT} || mkdir ${BUILDROOT} || exit 1
|
||||||
@ -147,10 +147,9 @@ _create_python_virtualenv() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_build_runtime() {
|
_build_runtime() {
|
||||||
_create_python_virtualenv || exit 1
|
|
||||||
cd ${SOURCEDIR}/runtime
|
cd ${SOURCEDIR}/runtime
|
||||||
make clean
|
make clean
|
||||||
${QMAKE} || { echo qmake failed; exit 1; }
|
PGADMIN_PYTHON_DIR=${PYTHON_HOME} ${QMAKE} || { echo qmake failed; exit 1; }
|
||||||
make || { echo make failed; exit 1; }
|
make || { echo make failed; exit 1; }
|
||||||
cp -r pgAdmin4.app "${BUILDROOT}/${APP_BUNDLE_NAME}"
|
cp -r pgAdmin4.app "${BUILDROOT}/${APP_BUNDLE_NAME}"
|
||||||
}
|
}
|
||||||
@ -280,6 +279,7 @@ _codesign_dmg() {
|
|||||||
|
|
||||||
_get_version || { echo Could not get versioning; exit 1; }
|
_get_version || { echo Could not get versioning; exit 1; }
|
||||||
_cleanup
|
_cleanup
|
||||||
|
_create_venv || { echo venv creation failed; exit 1; }
|
||||||
_build_runtime || { echo Runtime build failed; exit 1; }
|
_build_runtime || { echo Runtime build failed; exit 1; }
|
||||||
_build_doc
|
_build_doc
|
||||||
_complete_bundle
|
_complete_bundle
|
||||||
|
@ -4,12 +4,16 @@ QMAKE_TARGET_PRODUCT = "pgAdmin 4"
|
|||||||
QMAKE_TARGET_DESCRIPTION = "pgAdmin 4 Desktop Runtime"
|
QMAKE_TARGET_DESCRIPTION = "pgAdmin 4 Desktop Runtime"
|
||||||
QMAKE_TARGET_COPYRIGHT = "Copyright (C) 2013 - 2020, The pgAdmin Development Team"
|
QMAKE_TARGET_COPYRIGHT = "Copyright (C) 2013 - 2020, The pgAdmin Development Team"
|
||||||
|
|
||||||
|
message(==================================)
|
||||||
|
message(Configuring the pgAdmin 4 runtime.)
|
||||||
|
message(==================================)
|
||||||
|
|
||||||
# Configure QT modules for the appropriate version of QT
|
# Configure QT modules for the appropriate version of QT
|
||||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||||
message(Building for QT5+...)
|
message(Qt version: 5)
|
||||||
QT += network widgets
|
QT += network widgets
|
||||||
} else {
|
} else {
|
||||||
message(Building for QT4...)
|
message(Qt version: 4)
|
||||||
QT += network
|
QT += network
|
||||||
DEFINES += Q_NULLPTR=NULL
|
DEFINES += Q_NULLPTR=NULL
|
||||||
}
|
}
|
||||||
@ -22,60 +26,70 @@ QMAKE_CFLAGS += $$(PGADMIN_CFLAGS)
|
|||||||
QMAKE_CXXFLAGS += $$(PGADMIN_CXXFLAGS)
|
QMAKE_CXXFLAGS += $$(PGADMIN_CXXFLAGS)
|
||||||
QMAKE_LFLAGS += $$(PGADMIN_LDFLAGS)
|
QMAKE_LFLAGS += $$(PGADMIN_LDFLAGS)
|
||||||
|
|
||||||
|
# Figure out where/what Python looks like and that it's suitable
|
||||||
|
PYTHON_DIR = $$(PGADMIN_PYTHON_DIR)
|
||||||
|
|
||||||
|
equals(PYTHON_DIR, "") {
|
||||||
|
error(The PGADMIN_PYTHON_DIR environment variable is not set. Please set it to a directory path under which Python 3.4 or later has been installed and try again.)
|
||||||
|
}
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
message(Building for Windows...)
|
message(Platform: Windows)
|
||||||
|
PYTHON_EXE = $${PYTHON_DIR}\python.exe
|
||||||
|
} else {
|
||||||
|
macx {
|
||||||
|
message(Platform: macOS)
|
||||||
|
} else {
|
||||||
|
message(Platform: Linux)
|
||||||
|
}
|
||||||
|
PYTHON_EXE = $${PYTHON_DIR}/bin/python3
|
||||||
|
}
|
||||||
|
|
||||||
# Read the PYTHON_HOME and PYTHON_VERSION system environment variables.
|
!exists($$PYTHON_EXE) {
|
||||||
PY_HOME = $$(PYTHON_HOME)
|
error(The Python executable ($$PYTHON_EXE) could not be found. Please ensure the PGADMIN_PYTHON_DIR environment variable is correctly set.)
|
||||||
PY_VERSION = $$(PYTHON_VERSION)
|
}
|
||||||
|
message(Python executable: $$PYTHON_EXE)
|
||||||
|
|
||||||
lessThan(PY_VERSION, 34) {
|
PYTHON_VERSION = $$system($$PYTHON_EXE -c \"import sys; print(\'%s.%s\' % (sys.version_info[0], sys.version_info[1]))\")
|
||||||
error(Python 3.4 or later is required.)
|
PYTHON_SHORT_VERSION = $$system($$PYTHON_EXE -c \"import sys; print(\'%s%s\' % (sys.version_info[0], sys.version_info[1]))\")
|
||||||
}
|
PYTHON_MAJOR_VERSION = $$system($$PYTHON_EXE -c \"import sys; print(sys.version_info[0])\")
|
||||||
|
message(Python version: $$PYTHON_VERSION ($$PYTHON_SHORT_VERSION))
|
||||||
|
|
||||||
isEmpty(PY_HOME) {
|
lessThan(PYTHON_SHORT_VERSION, 34) {
|
||||||
error(Please define the PYTHON_HOME variable in the system environment.)
|
error(Python 3.4 or later is required to build pgAdmin.)
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
isEmpty(PY_VERSION) {
|
# Configure for the platform
|
||||||
error(Please define the PYTHON_VERSION variable in the system environment.)
|
win32 {
|
||||||
}
|
INCLUDEPATH = $${PYTHON_DIR}\include
|
||||||
else {
|
message(Include path: $$INCLUDEPATH)
|
||||||
INCLUDEPATH = $$PY_HOME\include
|
|
||||||
LIBS += -L"$$PY_HOME\libs" -lpython$$PY_VERSION
|
LIBS += -L"$${PYTHON_DIR}\libs" -lpython$${PYTHON_SHORT_VERSION}
|
||||||
}
|
message(LIBS: $$LIBS)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
message(Building for Linux/Mac...)
|
# Find the best matching python-config (there may be more than one)
|
||||||
|
exists($PYTHON_DIR/bin/python$${PYTHON_VERSION}-config) {
|
||||||
# Find and configure Python
|
PYTHON_CONFIG = $$PYTHON_DIR/bin/python$${PYTHON_VERSION}-config
|
||||||
# Environment setting
|
} else: exists($${PYTHON_DIR}/bin/python$${PYTHON_MAJOR_VERSION}-config) {
|
||||||
PYTHON_CONFIG = $$(PYTHON_CONFIG)
|
PYTHON_CONFIG = $${PYTHON_DIR}/bin/python$${PYTHON_MAJOR_VERSION}-config
|
||||||
|
} else: exists($${PYTHON_DIR}/bin/python-config) {
|
||||||
# Maybe Python 3?
|
PYTHON_CONFIG = $${PYTHON_DIR}/bin/python-config
|
||||||
isEmpty(PYTHON_CONFIG) {
|
} else {
|
||||||
PYTHON_CONFIG = $$system(which python3-config)
|
error(No suitable python-config could be found in $${PYTHON_DIR}/bin.)
|
||||||
}
|
}
|
||||||
|
message(Python config: $$PYTHON_CONFIG)
|
||||||
# Argh!
|
|
||||||
isEmpty(PYTHON_CONFIG) {
|
|
||||||
error(The python3-config executable could not be found. Ensure Python is installed and in the system path.)
|
|
||||||
}
|
|
||||||
|
|
||||||
message(Using $$PYTHON_CONFIG)
|
|
||||||
|
|
||||||
PYTHON_EMBED = $$system($$PYTHON_CONFIG --help 2>&1 | grep -o \'\\-\\-embed\')
|
PYTHON_EMBED = $$system($$PYTHON_CONFIG --help 2>&1 | grep -o \'\\-\\-embed\')
|
||||||
|
|
||||||
QMAKE_CXXFLAGS += $$system($$PYTHON_CONFIG --includes)
|
QMAKE_CXXFLAGS += $$system($$PYTHON_CONFIG --includes)
|
||||||
QMAKE_LFLAGS += $$system($$PYTHON_CONFIG --ldflags)
|
message(CXXFLAGS: $$QMAKE_CXXFLAGS)
|
||||||
LIBS += $$system($$PYTHON_CONFIG --libs $$PYTHON_EMBED)
|
|
||||||
|
|
||||||
contains( LIBS, -lpython2.* ) {
|
QMAKE_LFLAGS += $$system($$PYTHON_CONFIG --ldflags)
|
||||||
error(Building with Python 2 is not supported.)
|
message(LDFLAGS: $$QMAKE_LFLAGS)
|
||||||
} else {
|
|
||||||
message(Building with Python 3.)
|
LIBS += $$system($$PYTHON_CONFIG --libs $$PYTHON_EMBED)
|
||||||
}
|
message(LIBS: $$LIBS)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Source code
|
# Source code
|
||||||
@ -87,6 +101,7 @@ HEADERS = Server.h \
|
|||||||
MenuActions.h \
|
MenuActions.h \
|
||||||
FloatingWindow.h \
|
FloatingWindow.h \
|
||||||
Logger.h
|
Logger.h
|
||||||
|
|
||||||
SOURCES = pgAdmin4.cpp \
|
SOURCES = pgAdmin4.cpp \
|
||||||
Server.cpp \
|
Server.cpp \
|
||||||
ConfigWindow.cpp \
|
ConfigWindow.cpp \
|
||||||
@ -99,7 +114,9 @@ SOURCES = pgAdmin4.cpp \
|
|||||||
FORMS = ConfigWindow.ui \
|
FORMS = ConfigWindow.ui \
|
||||||
LogWindow.ui \
|
LogWindow.ui \
|
||||||
FloatingWindow.ui
|
FloatingWindow.ui
|
||||||
|
|
||||||
ICON = pgAdmin4.icns
|
ICON = pgAdmin4.icns
|
||||||
|
|
||||||
QMAKE_INFO_PLIST = Info.plist
|
QMAKE_INFO_PLIST = Info.plist
|
||||||
|
|
||||||
RESOURCES += pgadmin4.qrc \
|
RESOURCES += pgadmin4.qrc \
|
||||||
|
Loading…
Reference in New Issue
Block a user