Unverified Commit 0f0d895c authored by Emily's avatar Emily Committed by GitHub
Browse files

python312Packages.scales: use pytestCheckHook; modernize (#348559)

parents 959200a0 6305fa48
Loading
Loading
Loading
Loading
+28 −9
Original line number Diff line number Diff line
@@ -2,29 +2,48 @@
  lib,
  buildPythonPackage,
  fetchPypi,
  nose,
  pytestCheckHook,
  fetchpatch2,
  six,
  setuptools,
}:

buildPythonPackage rec {
  pname = "scales";
  version = "1.0.9";
  format = "setuptools";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    sha256 = "8b6930f7d4bf115192290b44c757af5e254e3fcfcb75ff9a51f5c96a404e2753";
    hash = "sha256-i2kw99S/EVGSKQtEx1evXiVOP8/Ldf+aUfXJakBOJ1M=";
  };

  nativeCheckInputs = [ nose ];
  propagatedBuildInputs = [ six ];
  patches = [
    # Use html module in Python 3 and cgi module in Python 2
    # https://github.com/Cue/scales/pull/47
    (fetchpatch2 {
      url = "https://github.com/Cue/scales/commit/ee69d45f1a7f928f7b241702e9be06007444115e.patch?full_index=1";
      hash = "sha256-xBlgkh1mf+3J7GtNI0zGb7Sum8UYbTpUmM12sxK/fSU=";
    })
  ];

  # No tests included
  doCheck = false;
  postPatch = ''
    for file in scales_test formats_test aggregation_test; do
      substituteInPlace src/greplin/scales/$file.py \
        --replace-fail "assertEquals" "assertEqual"
    done;
  '';

  meta = with lib; {
  build-system = [ setuptools ];

  dependencies = [ six ];

  nativeCheckInputs = [ pytestCheckHook ];

  meta = {
    description = "Stats for Python processes";
    homepage = "https://www.github.com/Cue/scales";
    license = licenses.asl20;
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ pyrox0 ];
  };
}