Skip to content

Commit

Permalink
distribution : add Python 2.7 in installer (for this version, just a …
Browse files Browse the repository at this point in the history
…checkbox)

cmake scripts : fix messages (as status, not interpreted as errors)
findGammu.cmake : for windows remove library dependencies search (not used as of 1.38.5)
Fix #334
  • Loading branch information
jano42 committed Oct 20, 2017
1 parent 719ce7a commit 5063316
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 4 deletions.
11 changes: 10 additions & 1 deletion distribution/NSIS/NSIS.InstallOptions.ini.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Settings]
NumFields=2
NumFields=3

[Field 1]
Type=CheckBox
Expand All @@ -18,3 +18,12 @@ Right=-1
Top=30
Bottom=40
State=1

[Field 3]
Type=CheckBox
Text=Install Python 2.7 (required by script interpreters)
Left=0
Right=-1
Top=60
Bottom=70
State=1
56 changes: 56 additions & 0 deletions distribution/NSIS/NSIS.template.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
Var ADD_TO_PATH_CURRENT_USER
Var INSTALL_SERVICE
Var INSTALL_DESKTOP
Var INSTALL_PYTHON
Var IS_DEFAULT_INSTALLDIR
;--------------------------------
;Include Modern UI
Expand Down Expand Up @@ -59,6 +60,53 @@ BrandingText "@CPACK_NSIS_PACKAGE_NAME@"

!include Sections.nsh


var PythonExecutable

/*
* Check if Python 2.7 is installed.
* Result: $PythonExecutable contains the python executable path; of is empty if python not found
*
*/
Function CheckPython27
ReadRegStr $1 HKEY_LOCAL_MACHINE "SOFTWARE\Python\PythonCore\2.7\InstallPath" ""
StrCmp $1 "" 0 done ;if $1 is not empty, then goto next line, else goto "done"
ReadRegStr $1 HKEY_LOCAL_MACHINE "SOFTWARE\WOW6432Node\Python\PythonCore\2.7\InstallPath" ""
StrCmp $1 "" 0 done ;if $1 is not empty, then goto next line, else goto "done"
ReadRegStr $1 HKEY_CURRENT_USER "SOFTWARE\Python\PythonCore\2.7\InstallPath" ""
StrCmp $1 "" 0 done ;if $1 is not empty, then goto next line, else goto "done"
ReadRegStr $1 HKEY_CURRENT_USER "SOFTWARE\WOW6432Node\Python\PythonCore\2.7\InstallPath" ""
StrCmp $1 "" end done ;if $1 is not empty, then goto next line, else goto "done"
done:
StrCpy $PythonExecutable "$1\python.exe"
end:
FunctionEnd

/*
* Install Python on system
*/
Function InstallPython
File /oname=$TEMP\python.msi "@CPACK_NSIS_PLUGINS_ROOT@\python-2.7.14.msi"

DetailPrint "Installing Python..."
SetDetailsPrint none
ExecWait '"$SYSDIR\msiexec.exe" /i "$TEMP\python.msi" /qb!"' $0
SetDetailsPrint both
DetailPrint "Python installation returned $0"

Delete =$TEMP\python.msi
FunctionEnd

/*
* Check if Python exists, and install it if required
*/
Function CheckAndInstallPython
Call CheckPython27
StrCmp $PythonExecutable "" 0 +2
Call InstallPython
FunctionEnd


;--- Component support macros: ---
; The code for the add/remove functionality is from:
; http://nsis.sourceforge.net/Add/Remove_Functionality
Expand Down Expand Up @@ -707,6 +755,7 @@ Section "-Core installation"
;Read a value from an InstallOptions INI file
!insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 1" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_SERVICE "NSIS.InstallOptions.ini" "Field 2" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_PYTHON "NSIS.InstallOptions.ini" "Field 3" "State"

!insertmacro MUI_STARTMENU_WRITE_BEGIN Application

Expand All @@ -731,6 +780,10 @@ Section "-Core installation"
@CPACK_NSIS_INSTALL_SERVICE@
end_of_install_service:

IntCmp $INSTALL_PYTHON 0 end_of_install_python
DetailPrint "Checking Python 2.7 and install it if needed"
Call CheckAndInstallPython
end_of_install_python:



