diff options
author | Steve Dower <steve.dower@microsoft.com> | 2017-09-07 02:29:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-07 02:29:10 (GMT) |
commit | 1f06a680de465be0c24a78ea3b610053955daa99 (patch) | |
tree | 20baad151d4a42b9b074bf02da48aeb5d07961e0 /Tools | |
parent | d3b9f97e6d92bbfcf956638344fd827a40837b96 (diff) | |
download | cpython-1f06a680de465be0c24a78ea3b610053955daa99.zip cpython-1f06a680de465be0c24a78ea3b610053955daa99.tar.gz cpython-1f06a680de465be0c24a78ea3b610053955daa99.tar.bz2 |
Add props file for nuget packages (#3410)
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/nuget/make_pkg.proj | 14 | ||||
-rw-r--r-- | Tools/nuget/python.nuspec | 3 | ||||
-rw-r--r-- | Tools/nuget/python.props | 56 | ||||
-rw-r--r-- | Tools/nuget/pythondaily.nuspec | 3 | ||||
-rw-r--r-- | Tools/nuget/pythonx86.nuspec | 3 |
5 files changed, 76 insertions, 3 deletions
diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj index f21d21e..9843bc9 100644 --- a/Tools/nuget/make_pkg.proj +++ b/Tools/nuget/make_pkg.proj @@ -51,6 +51,20 @@ <Exec Command="setlocal%0D%0A$(Environment)%0D%0A$(PythonArguments)" /> <Exec Command="$(PipArguments)" /> <Exec Command="$(PackageArguments)" Condition="$(PackageArguments) != ''" /> + + <PropertyGroup> + <_PropsContents>$([System.IO.File]::ReadAllText('python.props'))</_PropsContents> + <_PropsContents>$(_PropsContents.Replace('$$PYTHON_TAG$$', '$(MajorVersionNumber).$(MinorVersionNumber)'))</_PropsContents> + <_PropsContents>$(_PropsContents.Replace('$$PYTHON_VERSION$$', '$(NuspecVersion)'))</_PropsContents> + <_PropsContents Condition="$(Platform) == 'x86'">$(_PropsContents.Replace('$$PYTHON_PLATFORM$$', 'Win32'))</_PropsContents> + <_PropsContents Condition="$(Platform) != 'x86'">$(_PropsContents.Replace('$$PYTHON_PLATFORM$$', '$(Platform)'))</_PropsContents> + <_PropsContents>$(_PropsContents.Replace('$$PYTHON_TARGET$$', '_GetPythonRuntimeFilesDependsOn$(MajorVersionNumber)$(MinorVersionNumber)_$(Platform)'))</_PropsContents> + <_ExistingContents Condition="Exists('$(IntermediateOutputPath)\python.props')">$([System.IO.File]::ReadAllText('$(IntermediateOutputPath)\python.props'))</_ExistingContents> + </PropertyGroup> + <WriteLinesToFile File="$(IntermediateOutputPath)\python.props" + Lines="$(_PropsContents)" + Condition="$(_PropsContents) != $(_ExistingContents)" /> + <Exec Command="$(NugetPackCommand) $(NugetArguments)" /> <Exec Command="$(NugetPackSymbolsCommand) $(NugetArguments)" Condition="$(NugetPackSymbolsCommand) != ''" /> </Target> diff --git a/Tools/nuget/python.nuspec b/Tools/nuget/python.nuspec index b3c5c34..d5f3e63 100644 --- a/Tools/nuget/python.nuspec +++ b/Tools/nuget/python.nuspec @@ -13,6 +13,7 @@ <tags>python</tags> </metadata> <files> - <file src="**\*" target="tools" /> + <file src="**\*" exclude="python.props" target="tools" /> + <file src="python.props" target="build\native" /> </files> </package> diff --git a/Tools/nuget/python.props b/Tools/nuget/python.props new file mode 100644 index 0000000..4cc7008 --- /dev/null +++ b/Tools/nuget/python.props @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup Condition="$(Platform) == '$$PYTHON_PLATFORM$$'"> + <PythonHome>$(MSBuildThisFileDirectory)\..\..\tools</PythonHome> + <PythonInclude>$(PythonHome)\include</PythonInclude> + <PythonLibs>$(PythonHome)\libs</PythonLibs> + <PythonTag>$$PYTHON_TAG$$</PythonTag> + <PythonVersion>$$PYTHON_VERSION$$</PythonVersion> + + <IncludePythonExe Condition="$(IncludePythonExe) == ''">true</IncludePythonExe> + <IncludeDistutils Condition="$(IncludeDistutils) == ''">false</IncludeDistutils> + <IncludeLib2To3 Condition="$(IncludeLib2To3) == ''">false</IncludeLib2To3> + <IncludeVEnv Condition="$(IncludeVEnv) == ''">false</IncludeVEnv> + + <GetPythonRuntimeFilesDependsOn>$$PYTHON_TARGET$$;$(GetPythonRuntimeFilesDependsOn)</GetPythonRuntimeFilesDependsOn> + </PropertyGroup> + + <ItemDefinitionGroup Condition="$(Platform) == '$$PYTHON_PLATFORM$$'"> + <ClCompile> + <AdditionalIncludeDirectories>$(PythonInclude);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + </ClCompile> + <Link> + <AdditionalLibraryDirectories>$(PythonLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + </ItemDefinitionGroup> + + <Target Name="GetPythonRuntimeFiles" Returns="@(PythonRuntime)" DependsOnTargets="$(GetPythonRuntimeFilesDependsOn)" /> + + <Target Name="$$PYTHON_TARGET$$" Returns="@(PythonRuntime)"> + <ItemGroup> + <_PythonRuntimeExe Include="$(PythonHome)\python*.dll" /> + <_PythonRuntimeExe Include="$(PythonHome)\vcruntime140.dll" /> + <_PythonRuntimeExe Include="$(PythonHome)\python*.exe" Condition="$(IncludePythonExe) == 'true'" /> + <_PythonRuntimeExe> + <Link>%(Filename)%(Extension)</Link> + </_PythonRuntimeExe> + <_PythonRuntimeDlls Include="$(PythonHome)\DLLs\*.pyd" /> + <_PythonRuntimeDlls Include="$(PythonHome)\DLLs\*.dll" /> + <_PythonRuntimeDlls> + <Link>DLLs\%(Filename)%(Extension)</Link> + </_PythonRuntimeDlls> + <_PythonRuntimeLib Include="$(PythonHome)\Lib\**\*" Exclude="$(PythonHome)\Lib\**\*.pyc;$(PythonHome)\Lib\site-packages\**\*" /> + <_PythonRuntimeLib Remove="$(PythonHome)\Lib\distutils\**\*" Condition="$(IncludeDistutils) != 'true'" /> + <_PythonRuntimeLib Remove="$(PythonHome)\Lib\lib2to3\**\*" Condition="$(IncludeLib2To3) != 'true'" /> + <_PythonRuntimeLib Remove="$(PythonHome)\Lib\ensurepip\**\*" Condition="$(IncludeVEnv) != 'true'" /> + <_PythonRuntimeLib Remove="$(PythonHome)\Lib\venv\**\*" Condition="$(IncludeVEnv) != 'true'" /> + <_PythonRuntimeLib> + <Link>Lib\%(RecursiveDir)%(Filename)%(Extension)</Link> + </_PythonRuntimeLib> + <PythonRuntime Include="@(_PythonRuntimeExe);@(_PythonRuntimeDlls);@(_PythonRuntimeLib)" /> + </ItemGroup> + + <Message Importance="low" Text="Collected Python runtime from $(PythonHome):%0D%0A@(PythonRuntime->' %(Link)','%0D%0A')" /> + </Target> +</Project> diff --git a/Tools/nuget/pythondaily.nuspec b/Tools/nuget/pythondaily.nuspec index 2634ed1..ee3343b 100644 --- a/Tools/nuget/pythondaily.nuspec +++ b/Tools/nuget/pythondaily.nuspec @@ -13,6 +13,7 @@ <tags>python</tags> </metadata> <files> - <file src="**\*" target="tools" /> + <file src="**\*" exclude="python.props" target="tools" /> + <file src="python.props" target="build\native" /> </files> </package> diff --git a/Tools/nuget/pythonx86.nuspec b/Tools/nuget/pythonx86.nuspec index b55c879..ebfcd6c 100644 --- a/Tools/nuget/pythonx86.nuspec +++ b/Tools/nuget/pythonx86.nuspec @@ -13,6 +13,7 @@ <tags>python</tags> </metadata> <files> - <file src="**\*" target="tools" /> + <file src="**\*" exclude="python.props" target="tools" /> + <file src="python.props" target="build\native" /> </files> </package> |