X Tutup
Skip to content

Commit 3bedd07

Browse files
committed
resolve confict with upstream, Python.Runtim.15.csproj updated on upstream.
2 parents 1591a71 + fc7d8a4 commit 3bedd07

File tree

9 files changed

+211
-9
lines changed

9 files changed

+211
-9
lines changed

AUTHORS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@
2727
- David Lechner ([@dlech](https://github.com/dlech))
2828
- Dmitriy Se ([@dmitriyse](https://github.com/dmitriyse))
2929
- He-chien Tsai ([@t3476](https://github.com/t3476))
30-
-   Ivan Cronyn ([@cronan](https://github.com/cronan))
30+
- Inna Wiesel ([@inna-w](https://github.com/inna-w))
31+
- Ivan Cronyn ([@cronan](https://github.com/cronan))
3132
- Jan Krivanek ([@jakrivan](https://github.com/jakrivan))
32-
-   Jeff Reback ([@jreback](https://github.com/jreback))
33+
- Jeff Reback ([@jreback](https://github.com/jreback))
3334
- Joe Frayne ([@jfrayne](https://github.com/jfrayne))
3435
- John Burnett ([@johnburnett](https://github.com/johnburnett))
3536
- John Wilkes ([@jbw3](https://github.com/jbw3))

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
99

1010
### Added
1111

12+
- Added automatic NuGet package generation in appveyor and local builds
13+
1214
### Changed
1315

1416
### Fixed

README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pythonnet - Python for .NET
55

66
|appveyor shield| |travis shield| |codecov shield|
77

8-
|license shield| |pypi package version| |python supported shield|
8+
|license shield| |pypi package version| |conda-forge version| |python supported shield|
99
|stackexchange shield|
1010

1111
Python for .NET is a package that gives Python programmers nearly
@@ -111,3 +111,5 @@ https://github.com/pythonnet/pythonnet/wiki
111111
:target: https://pypi.python.org/pypi/pythonnet
112112
.. |stackexchange shield| image:: https://img.shields.io/badge/StackOverflow-python.net-blue.svg
113113
:target: http://stackoverflow.com/questions/tagged/python.net
114+
.. |conda-forge version| image:: https://img.shields.io/conda/vn/conda-forge/pythonnet.svg
115+
:target: https://anaconda.org/conda-forge/pythonnet

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ on_finish:
7272

7373
artifacts:
7474
- path: dist\*
75+
- path: '.\src\runtime\bin\*.nupkg'
7576

7677
notifications:
7778
- provider: Slack

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ def build_extension(self, ext):
334334
),
335335
'/p:PythonBuildDir="{}"'.format(os.path.abspath(dest_dir)),
336336
'/p:PythonInteropFile="{}"'.format(os.path.basename(interop_file)),
337+
"/p:PackageId=pythonnet_py{0}{1}_{2}".format(PY_MAJOR, PY_MINOR, ARCH),
337338
"/verbosity:{}".format(VERBOSITY),
338339
]
339340

src/embed_tests/TestFinalizer.cs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void CollectBasicObject()
4545
called = true;
4646
};
4747

48-
Assert.IsFalse(called);
48+
Assert.IsFalse(called, "The event handler was called before it was installed");
4949
Finalizer.Instance.CollectOnce += handler;
5050

5151
WeakReference shortWeak;
@@ -55,13 +55,25 @@ public void CollectBasicObject()
5555
}
5656
FullGCCollect();
5757
// The object has been resurrected
58-
Assert.IsFalse(shortWeak.IsAlive);
59-
Assert.IsTrue(longWeak.IsAlive);
58+
Warn.If(
59+
shortWeak.IsAlive,
60+
"The referenced object is alive although it should have been collected",
61+
shortWeak
62+
);
63+
Assert.IsTrue(
64+
longWeak.IsAlive,
65+
"The reference object is not alive although it should still be",
66+
longWeak
67+
);
6068

6169
{
6270
var garbage = Finalizer.Instance.GetCollectedObjects();
63-
Assert.NotZero(garbage.Count);
64-
Assert.IsTrue(garbage.Any(T => ReferenceEquals(T.Target, longWeak.Target)));
71+
Assert.NotZero(garbage.Count, "There should still be garbage around");
72+
Warn.Unless(
73+
garbage.Any(T => ReferenceEquals(T.Target, longWeak.Target)),
74+
$"The {nameof(longWeak)} reference doesn't show up in the garbage list",
75+
garbage
76+
);
6577
}
6678
try
6779
{
@@ -71,7 +83,7 @@ public void CollectBasicObject()
7183
{
7284
Finalizer.Instance.CollectOnce -= handler;
7385
}
74-
Assert.IsTrue(called);
86+
Assert.IsTrue(called, "The event handler was not called during finalization");
7587
Assert.GreaterOrEqual(objectCount, 1);
7688
}
7789

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<Project>
2+
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
3+
<PropertyGroup>
4+
<TargetFrameworks>net40;netstandard2.0</TargetFrameworks>
5+
<Platforms>AnyCPU</Platforms>
6+
<Configurations>DebugMono;DebugMonoPY3;ReleaseMono;ReleaseMonoPY3;DebugWin;DebugWinPY3;ReleaseWin;ReleaseWinPY3</Configurations>
7+
<AssetTargetFallback Condition="'$(TargetFramework)'=='net40' AND $(Configuration.Contains('Mono'))">net45</AssetTargetFallback>
8+
<RootNamespace>Python.Runtime</RootNamespace>
9+
<AssemblyName>Python.Runtime</AssemblyName>
10+
<PackageId>pythonnet</PackageId>
11+
<VersionPrefix>2.4.1</VersionPrefix>
12+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
13+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
14+
<Title>Python for .NET</Title>
15+
<Copyright>Copyright (c) 2006-2019 the contributors of the 'Python for .NET' project</Copyright>
16+
<Description>Python and CLR (.NET and Mono) cross-platform language interop</Description>
17+
<Authors>pythonnet</Authors>
18+
<PackageLicenseUrl>https://github.com/pythonnet/pythonnet/blob/master/LICENSE</PackageLicenseUrl>
19+
<RepositoryUrl>https://github.com/pythonnet/pythonnet</RepositoryUrl>
20+
<RepositoryType>git</RepositoryType>
21+
<!--<PackageReleaseNotes>https://github.com/pythonnet/pythonnet/releases/tag/v2.4.0</PackageReleaseNotes>-->
22+
<PackageTags>python interop dynamic dlr Mono pinvoke</PackageTags>
23+
<PackageIconUrl>https://raw.githubusercontent.com/pythonnet/pythonnet/master/src/console/python-clear.ico</PackageIconUrl>
24+
<PackageProjectUrl>https://pythonnet.github.io/</PackageProjectUrl>
25+
<OutputPath>bin\</OutputPath>
26+
<AppendTargetFrameworkToOutputPath Condition="'$(TargetFramework)'=='net40'">false</AppendTargetFrameworkToOutputPath>
27+
<DocumentationFile Condition="'$(TargetFramework)'=='net40'">$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
28+
<DocumentationFile Condition="'$(TargetFramework)'!='net40'">$(OutputPath)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
29+
<NoWarn>1591;NU1701</NoWarn>
30+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
31+
<PythonBuildDir Condition="'$(PythonBuildDir)' == ''">$(SolutionDir)\bin\</PythonBuildDir>
32+
<PublishDir Condition="'$(TargetFramework)'!='net40'">$(PythonBuildDir)\$(TargetFramework)\</PublishDir>
33+
<LangVersion>6</LangVersion>
34+
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
35+
<AssemblyOriginatorKeyFile>..\pythonnet.snk</AssemblyOriginatorKeyFile>
36+
<CustomDefineConstants Condition="'$(CustomDefineConstants)' == ''">$(PYTHONNET_DEFINE_CONSTANTS)</CustomDefineConstants>
37+
<BaseDefineConstants>XPLAT</BaseDefineConstants>
38+
<DefineConstants>$(DefineConstants);$(CustomDefineConstants);$(BaseDefineConstants);</DefineConstants>
39+
<DefineConstants Condition="'$(TargetFramework)'=='netstandard2.0'">$(DefineConstants);NETSTANDARD</DefineConstants>
40+
<DefineConstants Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(CustomDefineConstants)' != '' AND $(Configuration.Contains('Debug'))">$(DefineConstants);TRACE;DEBUG</DefineConstants>
41+
<FrameworkPathOverride Condition="'$(TargetFramework)'=='net40' AND $(Configuration.Contains('Mono'))">$(NuGetPackageRoot)\microsoft.targetingpack.netframework.v4.5\1.0.1\lib\net45\</FrameworkPathOverride>
42+
<Python2Version>$(PYTHONNET_PY2_VERSION)</Python2Version>
43+
<Python2Version Condition="'$(Python2Version)'==''">PYTHON27</Python2Version>
44+
<Python3Version>$(PYTHONNET_PY3_VERSION)</Python3Version>
45+
<Python3Version Condition="'$(Python3Version)'==''">PYTHON37</Python3Version>
46+
<PythonWinDefineConstants>$(PYTHONNET_WIN_DEFINE_CONSTANTS)</PythonWinDefineConstants>
47+
<PythonWinDefineConstants Condition="'$(PythonWinDefineConstants)'==''">UCS2</PythonWinDefineConstants>
48+
<PythonMonoDefineConstants>$(PYTHONNET_MONO_DEFINE_CONSTANTS)</PythonMonoDefineConstants>
49+
<PythonMonoDefineConstants Condition="'$(PythonMonoDefineConstants)'==''">UCS4;MONO_LINUX;PYTHON_WITH_PYMALLOC</PythonMonoDefineConstants>
50+
<PythonInteropFile Condition="'$(PythonInteropFile)'==''">$(PYTHONNET_INTEROP_FILE)</PythonInteropFile>
51+
</PropertyGroup>
52+
<PropertyGroup Condition="$(Configuration.Contains('Debug')) AND '$(TargetFramework)'=='net40'">
53+
<Optimize>false</Optimize>
54+
<DebugType>full</DebugType>
55+
</PropertyGroup>
56+
<PropertyGroup Condition="$(Configuration.Contains('Release')) AND '$(TargetFramework)'=='net40'">
57+
<Optimize>true</Optimize>
58+
<DebugType>pdbonly</DebugType>
59+
</PropertyGroup>
60+
<PropertyGroup Condition="$(Configuration.Contains('Debug')) AND '$(TargetFramework)'=='netstandard2.0'">
61+
<DebugSymbols>true</DebugSymbols>
62+
<Optimize>false</Optimize>
63+
<DebugType>full</DebugType>
64+
</PropertyGroup>
65+
<PropertyGroup Condition="$(Configuration.Contains('Release')) AND '$(TargetFramework)'=='netstandard2.0'">
66+
<DebugSymbols>true</DebugSymbols>
67+
<Optimize>true</Optimize>
68+
<DebugType>portable</DebugType>
69+
</PropertyGroup>
70+
71+
<PropertyGroup Condition=" '$(Configuration)' == 'ReleaseMono'">
72+
<DefineConstants Condition="'$(CustomDefineConstants)' == ''">$(DefineConstants);PYTHON2;$(Python2Version);$(PythonMonoDefineConstants)</DefineConstants>
73+
</PropertyGroup>
74+
<PropertyGroup Condition=" '$(Configuration)' == 'ReleaseMonoPY3'">
75+
<DefineConstants Condition="'$(CustomDefineConstants)' == ''">$(DefineConstants);PYTHON3;$(Python3Version);$(PythonMonoDefineConstants)</DefineConstants>
76+
</PropertyGroup>
77+
<PropertyGroup Condition=" '$(Configuration)' == 'DebugMono'">
78+
<DefineConstants Condition="'$(CustomDefineConstants)' == ''">$(DefineConstants);PYTHON2;$(Python2Version);$(PythonMonoDefineConstants);FINALIZER_CHECK;TRACE;DEBUG</DefineConstants>
79+
</PropertyGroup>
80+
<PropertyGroup Condition=" '$(Configuration)' == 'DebugMonoPY3'">
81+
<DefineConstants Condition="'$(CustomDefineConstants)' == ''">$(DefineConstants);PYTHON3;$(Python3Version);$(PythonMonoDefineConstants);FINALIZER_CHECK;TRACE;DEBUG</DefineConstants>
82+
</PropertyGroup>
83+
<PropertyGroup Condition=" '$(Configuration)' == 'ReleaseWin'">
84+
<DefineConstants Condition="'$(CustomDefineConstants)' == ''">$(DefineConstants);PYTHON2;$(Python2Version);$(PythonWinDefineConstants)</DefineConstants>
85+
</PropertyGroup>
86+
<PropertyGroup Condition=" '$(Configuration)' == 'ReleaseWinPY3'">
87+
<DefineConstants Condition="'$(CustomDefineConstants)' == ''">$(DefineConstants);PYTHON3;$(Python3Version);$(PythonWinDefineConstants)</DefineConstants>
88+
</PropertyGroup>
89+
<PropertyGroup Condition=" '$(Configuration)' == 'DebugWin'">
90+
<DefineConstants Condition="'$(CustomDefineConstants)' == ''">$(DefineConstants);PYTHON2;$(Python2Version);$(PythonWinDefineConstants);FINALIZER_CHECK;TRACE;DEBUG</DefineConstants>
91+
</PropertyGroup>
92+
<PropertyGroup Condition=" '$(Configuration)' == 'DebugWinPY3'">
93+
<DefineConstants Condition="'$(CustomDefineConstants)' == ''">$(DefineConstants);PYTHON3;$(Python3Version);$(PythonWinDefineConstants);FINALIZER_CHECK;TRACE;DEBUG</DefineConstants>
94+
</PropertyGroup>
95+
96+
<ItemGroup Condition=" '$(PythonInteropFile)' != '' ">
97+
<Compile Remove="interop*.cs" />
98+
<Compile Include="interop.cs" />
99+
<Compile Include="$(PythonInteropFile)" />
100+
</ItemGroup>
101+
102+
<ItemGroup>
103+
<None Include="..\pythonnet.snk" />
104+
</ItemGroup>
105+
<ItemGroup>
106+
<None Remove="resources\clr.py" />
107+
</ItemGroup>
108+
109+
<ItemGroup>
110+
<Compile Include="..\SharedAssemblyInfo.cs" Link="Properties\SharedAssemblyInfo.cs" />
111+
</ItemGroup>
112+
113+
<ItemGroup>
114+
<EmbeddedResource Include="resources\clr.py">
115+
<LogicalName>clr.py</LogicalName>
116+
</EmbeddedResource>
117+
</ItemGroup>
118+
119+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
120+
<PackageReference Include="System.Security.Permissions" Version="4.4.0" />
121+
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" />
122+
</ItemGroup>
123+
124+
<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
125+
<Reference Include="Microsoft.CSharp" />
126+
</ItemGroup>
127+
128+
<ItemGroup Condition="'$(TargetFramework)'=='net40'">
129+
<PackageReference Include="Microsoft.TargetingPack.NETFramework.v4.5" Version="1.0.1" ExcludeAssets="All" PrivateAssets="All" />
130+
</ItemGroup>
131+
132+
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
133+
134+
<PropertyGroup>
135+
<TargetAssembly>$(TargetPath)</TargetAssembly>
136+
<TargetAssemblyPdb>$(TargetDir)$(TargetName).pdb</TargetAssemblyPdb>
137+
</PropertyGroup>
138+
139+
<Target Name="BeforeBuild" Condition="'$(TargetFramework)'=='net40' AND $(Configuration.Contains('Mono')) AND '$(OS)' != 'Windows_NT'">
140+
<!--Endless war!-->
141+
<Exec Command="[[ -e $(NuGetPackageRoot)/microsoft.targetingpack.netframework.v4.5/1.0.1/lib/net45/System.Xml.dll ]] || cp $(NuGetPackageRoot)/microsoft.targetingpack.netframework.v4.5/1.0.1/lib/net45/System.XML.dll $(NuGetPackageRoot)/microsoft.targetingpack.netframework.v4.5/1.0.1/lib/net45/System.Xml.dll" />
142+
</Target>
143+
<Target Name="AfterBuild">
144+
<Copy Condition="'$(TargetFramework)'=='net40'" SourceFiles="$(TargetAssembly)" DestinationFolder="$(PythonBuildDir)" />
145+
<!--Copy SourceFiles="$(TargetAssemblyPdb)" Condition="Exists('$(TargetAssemblyPdb)')" DestinationFolder="$(PythonBuildDir)" /-->
146+
</Target>
147+
</Project>

src/runtime/runtime.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ public enum MachineType
229229
{
230230
i386,
231231
x86_64,
232+
armv7l,
233+
armv8,
232234
Other
233235
};
234236

@@ -247,6 +249,8 @@ public enum MachineType
247249
["amd64"] = MachineType.x86_64,
248250
["x64"] = MachineType.x86_64,
249251
["em64t"] = MachineType.x86_64,
252+
["armv7l"] = MachineType.armv7l,
253+
["armv8"] = MachineType.armv8,
250254
};
251255

252256
/// <summary>

src/runtime/typemanager.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,10 @@ public static NativeCode Active
510510
return I386;
511511
case Runtime.MachineType.x86_64:
512512
return X86_64;
513+
case Runtime.MachineType.armv7l:
514+
return Armv7l;
515+
case Runtime.MachineType.armv8:
516+
return Armv8;
513517
default:
514518
throw new NotImplementedException($"No support for {Runtime.MachineName}");
515519
}
@@ -546,6 +550,34 @@ public static NativeCode Active
546550
/// <see cref="NativeCode.X86_64"/>
547551
/// </summary>
548552
public static readonly NativeCode I386 = X86_64;
553+
554+
public static readonly NativeCode Armv7l = new NativeCode()
555+
{
556+
Return0 = 0,
557+
Return1 = 0x08,
558+
Code = new byte[]
559+
{
560+
0xe3, 0xa0, 0x00, 0x00, // mov r0, #0
561+
0xe1, 0x2f, 0xff, 0x1e, // bx lr
562+
563+
0xe3, 0xa0, 0x00, 0x01, // mov r0, #1
564+
0xe1, 0x2f, 0xff, 0x1e, // bx lr
565+
}
566+
};
567+
568+
public static readonly NativeCode Armv8 = new NativeCode()
569+
{
570+
Return0 = 0,
571+
Return1 = 0x08,
572+
Code = new byte[]
573+
{
574+
0x52, 0x80, 0x00, 0x00, // mov w0, #0x0
575+
0xd6, 0x5f, 0x03, 0xc0, // ret
576+
577+
0x52, 0x80, 0x00, 0x20, // mov w0, #0x1
578+
0xd6, 0x5f, 0x03, 0xc0, // ret
579+
}
580+
};
549581
}
550582

551583
/// <summary>

0 commit comments

Comments
 (0)
X Tutup