Skip to content

Commit

Permalink
Merge pull request #330739 from pyrox0/denose/python-hglib
Browse files Browse the repository at this point in the history
python312Packages.python-hglib: Remove nose dependency; modernize
  • Loading branch information
emilazy committed Jul 31, 2024
2 parents 88b35f7 + 43a5b1e commit a6100a4
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 62 deletions.
8 changes: 8 additions & 0 deletions pkgs/applications/misc/mozphab/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ python3.pkgs.buildPythonApplication rec {
export HOME=$(mktemp -d)
'';

disabledTests = [
# AttributeError: 'called_once' is not a valid assertion.
"test_commit"
# AttributeError: 'not_called' is not a valid assertion.
"test_finalize_no_evolve"
"test_patch"
];

disabledTestPaths = [
# codestyle doesn't matter to us
"tests/test_style.py"
Expand Down
26 changes: 11 additions & 15 deletions pkgs/development/python-modules/glean-parser/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,39 @@
jinja2,
jsonschema,
pytestCheckHook,
pythonOlder,
pyyaml,
setuptools,
setuptools-scm,
yamllint,
}:

buildPythonPackage rec {
pname = "glean-parser";
version = "14.1.2";
format = "setuptools";

disabled = pythonOlder "3.8";
version = "14.3.0";
pyproject = true;

src = fetchPypi {
pname = "glean_parser";
inherit version;
hash = "sha256-OL59Tg+rD4M0DjQnkU4IqGMcf6sIioxg6bVDyrbqgww=";
hash = "sha256-tI1kMCn7gksLdq2ytKAOiKSd5OxHmsnFrdUsUR6b5IE=";
};

postPatch = ''
substituteInPlace setup.py \
--replace "pytest-runner" "" \
--replace "MarkupSafe>=1.1.1,<=2.0.1" "MarkupSafe>=1.1.1"
--replace-fail "pytest-runner" ""
'';

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

propagatedBuildInputs = [
dependencies = [
appdirs
click
diskcache
jinja2
jsonschema
pyyaml
setuptools
yamllint
];

nativeCheckInputs = [ pytestCheckHook ];
Expand All @@ -63,12 +59,12 @@ buildPythonPackage rec {

pythonImportsCheck = [ "glean_parser" ];

meta = with lib; {
meta = {
description = "Tools for parsing the metadata for Mozilla's glean telemetry SDK";
mainProgram = "glean_parser";
homepage = "https://github.com/mozilla/glean_parser";
changelog = "https://github.com/mozilla/glean_parser/blob/v${version}/CHANGELOG.md";
license = licenses.mpl20;
license = lib.licenses.mpl20;
maintainers = [ ];
};
}
56 changes: 21 additions & 35 deletions pkgs/development/python-modules/glean-sdk/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,41 @@
stdenv,
lib,
buildPythonPackage,
cargo,
cffi,
fetchPypi,
fetchFromGitHub,
glean-parser,
iso8601,
lmdb,
pkg-config,
pytest-localserver,
pytestCheckHook,
python,
pythonOlder,
rustc,
rustPlatform,
semver,
setuptools-rust,
setuptools,
}:

buildPythonPackage rec {
pname = "glean-sdk";
version = "52.7.0";
format = "setuptools";
version = "60.4.0";
pyproject = true;

disabled = pythonOlder "3.6";

src = fetchPypi {
inherit pname version;
hash = "sha256-sLjdGHiS7Co/oA9gQyAFkD14tAYjmwjWcPr4CRrzw/0=";
src = fetchFromGitHub {
owner = "mozilla";
repo = "glean";
rev = "v${version}";
hash = "sha256-C3wQdxPNBPQN6eUK6Vq0bA6Wpqb28e9BTBf7c/hTQxU=";
};

cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
name = "${pname}-${version}";
hash = "sha256-5TlgWcLmjklxhtDbB0aRF71iIRTJwetFj1Jii1DGdvU=";
hash = "sha256-XqOCHnvM64kZNifU5Wt/bFAvyRVy28ozWSwlvm/sMk8=";
};

nativeBuildInputs = [
cargo
pkg-config
rustc
build-system = [
rustPlatform.cargoSetupHook
setuptools-rust
rustPlatform.maturinBuildHook
setuptools
];

buildInputs = [ lmdb ];

propagatedBuildInputs = [
cffi
dependencies = [
glean-parser
iso8601
semver
];

Expand All @@ -59,23 +45,23 @@ buildPythonPackage rec {
pytestCheckHook
];

pytestFlagsArray = [ "glean-core/python/tests" ];

disabledTests = [
# RuntimeError: No ping received.
"test_client_activity_api"
"test_flipping_upload_enabled_respects_order_of_events"
# A warning causes this test to fail
"test_get_language_tag_reports_the_tag_for_the_default_locale"
];

postInstallCheck = lib.optionalString stdenv.hostPlatform.isElf ''
readelf -a $out/${python.sitePackages}/glean/libglean_ffi.so | grep -F 'Shared library: [liblmdb.so'
'';

pythonImportsCheck = [ "glean" ];

meta = with lib; {
meta = {
broken = stdenv.isDarwin;
description = "Telemetry client libraries and are a part of the Glean project";
homepage = "https://mozilla.github.io/glean/book/index.html";
license = licenses.mpl20;
maintainers = with maintainers; [ melling ];
license = lib.licenses.mpl20;
maintainers = with lib.maintainers; [ melling ];
};
}
36 changes: 27 additions & 9 deletions pkgs/development/python-modules/python-hglib/default.nix
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
{
lib,
buildPythonPackage,
fetchPypi,
fetchzip,
mercurial,
nose,
pytestCheckHook,
fetchpatch2,
setuptools,
}:

buildPythonPackage rec {
pname = "python-hglib";
version = "2.6.2";
format = "setuptools";
pyproject = true;

src = fetchPypi {
inherit pname version;
hash = "sha256-sYvR7VPJDuV9VxTWata7crZOkw1K7KmDCJLAi7KNpgg=";
src = fetchzip {
url = "https://repo.mercurial-scm.org/python-hglib/archive/${version}.tar.gz";
hash = "sha256-UXersegqJ9VAxy4Kvpb2IiOJfQbWryeeaGvwiR4ncW8=";
};

patches = [
(fetchpatch2 {
name = "remove-nose.patch";
excludes = [ "heptapod-ci.yml" ];
url = "https://repo.mercurial-scm.org/python-hglib/raw-rev/8341f2494b3fc1c0d9ee55fa4487c0ac82f64d2a";
hash = "sha256-4gicVCAH94itxHY0l8ek0L/RVhUrw2lMbbnENbWrV6U=";
})
(fetchpatch2 {
name = "fix-tests.patch";
url = "https://repo.mercurial-scm.org/python-hglib/raw-rev/a2afbf236ca86287e72f54e1248413625d1bc405";
hash = "sha256-T/yKJ8cMMOBVk24SXwyPOoD321S1fZEIunaPJAxI0KI=";
})
];

build-system = [ setuptools ];

nativeCheckInputs = [
mercurial
nose
pytestCheckHook
];

preCheck = ''
Expand All @@ -28,10 +46,10 @@ buildPythonPackage rec {

pythonImportsCheck = [ "hglib" ];

meta = with lib; {
meta = {
description = "Library with a fast, convenient interface to Mercurial. It uses Mercurial’s command server for communication with hg";
homepage = "https://www.mercurial-scm.org/wiki/PythonHglibs";
license = licenses.mit;
license = lib.licenses.mit;
maintainers = [ ];
};
}
4 changes: 1 addition & 3 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4972,9 +4972,7 @@ self: super: with self; {

glean-parser = callPackage ../development/python-modules/glean-parser { };

glean-sdk = callPackage ../development/python-modules/glean-sdk {
inherit (pkgs) lmdb;
};
glean-sdk = callPackage ../development/python-modules/glean-sdk { };

glfw = callPackage ../development/python-modules/glfw { };

Expand Down

0 comments on commit a6100a4

Please sign in to comment.