8000 Backed #519, wrong merge! · pythonnet/pythonnet@43a9eb6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 43a9eb6

Browse files
author
dse
committed
Backed #519, wrong merge!
1 parent 700b522 commit 43a9eb6

24 files changed

+61
-223
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ install:
169169
script:
170170
- python -m pytest
171171
- 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
173172

174173
after_script:
175174
# Uncomment if need to geninterop, ie. py37 final

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
88
## [unreleased][]
99

1010
### Added
11-
- Added support for embedding python into dotnet core 2.0 (NetStandard 2.0)
1211
- Added new build system (pythonnet.15.sln) based on dotnetcore-sdk/xplat(crossplatform msbuild).
1312
Currently there two side-by-side build systems that produces the same output (net40) from the same sources.
1413
After a some transition time, current (mono/ msbuild 14.0) build system will be removed.

appveyor.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ init:
4343
install:
4444
- pip install --upgrade -r requirements.txt --quiet
4545
- 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
4846

4947
# Install OpenCover. Can't put on `packages.config`, not Mono compatible
5048
- .\tools\nuget\nuget.exe install OpenCover -OutputDirectory packages -Verbosity quiet

ci/appveyor_run_tests.ps1

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,6 @@ if ($CS_STATUS -ne 0) {
4444
Write-Host "Embedded tests failed" -ForegroundColor "Red"
4545
}
4646

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-
6447
# Set exit code to fail if either Python or Embedded tests failed
6548
if ($PYTHON_STATUS -ne 0 -or $CS_STATUS -ne 0) {
6649
Write-Host "Tests failed" -ForegroundColor "Red"

pythonnet.15.sln

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio 15
33
VisualStudioVersion = 15.0.26730.3
44
MinimumVisualStudioVersion = 10.0.40219.1
5-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.Runtime.15", "src/runtime/Python.Runtime.15.csproj", "{2759F4FF-716B-4828-916F-50FA86613DFC}"
5+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.Runtime.15", "src\runtime\Python.Runtime.15.csproj", "{2759F4FF-716B-4828-916F-50FA86613DFC}"
66
EndProject
7-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.EmbeddingTest.15", "src/embed_tests/Python.EmbeddingTest.15.csproj", "{66B8D01A-9906-452A-B09E-BF75EA76468F}"
7+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.EmbeddingTest.15", "src\embed_tests\Python.EmbeddingTest.15.csproj", "{66B8D01A-9906-452A-B09E-BF75EA76468F}"
88
EndProject
9-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "clrmodule.15", "src/clrmodule/clrmodule.15.csproj", "{E08678D4-9A52-4AD5-B63D-8EBC7399981B}"
9+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "clrmodule.15", "src\clrmodule\clrmodule.15.csproj", "{E08678D4-9A52-4AD5-B63D-8EBC7399981B}"
1010
EndProject
11-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Console.15", "src/console/Console.15.csproj", "{CDAD305F-8E72-492C-A314-64CF58D472A0}"
11+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Console.15", "src\console\Console.15.csproj", "{CDAD305F-8E72-492C-A314-64CF58D472A0}"
1212
EndProject
13-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.Test.15", "src/testing/Python.Test.15.csproj", "{F94B547A-E97E-4500-8D53-B4D64D076E5F}"
13+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.Test.15", "src\testing\Python.Test.15.csproj", "{F94B547A-E97E-4500-8D53-B4D64D076E5F}"
1414
EndProject
1515
Global
1616
GlobalSection(SolutionConfigurationPlatforms) = preSolution

setup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,6 @@ def build_extension(self, ext):
257257

258258
subprocess.check_call(" ".join(cmd + ["/t:Clean"]), shell=use_shell)
259259
subprocess.check_call(" ".join(cmd + ["/t:Build"]), shell=use_shell)
260-
if DEVTOOLS == "MsDev15" or DEVTOOLS == "dotnet":
261-
subprocess.check_call(" ".join(cmd + ['"/t:Console_15:publish;Python_EmbeddingTest_15:publish"', "/p:TargetFramework=netcoreapp2.0"]), shell=use_shell)
262260

263261
if DEVTOOLS == "Mono" or DEVTOOLS == "dotnet":
264262
self._build_monoclr()

src/clrmodule/clrmodule.15.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
<NoWarn>1591</NoWarn>
2323
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
2424
<PythonBuildDir Condition=" '$(PythonBuildDir)' == '' ">$(SolutionDir)\bin\</PythonBuildDir>
25-
<PythonBuildDir Condition="'$(TargetFramework)'!='net40'">$(PythonBuildDir)\$(TargetFramework)\</PythonBuildDir>
2625
<LangVersion>6</LangVersion>
2726
<ErrorReport>prompt</ErrorReport>
2827
<CustomDefineConstants Condition="'$(CustomDefineConstants)' == ''">$(PYTHONNET_DEFINE_CONSTANTS)</CustomDefineConstants>

src/console/Console.15.csproj

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
33
<PropertyGroup>
4-
<TargetFrameworks>net40;netcoreapp2.0</TargetFrameworks>
4+
<TargetFrameworks>net40</TargetFrameworks>
55
<Platforms>x64;x86</Platforms>
66
<Configurations>DebugMono;DebugMonoPY3;ReleaseMono;ReleaseMonoPY3;DebugWin;DebugWinPY3;ReleaseWin;ReleaseWinPY3</Configurations>
77
<OutputType>Exe</OutputType>
@@ -15,14 +15,12 @@
1515
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
1616
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
1717
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
18+
<DocumentationFile>bin\nPython.xml</DocumentationFile>
1819
<OutputPath>bin\</OutputPath>
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+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
2221
<NoWarn>1591</NoWarn>
2322
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
2423
<PythonBuildDir Condition=" '$(PythonBuildDir)' == '' ">$(SolutionDir)\bin\</PythonBuildDir>
25-
<PublishDir Condition="'$(TargetFramework)'!='net40'">$(PythonBuildDir)\$(TargetFramework)\</PublishDir>
2624
<LangVersion>6</LangVersion>
2725
<ApplicationIcon>python-clear.ico</ApplicationIcon>
2826
<ErrorReport>prompt</ErrorReport>
@@ -91,7 +89,7 @@
9189
</ItemGroup>
9290
<ItemGroup>
9391
<Content Include="python-clear.ico" />
94-
<EmbeddedResource Condition="'$(TargetFramework)'=='net40'" Include="$(PythonBuildDir)\Python.Runtime.dll">
92+
<EmbeddedResource Include="$(PythonBuildDir)\Python.Runtime.dll">
9593
<LogicalName>Python.Runtime.dll</LogicalName>
9694
</EmbeddedResource>
9795
</ItemGroup>
@@ -102,6 +100,6 @@
102100
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
103101

104102
<Target Name="AfterBuild">
105-
<Copy Condition="'$(TargetFramework)'=='net40'" SourceFiles="$(TargetPath)" DestinationFolder="$(PythonBuildDir)" />
103+
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(PythonBuildDir)" />
106104
</Target>
107105
</Project>

src/console/pythonconsole.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,18 @@ namespace Python.Runtime
1616
/// </remarks>
1717
public sealed class PythonConsole
1818
{
19-
#if NET40
2019
private static AssemblyLoader assemblyLoader = new AssemblyLoader();
21-
#endif
20+
2221
private PythonConsole()
2322
{
2423
}
2524

2625
[STAThread]
2726
public static int Main(string[] args)
2827
{
29-
// Only net40 is capable to safely inject python.runtime.dll into resources.
30-
#if NET40
3128
// reference the static assemblyLoader to stop it being optimized away
3229
AssemblyLoader a = assemblyLoader;
33-
#endif
30+
3431
string[] cmd = Environment.GetCommandLineArgs();
3532
PythonEngine.Initialize();
3633

@@ -40,7 +37,6 @@ public static int Main(string[] args)
4037
return i;
4138
}
4239

43-
#if NET40
4440
// Register a callback function to load embedded assemblies.
4541
// (Python.Runtime.dll is included as a resource)
4642
private sealed class AssemblyLoader
@@ -77,6 +73,5 @@ public AssemblyLoader()
7773
};
7874
}
7975
}
80-
#endif
8176
}
8277
}

