Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
028e1cd
PP_TYPE added in build.bat and main.nsi
Jan 24, 2014
31f8e7e
suggestion for PP and PY version names
Jan 26, 2014
26526d6
modules.bat accepts a package list as parameter
Mar 21, 2014
e0e704c
alternative IPython installation via pip
Mar 24, 2014
fff7d0d
correction alternative IPython installation
Mar 25, 2014
d6fc39b
merge origin PortablePython 2.7.6 changes
Apr 29, 2014
a75273e
2.7.6 merge conflict
Apr 30, 2014
0f3293a
Updated Portable Python with major updates: python (win32) 2.7.9, num…
xunningy Apr 23, 2015
9afc798
Initial build with python 3.4.3 (x64) core and the PyScripter 2.6.0.0
xunningy Apr 24, 2015
2ebf663
Added PyCharm 4.0.6 Community Version for Python 3.4
xunningy Apr 25, 2015
9e6861b
Fixed directory issue with Pycharm on Python 3.4
xunningy Apr 25, 2015
460ea1e
Update Portable Python with python 2.7.10 (win32), PyCharm 4.5.1 comm…
xunningy May 27, 2015
9c044be
Updated Python 2.7 with PyScripter 2.6
xunningy Jun 21, 2015
65c40db
integrate xunningy - 3.4 PyCharm PyScripter
Aug 21, 2015
5b04a4e
2.7 modules - PyCharm.4.0.x.PPpatch - del other.xml obsolet
Aug 22, 2015
d404419
fix Unpack PyScripter long pathname
Sep 1, 2015
0bac529
PyCharm download source changed 4.5.1 -> 4.5.4
Oct 14, 2015
c838c82
Update to Python 2.7.11
NHellFire Apr 11, 2016
3fa1f98
Update PyCharm
NHellFire Apr 11, 2016
32e847d
2.7: Update NetworkX
NHellFire Apr 11, 2016
ce09d81
2.7: Update PyWin32
NHellFire Apr 13, 2016
883d3f0
Move temp folder to portablepython source location
NHellFire Apr 13, 2016
9cda06c
Move build config to a sub folder
NHellFire Apr 13, 2016
fd5eef7
Show errors from NSIS
NHellFire Apr 13, 2016
54b5c5d
merge NHellFire
Dec 26, 2016
a5867e8
move 3.4 config, update pycharm
Dec 27, 2016
20fecf1
pyodbc pip installation
Dec 27, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,13 @@
#################

