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
DotNetCore + Ubuntu 14.04 x64 + Python 3.5 = all tests passed.
  • Loading branch information
dse committed Mar 29, 2017
commit 563a844e0e8dfbfc18d87cb63f480900bd506bf5
34 changes: 12 additions & 22 deletions pythonnet.15.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,28 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.EmbeddingTest.15", "
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-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|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
{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|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
{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
Expand Down
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>
2 changes: 1 addition & 1 deletion src/embed_tests/Python.EmbeddingTest.15.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>exe</OutputType>
<TargetFrameworks><!--net40;-->netcoreapp1.0</TargetFrameworks>
<RuntimeIdentifiers>win7-x64;ubuntu.16.04-x64</RuntimeIdentifiers>
<RuntimeIdentifiers>win7-x64;ubuntu.16.04-x64;ubuntu.14.04-x64</RuntimeIdentifiers>
<RootNamespace>Python.EmbeddingTest</RootNamespace>
<AssemblyName>Python.EmbeddingTest</AssemblyName>
<PackageId>Python.EmbeddingTest</PackageId>
Expand Down
35 changes: 27 additions & 8 deletions src/runtime/Python.Runtime.15.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,49 @@
<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-Win-x64|net40|x64'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug-Linux-x64|netstandard1.5|x64'">
<PlatformTarget>x64</PlatformTarget>
<DefineConstants>TRACE;DEBUG;X64;LINUX;UNIX;NET40;UCS2;</DefineConstants>
<DefineConstants>TRACE;DEBUG;X64;LINUX;UNIX;UCS4;PYTHON_WITH_PYMALLOC;MONO_LINUX</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release-Win-x64|net40|x64'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release-Linux-x64|net40|x64'">
<PlatformTarget>x64</PlatformTarget>
<DefineConstants>TRACE;X64;LINUX;UNIX;NET40;UCS2;</DefineConstants>
<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;LINUX;UNIX;NETSTANDARD1_5;UCS2;</DefineConstants>
<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;LINUX;UNIX;NETSTANDARD1_5;UCS2;</DefineConstants>
<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">
Expand Down
36 changes: 29 additions & 7 deletions src/runtime/runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ internal static class NativeMethods

public static IntPtr LoadLibrary(string fileName)
{
#if NETSTANDARD1_5
return dlopen(fileName, RTLD_NOW);
#else
return dlopen(fileName, RTLD_NOW | RTLD_SHARED);
#endif
}

public static void FreeLibrary(IntPtr handle)
Expand Down Expand Up @@ -281,9 +285,13 @@ internal static void Initialize()
IntPtr dllLocal = IntPtr.Zero;
if (PythonDll != "__Internal")
{
#if !NETSTANDARD1_5
NativeMethods.LoadLibrary(PythonDll);
#endif
}
#if !NETSTANDARD1_5
_PyObject_NextNotImplemented = NativeMethods.GetProcAddress(dllLocal, "_PyObject_NextNotImplemented");
#endif
#if !(MONO_LINUX || MONO_OSX)
if (dllLocal != IntPtr.Zero)
{
Expand Down Expand Up @@ -648,8 +656,10 @@ string[] argv
var unmanagedDataPtr = marshaler.MarshalManagedToNative(argv);

int result = Py_Main(argc, unmanagedDataPtr);

marshaler.CleanUpNativeData(unmanagedDataPtr);
if (unmanagedDataPtr != IntPtr.Zero)
{
marshaler.CleanUpNativeData(unmanagedDataPtr);
}
return result;
}
#else
Expand Down Expand Up @@ -1207,7 +1217,10 @@ int size

IntPtr result = PyString_FromStringAndSize(unmanagedDataPtr, size);

marshaler.CleanUpNativeData(unmanagedDataPtr);
if (unmanagedDataPtr != IntPtr.Zero)
{
marshaler.CleanUpNativeData(unmanagedDataPtr);
}
return result;
}
#else
Expand Down Expand Up @@ -1262,7 +1275,11 @@ int size

IntPtr result = PyUnicode_FromKindAndData(kind, unmanagedDataPtr, size);

marshaler.CleanUpNativeData(unmanagedDataPtr);
if (unmanagedDataPtr != IntPtr.Zero)
{
marshaler.CleanUpNativeData(unmanagedDataPtr);
}

return result;
}
#else
Expand Down Expand Up @@ -1310,8 +1327,11 @@ int size
var unmanagedDataPtr = marshaler.MarshalManagedToNative(s);

IntPtr result = PyUnicode_FromUnicode(unmanagedDataPtr, size);
if (unmanagedDataPtr != IntPtr.Zero)
{
marshaler.CleanUpNativeData(unmanagedDataPtr);
}

marshaler.CleanUpNativeData(unmanagedDataPtr);
return result;
}
#else
Expand Down Expand Up @@ -1576,8 +1596,10 @@ int updatepath
var unmanagedDataPtr = marshaler.MarshalManagedToNative(argv);

PySys_SetArgvEx(argc, unmanagedDataPtr, updatepath);

marshaler.CleanUpNativeData(unmanagedDataPtr);
if (unmanagedDataPtr != IntPtr.Zero)
{
marshaler.CleanUpNativeData(unmanagedDataPtr);
}
}
#else
[DllImport(PythonDll)]
Expand Down