-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathbuild_win_release.ps1
34 lines (28 loc) · 1.18 KB
/
build_win_release.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function ZipFiles( $zipfilename, $sourcedir ) {
Add-Type -Assembly System.IO.Compression.FileSystem
$compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
[System.IO.Compression.ZipFile]::CreateFromDirectory(
$sourcedir, $zipfilename, $compressionLevel, $true)
}
function Clean( $projectroot, $version ) {
Remove-Item "$projectroot\build" -Recurse -ErrorAction Ignore
Remove-Item "$projectroot\dist" -Recurse -ErrorAction Ignore
Remove-Item "$projectroot\pyportify.zip" -ErrorAction Ignore
Remove-Item "$projectroot\pyportify-$version" -Recurse -ErrorAction Ignore
}
function BuildAndRunExe( $pyroot ) {
Invoke-Expression "$pyroot\pyinstaller --onefile pyportify.spec"
dist\pyportify.exe
}
function Build( $projectroot, $version, $pyroot ) {
Invoke-Expression "$pyroot\pyinstaller --onefile pyportify.spec"
move-item dist pyportify-$version
ZipFiles "$projectroot\pyportify.zip" "$projectroot\pyportify-$version"
}
$version = "0.4.1"
$pyroot = "c:\Users\josh\virtualenvs\pyportify36\Scripts"
$projectroot = $PSScriptRoot
$env:PYTHONPATH = "$projectroot"
Clean $projectroot $version
Build $projectroot $version $pyroot
# BuildAndRunExe $pyroot