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 all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning][].
This document follows the conventions laid out in [Keep a CHANGELOG][].

## [unreleased][]
- Added VS 2017 build with net40 and NetStandard 1.5 targets

### Added
- Added `clr.GetClrType` (#432, #433)
Expand Down
38 changes: 38 additions & 0 deletions pythonnet.15.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
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-Linux-x64|x64 = Debug-Linux-x64|x64
Debug-Win-x64|x64 = Debug-Win-x64|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-Linux-x64|x64.ActiveCfg = Debug-Linux-x64|x64
{4D2089E1-5B6A-4799-984B-178AE467902D}.Debug-Linux-x64|x64.Build.0 = Debug-Linux-x64|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-Linux-x64|x64.ActiveCfg = Release-Win-x64|x64
{4D2089E1-5B6A-4799-984B-178AE467902D}.Release-Linux-x64|x64.Build.0 = Release-Win-x64|x64
{4D2089E1-5B6A-4799-984B-178AE467902D}.Release-Win-x64|x64.ActiveCfg = Release-Win-x64|x64
{4D2089E1-5B6A-4799-984B-178AE467902D}.Release-Win-x64|x64.Build.0 = Release-Win-x64|x64
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Debug-Linux-x64|x64.ActiveCfg = Debug|x64
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Debug-Linux-x64|x64.Build.0 = Debug|x64
{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-Linux-x64|x64.ActiveCfg = Release|x64
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Release-Linux-x64|x64.Build.0 = Release|x64
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Release-Win-x64|x64.ActiveCfg = Release|x64
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Release-Win-x64|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
21 changes: 21 additions & 0 deletions src/embed_tests/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Reflection;
using NUnit.Common;
using NUnitLite;

namespace Python.EmbeddingTest
{
public class Program
{
public static int Main(string[] args)
{
////var example = new TestExample();
////example.SetUp();
////example.TestReadme();
////example.Dispose();
////return 0;
return new AutoRun(typeof(Program).GetTypeInfo().Assembly)
.Execute(args, new ExtendedTextWrapper(Console.Out), Console.In);
}
}
}
14 changes: 14 additions & 0 deletions src/embed_tests/Properties/PublishProfiles/FolderProfile.pubxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Configuration>Debug-Linux-x64</Configuration>
<TargetFramework>netcoreapp1.0</TargetFramework>
<PublishDir>bin\publish\Debug-Linux-x64</PublishDir>
<RuntimeIdentifier>ubuntu.14.04-x64</RuntimeIdentifier>
</PropertyGroup>
</Project>
7 changes: 7 additions & 0 deletions src/embed_tests/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"profiles": {
"Python.EmbeddingTest.15": {
"commandName": "Project"
}
}
}
64 changes: 64 additions & 0 deletions src/embed_tests/Python.EmbeddingTest.15.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>exe</OutputType>
<TargetFrameworks><!--net40;-->netcoreapp1.0</TargetFrameworks>
<RuntimeIdentifiers>win7-x64;ubuntu.16.04-x64;ubuntu.14.04-x64</RuntimeIdentifiers>
<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>
<!--This is for NUnit Test Adaptor crash workaround.-->
<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|netcoreapp1.0|x64'" />

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

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

<ItemGroup>
<PackageReference Include="NUnit">
<Version>3.6.1</Version>
</PackageReference>
<PackageReference Include="NUnitLite" Version="3.6.1" />
</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>
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
99 changes: 99 additions & 0 deletions src/runtime/Python.Runtime.15.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net40;netstandard1.5</TargetFrameworks>
<RootNamespace>Python.Runtime</RootNamespace>
<AssemblyName>Python.Runtime</AssemblyName>
<PackageId>Python.Runtime</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>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug-Linux-x64|net40|x64'">
<PlatformTarget>x64</PlatformTarget>
<DefineConstants>TRACE;DEBUG;X64;LINUX;UNIX;UCS4;PYTHON_WITH_PYMALLOC;MONO_LINUX</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug-Linux-x64|netstandard1.5|x64'">
<PlatformTarget>x64</PlatformTarget>
<DefineConstants>TRACE;DEBUG;X64;LINUX;UNIX;UCS4;PYTHON_WITH_PYMALLOC;MONO_LINUX</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release-Linux-x64|net40|x64'">
<PlatformTarget>x64</PlatformTarget>
<DefineConstants>TRACE;DEBUG;X64;LINUX;UNIX;UCS4;PYTHON_WITH_PYMALLOC;MONO_LINUX</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release-Linux-x64|netstandard1.5|x64'">
<PlatformTarget>x64</PlatformTarget>
<DefineConstants>TRACE;DEBUG;X64;LINUX;UNIX;UCS4;PYTHON_WITH_PYMALLOC;MONO_LINUX</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug-Win-x64|net40|x64'">
<PlatformTarget>x64</PlatformTarget>
<DefineConstants>TRACE;DEBUG;X64;UCS2</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug-Win-x64|netstandard1.5|x64'">
<PlatformTarget>x64</PlatformTarget>
<DefineConstants>TRACE;DEBUG;X64;UCS2</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release-Win-x64|net40|x64'">
<PlatformTarget>x64</PlatformTarget>
<DefineConstants>TRACE;X64;UCS2</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release-Win-x64|netstandard1.5|x64'">
<PlatformTarget>x64</PlatformTarget>
<DefineConstants>TRACE;DEBUG;X64;UCS2;</DefineConstants>
</PropertyGroup>

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

<PropertyGroup Condition="'$(Configuration.Substring(0,5))'=='Debug'">
<!--MS bug, publish makes no sense to configuration name.-->
<OutputPath>bin\Debug</OutputPath>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.5'">
<PackageReference Include="System.AppDomain">
<Version>2.0.11</Version>
</PackageReference>
<PackageReference Include="System.Collections.NonGeneric">
<Version>4.0.1</Version>
</PackageReference>
<PackageReference Include="System.Data.Common">
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="System.Diagnostics.StackTrace">
<Version>4.0.1</Version>
</PackageReference>
<PackageReference Include="System.Dynamic.Runtime">
<Version>4.0.11</Version>
</PackageReference>
<PackageReference Include="System.Reflection.Emit">
<Version>4.0.1</Version>
</PackageReference>
<PackageReference Include="System.Reflection.TypeExtensions">
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="System.Runtime.Loader">
<Version>4.0.0</Version>
</PackageReference>
<PackageReference Include="System.Runtime.Serialization.Formatters">
<Version>4.0.0-rc3-24212-01</Version>
</PackageReference>
<PackageReference Include="System.Threading.Thread">
<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/Python.Runtime.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="polyfill\ReflectionBridge\ReflectionBridgeExtensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="..\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
Expand Down Expand Up @@ -158,6 +159,9 @@
<LogicalName>clr.py</LogicalName>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="polyfill\ReflectionBridge\LICENSE.txt" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
<PropertyGroup>
<TargetAssembly>$(TargetPath)</TargetAssembly>
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/arrayobject.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections;

namespace Python.Runtime
Expand Down Expand Up @@ -140,8 +140,8 @@ public static int mp_ass_subscript(IntPtr ob, IntPtr idx, IntPtr v)
int rank = items.Rank;
int index;
object value;

if (items.IsReadOnly)
if (((IList)items).IsReadOnly)
{
Exceptions.RaiseTypeError("array is read-only");
return -1;
Expand Down
Loading