shortcuts/*.exe

# Temp dir
build

#################
## chm doc index
#################

tools/nsis/*.chw

22 changes: 12 additions & 10 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,21 @@ if "--clean" == "%2" (

call COMMON :LogMessage
call COMMON :LogMessage "Portable Python build script started :: %date% %time%"
call COMMON :LogMessage
call COMMON :LogMessage "Building distribution based on Python %1"


:: Check can we find config dir
if not exist %1 (
if not exist config\%1 (
call COMMON :LogMessage "ERROR: Config folder not found for this version !! Aborting..."
goto:eof
)

:: Load variables for specified version
call .\%1\settings.bat
set PP_TYPE=%1
call .\config\%PP_TYPE%\settings.bat

set TEMP_FOLDER=%TEMP%PortablePython.v.%PY_VERSION%.%PP_VERSION%.Build
call COMMON :LogMessage
call COMMON :LogMessage "Building distribution %PP_TYPE% based on Python %PY_VERSION%"

set TEMP_FOLDER=%CD%\build\PortablePython%PP_TYPE%.v.%PY_VERSION%.%PP_VERSION%.Build
set BIN_FOLDER=%TEMP_FOLDER%\binaries
set UNPACK_FOLDER=%TEMP_FOLDER%\unpacked
set OUTPUT_FOLDER=%TEMP_FOLDER%\output
Expand Down Expand Up @@ -91,12 +93,12 @@ if not exist %TEMP_FOLDER% (
)

:: Extract modules
call .\%1\modules.bat
call .\config\%PP_TYPE%\modules.bat

:: Build installer
call COMMON :LogMessage
call COMMON :LogMessage "Building Portable Python %PY_VERSION%.%PP_VERSION% installer ..."
tools\nsis\makensis /V0 /DPY_VERSION=%1 /DPP_VERSION=%PP_VERSION% /DOUTPUT_FOLDER="%OUTPUT_FOLDER%" /DSOURCES_FOLDER="%UNPACK_FOLDER%" main.nsi
call COMMON :LogMessage "Building Portable Python %PP_TYPE% %PY_VERSION%.%PP_VERSION% installer ..."
tools\nsis\makensis /V1 /DPP_TYPE=%1 /DPY_VERSION=%PY_VERSION% /DPP_VERSION=%PP_VERSION% /DOUTPUT_FOLDER="%OUTPUT_FOLDER%" /DSOURCES_FOLDER="%UNPACK_FOLDER%" main.nsi
call COMMON :LogMessage
call COMMON :LogMessage "Portable Python build script completed at :: %date% %time%"
call COMMON :LogMessage "Installer ready at: %OUTPUT_FOLDER%"
call COMMON :LogMessage "Installer ready at: %OUTPUT_FOLDER%"
7 changes: 6 additions & 1 deletion 2.7/descriptions.nsh → config/2.7/descriptions.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ LangString DESC_MODULE_XLRD ${LANG_ENGLISH} "Library for developers to extract d
LangString DESC_MODULE_XLWT ${LANG_ENGLISH} "Library to create spreadsheet files compatible with MS Excel 97/2000/XP/2003 XLS files, on any platform, with Python 2.3 to 2.7"
LangString DESC_MODULE_XLUTILS ${LANG_ENGLISH} "Utilities for working with Excel files that require both xlrd and xlwt"
LangString DESC_MODULE_OPENPYXL ${LANG_ENGLISH} "A Python library to read/write Excel 2007 xlsx/xlsm files"
LangString DESC_PIP_MODULE_IPYTHON ${LANG_ENGLISH} "Alternative pip installation for IPython. IPython provides a rich toolkit to help you make the most out of using Python interactively."
LangString DESC_PIP_MODULE_PYODBC ${LANG_ENGLISH} "pip installation for PyODBC. Allows you to use ODBC to connect to almost any database from Windows, Linux, OS/X, and more."

!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${PYTHON_CORE} $(DESC_PYTHON_CORE)
Expand Down Expand Up @@ -82,4 +84,7 @@ LangString DESC_MODULE_OPENPYXL ${LANG_ENGLISH} "A Python library to read/write
!insertmacro MUI_DESCRIPTION_TEXT ${MODULE_XLWT} $(DESC_MODULE_XLWT)
!insertmacro MUI_DESCRIPTION_TEXT ${MODULE_XLUTILS} $(DESC_MODULE_XLUTILS)
!insertmacro MUI_DESCRIPTION_TEXT ${MODULE_OPENPYXL} $(DESC_MODULE_OPENPYXL)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
!insertmacro MUI_DESCRIPTION_TEXT ${PIP_MODULE_IPYTHON} $(DESC_PIP_MODULE_IPYTHON)
!insertmacro MUI_DESCRIPTION_TEXT ${PIP_MODULE_PYODBC} $(DESC_PIP_MODULE_PYODBC)

!insertmacro MUI_FUNCTION_DESCRIPTION_END
44 changes: 23 additions & 21 deletions 2.7/modules.bat → config/2.7/modules.bat
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
:: Include common functions
set COMMON=.\..\common.bat

:: CHECK Parameter, maybe only a subset of packages should be build
if [%1]==[] (SET _packagelist=All) ELSE (SET _packagelist=%*)
for %%G in (%_packagelist%) do (call :Unpack%%G)
goto:EOF

:UnpackAll

call :UnpackPython
call :UnpackPyScripter
call :UnpackPyCharm
Expand All @@ -41,7 +48,8 @@ call :UnpackDateutil
call :UnpackPyParsing
call :UnpackLXML
call :UnpackPySerial
call :UnpackPyODBC
:: since pyodbc moved from google to github - installation via pip is required
:: call :UnpackPyODBC
call :UnpackPyGame
call :UnpackPyGTK
call :UnpackPyQT
Expand Down Expand Up @@ -108,6 +116,7 @@ call COMMON :LogMessage "Copy Python Portable shortcut"
copy shortcuts\Python-Portable.exe "%UNPACK_FOLDER%" 1>NUL
copy shortcuts\PythonW-Portable.exe "%UNPACK_FOLDER%" 1>NUL
copy shortcuts\IDLE-Portable.exe "%UNPACK_FOLDER%" 1>NUL
copy shortcuts\PortablePythonPrompt.cmd "%UNPACK_FOLDER%" 1>NUL

:: Fix
call COMMON :FixMSCRT %UNPACK_FOLDER%\python-core\
Expand Down Expand Up @@ -137,21 +146,12 @@ tools\uniextract16\UniExtract.exe "%BIN_FOLDER%\%PY_SCRIPTER_FILE%" %UNPACK_FOLD
:: Copy files to PyScripter folder
call COMMON :LogMessage "Copy files to PyScripter folder"
mkdir %UNPACK_FOLDER%\PyScripter
mkdir %UNPACK_FOLDER%\PyScripter\App
mkdir %UNPACK_FOLDER%\PyScripter\App\locale
mkdir %UNPACK_FOLDER%\PyScripter\App\Skins
copy %UNPACK_FOLDER%\pyscripter-temp\PyScripter\PyScripter.exe "%UNPACK_FOLDER%\PyScripter\App\" >NUL
copy %UNPACK_FOLDER%\pyscripter-temp\PyScripter\PyScripter.chm "%UNPACK_FOLDER%\PyScripter\App\" >NUL
copy %UNPACK_FOLDER%\pyscripter-temp\PyScripter\PyProject.ico "%UNPACK_FOLDER%\PyScripter\App\" >NUL
xcopy /EY %UNPACK_FOLDER%\pyscripter-temp\PyScripter\locale "%UNPACK_FOLDER%\PyScripter\App\locale" >NUL

:: Unpack rpyc
call COMMON :LogMessage "Unpack rypc"
tools\uniextract16\UniExtract.exe "%UNPACK_FOLDER%\pyscripter-temp\PyScripter\Lib\rpyc.zip" %UNPACK_FOLDER%\PyScripter\App\Lib\site-packages\ >NUL
ROBOCOPY /NP /E /MOVE "%UNPACK_FOLDER%\pyscripter-temp\PyScripter" "%UNPACK_FOLDER%\PyScripter\App"


:: Patch PyScripter
call COMMON :LogMessage "Patch PyScripter"
tools\uniextract16\UniExtract.exe patches\PyScripter.2.5.3.PPpatch %UNPACK_FOLDER%\PyScripter\App >NUL
copy /Y patches\PyScripter26.ini %UNPACK_FOLDER%\PyScripter\App\PyScripter.ini 1>NUL 2>NUL

:: Build Shortcut
call COMMON :LogMessage "Build PyScripter shortcut"
Expand Down Expand Up @@ -182,7 +182,7 @@ call COMMON :VerifyFile %NUMPY_FILE% MD5 %NUMPY_ZIP_MD5%
:: Unpack files
call COMMON :LogMessage "Extracting NumPy files"
tools\uniextract16\bin\7z.exe x "%BIN_FOLDER%\%NUMPY_FILE%" -o%UNPACK_FOLDER%\numpy\ -y
tools\uniextract16\UniExtract.exe "%UNPACK_FOLDER%\numpy\%NUMPY_FILE_NOSSE%" %UNPACK_FOLDER%\numpy\
tools\uniextract16\bin\7z.exe x "%UNPACK_FOLDER%\numpy\%NUMPY_FILE_NOSSE%" -o%UNPACK_FOLDER%\numpy\ -y

:: Fix
call COMMON :FixMSCRT %UNPACK_FOLDER%\numpy\
Expand Down Expand Up @@ -846,7 +846,7 @@ setlocal ENABLEEXTENSIONS
call COMMON :DownloadFile %PYCHARM_DOWNLOAD%

:: Verify
call COMMON :VerifyFile %PYCHARM_FILE% MD5 %PYCHARM_MD5%
call COMMON :VerifyFile %PYCHARM_FILE% SHA256 %PYCHARM_SHA256%

:: Unpack files
call COMMON :LogMessage "Extracting PyCharm files"
Expand All @@ -856,26 +856,28 @@ tools\uniextract16\UniExtract.exe "%BIN_FOLDER%\%PYCHARM_FILE%" %UNPACK_FOLDER%\
call COMMON :LogMessage "Copy files to PyCharm folder"
RD %UNPACK_FOLDER%\pycharm-temp\$PLUGINSDIR /S /Q
RD %UNPACK_FOLDER%\pycharm-temp\bin\$PLUGINSDIR /S /Q
RD "%UNPACK_FOLDER%\PyCharm" /S /Q
mkdir %UNPACK_FOLDER%\PyCharm
mkdir %UNPACK_FOLDER%\PyCharm\App
move /Y "%UNPACK_FOLDER%\pycharm-temp" "%UNPACK_FOLDER%\PyCharm\App\PyCharm"

:: Patch PyCharm
call COMMON :LogMessage "Patch PyCharm"
del %UNPACK_FOLDER%\PyCharm\App\PyCharm\bin\idea.properties /Q
tools\uniextract16\UniExtract.exe "patches\PyCharm.3.1.x.PPpatch" "%UNPACK_FOLDER%\PyCharm\App\PyCharm" >NUL
tools\uniextract16\bin\7z.exe x patches\PyCharm.4.0.x.PPpatch -o%UNPACK_FOLDER%\PyCharm\App\PyCharm -y >NUL

:: Replace @PY_VERSION@ in jdk.table.xml.tmp to %PY_VERSION% jdk.table.xml
setlocal ENABLEDELAYEDEXPANSION
set filein="%UNPACK_FOLDER%\PyCharm\App\PyCharm\.PyCharm30\config\options\jdk.table.xml.tmp"
set fileout="%UNPACK_FOLDER%\PyCharm\App\PyCharm\.PyCharm30\config\options\jdk.table.xml"
set filein="%UNPACK_FOLDER%\PyCharm\App\PyCharm\.PyCharm\config\options\jdk.table.xml.tmp"
set fileout="%UNPACK_FOLDER%\PyCharm\App\PyCharm\.PyCharm\config\options\jdk.table.xml"
echo write to "%fileout%"...
set old=@PY_VERSION@
set new=%PY_VERSION%
for /f "tokens=* delims=" %%i in ( '"type %filein%"') do (
(for /f "usebackq tokens=* delims=? " %%i in (`type %filein%`) do (
set str=%%i
set str=!str:%old%=%new%!
echo !str! >> %fileout%
)
echo !str!
)) > %fileout%
del %filein%

:: Build Shortcut
Expand Down
73 changes: 59 additions & 14 deletions 2.7/modules.nsh → config/2.7/modules.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,32 @@
InstType "Full"
InstType "Minimal"

Section "!Python 2.7.6 core" PYTHON_CORE
Section "!Python 2.7.11 core" PYTHON_CORE
SectionIn 1 2 RO
SetOutPath "$INSTDIR"
File /r "${SOURCESFOLDER}\python-core\*.*"
File "${SOURCESFOLDER}\Python-Portable.exe"
File "${SOURCESFOLDER}\PythonW-Portable.exe"
File "${SOURCESFOLDER}\IDLE-Portable.exe"
File "${SOURCESFOLDER}\PortablePythonPrompt.cmd"
SectionEnd
SectionGroup "Modules"
Section "NumPy 1.8.1" MODULE_NUMPY
Section "NumPy 1.9.2" MODULE_NUMPY
SectionIn 1
SetOutPath "$INSTDIR\App\Lib\site-packages\"
File /r "${SOURCESFOLDER}\numpy\PLATLIB\*.*"
SectionEnd
Section "SciPy 0.13.3" MODULE_SCIPY
Section "SciPy 0.15.1" MODULE_SCIPY
SectionIn 1
SetOutPath "$INSTDIR\App\Lib\site-packages\"
File /r "${SOURCESFOLDER}\scipy\PLATLIB\*.*"
SectionEnd
Section "PyWin32 218" MODULE_PYWIN32
Section "PyWin32 220" MODULE_PYWIN32
SectionIn 1
SetOutPath "$INSTDIR\App\"
File /r "${SOURCESFOLDER}\pywin32\*.*"
SectionEnd
Section "NetworkX 1.7" MODULE_NETWORKX
Section "NetworkX 1.11" MODULE_NETWORKX
SectionIn 1
SetOutPath "$INSTDIR\App\Lib\site-packages\networkx\"
File /r "${SOURCESFOLDER}\networkx\networkx\*.*"
Expand All @@ -77,12 +78,12 @@ SectionGroup "Modules"
SetOutPath "$INSTDIR\App\"
File /r "${SOURCESFOLDER}\wxpython\package\*.*"
SectionEnd
Section "matplotlib 1.3.1" MODULE_MATPLOTLIB
Section "matplotlib 1.4.3" MODULE_MATPLOTLIB
SectionIn 1
SetOutPath "$INSTDIR\App\Lib\site-packages\"
File /r "${SOURCESFOLDER}\matplotlib\PLATLIB\*.*"
SectionEnd
Section "lxml 3.3.4" MODULE_LXML
Section "lxml 3.4.3" MODULE_LXML
SectionIn 1
SetOutPath "$INSTDIR\App\Lib\site-packages\"
File /r "${SOURCESFOLDER}\lxml\PLATLIB\*.*"
Expand All @@ -92,12 +93,13 @@ SectionGroup "Modules"
SetOutPath "$INSTDIR\App\Lib\site-packages\"
File /r "${SOURCESFOLDER}\pyserial\PURELIB\*.*"
SectionEnd
/* since pyodbc moved from google to github - installation via pip is required
Section "PyODBC 3.0.7" MODULE_PYODBC
SectionIn 1
SetOutPath "$INSTDIR\App\Lib\site-packages\"
File /r "${SOURCESFOLDER}\pyodbc\PLATLIB\*.*"
SectionEnd
Section "PyGame 1.9.1" MODULE_PYGAME
*/ Section "PyGame 1.9.1" MODULE_PYGAME
SectionIn 1
SetOutPath "$INSTDIR\App\"
File /r "${SOURCESFOLDER}\pygame\*.*"
Expand All @@ -109,7 +111,7 @@ SectionGroup "Modules"
SetOutPath "$INSTDIR"
File "${SOURCESFOLDER}\Glade3-Portable.exe"
SectionEnd
Section "PyQT 4.10.4" MODULE_PYQT
Section "PyQT 4.11.3" MODULE_PYQT
SectionIn 1
SetOutPath "$INSTDIR\App\Lib\"
File /r "${SOURCESFOLDER}\pyqt\Lib\*.*"
Expand All @@ -129,10 +131,10 @@ SectionGroup "Modules"
SetOutPath "$INSTDIR"
File "${SOURCESFOLDER}\IPython-Portable.exe"
SectionEnd
Section "Pandas 0.13.1" MODULE_PANDAS
Section "Pandas 0.16.0" MODULE_PANDAS
SectionIn 1
SetOutPath "$INSTDIR\App\Lib\site-packages\"
File /r "${SOURCESFOLDER}\pandas\PLATLIB\*.*"
File /r "${SOURCESFOLDER}\pandas\*.*"
SectionEnd
Section "Dateutil 2.2" MODULE_DATEUTIL
SectionIn 1
Expand Down Expand Up @@ -173,20 +175,63 @@ SectionGroupEnd