Expand Down Expand Up @@ -769,12 +822,15 @@ LangString TEXT_IO_OPTIONS_DESKTOP_ICON ${LANG_FRENCH} "Raccourci sur le Bureau"
LangString TEXT_IO_OPTIONS_DESKTOP_ICON ${LANG_ENGLISH} "Desktop Icon"
LangString TEXT_IO_OPTIONS_AS_SERVICE ${LANG_FRENCH} "Installer @CPACK_PACKAGE_NAME@ en tant que service Windows"
LangString TEXT_IO_OPTIONS_AS_SERVICE ${LANG_ENGLISH} "Install @CPACK_PACKAGE_NAME@ as a service"
LangString TEXT_IO_OPTIONS_PYTHON ${LANG_FRENCH} "Installer Python 2.7 (requis pour les scripts d'automatisation)"
LangString TEXT_IO_OPTIONS_PYTHON ${LANG_ENGLISH} "Install Python 2.7 (required for automation rules)"


Function InstallOptionsPage
!insertmacro MUI_HEADER_TEXT $(TEXT_IO_OPTIONS_TITLE) $(TEXT_IO_OPTIONS_SUBTITLE)
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 1" "Text" $(TEXT_IO_OPTIONS_DESKTOP_ICON)
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" $(TEXT_IO_OPTIONS_AS_SERVICE)
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" $(TEXT_IO_OPTIONS_PYTHON)
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini"

FunctionEnd
Expand Down
Binary file added distribution/NSIS/extensions/python-2.7.14.msi
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ cmake_minimum_required (VERSION 3.2.0)
## Extract Yadoms version from Version.h
##################################################################################################
include(cmake/version.cmake)
message ("### Building Yadoms ${YADOMS_VERSION} ###\n")
message (STATUS "### Building Yadoms ${YADOMS_VERSION} ###\n")


##################################################################################################
Expand Down
2 changes: 1 addition & 1 deletion sources/cmake/compilers.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Compilers/IDE specific configurations
#
message("System Name = ${CMAKE_SYSTEM_NAME}")
message(STATUS "System Name = ${CMAKE_SYSTEM_NAME}")

if(MSVC)

Expand Down
9 changes: 8 additions & 1 deletion sources/plugins/SmsDialer/findGammu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,20 @@ if(NOT APPLE)
find_library(GAMMU_STRING_LIBRARY_DEBUG NAMES ${GAMMU_PKG_STRING_LIBRARIES} PATHS ${GAMMU_PKG_HELPER_DIR_DEBUG})
find_library(GAMMU_STRING_LIBRARY_RELEASE NAMES ${GAMMU_PKG_STRING_LIBRARIES} PATHS ${GAMMU_PKG_HELPER_DIR_RELEASE})
select_library_configurations(GAMMU_STRING)
if(GAMMU_STRING_FOUND)
set(GAMMU_ADDITIONAL_LIBRARIES ${GAMMU_ADDITIONAL_LIBRARIES} ${GAMMU_STRING_LIBRARIES})
endif(GAMMU_STRING_FOUND)

# - win32dirent.lib
set(GAMMU_PKG_WIN32DIRENT_LIBRARIES win32dirent.lib)
find_library(GAMMU_WIN32DIRENT_LIBRARY_DEBUG NAMES ${GAMMU_PKG_WIN32DIRENT_LIBRARIES} PATHS ${GAMMU_PKG_HELPER_DIR_DEBUG})
find_library(GAMMU_WIN32DIRENT_LIBRARY_RELEASE NAMES ${GAMMU_PKG_WIN32DIRENT_LIBRARIES} PATHS ${GAMMU_PKG_HELPER_DIR_RELEASE})
select_library_configurations(GAMMU_WIN32DIRENT)

set(GAMMU_ADDITIONAL_LIBRARIES ${GAMMU_STRING_LIBRARIES} ${GAMMU_WIN32DIRENT_LIBRARIES})
if(GAMMU_WIN32DIRENT_FOUND)
set(GAMMU_ADDITIONAL_LIBRARIES ${GAMMU_ADDITIONAL_LIBRARIES} ${GAMMU_WIN32DIRENT_LIBRARIES})
endif(GAMMU_WIN32DIRENT_FOUND)


else()
set(GAMMU_PKG_INCLUDE_DIRS ${GAMMU_ROOT}/build/include)
Expand Down

0 comments on commit 5063316

Please sign in to comment.