Skip to content

Commit

Permalink
Remove .NET Core 2.1 (#801)
Browse files Browse the repository at this point in the history
* Remove .NET Core 2.1

* Update IronPythonConsoleAny

* Update test_env
  • Loading branch information
slozier authored Nov 26, 2021
1 parent 51e2924 commit 689535c
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 26 deletions.
2 changes: 2 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>

<ProduceReferenceAssembly>false</ProduceReferenceAssembly>

<!-- Don't include SourceRevisionId in InformationalVersion (SourceLink) - causes issues with IronPython.Runtime.CurrentVersion if true -->
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>

Expand Down
19 changes: 8 additions & 11 deletions Package/nuget/IronPython.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>IronPython</id>
<title>IronPython</title>
<version>2.7.10</version>
<version>2.7.12</version>
<authors>IronPython Contributors,Microsoft</authors>
<owners>IronPython Community</owners>
<projectUrl>http://ironpython.net</projectUrl>
Expand All @@ -18,26 +18,23 @@
<group targetFramework="net45">
<dependency id="DynamicLanguageRuntime" version="1.3.0" />
</group>
<group targetFramework="netcoreapp2.1">
<dependency id="System.Text.Encoding.CodePages" version="4.6.0" />
<dependency id="Microsoft.Win32.Registry" version="4.5.0" />
<dependency id="DynamicLanguageRuntime" version="1.3.0" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="DynamicLanguageRuntime" version="1.3.0" />
<dependency id="System.Text.Encoding.CodePages" version="4.6.0" />
<dependency id="Microsoft.Win32.Registry" version="4.5.0" />
<dependency id="DynamicLanguageRuntime" version="1.3.0" />
<dependency id="Mono.Unix" version="7.1.0-final.1.21458.1" />
</group>
<group targetFramework="netcoreapp3.1">
<dependency id="Microsoft.Win32.Registry" version="4.7.0" />
<dependency id="DynamicLanguageRuntime" version="1.3.0" />
<dependency id="Microsoft.Win32.Registry" version="4.7.0" />
<dependency id="Mono.Unix" version="7.1.0-final.1.21458.1" />
</group>
</dependencies>
</metadata>
<files>
<file src="**\IronPython*.dll" target="lib" exclude="**\IronPythonTest.dll;**\DLLs\*.dll" />
<file src="**\IronPython*.pdb" target="lib" exclude="**\IronPythonTest.pdb;**\DLLs\*.pdb" />
<file src="**\IronPython*.xml" target="lib" exclude="**\IronPythonTest.xml;**\DLLs\*.xml" />
<file src="**\IronPython*.dll" target="lib" exclude="**\IronPythonTest.dll;**\DLLs\*.dll;netcoreapp2.1\**\*;net5.0*\**\*;net6.0*\**\*" />
<file src="**\IronPython*.pdb" target="lib" exclude="**\IronPythonTest.pdb;**\DLLs\*.pdb;netcoreapp2.1\**\*;net5.0*\**\*;net6.0*\**\*" />
<file src="**\IronPython*.xml" target="lib" exclude="**\IronPythonTest.xml;**\DLLs\*.xml;netcoreapp2.1\**\*;net5.0*\**\*;net6.0*\**\*" />
<file src="LICENSE;README.md" />
</files>
</package>
2 changes: 1 addition & 1 deletion Package/zip/Zip.Packaging.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<MakeDir Directories="$(PackageDir)" Condition="!Exists('$(PackageDir)')"/>

<ItemGroup>
<ZipFiles Include="$(StageDir)\**\*.*" Exclude="$(StageDir)\**\IronPythonTest.*;$(StageDir)\**\*.pdb" />
<ZipFiles Include="$(StageDir)\**\*.*" Exclude="$(StageDir)\**\IronPythonTest.*;$(StageDir)\**\*.pdb;$(StageDir)\netcoreapp2.1\**\*;$(StageDir)\net5.0*\**\*;$(StageDir)\net6.0*\**\*" />
</ItemGroup>
<Zip Files="@(ZipFiles)" ZipFileName="$(PackageDir)\IronPython.$(PackageVersion).zip" WorkingDirectory="$(StageDir)" />

Expand Down
4 changes: 2 additions & 2 deletions Src/IronPython.Modules/IronPython.Modules.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;netcoreapp2.1;netcoreapp3.1;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net45;netcoreapp3.1;netstandard2.0</TargetFrameworks>
<BaseAddress>885063680</BaseAddress>
<CodeAnalysisRuleSet>..\..\IronPython.ruleset</CodeAnalysisRuleSet>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down Expand Up @@ -33,7 +33,7 @@
</PackageReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' or '$(TargetFramework)' == 'netstandard2.0' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Microsoft.Win32.Registry" Version="4.5.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Src/IronPython.SQLite/IronPython.SQLite.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;netcoreapp2.1;netcoreapp3.1;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net45;netcoreapp3.1;netstandard2.0</TargetFrameworks>
<DocumentationFile>$(OutputPath)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<SQLiteCommon>SQLITE_DEBUG;TRUE;WIN32;_MSC_VER;SQLITE_ASCII;SQLITE_MEM_POOL;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_OS_WIN;SQLITE_SYSTEM_MALLOC;VDBE_PROFILE_OFF</SQLiteCommon>
<SQLiteCommonOmit>SQLITE_OMIT_AUTHORIZATION;SQLITE_OMIT_DEPRECATED;SQLITE_OMIT_GET_TABLE;SQLITE_OMIT_INCRBLOB;SQLITE_OMIT_LOOKASIDE;SQLITE_OMIT_SHARED_CACHE;SQLITE_OMIT_UTF16;SQLITE_OMIT_WAL</SQLiteCommonOmit>
Expand Down
2 changes: 1 addition & 1 deletion Src/IronPython.Wpf/DynamicXamlReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.

#if NETCOREAPP3_1
#if NETCOREAPP3_1_OR_GREATER

using System;
using System.Xaml;
Expand Down
4 changes: 2 additions & 2 deletions Src/IronPython.Wpf/_wpf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.

#if FEATURE_WPF || NETCOREAPP3_1
#if FEATURE_WPF || NETCOREAPP3_1_OR_GREATER

using System.IO;
using System.Runtime.CompilerServices;
Expand All @@ -15,7 +15,7 @@
using IronPython.Runtime;
using IronPython.Runtime.Operations;

#if NETCOREAPP3_1
#if NETCOREAPP3_1_OR_GREATER
using Microsoft.Internal.Scripting.Runtime; // TODO: get rid of this once DynamicXamlReader is in the DLR
#endif

Expand Down
4 changes: 2 additions & 2 deletions Src/IronPython/IronPython.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;netcoreapp2.1;netcoreapp3.1;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net45;netcoreapp3.1;netstandard2.0</TargetFrameworks>
<BaseAddress>879755264</BaseAddress>
<CodeAnalysisRuleSet>..\..\IronPython.ruleset</CodeAnalysisRuleSet>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down Expand Up @@ -61,7 +61,7 @@
</PackageReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' or '$(TargetFramework)' == 'netstandard2.0' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.6.0" />
</ItemGroup>

Expand Down
5 changes: 3 additions & 2 deletions Src/IronPython/Lib/iptest/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
import System
import clr
is_netcoreapp = clr.IsNetCoreApp
is_netcoreapp21 = clr.TargetFramework == ".NETCoreApp,Version=v2.1"
is_netcoreapp31 = clr.TargetFramework == ".NETCoreApp,Version=v3.1"
is_netcoreapp21 = clr.FrameworkDescription.startswith(".NET Core 2.x")
is_netcoreapp31 = clr.FrameworkDescription.startswith(".NET Core 3.1")
is_net50 = clr.FrameworkDescription.startswith(".NET 5.0")
if is_netcoreapp: clr.AddReference("System.Runtime.Extensions")
is_posix = sys.platform == 'posix' or System.Environment.OSVersion.Platform == System.PlatformID.Unix
is_osx = os.path.exists('/System/Library/CoreServices/SystemVersion.plist')
Expand Down
6 changes: 4 additions & 2 deletions Src/IronPython/Runtime/ClrModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ namespace IronPython.Runtime {
public static class ClrModule {
#if NETCOREAPP
public static readonly bool IsNetCoreApp = true;
#else
#elif NETFRAMEWORK
public static readonly bool IsNetCoreApp = false;
#else
public static readonly bool IsNetCoreApp = FrameworkDescription.StartsWith(".NET", StringComparison.Ordinal) && !FrameworkDescription.StartsWith(".NET Framework", StringComparison.Ordinal);
#endif

public static string TargetFramework => typeof(ClrModule).Assembly.GetCustomAttribute<TargetFrameworkAttribute>()?.FrameworkName;
Expand All @@ -59,7 +61,7 @@ public static class ClrModule {
public static readonly bool IsDebug = false;
#endif

internal static string FrameworkDescription {
public static string FrameworkDescription {
get {
#if FEATURE_RUNTIMEINFORMATION
var frameworkDescription = RuntimeInformation.FrameworkDescription;
Expand Down
24 changes: 22 additions & 2 deletions Src/IronPython/Runtime/ExtensionMethodSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ public AssemblyLoadInfo EnsureTypesLoaded() {
}
}

#if FEATURE_ASSEMBLY_GETFORWARDEDTYPES
Type[] forwardedTypes;
try {
forwardedTypes = _asm.GetForwardedTypes();
Expand All @@ -134,7 +133,6 @@ public AssemblyLoadInfo EnsureTypesLoaded() {
loadedTypes.Add(DynamicHelpers.GetPythonTypeFromType(type));
}
}
#endif
}

var info = new AssemblyLoadInfo(_asm);
Expand Down Expand Up @@ -488,4 +486,26 @@ internal static ExtensionMethodSet AddExtensions(ExtensionMethodSet extensionMet
}
#endif
}

#if !FEATURE_ASSEMBLY_GETFORWARDEDTYPES
internal static class AssemblyExtensions {
#if NETSTANDARD2_0
private static readonly MethodInfo GetForwardedTypesMethodInfo = typeof(Assembly).GetMethod("GetForwardedTypes", Array.Empty<Type>());

internal static Type[] GetForwardedTypes(this Assembly assembly) {
if (GetForwardedTypesMethodInfo is not null) {
// just in case we're running on .NET Core 2.1...
try {
return GetForwardedTypesMethodInfo.Invoke(assembly, null) as Type[] ?? Array.Empty<Type>();
} catch (TargetInvocationException ex) {
throw ex.InnerException;
}
}
return Array.Empty<Type>();
}
#else
internal static Type[] GetForwardedTypes(this Assembly assembly) => ReflectionUtils.EmptyTypes;
#endif
}
#endif
}
2 changes: 2 additions & 0 deletions Src/IronPythonConsoleAny/IronPythonConsoleAny.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<ProjectReference Include="..\IronPython\IronPython.csproj" />
<ProjectReference Include="..\IronPython.Modules\IronPython.Modules.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<OutputItemType>Content</OutputItemType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</ProjectReference>
</ItemGroup>

Expand Down

0 comments on commit 689535c

Please sign in to comment.