Commit 233fb37a authored by Robert Schütz's avatar Robert Schütz
Browse files
parent 2ad4dc8c
Loading
Loading
Loading
Loading
+12 −16
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,
  fetchFromGitHub,
  pytest-mock,
  pytestCheckHook,
  pythonAtLeast,
  pythonOlder,
  setuptools,
}:

buildPythonPackage rec {
  pname = "restrictedpython";
  version = "8.0";
  version = "8.1";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-OvIxK8Z+X87Yh/uFsAbImGHackiBKLFVvuqB62oKmyQ=";
  src = fetchFromGitHub {
    owner = "zopefoundation";
    repo = "RestrictedPython";
    tag = version;
    hash = "sha256-UcmH1I2p+XmQm4Y5M+Ms/LMSchor6GD6V9dxippa4HI=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail "setuptools <= 75.6.0" setuptools
      --replace-fail "setuptools >= 78.1.1,< 81" setuptools
  '';

  build-system = [ setuptools ];
@@ -33,15 +31,13 @@ buildPythonPackage rec {
    pytest-mock
  ];

  disabledTests = lib.optionals (pythonAtLeast "3.11") [ "test_compile__compile_restricted_exec__5" ];

  pythonImportsCheck = [ "RestrictedPython" ];

  meta = with lib; {
  meta = {
    description = "Restricted execution environment for Python to run untrusted code";
    homepage = "https://github.com/zopefoundation/RestrictedPython";
    changelog = "https://github.com/zopefoundation/RestrictedPython/blob/${version}/CHANGES.rst";
    license = licenses.zpl21;
    maintainers = with maintainers; [ juaningan ];
    changelog = "https://github.com/zopefoundation/RestrictedPython/blob/${src.tag}/CHANGES.rst";
    license = lib.licenses.zpl21;
    maintainers = with lib.maintainers; [ juaningan ];
  };
}