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 <BuildForRelease Condition="'$(BuildForRelease)' == ''">true</BuildForRelease> 12 <DryRun Condition="'$(DryRun)' == ''">false</DryRun> 13 <Purge Condition="'$(Purge)' == ''">false</Purge> 14 </PropertyGroup> 15 16 <Import Project="msi.props" /> 17 <Import Project="bundle\bundle.targets" /> 18 19 <PropertyGroup> 20 <EXETarget>$(DownloadUrlBase.TrimEnd(`/`))/$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</EXETarget> 21 <MSITarget>$(DownloadUrl.Replace(`{version}`, `$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)`).Replace(`{arch}`, `$(ArchName)`).Replace(`{releasename}`, `$(ReleaseLevelName)`).Replace(`{msi}`, ``).TrimEnd(`/`))</MSITarget> 22 </PropertyGroup> 23 24 <ItemGroup> 25 <File Include="$(OutputPath)\*.msi;$(OutputPath)\*.msu"> 26 <CopyTo>$(MSITarget)</CopyTo> 27 </File> 28 <File Include="$(OutputPath)\*.exe;$(OutputPath)\*.zip"> 29 <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 43 <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=""$(GPG)" -ba -o "$(IntermediateOutputPath)\gpg\%(File.FileName)%(File.Extension).asc" "%(File.FullPath)"" /> 47 <ItemGroup> 48 <File Include="$(IntermediateOutputPath)\gpg\%(File.FileName)%(File.Extension).asc"> 49 <CopyTo>%(File.CopyTo)</CopyTo> 50 </File> 51 </ItemGroup> 52 </Target> 53 54 <Target Name="_Upload" Condition="!$(DryRun)"> 55 <Exec Command=""$(PLINK)" $(User)@$(Host) mkdir %(File.CopyTo) ^&^& chgrp downloads %(File.CopyTo) ^&^& chmod g-w,o+rx %(File.CopyTo) 56"$(PSCP)" @(File,' ') $(User)@$(Host):%(File.CopyTo) 57"$(PLINK)" $(User)@$(Host) chgrp downloads %(File.CopyTo)/*; chmod g-w,o+r %(File.CopyTo)/* 58" /> 59 </Target> 60 61 <Target Name="_PrintNames" Condition="$(DryRun)"> 62 <Exec Command="echo "$(PLINK)" $(User)@$(Host) mkdir %(File.CopyTo) ^&^& chgrp downloads %(File.CopyTo) ^&^& chmod g-w,o+rx %(File.CopyTo) 63echo "$(PSCP)" @(File,' ') $(User)@$(Host):%(File.CopyTo) 64echo "$(PLINK)" $(User)@$(Host) chgrp downloads %(File.CopyTo)/*; chmod g-w,o+r %(File.CopyTo)/* 65echo. 66echo." /> 67 </Target> 68 69 <Target Name="_Purge" Condition="$(Purge) and !$(DryRun)"> 70 <Error Condition="!Exists('$(PythonExe)')" Text="No Python executable available at $(PythonExe)" /> 71 <Exec Command=""$(PythonExe)" 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 "Install test" /wait "%(WebInstaller.SourceExe)" /layout "%(WebInstaller.LayoutDir)" /passive /log "%(WebInstaller.LogFile)"" 91 IgnoreExitCode="false" /> 92 <RemoveDir Directories="%(WebInstaller.LayoutDir)" /> 93 <RemoveDir Directories="%(WebInstaller.SourceDir)" /> 94 <RemoveDir Directories="%(WebInstaller.LogDir)" /> 95 <Message Text="Successfully downloaded %(WebInstaller.Filename)%(WebInstaller.Extension) layout" Importance="high" /> 96 </Target> 97 98 <Target Name="Upload" DependsOnTargets="_ValidateProperties;_RunGpg;_PrintNames;_Upload;_Purge" /> 99 <Target Name="Test" DependsOnTargets="_TestLayout" /> 100 101 <Target Name="ShowHashes"> 102 <ItemGroup> 103 <UserFiles Include="@(File)" Condition="'%(File.CopyTo)' == '$(EXETarget)'" /> 104 </ItemGroup> 105 106 <Exec Command=""$(PythonExe)" generate_md5.py @(UserFiles->'"%(FullPath)"',' ')" /> 107 </Target> 108 109 <Target Name="Build"> 110 <Error Text="This script should be invoked using uploadrelease.bat." /> 111 </Target> 112</Project> 113