Home | History | Annotate | Download | only in msi
      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     </PropertyGroup>
     14 
     15     <Import Project="msi.props" />
     16     <Import Project="bundle\bundle.targets" />
     17     
     18     <PropertyGroup>
     19         <EXETarget>$(DownloadUrlBase.TrimEnd(`/`))/$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</EXETarget>
     20         <MSITarget>$(DownloadUrl.Replace(`{version}`, `$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)`).Replace(`{arch}`, `$(ArchName)`).Replace(`{releasename}`, `$(ReleaseLevelName)`).Replace(`{msi}`, ``).TrimEnd(`/`))</MSITarget>
     21     </PropertyGroup>
     22     
     23     <ItemGroup>
     24         <File Include="$(OutputPath)\*.msi">
     25             <CopyTo>$(MSITarget)</CopyTo>
     26         </File>
     27         <File Include="$(OutputPath)\*.exe;$(OutputPath)\*.zip">
     28             <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     
     42     <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')" />
     45         <Exec Command="&quot;$(GPG)&quot; -ba -o &quot;$(IntermediateOutputPath)\gpg\%(File.FileName)%(File.Extension).asc&quot; &quot;%(File.FullPath)&quot;"
     46               IgnoreExitCode="false" />
     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="&quot;$(PLINK)&quot; $(User)@$(Host) mkdir %(File.CopyTo) ^&amp;^&amp; chgrp downloads %(File.CopyTo) ^&amp;^&amp; chmod g-w,o+rx %(File.CopyTo)" ContinueOnError="true" />
     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)/*" ContinueOnError="true" />
     58     </Target>
     59 
     60     <Target Name="_PrintNames" Condition="$(DryRun)">
     61         <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)/*" />
     64     </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>
     77         <Error Text="Could not find installer" Condition="@(WebInstaller) == ''" />
     78         <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)" />
     88         <Message Text="Successfully downloaded %(WebInstaller.Filename)%(WebInstaller.Extension) layout" Importance="high" />
     89     </Target>
     90     
     91     <Target Name="Upload" DependsOnTargets="_ValidateProperties;_RunGpg;_PrintNames;_Upload" />
     92     <Target Name="Test" DependsOnTargets="_TestLayout" />
     93     
     94     <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     
    101     <Target Name="ShowHashes">
    102         <ItemGroup>
    103             <UserFiles Include="@(File)" Condition="'%(File.CopyTo)' == '$(EXETarget)'" />
    104         </ItemGroup>
    105         
    106         <Error Text="No files generated" Condition="@(UserFiles) == ''" />
    107         <Exec Command="&quot;$(PythonExe)&quot; generate_md5.py @(UserFiles->'&quot;%(FullPath)&quot;',' ')" />
    108     </Target>
    109     
    110     <Target Name="Build">
    111         <Error Text="This script should be invoked using uploadrelease.bat." />
    112     </Target>
    113 </Project>
    114