| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0852392 commit d16100c
15 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -169,6 +169,7 @@ install: | |||
| 169 | 169 | script: | |
| 170 | 170 | - python -m pytest | |
| 171 | 171 | - mono $NUNIT_PATH src/embed_tests/bin/Python.EmbeddingTest.dll | |
| 172 | + - if [[ $BUILD_OPTS == --xplat ]]; then dotnet src/embed_tests/bin/netcoreapp2.0_publish/Python.EmbeddingTest.dll; fi | ||
| 172 | 173 | ||
| 173 | 174 | after_script: | |
| 174 | 175 | # Uncomment if need to geninterop, ie. py37 final | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,6 +43,8 @@ init: | |||
| 43 | 43 | install: | |
| 44 | 44 | - pip install --upgrade -r requirements.txt --quiet | |
| 45 | 45 | - choco install vswhere -y | |
| 46 | + # - cmd: curl -O https://download.microsoft.com/download/5/6/B/56BFEF92-9045-4414-970C-AB31E0FC07EC/dotnet-runtime-2.0.0-win-x86.exe | ||
| 47 | + # - cmd: dotnet-runtime-2.0.0-win-x86.exe /install /quiet /norestart /log install.log | ||
| 46 | 48 | ||
| 47 | 49 | # Install OpenCover. Can't put on `packages.config`, not Mono compatible | |
| 48 | 50 | - .\tools\nuget\nuget.exe install OpenCover -OutputDirectory packages -Verbosity quiet | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -44,6 +44,23 @@ if ($CS_STATUS -ne 0) { | |||
| 44 | 44 | Write-Host "Embedded tests failed" -ForegroundColor "Red" | |
| 45 | 45 | } | |
| 46 | 46 | ||
| 47 | + if ($env:BUILD_OPTS -eq "--xplat"){ | ||
| 48 | + if ($env:PLATFORM -eq "x64") { | ||
| 49 | + $DOTNET_CMD = "dotnet" | ||
| 50 | + } | ||
| 51 | + else{ | ||
| 52 | + $DOTNET_CMD = "c:\Program Files (x86)\dotnet\dotnet" | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + # Run Embedded tests for netcoreapp2.0 (OpenCover currently does not supports dotnet core) | ||
| 56 | + Write-Host ("Starting embedded tests for netcoreapp2.0") -ForegroundColor "Green" | ||
| 57 | + &$DOTNET_CMD .\src\embed_tests\bin\netcoreapp2.0_publish\Python.EmbeddingTest.dll | ||
| 58 | + $CS_STATUS = $LastExitCode | ||
| 59 | + if ($CS_STATUS -ne 0) { | ||
| 60 | + Write-Host "Embedded tests for netcoreapp2.0 failed" -ForegroundColor "Red" | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + | ||
| 47 | 64 | # Set exit code to fail if either Python or Embedded tests failed | |
| 48 | 65 | if ($PYTHON_STATUS -ne 0 -or $CS_STATUS -ne 0) { | |
| 49 | 66 | Write-Host "Tests failed" -ForegroundColor "Red" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -257,7 +257,11 @@ def build_extension(self, ext): | |||
| 257 | 257 | ||
| 258 | 258 | subprocess.check_call(" ".join(cmd + ["/t:Clean"]), shell=use_shell) | |
| 259 | 259 | subprocess.check_call(" ".join(cmd + ["/t:Build"]), shell=use_shell) | |
| 260 | - | ||
| 260 | + if DEVTOOLS == "MsDev15": | ||
| 261 | + subprocess.check_call(" ".join(cmd + ["/t:Console_15:publish;Python_EmbeddingTest_15:publish", "/p:TargetFramework=netcoreapp2.0"]), shell=use_shell) | ||
| 262 | + elif DEVTOOLS == "dotnet": | ||
| 263 | + subprocess.check_call(" ".join(cmd + ["/t:publish", "/p:TargetFramework=netcoreapp2.0"]), shell=use_shell) | ||
| 264 | + | ||
| 261 | 265 | if DEVTOOLS == "Mono" or DEVTOOLS == "dotnet": | |
| 262 | 266 | self._build_monoclr() | |
| 263 | 267 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,6 +22,7 @@ | |||
| 22 | 22 | <NoWarn>1591</NoWarn> | |
| 23 | 23 | <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> | |
| 24 | 24 | <PythonBuildDir Condition=" '$(PythonBuildDir)' == '' ">$(SolutionDir)\bin\</PythonBuildDir> | |
| 25 | + <PythonBuildDir Condition="'$(TargetFramework)'!='net40'">$(PythonBuildDir)\$(TargetFramework)\</PythonBuildDir> | ||
| 25 | 26 | <LangVersion>6</LangVersion> | |
| 26 | 27 | <ErrorReport>prompt</ErrorReport> | |
| 27 | 28 | <CustomDefineConstants Condition="'$(CustomDefineConstants)' == ''">$(PYTHONNET_DEFINE_CONSTANTS)</CustomDefineConstants> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,7 @@ | |||
| 1 | 1 | <Project> | |
| 2 | 2 | <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" /> | |
| 3 | 3 | <PropertyGroup> | |
| 4 | - <TargetFrameworks>net40</TargetFrameworks> | ||
| 4 | + <TargetFrameworks>net40;netcoreapp2.0</TargetFrameworks> | ||
| 5 | 5 | <Platforms>x64;x86</Platforms> | |
| 6 | 6 | <Configurations>DebugMono;DebugMonoPY3;ReleaseMono;ReleaseMonoPY3;DebugWin;DebugWinPY3;ReleaseWin;ReleaseWinPY3</Configurations> | |
| 7 | 7 | <OutputType>Exe</OutputType> | |
@@ -15,12 +15,14 @@ | |||
| 15 | 15 | <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> | |
| 16 | 16 | <GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute> | |
| 17 | 17 | <GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute> | |
| 18 | - <DocumentationFile>bin\nPython.xml</DocumentationFile> | ||
| 19 | 18 | <OutputPath>bin\</OutputPath> | |
| 20 | - <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> | ||
| 19 | + <AppendTargetFrameworkToOutputPath Condition="'$(TargetFramework)'=='net40'">false</AppendTargetFrameworkToOutputPath> | ||
| 20 | + <DocumentationFile Condition="'$(TargetFramework)'=='net40'">$(OutputPath)\$(AssemblyName).xml</DocumentationFile> | ||
| 21 | + <DocumentationFile Condition="'$(TargetFramework)'!='net40'">$(OutputPath)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile> | ||
| 21 | 22 | <NoWarn>1591</NoWarn> | |
| 22 | 23 | <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> | |
| 23 | 24 | <PythonBuildDir Condition=" '$(PythonBuildDir)' == '' ">$(SolutionDir)\bin\</PythonBuildDir> | |
| 25 | + <PublishDir Condition="'$(TargetFramework)'!='net40'">$(PythonBuildDir)\$(TargetFramework)\</PublishDir> | ||
| 24 | 26 | <LangVersion>6</LangVersion> | |
| 25 | 27 | <ApplicationIcon>python-clear.ico</ApplicationIcon> | |
| 26 | 28 | <ErrorReport>prompt</ErrorReport> | |
@@ -88,7 +90,7 @@ | |||
| 88 | 90 | </ItemGroup> | |
| 89 | 91 | <ItemGroup> | |
| 90 | 92 | <Content Include="python-clear.ico" /> | |
| 91 | - <EmbeddedResource Include="$(PythonBuildDir)\Python.Runtime.dll"> | ||
| 93 | + <EmbeddedResource Condition="'$(TargetFramework)'=='net40'" Include="$(PythonBuildDir)\Python.Runtime.dll"> | ||
| 92 | 94 | <LogicalName>Python.Runtime.dll</LogicalName> | |
| 93 | 95 | </EmbeddedResource> | |
| 94 | 96 | </ItemGroup> | |
@@ -99,6 +101,6 @@ | |||
| 99 | 101 | <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" /> | |
| 100 | 102 | ||
| 101 | 103 | <Target Name="AfterBuild"> | |
| 102 | - <Copy SourceFiles="$(TargetPath)" DestinationFolder="$(PythonBuildDir)" /> | ||
| 104 | + <Copy Condition="'$(TargetFramework)'=='net40'" SourceFiles="$(TargetPath)" DestinationFolder="$(PythonBuildDir)" /> | ||
| 103 | 105 | </Target> | |
| 104 | 106 | </Project> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,18 +16,21 @@ namespace Python.Runtime | |||
| 16 | 16 | /// </remarks> | |
| 17 | 17 | public sealed class PythonConsole | |
| 18 | 18 | { | |
| 19 | + #if NET40 | ||
| 19 | 20 | private static AssemblyLoader assemblyLoader = new AssemblyLoader(); | |
| 20 | - | ||
| 21 | + #endif | ||
| 21 | 22 | private PythonConsole() | |
| 22 | 23 | { | |
| 23 | 24 | } | |
| 24 | 25 | ||
| 25 | 26 | [STAThread] | |
| 26 | 27 | public static int Main(string[] args) | |
| 27 | 28 | { | |
| 29 | + // Only net40 is capable to safely inject python.runtime.dll into resources. | ||
| 30 | + #if NET40 | ||
| 28 | 31 | // reference the static assemblyLoader to stop it being optimized away | |
| 29 | 32 | AssemblyLoader a = assemblyLoader; | |
| 30 | - | ||
| 33 | + #endif | ||
| 31 | 34 | string[] cmd = Environment.GetCommandLineArgs(); | |
| 32 | 35 | PythonEngine.Initialize(); | |
| 33 | 36 | ||
@@ -37,6 +40,7 @@ public static int Main(string[] args) | |||
| 37 | 40 | return i; | |
| 38 | 41 | } | |
| 39 | 42 | ||
| 43 | + #if NET40 | ||
| 40 | 44 | // Register a callback function to load embedded assemblies. | |
| 41 | 45 | // (Python.Runtime.dll is included as a resource) | |
| 42 | 46 | private sealed class AssemblyLoader | |
@@ -73,5 +77,6 @@ public AssemblyLoader() | |||
| 73 | 77 | }; | |
| 74 | 78 | } | |
| 75 | 79 | } | |
| 80 | + #endif | ||
| 76 | 81 | } | |
| 77 | 82 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,19 @@ | |||
| 1 | + using System; | ||
| 2 | + | ||
| 3 | + using NUnit.Common; | ||
| 4 | + | ||
| 5 | + using NUnitLite; | ||
| 6 | + | ||
| 7 | + namespace Python.EmbeddingTest | ||
| 8 | + { | ||
| 9 | + public class Program | ||
| 10 | + { | ||
| 11 | + public static int Main(string[] args) | ||
| 12 | + { | ||
| 13 | + return new AutoRun(typeof(Program).Assembly).Execute( | ||
| 14 | + args, | ||
| 15 | + new ExtendedTextWrapper(Console.Out), | ||
| 16 | + Console.In); | ||
| 17 | + } | ||
| 18 | + } | ||
| 19 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,10 +2,11 @@ | |||
| 2 | 2 | <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" /> | |
| 3 | 3 | ||
| 4 | 4 | <PropertyGroup> | |
| 5 | - <TargetFrameworks>net40</TargetFrameworks> | ||
| 5 | + <TargetFrameworks>net40;netcoreapp2.0</TargetFrameworks> | ||
| 6 | 6 | <Platforms>x64;x86</Platforms> | |
| 7 | 7 | <Configurations>DebugMono;DebugMonoPY3;ReleaseMono;ReleaseMonoPY3;DebugWin;DebugWinPY3;ReleaseWin;ReleaseWinPY3</Configurations> | |
| 8 | - <AssetTargetFallback Condition="'$(TargetFramework)'=='net40' AND $(Configuration.Contains('Mono'))">net45</AssetTargetFallback> | ||
| 8 | + <OutputType Condition="'$(TargetFramework)' != 'net40' OR '$(PYTHONNET_VS_ENV)' == 'true'">Exe</OutputType> | ||
| 9 | + <GenerateProgramFile>false</GenerateProgramFile> | ||
| 9 | 10 | <AssemblyName>Python.EmbeddingTest</AssemblyName> | |
| 10 | 11 | <RootNamespace>Python.EmbeddingTest</RootNamespace> | |
| 11 | 12 | <PackageId>Python.EmbeddingTest</PackageId> | |
@@ -15,16 +16,19 @@ | |||
| 15 | 16 | <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> | |
| 16 | 17 | <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> | |
| 17 | 18 | <OutputPath>bin\</OutputPath> | |
| 18 | - <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> | ||
| 19 | - <DocumentationFile>$(OutputPath)\$(AssemblyName).xml</DocumentationFile> | ||
| 19 | + <AppendTargetFrameworkToOutputPath Condition="'$(TargetFramework)'=='net40'">false</AppendTargetFrameworkToOutputPath> | ||
| 20 | + <DocumentationFile Condition="'$(TargetFramework)'=='net40'">$(OutputPath)\$(AssemblyName).xml</DocumentationFile> | ||
| 21 | + <DocumentationFile Condition="'$(TargetFramework)'!='net40'">$(OutputPath)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile> | ||
| 20 | 22 | <NoWarn>1591</NoWarn> | |
| 21 | 23 | <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> | |
| 22 | - <PythonBuildDir Condition=" '$(PythonBuildDir)' == '' ">$(SolutionDir)\bin\</PythonBuildDir> | ||
| 24 | + <PythonBuildDir Condition="'$(TargetFramework)'=='net40' AND '$(PythonBuildDir)' == ''">$(SolutionDir)\bin\</PythonBuildDir> | ||
| 25 | + <PublishDir Condition="'$(TargetFramework)'!='net40'">$(OutputPath)\$(TargetFramework)_publish</PublishDir> | ||
| 23 | 26 | <LangVersion>6</LangVersion> | |
| 24 | 27 | <ErrorReport>prompt</ErrorReport> | |
| 25 | 28 | <CustomDefineConstants Condition="'$(CustomDefineConstants)' == ''">$(PYTHONNET_DEFINE_CONSTANTS)</CustomDefineConstants> | |
| 26 | 29 | <BaseDefineConstants>XPLAT</BaseDefineConstants> | |
| 27 | 30 | <DefineConstants>$(DefineConstants);$(CustomDefineConstants);$(BaseDefineConstants);</DefineConstants> | |
| 31 | + <DefineConstants Condition="'$(TargetFramework)'=='netcoreapp2.0'">$(DefineConstants);NETCOREAPP</DefineConstants> | ||
| 28 | 32 | <FrameworkPathOverride Condition="'$(TargetFramework)'=='net40' AND $(Configuration.Contains('Mono'))">$(NuGetPackageRoot)\microsoft.targetingpack.netframework.v4.5\1.0.1\lib\net45\</FrameworkPathOverride> | |
| 29 | 33 | </PropertyGroup> | |
| 30 | 34 | <PropertyGroup Condition=" '$(Platform)' == 'x86'"> | |
@@ -87,8 +91,12 @@ | |||
| 87 | 91 | <ItemGroup> | |
| 88 | 92 | <PackageReference Include="NUnit" Version="3.7.1" /> | |
| 89 | 93 | <PackageReference Include="NUnit.ConsoleRunner" Version="3.7.0" /> | |
| 94 | + <PackageReference Include="NUnit3TestAdapter" Version="3.8.0" /> | ||
| 95 | + <PackageReference Include="NUnitLite" Version="3.7.2" /> | ||
| 96 | + </ItemGroup> | ||
| 97 | + <ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'"> | ||
| 98 | + <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" /> | ||
| 90 | 99 | </ItemGroup> | |
| 91 | - | ||
| 92 | 100 | <ItemGroup> | |
| 93 | 101 | <ProjectReference Include="..\runtime\Python.Runtime.15.csproj" /> | |
| 94 | 102 | </ItemGroup> | |
@@ -113,7 +121,7 @@ | |||
| 113 | 121 | </PropertyGroup> | |
| 114 | 122 | ||
| 115 | 123 | <Target Name="AfterBuild"> | |
| 116 | - <Copy SourceFiles="$(TargetAssembly)" DestinationFolder="$(PythonBuildDir)" /> | ||
| 124 | + <Copy Condition="'$(TargetFramework)'=='net40'" SourceFiles="$(TargetAssembly)" DestinationFolder="$(PythonBuildDir)" /> | ||
| 117 | 125 | <!--Copy SourceFiles="$(TargetAssemblyPdb)" Condition="Exists('$(TargetAssemblyPdb)')" DestinationFolder="$(PythonBuildDir)" /--> | |
| 118 | 126 | </Target> | |
| 119 | 127 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,7 +30,11 @@ public void SetUp() | |||
| 30 | 30 | /* Append the tests directory to sys.path | |
| 31 | 31 | * using reflection to circumvent the private | |
| 32 | 32 | * modifiers placed on most Runtime methods. */ | |
| 33 | + #if NETCOREAPP | ||
| 34 | + const string s = "../../fixtures"; | ||
| 35 | + #else | ||
| 33 | 36 | const string s = "../fixtures"; | |
| 37 | + #endif | ||
| 34 | 38 | string testPath = Path.Combine(TestContext.CurrentContext.TestDirectory, s); | |
| 35 | 39 | ||
| 36 | 40 | IntPtr str = Runtime.Runtime.PyString_FromString(testPath); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments