Skip to content

Commit

Permalink
build: use winpython and fix bugs
Browse files Browse the repository at this point in the history
This will allow us to make our installer ~4 times smaller(120MB ->
30MB). This patch also has fix for PATH bug and installs dvc to whatever
direstory user specified.
  • Loading branch information
efiop committed May 6, 2017
1 parent 5a3c81d commit ea298c5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 30 deletions.
39 changes: 18 additions & 21 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
@echo OFF
set Miniconda_dir=C:\DVC
set Miniconda_bin=Miniconda3-latest-Windows-x86_64.exe
set Miniconda_url=https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe
set Src_dir=%cd%

rmdir /Q /S %Miniconda_dir%
del /Q /S %Miniconda_bin%
REM @echo OFF

rmdir /Q /S dist
rmdir /Q /S WinPython
del /Q /S "dvc-*.exe"

call powershell.exe -Command (new-object System.Net.WebClient).DownloadFile('%Miniconda_url%','%Miniconda_bin%')
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 "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)

REM NOTE: This is extremely important, that we use same directory that we will install dvc into.
REM The reason is that dvc.exe will have hardcoded path to python interpreter and thus we need
REM to make sure that it is the same everywhere(C:\DVC).
call .\%Miniconda_bin% /InstallationType=JustMe /RegisterPython=0 /S /D=%Miniconda_dir%
call .\WinPython-64bit-3.6.1.0Zero.exe /S /D=%cd%\WinPython

copy innosetup\addSymLinkPermissions.ps1 %Miniconda_dir%\
copy innosetup\addSymLinkPermissions.ps1 WinPython\
mkdir Winpython\bin
copy innosetup\dvc.bat WinPython\bin

pushd %Miniconda_dir%
call .\python -m pip install -r %Src_dir%\requirements.txt
popd
cd WinPython
call scripts\python -m pip install -r ..\requirements.txt
cd ..

call %Miniconda_dir%\python setup.py sdist
call WinPython\scripts\python setup.py sdist

pushd %Miniconda_dir%
call .\python -m pip install %Src_dir%\dist\dvc-0.8.1.tar.gz
popd
cd WinPython
call scripts\python -m pip install ..\dist\dvc-0.8.2.tar.gz
cd ..

call "C:\Program Files (x86)\Inno Setup 5\iscc" innosetup\setup.iss
2 changes: 2 additions & 0 deletions innosetup/addSymLinkPermissions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ SECreateSymbolicLinkPrivilege = $($currentSetting)
return $true;
}
}

addSymLinkPermissions $(Get-WMIObject -class Win32_ComputerSystem | select username).username
2 changes: 2 additions & 0 deletions innosetup/dvc.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
call "%~dp0..\python-3.6.1.amd64\python" -m dvc %*
16 changes: 7 additions & 9 deletions innosetup/setup.iss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#define MyAppName "Data Version Control"
; FIXME: Hardcoded version is not nice, but will do for now.
#define MyAppVersion "0.8.1"
#define MyAppVersion "0.8.2"
#define MyAppPublisher "Dmitry Petrov"
#define MyAppURL "https://dataversioncontrol.com/"
;#define MyAppExeName "dvc.exe"
#define MyAppDir "C:\DVC"
#define MyAppDir "..\WinPython"

[Setup]
AppId={{8258CE8A-110E-4E0D-AE60-FEE00B15F041}
Expand All @@ -15,17 +15,15 @@ AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
;DefaultDirName={pf}\{#MyAppName}
DefaultDirName={pf64}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
LicenseFile=..\LICENSE
OutputBaseFilename=dvc-{#MyAppVersion}
Compression=lzma
Compression=lzma2/max
SolidCompression=yes
OutputDir=..\
ChangesEnvironment=yes
DefaultDirName={#MyAppDir}
DisableDirPage=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Expand All @@ -50,7 +48,7 @@ const
function ModPathDir(): TArrayOfString;
begin
setArrayLength(Result, 1)
Result[0] := ExpandConstant('{app}');
Result[0] := ExpandConstant('{app}\bin');
end;
// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -223,9 +221,9 @@ var
ErrorCode: Integer;
SRCdir: String;
begin
SRCdir := ExpandConstant('{app}\Scripts');
SRCdir := ExpandConstant('{app}');
if isUninstaller() = false then
Exec('powershell.exe', '-noexit -executionpolicy bypass -File "' + SRCdir + '\addSymLinkPermissions.ps1"', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
ShellExec('', 'powershell.exe', '-noninteractive -windowstyle hidden -executionpolicy bypass -File "' + SRCdir + '\addSymLinkPermissions.ps1"', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
end;

procedure CurStepChanged(CurStep: TSetupStep);
Expand Down

0 comments on commit ea298c5

Please sign in to comment.