blob: 75840f2f851ecda10d886e1d61c525b7f12ae1b5 [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>
Steve Dower1aceb022017-02-23 14:11:36 -080013 <Purge Condition="'$(Purge)' == ''">false</Purge>
Steve Dower28563322015-03-04 20:27:03 -080014 </PropertyGroup>
15
16 <Import Project="msi.props" />
17 <Import Project="bundle\bundle.targets" />
18
19 <PropertyGroup>
20 <EXETarget>$(DownloadUrlBase.TrimEnd(`/`))/$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</EXETarget>
Steve Dower21cecb92015-11-22 18:20:11 -080021 <MSITarget>$(DownloadUrl.Replace(`{version}`, `$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)`).Replace(`{arch}`, `$(ArchName)`).Replace(`{releasename}`, `$(ReleaseLevelName)`).Replace(`{msi}`, ``).TrimEnd(`/`))</MSITarget>
Steve Dower28563322015-03-04 20:27:03 -080022 </PropertyGroup>
23
24 <ItemGroup>
25 <File Include="$(OutputPath)\*.msi;$(OutputPath)\*.msu">
26 <CopyTo>$(MSITarget)</CopyTo>
27 </File>
Steve Dower8c1cee92015-05-02 21:38:26 -070028 <File Include="$(OutputPath)\*.exe;$(OutputPath)\*.zip">
Steve Dower28563322015-03-04 20:27:03 -080029 <CopyTo>$(EXETarget)</CopyTo>
30 </File>
31 <File Include="$(PySourcePath)Doc\build\htmlhelp\python$(MajorVersionNumber)$(MinorVersionNumber)$(MicroVersionNumber)$(ReleaseLevelName).chm" Condition="$(IncludeDoc)">
32 <CopyTo>$(EXETarget)</CopyTo>
33 </File>
34 </ItemGroup>
35
36 <Target Name="_ValidateProperties">
37 <Error Text="No value for Host provided" Condition="'$(Host)' == ''" />
38 <Error Text="No value for User provided" Condition="'$(User)' == ''" />
39 <Error Text="No path for PSCP provided" Condition="'$(PSCP)' == ''" />
40 <Error Text="No path for PLINK provided" Condition="'$(PLINK)' == ''" />
41 </Target>
42
Steve Dower7b8c5f52015-04-05 18:42:37 -070043 <Target Name="_RunGpg" Condition="'$(GPG)' != ''" Inputs="@(File)" Outputs="$(IntermediateOutputPath)\gpg\%(FileName)%(Extension).asc">
44 <MakeDir Directories="$(IntermediateOutputPath)gpg" />
45 <Delete Files="$(IntermediateOutputPath)\gpg\%(File.FileName)%(File.Extension).asc" Condition="Exists('$(IntermediateOutputPath)\gpg\%(File.FileName)%(File.Extension).asc')" />
46 <Exec Command="&quot;$(GPG)&quot; -ba -o &quot;$(IntermediateOutputPath)\gpg\%(File.FileName)%(File.Extension).asc&quot; &quot;%(File.FullPath)&quot;" />
47 <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)">
55 <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&quot;$(PSCP)&quot; @(File,' ') $(User)@$(Host):%(File.CopyTo)
Steve Dower1872f932015-03-08 12:59:00 -070057&quot;$(PLINK)&quot; $(User)@$(Host) chgrp downloads %(File.CopyTo)/*; chmod g-w,o+r %(File.CopyTo)/*
Steve Dower28563322015-03-04 20:27:03 -080058" />
59 </Target>
60
61 <Target Name="_PrintNames" Condition="$(DryRun)">
62 <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)
63echo &quot;$(PSCP)&quot; @(File,' ') $(User)@$(Host):%(File.CopyTo)
Steve Dower1872f932015-03-08 12:59:00 -070064echo &quot;$(PLINK)&quot; $(User)@$(Host) chgrp downloads %(File.CopyTo)/*; chmod g-w,o+r %(File.CopyTo)/*
Steve Dower28563322015-03-04 20:27:03 -080065echo.
66echo." />
67 </Target>
68
Steve Dower1aceb022017-02-23 14:11:36 -080069 <Target Name="_Purge" Condition="$(Purge) and !$(DryRun)">
70 <Error Condition="!Exists('$(PythonExe)')" Text="No Python executable available at $(PythonExe)" />
71 <Exec Command="&quot;$(PythonExe)&quot; purge.py $(PythonVersion)" />
72 </Target>
73
74 <Target Name="_TestLayout">
75 <ItemGroup>
76 <WebInstaller Include="$(OutputPath)\*-webinstall.exe" />
77 <WebInstaller>
78 <SourceDir>$(TEMP)\%(Filename)_source</SourceDir>
79 <SourceExe>$(TEMP)\%(Filename)_source\%(Filename)%(Extension)</SourceExe>
80 <LayoutDir>$(TEMP)\%(Filename)_layout</LayoutDir>
81 <LogDir>$(OutputPath)\%(Filename)_layoutlog</LogDir>
82 <LogFile>$(OutputPath)\%(Filename)_layoutlog\%(Filename).log</LogFile>
83 </WebInstaller>
84 </ItemGroup>
85 <RemoveDir Directories="%(WebInstaller.SourceDir)" Condition="Exists('%(WebInstaller.SourceDir)')" />
86 <RemoveDir Directories="%(WebInstaller.LayoutDir)" Condition="Exists('%(WebInstaller.LayoutDir)')" />
87 <RemoveDir Directories="%(WebInstaller.LogDir)" Condition="Exists('%(WebInstaller.LogDir)')" />
88 <MakeDir Directories="%(WebInstaller.SourceDir)" />
89 <Copy SourceFiles="@(WebInstaller)" DestinationFiles="%(WebInstaller.SourceExe)" />
90 <Exec Command="start &quot;Install test&quot; /wait &quot;%(WebInstaller.SourceExe)&quot; /layout &quot;%(WebInstaller.LayoutDir)&quot; /passive /log &quot;%(WebInstaller.LogFile)&quot;"
91 IgnoreExitCode="false" />
92 <RemoveDir Directories="%(WebInstaller.LayoutDir)" />
93 <RemoveDir Directories="%(WebInstaller.SourceDir)" />
94 <RemoveDir Directories="%(WebInstaller.LogDir)" />
Steve Dowerf6e61012017-03-05 19:55:12 -080095 <Message Text="Successfully downloaded %(WebInstaller.Filename)%(WebInstaller.Extension) layout" Importance="high" />
Steve Dower1aceb022017-02-23 14:11:36 -080096 </Target>
97
98 <Target Name="Upload" DependsOnTargets="_ValidateProperties;_RunGpg;_PrintNames;_Upload;_Purge" />
99 <Target Name="Test" DependsOnTargets="_TestLayout" />
Steve Dower7b8c5f52015-04-05 18:42:37 -0700100
101 <Target Name="ShowHashes">
102 <ItemGroup>
103 <UserFiles Include="@(File)" Condition="'%(File.CopyTo)' == '$(EXETarget)'" />
104 </ItemGroup>
105
106 <Exec Command="&quot;$(PythonExe)&quot; generate_md5.py @(UserFiles->'&quot;%(FullPath)&quot;',' ')" />
107 </Target>
Steve Dower28563322015-03-04 20:27:03 -0800108
109 <Target Name="Build">
110 <Error Text="This script should be invoked using uploadrelease.bat." />
111 </Target>
112</Project>