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