src/embed_tests/Program.cs

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/embed_tests/Python.EmbeddingTest.15.csproj

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
33

44
<PropertyGroup>
5-
<TargetFrameworks>net40;netcoreapp2.0</TargetFrameworks>
5+
<TargetFrameworks>net40</TargetFrameworks>
66
<Platforms>x64;x86</Platforms>
77
<Configurations>DebugMono;DebugMonoPY3;ReleaseMono;ReleaseMonoPY3;DebugWin;DebugWinPY3;ReleaseWin;ReleaseWinPY3</Configurations>
8-
<OutputType Condition="'$(TargetFramework)' != 'net40' OR '$(PYTHONNET_VS_ENV)' == 'true'">Exe</OutputType>
9-
<GenerateProgramFile>false</GenerateProgramFile>
8+
<AssetTargetFallback Condition="'$(TargetFramework)'=='net40' AND $(Configuration.Contains('Mono'))">net45</AssetTargetFallback>
109
<AssemblyName>Python.EmbeddingTest</AssemblyName>
1110
<RootNamespace>Python.EmbeddingTest</RootNamespace>
1211
<PackageId>Python.EmbeddingTest</PackageId>
@@ -16,19 +15,16 @@
1615
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
1716
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
1817
<OutputPath>bin\</OutputPath>
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>
18+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
19+
<DocumentationFile>$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
2220
<NoWarn>1591</NoWarn>
2321
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
24-
<PythonBuildDir Condition="'$(TargetFramework)'=='net40' AND '$(PythonBuildDir)' == ''">$(SolutionDir)\bin\</PythonBuildDir>
25-
<PublishDir Condition="'$(TargetFramework)'!='net40'">$(OutputPath)\$(TargetFramework)_publish</PublishDir>
22+
<PythonBuildDir Condition=" '$(PythonBuildDir)' == '' ">$(SolutionDir)\bin\</PythonBuildDir>
2623
<LangVersion>6</LangVersion>
2724
<ErrorReport>prompt</ErrorReport>
2825
<CustomDefineConstants Condition="'$(CustomDefineConstants)' == ''">$(PYTHONNET_DEFINE_CONSTANTS)</CustomDefineConstants>
2926
<BaseDefineConstants>XPLAT</BaseDefineConstants>
3027
<DefineConstants>$(DefineConstants);$(CustomDefineConstants);$(BaseDefineConstants);</DefineConstants>
31-
<DefineConstants Condition="'$(TargetFramework)'=='netcoreapp2.0'">$(DefineConstants);NETCOREAPP</DefineConstants>
3228
<DefineConstants Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(CustomDefineConstants)' != '' AND $(Configuration.Contains('Debug'))">$(DefineConstants);TRACE;DEBUG</DefineConstants>
3329
<FrameworkPathOverride Condition="'$(TargetFramework)'=='net40' AND $(Configuration.Contains('Mono'))">$(NuGetPackageRoot)\microsoft.targetingpack.netframework.v4.5\1.0.1\lib\net45\</FrameworkPathOverride>
3430
</PropertyGroup>
@@ -92,11 +88,6 @@
9288
<ItemGroup>
9389
<PackageReference Include="NUnit" Version="3.7.1" />
9490
<PackageReference Include="NUnit.ConsoleRunner" Version="3.7.0" />
95-
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0" />
96-
<PackageReference Include="NUnitLite" Version="3.7.2" />
97-
</ItemGroup>
98-
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
99-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
10091
</ItemGroup>
10192

