build: create standalone binary with WinPython

Recent changes for building standalone dvc binary on Linux
made it possible to do the same thing on Windows. So now
we are getting rid of WinPython and instead building
standalone dvc binary using PyInstall and packaing it
into an installer with InnoSetup.

One of the benefits is dramatically decreased installer size.
From 125M we got to only 13M!

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2017-06-02 12:53:25 -07:00
parent e70aa8eec1
commit 5b810fed99
6 changed files with 42 additions and 52 deletions
+4
View File
@@ -16,3 +16,7 @@ hooks/*.pyc
*.rpm
*.deb
innosetup/config.ini
*.exe
-45
View File
@@ -1,45 +0,0 @@
@echo OFF
echo ====== Starting to build dvc installer for Windows... ======
rmdir /Q /S dist
rmdir /Q /S WinPython
del /Q /S "dvc-*.exe"
if not exist WinPython-64bit-3.6.1.0Zero.exe (echo Error: Couldn't find WinPython installer. Please go to winpython.github.io, download WinPython-64bit-3.6.1.0Zero.exe and place it in project's root directory && goto:error)
if not exist "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" (echo Error: Couldn't find Inno Setup compiler. Please go to jrsoftware.org/isinfo.php and install Inno Setup 5 && goto:error)
echo ====== Installing WinPython... ======
call .\WinPython-64bit-3.6.1.0Zero.exe /S /D=%cd%\WinPython || goto :error
echo ====== Copying additional files... ======
copy innosetup\addSymLinkPermissions.ps1 WinPython\ || goto :error
mkdir Winpython\bin || goto :error
copy innosetup\dvc.bat WinPython\bin || goto :error
echo ====== Installing requirements... ======
cd WinPython || goto :error
call scripts\python -m pip install -r ..\requirements.txt || goto :error
cd .. || goto :error
echo ====== Building dvc sdist... ======
call WinPython\scripts\python setup.py sdist || goto :error
echo ====== Installing dvc sdist into WinPython... ======
cd WinPython || goto :error
for %%s in ("..\dist\dvc-*.tar.gz") do call scripts\python -m pip install "%%s" || goto :error
cd .. || goto :error
echo ====== Building dvc installer... ======
cd innosetup || goto :error
call ..\WinPython\scripts\python config_gen.py || goto :error
cd .. || goto :error
call "C:\Program Files (x86)\Inno Setup 5\iscc" innosetup\setup.iss || goto :error
echo ====== DONE ======
goto :EOF
:error
echo ====== FAIL ======
exit /b 1
+35
View File
@@ -0,0 +1,35 @@
@echo Off
echo ====== Starting to build dvc installer for Windows... ======
rmdir /Q /S build
rmdir /Q /S dist
del /Q /S dvc.spec
del /Q /S "dvc-*.exe"
where pip
if %errorlevel% neq 0 (echo Error: pip not found && goto :error)
if not exist "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" (echo Error: Couldn't find Inno Setup compiler. Please go to jrsoftware.org/isinfo.php and install Inno Setup 5 && goto :error)
echo ====== Installing requirements... ======
call pip install -r requirements.txt || goto :error
call pip install pyinstaller || goto :error
echo ====== Building dvc binary... ======
call pyinstaller --onefile --additional-hooks-dir hooks dvc/__main__.py --name dvc --specpath build
echo ====== Copying additional files... ======
copy innosetup\addSymLinkPermissions.ps1 dist\ || goto :error
echo ====== Building dvc installer... ======
set PYTHONPATH=%cd%
call python innosetup\config_gen.py || goto :error
call "C:\Program Files (x86)\Inno Setup 5\iscc" innosetup\setup.iss || goto :error
echo ====== DONE ======
goto :EOF
:error
echo ====== FAIL ======
exit /b 1
+1 -1
View File
@@ -10,5 +10,5 @@ config = ConfigParser.ConfigParser()
config.add_section('Version')
config.set('Version', 'Version', VERSION)
with open('config.ini', 'w') as f:
with open('innosetup/config.ini', 'w') as f:
config.write(f)
-2
View File
@@ -1,2 +0,0 @@
@echo off
call "%~dp0..\python-3.6.1.amd64\python" -m dvc %*
+2 -4
View File
@@ -1,10 +1,8 @@
#define MyAppName "Data Version Control"
; FIXME: Hardcoded version is not nice, but will do for now.
#define MyAppVersion ReadIni(".\innosetup\config.ini", "Version", "version", "unknown")
#define MyAppPublisher "Dmitry Petrov"
#define MyAppURL "https://dataversioncontrol.com/"
;#define MyAppExeName "dvc.exe"
#define MyAppDir "..\WinPython"
#define MyAppDir "..\dist"
[Setup]
AppId={{8258CE8A-110E-4E0D-AE60-FEE00B15F041}
@@ -39,7 +37,7 @@ Name: addsymlinkpermissions\system; Description: Add permissions for creating sy
[Code]
const
ModPathName = 'modifypath';
ModPathPath = '{app}\bin';
ModPathPath = '{app}';
SymLinkName = 'addsymlinkpermissions';
var