1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 cython,
9 setuptools,
10
11 # native dependencies
12 libxml2,
13 libxslt,
14 zlib,
15 xcodebuild,
16}:
17
18buildPythonPackage rec {
19 pname = "lxml";
20 version = "5.2.2";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "lxml";
25 repo = "lxml";
26 rev = "refs/tags/lxml-${version}";
27 hash = "sha256-c9r2uqjXmQOXyPCsJTzi1OatkQ9rhJbKqpxaoFz2l18=";
28 };
29
30 # setuptoolsBuildPhase needs dependencies to be passed through nativeBuildInputs
31 nativeBuildInputs = [
32 libxml2.dev
33 libxslt.dev
34 cython
35 setuptools
36 ] ++ lib.optionals stdenv.isDarwin [ xcodebuild ];
37 buildInputs = [
38 libxml2
39 libxslt
40 zlib
41 ];
42
43 env = lib.optionalAttrs stdenv.cc.isClang {
44 NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-function-pointer-types";
45 };
46
47 # tests are meant to be ran "in-place" in the same directory as src
48 doCheck = false;
49
50 pythonImportsCheck = [
51 "lxml"
52 "lxml.etree"
53 ];
54
55 meta = with lib; {
56 changelog = "https://github.com/lxml/lxml/blob/lxml-${version}/CHANGES.txt";
57 description = "Pythonic binding for the libxml2 and libxslt libraries";
58 homepage = "https://lxml.de";
59 license = licenses.bsd3;
60 maintainers = [ ];
61 };
62}