SectionGroup "Code editors"
Section "PyScripter 2.5.3" IDE_PYSCRIPTER
Section "PyScripter 2.6.0" IDE_PYSCRIPTER
SectionIn 1
SetOutPath "$INSTDIR"
File /r "${SOURCESFOLDER}\PyScripter\*.*"
File "${SOURCESFOLDER}\PyScripter-Portable.exe"
SectionEnd
Section "PyCharm Community 3.1.2" IDE_PYCHARM
Section "PyCharm Community 2016.3.1" IDE_PYCHARM
SectionIn 1
SetOutPath "$INSTDIR"
File /r "${SOURCESFOLDER}\PyCharm\*.*"
File "${SOURCESFOLDER}\PyCharm-Portable.exe"
SectionEnd
SectionGroupEnd

; pip section is an extract from
; https://github.com/wheeler-microfluidics/microdrop_portable_python_base/blob/microdrop/2.7/modules.nsh
; many thanks to Christian Frobel for these piece of work

SectionGroup "`pip` packages"
Section "Prepare `easy_install` and `pip`"
Var /GLOBAL EasyInstall
Var /GLOBAL Pip
Var /GLOBAL PipInstallFlags
SectionIn 1 2 RO
StrCpy $EasyInstall '$INSTDIR\App\Scripts\easy_install.exe'
StrCpy $Pip '$INSTDIR\App\Scripts\pip.exe'
; Use `--pre` argument to allow installation of [pre-release][1]
; package versions.
;
; [1]: http://stackoverflow.com/questions/18230956/could-not-find-a-version-that-satisfies-the-requirement-pytz
StrCpy $PipInstallFlags '--no-cache-dir'
SectionEnd

