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>{10487945-15D1-4092-A214-338395C4116B}</ProjectGuid>
5        <OutputName>python</OutputName>
6        <OutputName Condition="$(Platform) == 'x86'">$(OutputName)x86</OutputName>
7        <OutputSuffix></OutputSuffix>
8        <SupportSigning>false</SupportSigning>
9        <BuildForRelease Condition="$(BuildForRelease) == ''">true</BuildForRelease>
10    </PropertyGroup>
11
12    <Import Project="..\msi\msi.props" />
13
14    <PropertyGroup>
15        <Nuget Condition="$(Nuget) == ''">$(ExternalsDir)\windows-installer\nuget\nuget.exe</Nuget>
16        <NuspecVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</NuspecVersion>
17        <NuspecVersion Condition="$(ReleaseLevelName) != ''">$(NuspecVersion)-$(ReleaseLevelName)</NuspecVersion>
18        <SignOutput>false</SignOutput>
19        <TargetName>$(OutputName).$(NuspecVersion)</TargetName>
20        <TargetExt>.nupkg</TargetExt>
21        <IntermediateOutputPath>$(IntermediateOutputPath)\nuget_$(ArchName)</IntermediateOutputPath>
22
23        <CleanCommand>rmdir /q/s "$(IntermediateOutputPath)"</CleanCommand>
24
25        <PythonArguments>"$(PythonExe)" "$(MSBuildThisFileDirectory)\..\msi\make_zip.py"</PythonArguments>
26        <PythonArguments>$(PythonArguments) -t "$(IntermediateOutputPath)" -a $(ArchName)</PythonArguments>
27
28        <PipArguments>"$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append(r'$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()"</PipArguments>
29        <PackageArguments Condition="$(Packages) != ''">"$(IntermediateOutputPath)\python.exe" -B -m pip install -U $(Packages)</PackageArguments>
30
31        <NugetArguments>"$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec"</NugetArguments>
32        <NugetArguments>$(NugetArguments) -BasePath "$(IntermediateOutputPath)"</NugetArguments>
33        <NugetArguments>$(NugetArguments) -OutputDirectory "$(OutputPath.Trim(`\`))"</NugetArguments>
34        <NugetArguments>$(NugetArguments) -Version "$(NuspecVersion)"</NugetArguments>
35        <NugetArguments>$(NugetArguments) -NoPackageAnalysis -NonInteractive</NugetArguments>
36
37        <Environment>set DOC_FILENAME=python$(PythonVersion).chm</Environment>
38        <Environment Condition="Exists($(CRTRedist))">$(Environment)%0D%0Aset VCREDIST_PATH=$(CRTRedist)\$(Platform)</Environment>
39    </PropertyGroup>
40
41    <Target Name="_NugetMissing" BeforeTargets="_Build" Condition="!Exists($(Nuget))">
42        <Error Text="$(Nuget) could not be found. Either avoid specifying the property or update your externals/windows-installer files." />
43    </Target>
44
45    <Target Name="_Build">
46        <Exec Command="$(CleanCommand)" />
47        <Exec Command="setlocal%0D%0A$(Environment)%0D%0A$(PythonArguments)" />
48        <Exec Command="$(PipArguments)" />
49        <Exec Command="$(PackageArguments)" Condition="$(PackageArguments) != ''" />
50        <Exec Command="$(NugetArguments)" />
51    </Target>
52
53    <Target Name="AfterBuild" />
54    <Target Name="Build" DependsOnTargets="_Build;AfterBuild" />
55</Project>
56