Unverified Commit dcf66dd3 authored by dotlambda's avatar dotlambda Committed by GitHub
Browse files

python3Packages.ufmt: cleanup, fix build (#455249)

parents d6a19187 032a192d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
{ python3Packages }: with python3Packages; toPythonApplication ufmt
+26 −11
Original line number Diff line number Diff line
{
  lib,
  black,
  buildPythonPackage,
  click,
  fetchFromGitHub,

  # build-system
  flit-core,

  # dependencies
  black,
  click,
  libcst,
  moreorless,
  pygls,
  pythonOlder,
  tomlkit,
  trailrunner,
  ruff-api,
  typing-extensions,
  unittestCheckHook,
  usort,

  # optional-dependencies
  pygls,
  ruff-api,

  # tests
  unittestCheckHook,
  versionCheckHook,
}:

buildPythonPackage rec {
@@ -22,8 +30,6 @@ buildPythonPackage rec {
  version = "2.8.0";
  pyproject = true;

  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "omnilib";
    repo = "ufmt";
@@ -31,6 +37,13 @@ buildPythonPackage rec {
    hash = "sha256-oEvvXUju7qne3pCwnrckplMs0kBJavB669qieXJZPKw=";
  };

  # Broken since click was updated to 8.2.1 in https://github.com/NixOS/nixpkgs/pull/448189
  # TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr'
  postPatch = ''
    substituteInPlace ufmt/tests/__init__.py \
      --replace-fail "from .cli import CliTest" ""
  '';

  build-system = [ flit-core ];

  dependencies = [
@@ -51,17 +64,19 @@ buildPythonPackage rec {

  nativeCheckInputs = [
    unittestCheckHook
    versionCheckHook
  ]
  ++ lib.flatten (builtins.attrValues optional-dependencies);
  versionCheckProgramArg = "--version";

  pythonImportsCheck = [ "ufmt" ];

  meta = with lib; {
  meta = {
    description = "Safe, atomic formatting with black and usort";
    homepage = "https://github.com/omnilib/ufmt";
    changelog = "https://github.com/omnilib/ufmt/blob/${version}/CHANGELOG.md";
    license = licenses.mit;
    maintainers = with maintainers; [ fab ];
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ fab ];
    mainProgram = "ufmt";
  };
}
+0 −2
Original line number Diff line number Diff line
@@ -4204,8 +4204,6 @@ with pkgs;
    libjpeg_turbo = libjpeg_turbo.override { enableJava = true; };
  };

  ufmt = with python3Packages; toPythonApplication ufmt;

  unbound-with-systemd = unbound.override {
    withSystemd = true;
  };