Skip to content

Commit

Permalink
build: improve windows installer
Browse files Browse the repository at this point in the history
1) Automatically update installer version by using dvc.main.VERSION
2) Make build.cmd more verbose and handle errors better
  • Loading branch information
efiop committed May 17, 2017
1 parent 43e80be commit c5d10e5
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 15 deletions.
46 changes: 32 additions & 14 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,27 +1,45 @@
@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:eof)
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

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:eof)
echo ====== Copying additional files... ======
copy innosetup\addSymLinkPermissions.ps1 WinPython\ || goto :error
mkdir Winpython\bin || goto :error
copy innosetup\dvc.bat WinPython\bin || goto :error

call .\WinPython-64bit-3.6.1.0Zero.exe /S /D=%cd%\WinPython
echo ====== Installing requirements... ======
cd WinPython || goto :error
call scripts\python -m pip install -r ..\requirements.txt || goto :error
cd .. || goto :error

copy innosetup\addSymLinkPermissions.ps1 WinPython\
mkdir Winpython\bin
copy innosetup\dvc.bat WinPython\bin
echo ====== Building dvc sdist... ======
call WinPython\scripts\python setup.py sdist || goto :error

cd WinPython
call scripts\python -m pip install -r ..\requirements.txt
cd ..
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

call WinPython\scripts\python setup.py sdist
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

cd WinPython
call scripts\python -m pip install ..\dist\dvc-0.8.2.tar.gz
cd ..
echo ====== DONE ======
goto :EOF

call "C:\Program Files (x86)\Inno Setup 5\iscc" innosetup\setup.iss
:error
echo ====== FAIL ======
exit /b 1
14 changes: 14 additions & 0 deletions innosetup/config_gen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This script generates config.ini for setup.iss script
from dvc.main import VERSION

try:
import configparser as ConfigParser
except ImportError:
import ConfigParser

config = ConfigParser.ConfigParser()
config.add_section('Version')
config.set('Version', 'Version', VERSION)

with open('config.ini', 'w') as f:
config.write(f)
2 changes: 1 addition & 1 deletion innosetup/setup.iss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define MyAppName "Data Version Control"
; FIXME: Hardcoded version is not nice, but will do for now.
#define MyAppVersion "0.8.2"
#define MyAppVersion ReadIni(".\innosetup\config.ini", "Version", "version", "unknown")
#define MyAppPublisher "Dmitry Petrov"
#define MyAppURL "https://dataversioncontrol.com/"
;#define MyAppExeName "dvc.exe"
Expand Down

0 comments on commit c5d10e5

Please sign in to comment.