Unverified Commit e20b8411 authored by David McFarland's avatar David McFarland Committed by GitHub
Browse files

clr-loader: 0.2.7 -> 0.2.10 + it and pythonnet to use .NET SDK 10 (#486605)

parents 007616aa e8c92f13
Loading
Loading
Loading
Loading
+17 −9
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  lib,
  fetchPypi,
  buildPythonPackage,
  pythonAtLeast,
  pytestCheckHook,
  dotnetCorePackages,
  setuptools,
@@ -13,17 +14,25 @@

let
  pname = "clr-loader";
  version = "0.2.7.post0";
  version = "0.2.10";
  src = fetchPypi {
    pname = "clr_loader";
    inherit version;
    hash = "sha256-t6iz+PuxvLu2OC2IfiHRdC1PELXqIJ5K2VVo/pfhx8Y=";
    hash = "sha256-gfEUr7xQBbr8Xv5a8TQdQA4iE34nWwQqiXnz/rn8lEY=";
  };
  patches = [ ./dotnet-8-upgrade.patch ];
  # This stops msbuild from picking up $version from the environment
  postPatch = ''
    echo '<Project><PropertyGroup><Version/></PropertyGroup></Project>' > \
      Directory.Build.props

    substituteInPlace example/example.csproj \
      --replace-fail 'net8.0;netstandard2.0' 'net10.0;netstandard2.0'

    substituteInPlace tests/test_common.py \
      --replace-fail 'return build_example(tmp_path_factory, "net8.0")' \
        'return build_example(tmp_path_factory, "net10.0")' \
      --replace-fail 'def test_coreclr_properties(example_netcore: Path):' \
        'def test_coreclr_properties(example_netcore: Path, example_netstandard: Path):'
  '';

  # This buildDotnetModule is used only to get nuget sources, the actual
@@ -33,7 +42,6 @@ let
      pname
      version
      src
      patches
      postPatch
      ;
    projectFile = [
@@ -41,7 +49,7 @@ let
      "example/example.csproj"
    ];
    nugetDeps = ./deps.json;
    dotnet-sdk = dotnetCorePackages.sdk_8_0;
    dotnet-sdk = dotnetCorePackages.sdk_10_0;
  };
in
buildPythonPackage {
@@ -49,19 +57,20 @@ buildPythonPackage {
    pname
    version
    src
    patches
    postPatch
    ;

  disabled = pythonAtLeast "3.14";

  pyproject = true;

  buildInputs = dotnetCorePackages.sdk_8_0.packages ++ dotnet-build.nugetDeps;
  buildInputs = dotnetCorePackages.sdk_10_0.packages ++ dotnet-build.nugetDeps;

  nativeBuildInputs = [
    setuptools
    setuptools-scm
    wheel
    dotnetCorePackages.sdk_8_0
    dotnetCorePackages.sdk_10_0
  ];

  propagatedBuildInputs = [ cffi ];
@@ -94,6 +103,5 @@ buildPythonPackage {
    homepage = "https://pythonnet.github.io/clr-loader/";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ mdarocha ];
    broken = true;
  };
}
+10 −5
Original line number Diff line number Diff line
@@ -9,15 +9,20 @@
    "version": "1.0.0",
    "hash": "sha256-6faPQ4jaFY3OGGVk3lZKW+DEZaIOBZ/wHqbiDTsRR1k="
  },
  {
    "pname": "Microsoft.NETFramework.ReferenceAssemblies",
    "version": "1.0.3",
    "hash": "sha256-FBoJP5DHZF0QHM0xLm9yd4HJZVQOuSpSKA+VQRpphEE="
  },
  {
    "pname": "Microsoft.NETFramework.ReferenceAssemblies.net461",
    "version": "1.0.0",
    "hash": "sha256-oS7sUMzKBkLmhggqbI6eBqb1OPAipH0TDTaDaBixcwM="
  },
  {
    "pname": "Microsoft.NETFramework.ReferenceAssemblies.net47",
    "version": "1.0.0",
    "hash": "sha256-Jh40dua+AQpSUGTOCQG493sJzbfqH+yIgyoA6+A1ZQM="
    "pname": "Microsoft.NETFramework.ReferenceAssemblies.net472",
    "version": "1.0.3",
    "hash": "sha256-/6ClVwo5+RE5kWTQWB/93vmbXj37ql8iDlziKWm89Xw="
  },
  {
    "pname": "NETStandard.Library",
@@ -26,7 +31,7 @@
  },
  {
    "pname": "NXPorts",
    "version": "1.0.0",
    "hash": "sha256-kpqQDljgsCBRDqbuJkgwClG3dkgjrBAhtXoPZlJR+ws="
    "version": "1.1.0",
    "hash": "sha256-etygV3Z2OnkrErt/1WVMHCGuvO00YtxxfFmp0W7x6is="
  }
]
+0 −31
Original line number Diff line number Diff line
diff --git a/example/example.csproj b/example/example.csproj
index fd6d566..ed76d15 100644
--- a/example/example.csproj
+++ b/example/example.csproj
@@ -1,6 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
-    <TargetFrameworks>net60;netstandard20</TargetFrameworks>
+    <TargetFrameworks>net8.0;netstandard2.0</TargetFrameworks>
     <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
   </PropertyGroup>
   <ItemGroup>
