summaryrefslogtreecommitdiffstats
path: root/Tools/msi/pip/pip.wxs
blob: c46a868188838b390b6085d62ae0037009230334 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Language="!(loc.LCID)" Name="!(loc.Title)" Version="$(var.Version)" Manufacturer="!(loc.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
        <Package InstallerVersion="300" Compressed="yes" InstallScope="perUser" Platform="$(var.Platform)" />
        
        <PropertyRef Id="UpgradeTable" />
        <PropertyRef Id="REGISTRYKEY" />
        
        <Property Id="PYTHON_EXE" Secure="yes">
            <ComponentSearch Id="PythonExe" Guid="$(var.PythonExeComponentGuid)">
                <FileSearch Name="python.exe" />
            </ComponentSearch>
        </Property>

        <Condition Message="!(loc.NoPython)">PYTHON_EXE</Condition>
        
        <Feature Id="DefaultFeature" AllowAdvertise="no" Title="!(loc.Title)" Description="!(loc.Description)">
            <Component Id="pip" Guid="*" Directory="InstallDirectory">
                <RegistryValue KeyPath="yes" Root="HKMU" Key="[REGISTRYKEY]\EnsurePipRun" Value="1" Type="integer" />
            </Component>
        </Feature>
        
        <?if $(var.Platform)~="x64" ?>
        <CustomAction Id="UpdatePip" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="ignore"/>
        <?else ?>
        <CustomAction Id="UpdatePip" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="ignore"/>
        <?endif ?>
        
        <!-- Install/uninstall pip -->
        <CustomAction Id="SetUpdatePipCommandLine" Property="UpdatePip" Value='"[PYTHON_EXE]" -E -s -m ensurepip -U --default-pip' Execute="immediate" />
        <CustomAction Id="SetRemovePipCommandLine" Property="UpdatePip" Value='"[PYTHON_EXE]" -E -s -B -m ensurepip._uninstall' Execute="immediate" />
        
        <InstallExecuteSequence>
            <Custom Action="SetUpdatePipCommandLine" Before="UpdatePip">(&amp;DefaultFeature=3) AND NOT (!DefaultFeature=3)</Custom>
            <Custom Action="SetRemovePipCommandLine" Before="UpdatePip">(&amp;DefaultFeature=2) AND (!DefaultFeature=3)</Custom>

            <Custom Action="UpdatePip" Before="InstallFinalize">UpdatePip</Custom>
        </InstallExecuteSequence>
    </Product>
</Wix>