1{
2 beautifulsoup4,
3 buildPythonPackage,
4 fetchFromGitHub,
5 html5lib,
6 lib,
7 lxml,
8 python,
9}:
10
11buildPythonPackage rec {
12 pname = "draftjs-exporter";
13 version = "5.1.0";
14 format = "setuptools";
15
16 src = fetchFromGitHub {
17 repo = "draftjs_exporter";
18 owner = "springload";
19 tag = "v${version}";
20 sha256 = "sha256-AR8CK75UdtEThE68WSE6DFSqryI509GTW1fBl1SL29w=";
21 };
22
23 optional-dependencies = {
24 lxml = [ lxml ];
25 html5lib = [
26 beautifulsoup4
27 html5lib
28 ];
29 };
30
31 checkInputs = optional-dependencies.lxml ++ optional-dependencies.html5lib;
32
33 checkPhase = ''
34 # 2 tests in this file randomly fail because they depend on the order of
35 # HTML attributes
36 rm tests/test_exports.py
37
38 ${python.interpreter} -m unittest discover
39 '';
40
41 pythonImportsCheck = [ "draftjs_exporter" ];
42
43 meta = with lib; {
44 description = "Library to convert Draft.js ContentState to HTML";
45 homepage = "https://github.com/springload/draftjs_exporter";
46 changelog = "https://github.com/springload/draftjs_exporter/blob/${src.tag}/CHANGELOG.md";
47 license = licenses.mit;
48 maintainers = with maintainers; [ sephi ];
49 };
50}