Unverified Commit f4c3cfc6 authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

python312Packages.cwcwidth: fix on darwin, cleanup (#401781)

parents 31357d17 b1d4b4b5
Loading
Loading
Loading
Loading
+27 −20
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchPypi,
  fetchFromGitHub,
  cython,
  pytestCheckHook,
  setuptools,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "cwcwidth";
  version = "0.1.10";
  format = "pyproject";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-dGh2D3LB9BB74bKyhUvAAEAeo2pp2u02+5ZqHhmnoSQ=";
  src = fetchFromGitHub {
    owner = "sebastinas";
    repo = "cwcwidth";
    tag = "v${version}";
    hash = "sha256-JrzItV+nCpQCz9MM1pcq5FtGZOsWNbgAra6i5WT4Mcg=";
  };

  nativeBuildInputs = [
  build-system = [
    cython
    setuptools
  ];

  nativeCheckInputs = [ pytestCheckHook ];
  nativeCheckInputs = [
    pytestCheckHook
  ];

  preCheck = ''
    # Hack needed to make pytest + cython work
    # https://github.com/NixOS/nixpkgs/pull/82410#issuecomment-827186298
    export HOME=$(mktemp -d)
    cp -r $TMP/$sourceRoot/tests $HOME
    pushd $HOME

    # locale settings used by upstream, has the effect of skipping
    # otherwise-failing tests on darwin
    # prevent import shadow
    rm -rf cwcwidth

    # locale settings used by upstream, has the effect of skipping otherwise-failing tests on darwin
    export LC_ALL='C.UTF-8'
    export LANG='C.UTF-8'
  '';
  postCheck = "popd";

  disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
    # Despite setting the locales above, this test fails with:
    # AssertionError: Tuples differ: (1, 1, 1, 1) != (1, 1, 1, 0)
    "test_combining_spacing"
  ];

  pythonImportsCheck = [ "cwcwidth" ];

  meta = with lib; {
  meta = {
    description = "Python bindings for wc(s)width";
    homepage = "https://github.com/sebastinas/cwcwidth";
    changelog = "https://github.com/sebastinas/cwcwidth/blob/main/CHANGELOG.md";
    license = licenses.mit;
    changelog = "https://github.com/sebastinas/cwcwidth/blob/v${version}/CHANGELOG.md";
    license = lib.licenses.mit;
    maintainers = [ ];
  };
}
+37 −26
Original line number Diff line number Diff line
{
  lib,
  fetchPypi,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  setuptools-scm,
  lxml,

  # dependencies
  cwcwidth,
  pytestCheckHook,
  lxml,

  # tests
  aeidon,
  charset-normalizer,
  cheroot,
  fluent-syntax,
  gettext,
  iniparse,
  vobject,
  mistletoe,
  phply,
  pyparsing,
  pytestCheckHook,
  ruamel-yaml,
  cheroot,
  fluent-syntax,
  aeidon,
  charset-normalizer,
  syrupy,
  gettext,
  vobject,
}:

buildPythonPackage rec {
  pname = "translate-toolkit";
  version = "3.15.1";
  version = "3.15.2";

  pyproject = true;
  build-system = [ setuptools-scm ];

  src = fetchPypi {
    pname = "translate_toolkit";
    inherit version;
    hash = "sha256-Omapbrcv6+A5fGb34xLdlmoh3QAXN1+5VxoCRdyX9mM=";
  src = fetchFromGitHub {
    owner = "translate";
    repo = "translate";
    tag = version;
    hash = "sha256-HZ00ds3MUrtLb6WjxpCch8CPvOuadHJXZsJRQdqge0M=";
  };

  build-system = [ setuptools-scm ];

  dependencies = [
    lxml
    cwcwidth
    lxml
  ];

  nativeCheckInputs = [
    pytestCheckHook
    aeidon
    charset-normalizer
    cheroot
    fluent-syntax
    gettext
    iniparse
    vobject
    mistletoe
    phply
    pyparsing
    pytestCheckHook
    ruamel-yaml
    cheroot
    fluent-syntax
    aeidon
    charset-normalizer
    syrupy
    gettext
    vobject
  ];

  disabledTests = [
    # Probably breaks because of nix sandbox
    "test_timezones"

    # Requires network
    "test_xliff_conformance"
  ];

  pythonImportsCheck = [ "translate" ];

  meta = with lib; {
  __darwinAllowLocalNetworking = true;

  meta = {
    description = "Useful localization tools for building localization & translation systems";
    homepage = "https://toolkit.translatehouse.org/";
    changelog = "https://docs.translatehouse.org/projects/translate-toolkit/en/latest/releases/${version}.html";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ erictapen ];
    license = lib.licenses.gpl2Plus;
    maintainers = with lib.maintainers; [ erictapen ];
  };
}