10293
<ItemGroup>
@@ -123,7 +114,7 @@
123114
</PropertyGroup>
124115

125116
<Target Name="AfterBuild">
126-
<Copy Condition="'$(TargetFramework)'=='net40'" SourceFiles="$(TargetAssembly)" DestinationFolder="$(PythonBuildDir)" />
117+
<Copy SourceFiles="$(TargetAssembly)" DestinationFolder="$(PythonBuildDir)" />
127118
<!--Copy SourceFiles="$(TargetAssemblyPdb)" Condition="Exists('$(TargetAssemblyPdb)')" DestinationFolder="$(PythonBuildDir)" /-->
128119
</Target>
129120

src/embed_tests/TestPySequence.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,8 @@ public void TestRepeat()
6969
PyObject actual = t1.Repeat(3);
7070
Assert.AreEqual("FooFooFoo", actual.ToString());
7171

72-
// On 32 bit system this argument should be int, but on the 64 bit system this should be long value.
73-
// This works on the Framework 4.0 accidentally, it should produce out of memory!
74-
// actual = t1.Repeat(-3);
75-
// Assert.AreEqual("", actual.ToString());
72+
actual = t1.Repeat(-3);
73+
Assert.AreEqual("", actual.ToString());
7674
}
7775

7876
[Test]

src/embed_tests/pyimport.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ public void SetUp()
3030
/* Append the tests directory to sys.path
3131
* using reflection to circumvent the private
3232
* modifiers placed on most Runtime methods. */
33-
#if NETCOREAPP
34-
const string s = "../../fixtures";
35-
#else
3633
const string s = "../fixtures";
37-
#endif
3834
string testPath = Path.Combine(TestContext.CurrentContext.TestDirectory, s);
3935

4036
IntPtr str = Runtime.Runtime.PyString_FromString(testPath);

0 commit comments

Comments
 (0)
0