Skip to content

Added side-by-side VS 2017 build with NetStandard 1.5 support. #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added embed_tests project to VS 2017 build. All tests are passed for …
…net40 build.
  • Loading branch information
dse committed Mar 28, 2017
commit 26966d371b0768d3fd43e359e4c6fba1b3d697d8
22 changes: 21 additions & 1 deletion pythonnet.15.sln
Original file line number Diff line number Diff line change
@@ -1,26 +1,46 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.9
VisualStudioVersion = 15.0.26228.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.Runtime.15", "src\runtime\Python.Runtime.15.csproj", "{4D2089E1-5B6A-4799-984B-178AE467902D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.EmbeddingTest.15", "src\embed_tests\Python.EmbeddingTest.15.csproj", "{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug-Linux-x64|x64 = Debug-Linux-x64|x64
Debug-Win-x64|x64 = Debug-Win-x64|x64
Release|x64 = Release|x64
Release-Linux-x64|x64 = Release-Linux-x64|x64
Release-Win-x64|x64 = Release-Win-x64|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4D2089E1-5B6A-4799-984B-178AE467902D}.Debug|x64.ActiveCfg = Debug|x64
{4D2089E1-5B6A-4799-984B-178AE467902D}.Debug|x64.Build.0 = Debug|x64
{4D2089E1-5B6A-4799-984B-178AE467902D}.Debug-Linux-x64|x64.ActiveCfg = Release|x64
{4D2089E1-5B6A-4799-984B-178AE467902D}.Debug-Linux-x64|x64.Build.0 = Debug|x64
{4D2089E1-5B6A-4799-984B-178AE467902D}.Debug-Win-x64|x64.ActiveCfg = Debug-Win-x64|x64
{4D2089E1-5B6A-4799-984B-178AE467902D}.Debug-Win-x64|x64.Build.0 = Debug-Win-x64|x64
{4D2089E1-5B6A-4799-984B-178AE467902D}.Release|x64.ActiveCfg = Release|x64
{4D2089E1-5B6A-4799-984B-178AE467902D}.Release|x64.Build.0 = Release|x64
{4D2089E1-5B6A-4799-984B-178AE467902D}.Release-Linux-x64|x64.ActiveCfg = Release|x64
{4D2089E1-5B6A-4799-984B-178AE467902D}.Release-Linux-x64|x64.Build.0 = Release|x64
{4D2089E1-5B6A-4799-984B-178AE467902D}.Release-Win-x64|x64.ActiveCfg = Release|x64
{4D2089E1-5B6A-4799-984B-178AE467902D}.Release-Win-x64|x64.Build.0 = Release|x64
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Debug|x64.ActiveCfg = Debug|Any CPU
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Debug|x64.Build.0 = Debug|Any CPU
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Debug-Linux-x64|x64.ActiveCfg = Debug|Any CPU
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Debug-Linux-x64|x64.Build.0 = Debug|Any CPU
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Debug-Win-x64|x64.ActiveCfg = Debug|x64
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Debug-Win-x64|x64.Build.0 = Debug|x64
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Release|x64.ActiveCfg = Release|Any CPU
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Release|x64.Build.0 = Release|Any CPU
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Release-Linux-x64|x64.ActiveCfg = Release|Any CPU
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Release-Linux-x64|x64.Build.0 = Release|Any CPU
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Release-Win-x64|x64.ActiveCfg = Release|Any CPU
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Release-Win-x64|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
61 changes: 61 additions & 0 deletions src/embed_tests/Python.EmbeddingTest.15.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net40;netstandard1.6</TargetFrameworks>
<!--<PackageTargetFallback>net</PackageTarg0etFallback>-->
<RootNamespace>Python.EmbeddingTest</RootNamespace>
<AssemblyName>Python.EmbeddingTest</AssemblyName>
<PackageId>Python.EmbeddingTest</PackageId>
<VersionPrefix>3.0.0</VersionPrefix>
<VersionSuffix>Alpha</VersionSuffix>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<!--<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>-->
<NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion>
<DebugType>Full</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'x86'">
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'x64'">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net40|x64'" />

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net40|x64'" />

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard1.6|x64'" />

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard1.6|x64'" />

<PropertyGroup>
<DefineConstants>$(DefineConstants);XPLAT</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NUnit">
<Version>3.6.1</Version>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\runtime\Python.Runtime.15.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.6'">
<PackageReference Include="Microsoft.CSharp">
<Version>4.0.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<ItemGroup>
<None Update="fixtures\**\*.py">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/embed_tests/TestRuntime.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using NUnit.Framework;
using Python.Runtime;

Expand Down
6 changes: 5 additions & 1 deletion src/embed_tests/pyimport.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using NUnit.Framework;
using Python.Runtime;
Expand Down Expand Up @@ -30,7 +30,11 @@ public void SetUp()
/* Append the tests directory to sys.path
* using reflection to circumvent the private
* modifiers placed on most Runtime methods. */
#if XPLAT
const string s = "fixtures";
#else
const string s = "../fixtures";
#endif
string testPath = Path.Combine(TestContext.CurrentContext.TestDirectory, s);

IntPtr str = Runtime.Runtime.PyString_FromString(testPath);
Expand Down
10 changes: 9 additions & 1 deletion src/runtime/Python.Runtime.15.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</PropertyGroup>

<PropertyGroup>
<DefineConstants>$(DefineConstants);REFLECTIONBRIDGE;PYTHON3;PYTHON35</DefineConstants>
<DefineConstants>$(DefineConstants);XPLAT;REFLECTIONBRIDGE;PYTHON3;PYTHON35</DefineConstants>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.5'">
Expand Down Expand Up @@ -69,4 +69,12 @@
<Version>4.0.0</Version>
</PackageReference>
</ItemGroup>

<ItemGroup>
<None Remove="resources\clr.py" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="resources\clr.py" />
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions src/runtime/pythonengine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,11 @@ public static void Initialize(IEnumerable<string> args, bool setSysArgv = true)
#else
Assembly assembly = Assembly.GetExecutingAssembly();
#endif
#if XPLAT
using (Stream stream = assembly.GetManifestResourceStream("Python.Runtime.resources.clr.py"))
#else
using (Stream stream = assembly.GetManifestResourceStream("clr.py"))
#endif
using (var reader = new StreamReader(stream))
{
// add the contents of clr.py to the module
Expand Down