-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from efiop/master
Miniconda-based Windows installer for standalone distribution of dvc
- Loading branch information
Showing
5 changed files
with
338 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,30 @@ | ||
@echo OFF | ||
rmdir /Q /S nuitka.build | ||
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% | ||
del /Q /S "dvc-*.exe" | ||
@echo This will take a while. Go get yourself a cup of tee... | ||
call nuitka --standalone --output-dir nuitka.build dvc.py | ||
call "C:\Program Files (x86)\Inno Setup 5\iscc" innosetup/setup.iss | ||
rmdir /Q /S nuitka.build | ||
|
||
call powershell.exe -Command (new-object System.Net.WebClient).DownloadFile('%Miniconda_url%','%Miniconda_bin%') | ||
|
||
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% | ||
|
||
copy innosetup\addSymLinkPermissions.ps1 %Miniconda_dir%\ | ||
|
||
pushd %Miniconda_dir% | ||
call .\python -m pip install -r %Src_dir%\requirements.txt | ||
popd | ||
|
||
call %Miniconda_dir%\python setup.py sdist | ||
|
||
pushd %Miniconda_dir% | ||
call .\python -m pip install %Src_dir%\dist\dvc-0.8.1.tar.gz | ||
popd | ||
|
||
call "C:\Program Files (x86)\Inno Setup 5\iscc" innosetup\setup.iss |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from dvc.main import main | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
function addSymLinkPermissions($accountToAdd){ | ||
Write-Host "Checking SymLink permissions.." | ||
$sidstr = $null | ||
try { | ||
$ntprincipal = new-object System.Security.Principal.NTAccount "$accountToAdd" | ||
$sid = $ntprincipal.Translate([System.Security.Principal.SecurityIdentifier]) | ||
$sidstr = $sid.Value.ToString() | ||
} catch { | ||
$sidstr = $null | ||
} | ||
Write-Host "Account: $($accountToAdd)" -ForegroundColor DarkCyan | ||
if( [string]::IsNullOrEmpty($sidstr) ) { | ||
Write-Host "Account not found!" -ForegroundColor Red | ||
exit -1 | ||
} | ||
Write-Host "Account SID: $($sidstr)" -ForegroundColor DarkCyan | ||
$tmp = [System.IO.Path]::GetTempFileName() | ||
Write-Host "Export current Local Security Policy" -ForegroundColor DarkCyan | ||
secedit.exe /export /cfg "$($tmp)" | ||
$c = Get-Content -Path $tmp | ||
$currentSetting = "" | ||
foreach($s in $c) { | ||
if( $s -like "SECreateSymbolicLinkPrivilege*") { | ||
$x = $s.split("=",[System.StringSplitOptions]::RemoveEmptyEntries) | ||
$currentSetting = $x[1].Trim() | ||
} | ||
} | ||
if( $currentSetting -notlike "*$($sidstr)*" ) { | ||
Write-Host "Need to add permissions to SymLink" -ForegroundColor Yellow | ||
|
||
Write-Host "Modify Setting ""Create SymLink""" -ForegroundColor DarkCyan | ||
|
||
if( [string]::IsNullOrEmpty($currentSetting) ) { | ||
$currentSetting = "*$($sidstr)" | ||
} else { | ||
$currentSetting = "*$($sidstr),$($currentSetting)" | ||
} | ||
Write-Host "$currentSetting" | ||
$outfile = @" | ||
[Unicode] | ||
Unicode=yes | ||
[Version] | ||
signature="`$CHICAGO`$" | ||
Revision=1 | ||
[Privilege Rights] | ||
SECreateSymbolicLinkPrivilege = $($currentSetting) | ||
"@ | ||
$tmp2 = [System.IO.Path]::GetTempFileName() | ||
Write-Host "Import new settings to Local Security Policy" -ForegroundColor DarkCyan | ||
$outfile | Set-Content -Path $tmp2 -Encoding Unicode -Force | ||
Push-Location (Split-Path $tmp2) | ||
try { | ||
secedit.exe /configure /db "secedit.sdb" /cfg "$($tmp2)" /areas USER_RIGHTS | ||
} finally { | ||
Pop-Location | ||
} | ||
} else { | ||
Write-Host "NO ACTIONS REQUIRED! Account already in ""Create SymLink""" -ForegroundColor DarkCyan | ||
Write-Host "Account $accountToAdd already has permissions to SymLink" -ForegroundColor Green | ||
return $true; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.