diff --git a/tests/test_common.py b/tests/test_common.py
index 8a9e36d..8370024 100644
--- a/tests/test_common.py
+++ b/tests/test_common.py
@@ -8,12 +8,12 @@ from pathlib import Path
 
 @pytest.fixture(scope="session")
 def example_netstandard(tmpdir_factory):
-    return build_example(tmpdir_factory, "netstandard20")
+    return build_example(tmpdir_factory, "netstandard2.0")
 
 
 @pytest.fixture(scope="session")
 def example_netcore(tmpdir_factory):
-    return build_example(tmpdir_factory, "net60")
+    return build_example(tmpdir_factory, "net8.0")
 
 
 def build_example(tmpdir_factory, framework):
+20 −4
Original line number Diff line number Diff line
@@ -2,10 +2,11 @@
  lib,
  fetchFromGitHub,
  buildPythonPackage,
  pythonAtLeast,
  pytestCheckHook,
  pycparser,
  psutil,
  dotnet-sdk_6,
  dotnet-sdk_10,
  buildDotnetModule,
  clr-loader,
  setuptools,
@@ -28,24 +29,39 @@ let
    projectFile = "src/runtime/Python.Runtime.csproj";
    testProjectFile = "src/testing/Python.Test.csproj";
    nugetDeps = ./deps.json;
    dotnet-sdk = dotnet-sdk_6;
    dotnet-sdk = dotnet-sdk_10;
  };
in
buildPythonPackage {
  inherit pname version src;

  disabled = pythonAtLeast "3.14";

  pyproject = true;

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace 'dynamic = ["version"]' 'version = "${version}"'
      --replace-fail 'dynamic = ["version"]' 'version = "${version}"'

    # .NET SDK 10 uses a newer toolchain that triggers NonCopyableAnalyzer failures
    # in this release; disable analyzers for the Nix build to keep the package building.
    substituteInPlace Directory.Build.props \
      --replace-fail '</PropertyGroup>' $'  <RunAnalyzers>false</RunAnalyzers>\n  </PropertyGroup>'

    # Tests (run with --runtime=coreclr) need a CoreCLR target; net6.0 requires a
    # runtime that isn't shipped with the .NET 10 SDK, so target net10.0 instead.
    substituteInPlace src/testing/Python.Test.csproj \
      --replace-fail 'netstandard2.0;net6.0' 'netstandard2.0;net10.0'

    substituteInPlace tests/conftest.py \
      --replace-fail '        # fw = "net6.0"' '        fw = "net10.0"'
  '';

  buildInputs = dotnet-build.nugetDeps;

  nativeBuildInputs = [
    setuptools
    dotnet-sdk_6
    dotnet-sdk_10
  ];

  propagatedBuildInputs = [