Skip to content

Commit 2856332

Browse files
committed
Add scripts for uploading Windows builds to a Linux server using pscp
1 parent 3e2500d commit 2856332

3 files changed

Lines changed: 108 additions & 0 deletions

File tree

Tools/msi/buildrelease.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ if not "%OUTDIR%" EQU "" (
140140
copy /Y "%BUILD%en-us\*.cab" "%OUTDIR%\%OUTDIR_PLAT%"
141141
copy /Y "%BUILD%en-us\*.exe" "%OUTDIR%\%OUTDIR_PLAT%"
142142
copy /Y "%BUILD%en-us\*.msi" "%OUTDIR%\%OUTDIR_PLAT%"
143+
copy /Y "%BUILD%en-us\*.msu" "%OUTDIR%\%OUTDIR_PLAT%"
143144
)
144145

145146
exit /B 0

Tools/msi/uploadrelease.bat

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
@setlocal
2+
@echo off
3+
4+
set D=%~dp0
5+
set PCBUILD=%D%..\..\PCBuild\
6+
7+
set HOST=
8+
set USER=
9+
set TARGET=
10+
set DRYRUN=false
11+
12+
:CheckOpts
13+
if "%1" EQU "-h" goto Help
14+
if "%1" EQU "-o" (set HOST=%~2) && shift && shift && goto CheckOpts
15+
if "%1" EQU "--host" (set HOST=%~2) && shift && shift && goto CheckOpts
16+
if "%1" EQU "-u" (set USER=%~2) && shift && shift && goto CheckOpts
17+
if "%1" EQU "--user" (set USER=%~2) && shift && shift && goto CheckOpts
18+
if "%1" EQU "-t" (set TARGET=%~2) && shift && shift && goto CheckOpts
19+
if "%1" EQU "--target" (set TARGET=%~2) && shift && shift && goto CheckOpts
20+
if "%1" EQU "--dry-run" (set DRYRUN=true) && shift && goto CheckOpts
21+
22+
if not defined PLINK where plink > "%TEMP%\plink.loc" 2> nul && set /P PLINK= < "%TEMP%\plink.loc" & del "%TEMP%\plink.loc"
23+
if not defined PLINK where /R "%ProgramFiles(x86)%" plink > "%TEMP%\plink.loc" 2> nul && set /P PLINK= < "%TEMP%\plink.loc" & del "%TEMP%\plink.loc"
24+
if not defined PLINK echo Cannot locate plink.exe & exit /B 1
25+
echo Found plink.exe at %PLINK%
26+
27+
if not defined PSCP where pscp > "%TEMP%\pscp.loc" 2> nul && set /P pscp= < "%TEMP%\pscp.loc" & del "%TEMP%\pscp.loc"
28+
if not defined PSCP where /R "%ProgramFiles(x86)%" pscp > "%TEMP%\pscp.loc" 2> nul && set /P pscp= < "%TEMP%\pscp.loc" & del "%TEMP%\pscp.loc"
29+
if not defined PSCP echo Cannot locate pscp.exe & exit /B 1
30+
echo Found pscp.exe at %PSCP%
31+
32+
call "%PCBUILD%env.bat" > nul 2> nul
33+
msbuild /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x86
34+
msbuild /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x64 /p:IncludeDoc=false
35+
36+
exit /B 0
37+
38+
:Help
39+
echo uploadrelease.bat --host HOST --user USERNAME [--target TARGET] [--dry-run] [-h]
40+
echo.
41+
echo --host (-o) Specify the upload host (required)
42+
echo --user (-u) Specify the user on the host (required)
43+
echo --target (-t) Specify the target directory on the host
44+
echo --dry-run Display commands and filenames without executing them
45+
echo -h Display this help information
46+
echo.