Section "Install pip"
SectionIn 1 2 RO
nsExec::ExecToLog '$EasyInstall pip'
SectionEnd

Section "Install ipython" PIP_MODULE_IPYTHON
;SectionIn 1
;not in section 'full', cause IPython 0.13.1 already included
;this is just an example, how packges could be installed via pip
;known problem:
; - with pip installed scripts App\Scripts\iXYZ-script.py incudes "hard coded" python path
; - if the pp installation moves, these paths must be adapted manually
nsExec::ExecToLog '$Pip install $PipInstallFlags ipython'
SectionEnd
Section "Install PyODBC" PIP_MODULE_PYODBC
SectionIn 1
;known problem:
; - with pip installed scripts App\Scripts\iXYZ-script.py incudes "hard coded" python path
; - if the pp installation moves, these paths must be adapted manually
nsExec::ExecToLog '$Pip install $PipInstallFlags pyodbc'
SectionEnd

SectionGroupEnd

; Section dependencies
Function .onSelChange
${Unless} ${SectionIsSelected} ${MODULE_DATEUTIL}
Expand All @@ -204,4 +249,4 @@ Function .onSelChange
${Unless} ${SectionIsSelected} ${MODULE_XLWT}
!insertmacro UnselectSection ${MODULE_XLUTILS}
${EndIf}
FunctionEnd
FunctionEnd
Loading