Merge pull request #146430 from kvark/moz-phab

This commit is contained in:
Sandro 2021-11-29 21:03:19 +01:00 committed by GitHub
commit 047671c50c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 238 additions and 0 deletions

View file

@ -6382,6 +6382,13 @@
githubId = 449813;
name = "Roman Kuznetsov";
};
kvark = {
name = "Dzmitry Malyshau";
email = "kvark@fastmail.com";
matrix = "@kvark:matrix.org";
github = "kvark";
githubId = 107301;
};
kwohlfahrt = {
email = "kai.wohlfahrt@gmail.com";
github = "kwohlfahrt";

View file

@ -0,0 +1,57 @@
{ lib
, buildPythonApplication
, fetchPypi
, mercurial
# build inputs
, distro
, glean-sdk
, python-hglib
, sentry-sdk
, setuptools
}:
buildPythonApplication rec {
pname = "moz-phab";
version = "0.1.99";
src = fetchPypi {
pname = "MozPhab";
inherit version;
sha256 = "sha256-uKoMMSp5AIvB1qTRYAh7n1+2dDLneFbssfkfTTshfcs=";
};
# Relax python-hglib requirement
# https://phabricator.services.mozilla.com/D131618
postPatch = ''
substituteInPlace setup.py \
--replace "==" ">="
'';
propagatedBuildInputs = [
distro
glean-sdk
python-hglib
sentry-sdk
setuptools
];
checkInputs = [
mercurial
];
preCheck = ''
export HOME=$(mktemp -d)
'';
meta = with lib; {
description = "Phabricator CLI from Mozilla to support submission of a series of commits";
longDescription = ''
moz-phab is a custom command-line tool, which communicates to
Phabricators API, providing several conveniences, including support for
submitting series of commits.
'';
homepage = "https://moz-conduit.readthedocs.io/en/latest/phabricator-user.html";
license = licenses.mpl20;
maintainers = [ maintainers.kvark ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,61 @@
{ lib
, buildPythonPackage
, fetchPypi
, pytestCheckHook
, pythonOlder
, setuptools-scm
# build inputs
, appdirs
, click
, diskcache
, jinja2
, jsonschema
, pyyaml
, yamllint
}:
buildPythonPackage rec {
pname = "glean_parser";
version = "4.3.1";
disabled = pythonOlder "3.6";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-wZSro1pX/50TlSfFMh71JlmXlJlONVutTDFL06tkw+s=";
};
postPatch = ''
substituteInPlace setup.py --replace "pytest-runner" ""
'';
propagatedBuildInputs = [
appdirs
click
diskcache
jinja2
jsonschema
pyyaml
yamllint
];
nativeBuildInputs = [
setuptools-scm
];
checkInputs = [
pytestCheckHook
];
disabledTests = [
# https://bugzilla.mozilla.org/show_bug.cgi?id=1741668
"test_validate_ping"
];
pythonImportsCheck = [ "glean_parser" ];
meta = with lib; {
description = "Tools for parsing the metadata for Mozilla's glean telemetry SDK";
homepage = "https://github.com/mozilla/glean_parser";
license = licenses.mpl20;
maintainers = [ maintainers.kvark ];
};
}

View file

@ -0,0 +1,53 @@
{ lib
, buildPythonPackage
, fetchPypi
, rustPlatform
, rustc
, cargo
, setuptools-rust
# build inputs
, cffi
, glean-parser
}:
buildPythonPackage rec {
pname = "glean-sdk";
version = "42.2.0";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-X2p6KQnEB6ZHdCHGFVEoEMiI+0R2vfGqel+jFKTcx74=";
};
patches = [
# Fix the environment for spawned process
# https://github.com/mozilla/glean/pull/1542
./fix-spawned-process-environment.patch
];
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
name = "${pname}-${version}";
sha256 = "sha256-/+rKGPYTLovgjTGL2F/pWzlUy1tY207yuJz3Xdhm1hg=";
};
nativeBuildInputs = [
rustc
cargo
setuptools-rust
rustPlatform.cargoSetupHook
];
propagatedBuildInputs = [
cffi
glean-parser
];
pythonImportsCheck = [ "glean" ];
meta = with lib; {
description = "Modern cross-platform telemetry client libraries and are a part of the Glean project";
homepage = "https://mozilla.github.io/glean/book/index.html";
license = licenses.mpl20;
maintainers = [ maintainers.kvark ];
};
}

View file

@ -0,0 +1,20 @@
diff --git a/glean-core/python/glean/_process_dispatcher.py b/glean-core/python/glean/_process_dispatcher.py
index 33a8b12796..a39b54a917 100644
--- a/glean-core/python/glean/_process_dispatcher.py
+++ b/glean-core/python/glean/_process_dispatcher.py
@@ -120,8 +120,14 @@ def dispatch(cls, func, args) -> Union[_SyncWorkWrapper, subprocess.Popen]:
Path(".coveragerc").absolute()
)
+ # Explicitly pass the contents of `sys.path` as `PYTHONPATH` to the
+ # subprocess so that there aren't any module search path
+ # differences.
+ python_path = ":".join(sys.path)[1:]
+
p = subprocess.Popen(
- [sys.executable, _process_dispatcher_helper.__file__, payload]
+ [sys.executable, _process_dispatcher_helper.__file__, payload],
+ env={"PYTHONPATH": python_path},
)
cls._last_process = p

View file

@ -0,0 +1,32 @@
{ lib
, buildPythonPackage
, fetchPypi
, mercurial
, nose
}:
buildPythonPackage rec {
pname = "python-hglib";
version = "2.6.2";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-sYvR7VPJDuV9VxTWata7crZOkw1K7KmDCJLAi7KNpgg=";
};
checkInputs = [ mercurial nose ];
preCheck = ''
export HGTMP=$(mktemp -d)
export HGUSER=test
'';
pythonImportsCheck = [ "hglib" ];
meta = with lib; {
description = "Library with a fast, convenient interface to Mercurial. It uses Mercurials command server for communication with hg.";
homepage = "https://www.mercurial-scm.org/wiki/PythonHglibs";
license = licenses.mit;
maintainers = [ maintainers.kvark ];
};
}

View file

@ -7072,6 +7072,8 @@ with pkgs;
motion = callPackage ../applications/video/motion { };
moz-phab = python3Packages.callPackage ../applications/misc/moz-phab { };
mtail = callPackage ../servers/monitoring/mtail { };
multitail = callPackage ../tools/misc/multitail { };

View file

@ -3148,6 +3148,10 @@ in {
glcontext = callPackage ../development/python-modules/glcontext { };
glean-parser = callPackage ../development/python-modules/glean-parser { };
glean-sdk = callPackage ../development/python-modules/glean-sdk { };
glfw = callPackage ../development/python-modules/glfw { };
glob2 = callPackage ../development/python-modules/glob2 { };
@ -7599,6 +7603,8 @@ in {
python-gvm = callPackage ../development/python-modules/python-gvm { };
python-hglib = callPackage ../development/python-modules/python-hglib { };
python-hosts = callPackage ../development/python-modules/python-hosts { };
python-hpilo = callPackage ../development/python-modules/python-hpilo { };