Tools/msi/uploadrelease.proj

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<ProjectGuid>{2D69F2AB-D5D0-4344-84B5-EF6DB34A9BC9}</ProjectGuid>
5+
<OutputName>python</OutputName>
6+
<OutputSuffix></OutputSuffix>
7+
8+
<DownloadUrlBase Condition="'$(DownloadUrlBase)' == ''">$(TARGET)</DownloadUrlBase>
9+
<DownloadUrlBase Condition="'$(DownloadUrlBase)' == ''">/srv/www.python.org/ftp/python</DownloadUrlBase>
10+
<IncludeDoc Condition="'$(IncludeDoc)' == ''">true</IncludeDoc>
11+
<DryRun Condition="'$(DryRun)' == ''">false</DryRun>
12+
</PropertyGroup>
13+
14+
<Import Project="msi.props" />
15+
<Import Project="bundle\bundle.targets" />
16+
17+
<PropertyGroup>
18+
<EXETarget>$(DownloadUrlBase.TrimEnd(`/`))/$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</EXETarget>
19+
<MSITarget>$(DownloadUrl.TrimEnd(`/`))</MSITarget>
20+
</PropertyGroup>
21+
22+
<ItemGroup>
23+
<File Include="$(OutputPath)\*.msi;$(OutputPath)\*.msu">
24+
<CopyTo>$(MSITarget)</CopyTo>
25+
</File>
26+
<File Include="$(OutputPath)\*.exe">
27+
<CopyTo>$(EXETarget)</CopyTo>
28+
</File>
29+
<File Include="$(PySourcePath)Doc\build\htmlhelp\python$(MajorVersionNumber)$(MinorVersionNumber)$(MicroVersionNumber)$(ReleaseLevelName).chm" Condition="$(IncludeDoc)">
30+
<CopyTo>$(EXETarget)</CopyTo>
31+
</File>
32+
</ItemGroup>
33+
34+
<Target Name="_ValidateProperties">
35+
<Error Text="No value for Host provided" Condition="'$(Host)' == ''" />
36+
<Error Text="No value for User provided" Condition="'$(User)' == ''" />
37+
<Error Text="No path for PSCP provided" Condition="'$(PSCP)' == ''" />
38+
<Error Text="No path for PLINK provided" Condition="'$(PLINK)' == ''" />
39+
</Target>
40+
41+
<Target Name="_Upload" Condition="!$(DryRun)">
42+
<Exec Command="&quot;$(PLINK)&quot; $(User)@$(Host) mkdir %(File.CopyTo) ^&amp;^&amp; chgrp downloads %(File.CopyTo) ^&amp;^&amp; chmod g-w,o+rx %(File.CopyTo)
43+
&quot;$(PSCP)&quot; @(File,' ') $(User)@$(Host):%(File.CopyTo)
44+
&quot;$(PLINK)&quot; $(User)@$(Host) chgrp downloads %(File.CopyTo)/* ^&amp;^&amp; chmod g-w,o+r %(File.CopyTo)/*
45+
" />
46+
</Target>
47+
48+
<Target Name="_PrintNames" Condition="$(DryRun)">
49+
<Exec Command="echo &quot;$(PLINK)&quot; $(User)@$(Host) mkdir %(File.CopyTo) ^&amp;^&amp; chgrp downloads %(File.CopyTo) ^&amp;^&amp; chmod g-w,o+rx %(File.CopyTo)
50+
echo &quot;$(PSCP)&quot; @(File,' ') $(User)@$(Host):%(File.CopyTo)
51+
echo &quot;$(PLINK)&quot; $(User)@$(Host) chgrp downloads %(File.CopyTo)/* ^&amp;^&amp; chmod g-w,o+r %(File.CopyTo)/*
52+
echo.
53+
echo." />
54+
</Target>
55+
56+
<Target Name="Upload" DependsOnTargets="_ValidateProperties;_PrintNames;_Upload" />
57+
58+
<Target Name="Build">
59+
<Error Text="This script should be invoked using uploadrelease.bat." />
60+
</Target>
61+
</Project>

0 commit comments

Comments
 (0)