blob: 881b825e10711d89081871a6b400c619191c2d5b [file] [log] [blame]
Steve Dower28563322015-03-04 20:27:03 -08001<?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>
Steve Dowerf6e61012017-03-05 19:55:12 -080011 <BuildForRelease Condition="'$(BuildForRelease)' == ''">true</BuildForRelease>
Steve Dower28563322015-03-04 20:27:03 -080012 <DryRun Condition="'$(DryRun)' == ''">false</DryRun>
13 </PropertyGroup>
14
15 <Import Project="msi.props" />
16 <Import Project="bundle\bundle.targets" />
17
18 <PropertyGroup>
19 <EXETarget>$(DownloadUrlBase.TrimEnd(`/`))/$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</EXETarget>
Steve Dower21cecb92015-11-22 18:20:11 -080020 <MSITarget>$(DownloadUrl.Replace(`{version}`, `$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)`).Replace(`{arch}`, `$(ArchName)`).Replace(`{releasename}`, `$(ReleaseLevelName)`).Replace(`{msi}`, ``).TrimEnd(`/`))</MSITarget>
Steve Dower28563322015-03-04 20:27:03 -080021 </PropertyGroup>
22
23 <ItemGroup>
24 <File Include="$(OutputPath)\*.msi;$(OutputPath)\*.msu">
25 <CopyTo>$(MSITarget)</CopyTo>
26 </File>
Steve Dower8c1cee92015-05-02 21:38:26 -070027 <File Include="$(OutputPath)\*.exe;$(OutputPath)\*.zip">
Steve Dower28563322015-03-04 20:27:03 -080028 <CopyTo>$(EXETarget)</CopyTo>
29 </File>
30 <File Include="$(PySourcePath)Doc\build\htmlhelp\python$(MajorVersionNumber)$(MinorVersionNumber)$(MicroVersionNumber)$(ReleaseLevelName).chm" Condition="$(IncludeDoc)">
31 <CopyTo>$(EXETarget)</CopyTo>
32 </File>
33 </ItemGroup>
34
35 <Target Name="_ValidateProperties">
36 <Error Text="No value for Host provided" Condition="'$(Host)' == ''" />
37 <Error Text="No value for User provided" Condition="'$(User)' == ''" />
38 <Error Text="No path for PSCP provided" Condition="'$(PSCP)' == ''" />
39 <Error Text="No path for PLINK provided" Condition="'$(PLINK)' == ''" />
40 </Target>
41
Steve Dower7b8c5f52015-04-05 18:42:37 -070042 <Target Name="_RunGpg" Condition="'$(GPG)' != ''" Inputs="@(File)" Outputs="$(IntermediateOutputPath)\gpg\%(FileName)%(Extension).asc">
43 <MakeDir Directories="$(IntermediateOutputPath)gpg" />
44 <Delete Files="$(IntermediateOutputPath)\gpg\%(File.FileName)%(File.Extension).asc" Condition="Exists('$(IntermediateOutputPath)\gpg\%(File.FileName)%(File.Extension).asc')" />
Steve Dower2084b302017-10-05 13:35:36 -070045 <Exec Command="&quot;$(GPG)&quot; -ba -o &quot;$(IntermediateOutputPath)\gpg\%(File.FileName)%(File.Extension).asc&quot; &quot;%(File.FullPath)&quot;"
46 IgnoreExitCode="false" />
Steve Dower7b8c5f52015-04-05 18:42:37 -070047 <ItemGroup>
48 <File Include="$(IntermediateOutputPath)\gpg\%(File.FileName)%(File.Extension).asc">
49 <CopyTo>%(File.CopyTo)</CopyTo>
50 </File>
51 </ItemGroup>
52 </Target>
53
Steve Dower28563322015-03-04 20:27:03 -080054 <Target Name="_Upload" Condition="!$(DryRun)">
Steve Dower2084b302017-10-05 13:35:36 -070055 <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)" />
56 <Exec Command="&quot;$(PSCP)&quot; @(File,' ') $(User)@$(Host):%(File.CopyTo)" />
57 <Exec Command="&quot;$(PLINK)&quot; $(User)@$(Host) chgrp downloads %(File.CopyTo)/*; chmod g-w,o+r %(File.CopyTo)/*" />
Steve Dower28563322015-03-04 20:27:03 -080058 </Target>
59
60 <Target Name="_PrintNames" Condition="$(DryRun)">
Steve Dower2084b302017-10-05 13:35:36 -070061 <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)" />
62 <Exec Command="echo &quot;$(PSCP)&quot; @(File,' ') $(User)@$(Host):%(File.CopyTo)" />
63 <Exec Command="echo &quot;$(PLINK)&quot; $(User)@$(Host) chgrp downloads %(File.CopyTo)/*; chmod g-w,o+r %(File.CopyTo)/*" />
Steve Dower1aceb022017-02-23 14:11:36 -080064 </Target>
65
66 <Target Name="_TestLayout">
67 <ItemGroup>
68 <WebInstaller Include="$(OutputPath)\*-webinstall.exe" />
69 <WebInstaller>
70 <SourceDir>$(TEMP)\%(Filename)_source</SourceDir>
71 <SourceExe>$(TEMP)\%(Filename)_source\%(Filename)%(Extension)</SourceExe>
72 <LayoutDir>$(TEMP)\%(Filename)_layout</LayoutDir>
73 <LogDir>$(OutputPath)\%(Filename)_layoutlog</LogDir>
74 <LogFile>$(OutputPath)\%(Filename)_layoutlog\%(Filename).log</LogFile>
75 </WebInstaller>
76 </ItemGroup>
Steve Dower2084b302017-10-05 13:35:36 -070077 <Error Text="Could not find installer" Condition="@(WebInstaller) == ''" />
Steve Dower1aceb022017-02-23 14:11:36 -080078 <RemoveDir Directories="%(WebInstaller.SourceDir)" Condition="Exists('%(WebInstaller.SourceDir)')" />
79 <RemoveDir Directories="%(WebInstaller.LayoutDir)" Condition="Exists('%(WebInstaller.LayoutDir)')" />
80 <RemoveDir Directories="%(WebInstaller.LogDir)" Condition="Exists('%(WebInstaller.LogDir)')" />
81 <MakeDir Directories="%(WebInstaller.SourceDir)" />
82 <Copy SourceFiles="@(WebInstaller)" DestinationFiles="%(WebInstaller.SourceExe)" />
83 <Exec Command="start &quot;Install test&quot; /wait &quot;%(WebInstaller.SourceExe)&quot; /layout &quot;%(WebInstaller.LayoutDir)&quot; /passive /log &quot;%(WebInstaller.LogFile)&quot;"
84 IgnoreExitCode="false" />
85 <RemoveDir Directories="%(WebInstaller.LayoutDir)" />
86 <RemoveDir Directories="%(WebInstaller.SourceDir)" />
87 <RemoveDir Directories="%(WebInstaller.LogDir)" />
Steve Dowerf6e61012017-03-05 19:55:12 -080088 <Message Text="Successfully downloaded %(WebInstaller.Filename)%(WebInstaller.Extension) layout" Importance="high" />
Steve Dower1aceb022017-02-23 14:11:36 -080089 </Target>
90
Steve Dower2084b302017-10-05 13:35:36 -070091 <Target Name="Upload" DependsOnTargets="_ValidateProperties;_RunGpg;_PrintNames;_Upload" />
Steve Dower1aceb022017-02-23 14:11:36 -080092 <Target Name="Test" DependsOnTargets="_TestLayout" />
Steve Dower7b8c5f52015-04-05 18:42:37 -070093
Steve Dower2084b302017-10-05 13:35:36 -070094 <Target Name="Purge">
95 <Error Condition="!Exists('$(PythonExe)')" Text="No Python executable available at $(PythonExe)" />
96 <Exec Command="echo &quot;$(PythonExe)&quot; purge.py $(PythonVersion)" Condition="$(DryRun)" />
97 <Exec Command="&quot;$(PythonExe)&quot; purge.py $(PythonVersion)" Condition="!$(DryRun)" />
98 <Message Text="Purged uploaded files" Importance="high" />
99 </Target>
100
Steve Dower7b8c5f52015-04-05 18:42:37 -0700101 <Target Name="ShowHashes">
102 <ItemGroup>
103 <UserFiles Include="@(File)" Condition="'%(File.CopyTo)' == '$(EXETarget)'" />
104 </ItemGroup>
105
Steve Dower2084b302017-10-05 13:35:36 -0700106 <Error Text="No files generated" Condition="@(UserFiles) == ''" />
Steve Dower7b8c5f52015-04-05 18:42:37 -0700107 <Exec Command="&quot;$(PythonExe)&quot; generate_md5.py @(UserFiles->'&quot;%(FullPath)&quot;',' ')" />
108 </Target>
Steve Dower28563322015-03-04 20:27:03 -0800109
110 <Target Name="Build">
111 <Error Text="This script should be invoked using uploadrelease.bat." />
112 </Target>
113</Project>