Merge branch 'master' into staging-next

This commit is contained in:
Vladimír Čunát
2019-01-10 13:07:21 +01:00
254 changed files with 5494 additions and 3475 deletions

View File

@@ -0,0 +1,39 @@
{ stdenv, buildPythonPackage, fetchFromGitHub, pytest }:
buildPythonPackage rec {
pname = "boltons";
version = "2019-01-07";
# No tests in PyPi Tarball
src = fetchFromGitHub {
owner = "mahmoud";
repo = "boltons";
rev = "3584ac9399f227a2a11b74153140ee171fd49783";
sha256 = "13xngjw249sk4vmr5kqqnia0npw0kpa0gm020a4dqid0cjyvj0rv";
};
checkInputs = [ pytest ];
checkPhase = "pytest tests";
meta = with stdenv.lib; {
homepage = https://github.com/mahmoud/boltons;
description = "220+ constructs, recipes, and snippets extending (and relying on nothing but) the Python standard library";
longDescription = ''
Boltons is a set of over 220 BSD-licensed, pure-Python utilities
in the same spirit as and yet conspicuously missing from the
standard library, including:
- Atomic file saving, bolted on with fileutils
- A highly-optimized OrderedMultiDict, in dictutils
- Two types of PriorityQueue, in queueutils
- Chunked and windowed iteration, in iterutils
- Recursive data structure iteration and merging, with iterutils.remap
- Exponential backoff functionality, including jitter, through
iterutils.backoff
- A full-featured TracebackInfo type, for representing stack
traces, in tbutils
'';
license = licenses.bsd3;
maintainers = with maintainers; [ twey ];
};
}

View File

@@ -11,11 +11,11 @@
buildPythonPackage rec {
pname = "elpy";
version = "1.27.0";
version = "1.28.0";
src = fetchPypi {
inherit pname version;
sha256 = "0fpxxmxjzcam3kharbmvprf4kagspya1rx9piacmxbgcp6w2lc4s";
sha256 = "0lx6bf6ajx6wmnns03gva5sh1mmmxahjaqrn735cgwn6j4ikyqfs";
};
propagatedBuildInputs = [ flake8 autopep8 jedi importmagic ]

View File

@@ -0,0 +1,31 @@
{ stdenv, buildPythonPackage, fetchPypi, boltons, pytest }:
buildPythonPackage rec {
pname = "face";
version = "0.1.0";
src = fetchPypi {
inherit pname version;
sha256 = "0zdp5qlrhxf4dypvvd0zr7zxj2svkz9wblp37vgw01wvcy9b1ds7";
};
propagatedBuildInputs = [ boltons ];
checkInputs = [ pytest ];
checkPhase = "pytest face/test";
# ironically, test_parse doesn't parse, but fixed in git so no point
# reporting
doCheck = false;
meta = with stdenv.lib; {
homepage = https://github.com/mahmoud/face;
description = "A command-line interface parser and framework";
longDescription = ''
A command-line interface parser and framework, friendly for
users, full-featured for developers.
'';
license = licenses.bsd3;
maintainers = with maintainers; [ twey ];
};
}

View File

@@ -0,0 +1,38 @@
{ stdenv
, buildPythonPackage
, fetchPypi
, boltons
, attrs
, face
, pytest
, pyyaml
, isPy37
}:
buildPythonPackage rec {
pname = "glom";
version = "18.4.0";
src = fetchPypi {
inherit pname version;
sha256 = "0rfikq27a9wwfkd4k3bk7x4fssw6r7z138g9i3wpzvjc7anlzk24";
};
propagatedBuildInputs = [ boltons attrs face ];
checkInputs = [ pytest pyyaml ];
checkPhase = "pytest glom/test";
doCheck = !isPy37; # https://github.com/mahmoud/glom/issues/72
meta = with stdenv.lib; {
homepage = https://github.com/mahmoud/glom;
description = "Restructuring data, the Python way";
longDescription = ''
glom helps pull together objects from other objects in a
declarative, dynamic, and downright simple way.
'';
license = licenses.bsd3;
maintainers = with maintainers; [ twey ];
};
}

View File

@@ -3,6 +3,8 @@
, gobject-introspection, pygobject3, gtk3, matplotlib, ncurses
, buildPythonPackage
, fetchpatch
, pythonAtLeast
, lib
}:
buildPythonPackage rec {
@@ -29,7 +31,14 @@ buildPythonPackage rec {
url = "https://git.skewed.de/count0/graph-tool/commit/aa39e4a6b42d43fac30c841d176c75aff92cc01a.patch";
sha256 = "1578inb4jqwq2fhhwscn5z95nzmaxvmvk30nzs5wirr26iznap4m";
})
];
] ++ (lib.optionals (pythonAtLeast "3.7") [
# # python 3.7 compatibility (`async` is now reserved)
(fetchpatch {
name = "async-reserved.patch";
url = "https://git.skewed.de/count0/graph-tool/commit/0407f41a35b6be7c670927fb5dc578cbd0e88be4.patch";
sha256 = "1fklznhmfvbb3ykwzyf8p2hiczby6y7r0xnkkjl2jkxlvr24000q";
})
]);
configureFlags = [
"--with-python-module-path=$(out)/${python.sitePackages}"

View File

@@ -1,25 +1,51 @@
{ stdenv
{ lib
, buildPythonPackage
, fetchPypi
, pkgs
, fetchFromGitHub
, substituteAll
, graphviz
, makeFontsConf
, freefont_ttf
, mock
, pytest
, pytest-mock
, pytestcov
}:
buildPythonPackage rec {
pname = "graphviz";
version = "0.10.1";
src = fetchPypi {
inherit pname version;
extension = "zip";
sha256 = "d311be4fddfe832a56986ac5e1d6e8715d7fcb0208560da79d1bb0f72abef41f";
# patch does not apply to PyPI tarball due to different line endings
src = fetchFromGitHub {
owner = "xflr6";
repo = "graphviz";
rev = version;
sha256 = "1vqk4xy45c72la56j24z9jmjp5a0aa2k32fybnlbkzqjvvbl72d8";
};
propagatedBuildInputs = [ pkgs.graphviz ];
patches = [
(substituteAll {
src = ./hardcode-graphviz-path.patch;
inherit graphviz;
})
];
meta = with stdenv.lib; {
# Fontconfig error: Cannot load default config file
FONTCONFIG_FILE = makeFontsConf {
fontDirectories = [ freefont_ttf ];
};
checkInputs = [ mock pytest pytest-mock pytestcov ];
checkPhase = ''
pytest
'';
meta = with lib; {
description = "Simple Python interface for Graphviz";
homepage = https://github.com/xflr6/graphviz;
license = licenses.mit;
maintainers = with maintainers; [ dotlambda ];
};
}

View File

@@ -0,0 +1,95 @@
diff --git a/graphviz/backend.py b/graphviz/backend.py
index 704017b..fe4aefe 100644
--- a/graphviz/backend.py
+++ b/graphviz/backend.py
@@ -114,7 +114,7 @@ def command(engine, format, filepath=None, renderer=None, formatter=None):
suffix = '.'.join(reversed(format_arg))
format_arg = ':'.join(format_arg)
- cmd = [engine, '-T%s' % format_arg]
+ cmd = [os.path.join('@graphviz@/bin', engine), '-T%s' % format_arg]
rendered = None
if filepath is not None:
cmd.extend(['-O', filepath])
@@ -217,7 +217,7 @@ def version():
subprocess.CalledProcessError: If the exit status is non-zero.
RuntimmeError: If the output cannot be parsed into a version number.
"""
- cmd = ['dot', '-V']
+ cmd = ['@graphviz@/bin/dot', '-V']
out, _ = run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
info = out.decode('ascii')
diff --git a/tests/test_backend.py b/tests/test_backend.py
index 7ec12f7..2e8550d 100644
--- a/tests/test_backend.py
+++ b/tests/test_backend.py
@@ -47,6 +47,7 @@ def test_render_formatter_unknown():
render('dot', 'ps', 'nonfilepath', 'ps', '')
+@pytest.mark.skip(reason='empty $PATH has no effect')
@pytest.mark.usefixtures('empty_path')
def test_render_missing_executable():
with pytest.raises(ExecutableNotFound, match=r'execute'):
@@ -85,7 +86,7 @@ def test_render_mocked(capsys, mocker, Popen, quiet):
assert render('dot', 'pdf', 'nonfilepath', quiet=quiet) == 'nonfilepath.pdf'
- Popen.assert_called_once_with(['dot', '-Tpdf', '-O', 'nonfilepath'],
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Tpdf', '-O', 'nonfilepath'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
startupinfo=mocker.ANY)
@@ -94,6 +95,7 @@ def test_render_mocked(capsys, mocker, Popen, quiet):
assert capsys.readouterr() == ('', '' if quiet else 'stderr')
+@pytest.mark.skip(reason='empty $PATH has no effect')
@pytest.mark.usefixtures('empty_path')
def test_pipe_missing_executable():
with pytest.raises(ExecutableNotFound, match=r'execute'):
@@ -143,7 +145,7 @@ def test_pipe_pipe_invalid_data_mocked(mocker, py2, Popen, quiet): # noqa: N803
assert e.value.returncode is mocker.sentinel.returncode
assert e.value.stdout is mocker.sentinel.out
assert e.value.stderr is err
- Popen.assert_called_once_with(['dot', '-Tpng'],
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Tpng'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
@@ -166,7 +168,7 @@ def test_pipe_mocked(capsys, mocker, Popen, quiet): # noqa: N803
assert pipe('dot', 'png', b'nongraph', quiet=quiet) is mocker.sentinel.out
- Popen.assert_called_once_with(['dot', '-Tpng'],
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Tpng'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
@@ -176,6 +178,7 @@ def test_pipe_mocked(capsys, mocker, Popen, quiet): # noqa: N803
assert capsys.readouterr() == ('', '' if quiet else 'stderr')
+@pytest.mark.skip(reason='empty $PATH has no effect')
@pytest.mark.usefixtures('empty_path')
def test_version_missing_executable():
with pytest.raises(ExecutableNotFound, match=r'execute'):
@@ -196,7 +199,7 @@ def test_version_parsefail_mocked(mocker, Popen):
with pytest.raises(RuntimeError):
version()
- Popen.assert_called_once_with(['dot', '-V'],
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-V'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
startupinfo=mocker.ANY)
@@ -211,7 +214,7 @@ def test_version_mocked(mocker, Popen):
assert version() == (1, 2, 3)
- Popen.assert_called_once_with(['dot', '-V'],
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-V'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
startupinfo=mocker.ANY)

View File

@@ -2,6 +2,8 @@
, buildPythonPackage
, fetchPypi
, isPyPy
, substituteAll
, graphvizPkg
, graphviz
, mock
}:
@@ -18,6 +20,13 @@ buildPythonPackage rec {
# Tests fail with PyPy.
disabled = isPyPy;
patches = [
(substituteAll {
src = ./hardcode-graphviz-path.patch;
graphviz = graphvizPkg;
})
];
propagatedBuildInputs = [ graphviz ];
checkInputs = [ mock ];

View File

@@ -0,0 +1,61 @@
diff --git a/objgraph.py b/objgraph.py
index 88e307b..0369f49 100755
--- a/objgraph.py
+++ b/objgraph.py
@@ -1045,12 +1045,12 @@ def _present_graph(dot_filename, filename=None):
if not filename and _program_in_path('xdot'):
print("Spawning graph viewer (xdot)")
subprocess.Popen(['xdot', dot_filename], close_fds=True)
- elif _program_in_path('dot'):
+ elif True: # path to dot is hardcoded and hence always in $PATH
if not filename:
print("Graph viewer (xdot) not found, generating a png instead")
filename = dot_filename[:-4] + '.png'
stem, ext = os.path.splitext(filename)
- cmd = ['dot', '-T' + ext[1:], '-o' + filename, dot_filename]
+ cmd = ['@graphviz@/bin/dot', '-T' + ext[1:], '-o' + filename, dot_filename]
dot = subprocess.Popen(cmd, close_fds=False)
dot.wait()
if dot.returncode != 0:
diff --git a/tests.py b/tests.py
index 7db2888..bdb666e 100755
--- a/tests.py
+++ b/tests.py
@@ -557,7 +557,7 @@ class PresentGraphTest(CaptureMixin, TemporaryDirectoryMixin,
self.programsInPath(['dot'])
objgraph._present_graph('foo.dot', 'bar.png')
self.assertOutput("""
- subprocess.Popen(['dot', '-Tpng', '-obar.png', 'foo.dot'])
+ subprocess.Popen(['@graphviz@/bin/dot', '-Tpng', '-obar.png', 'foo.dot'])
Image generated as bar.png
""")
@@ -566,11 +566,12 @@ class PresentGraphTest(CaptureMixin, TemporaryDirectoryMixin,
objgraph.subprocess.should_fail = True
objgraph._present_graph('f.dot', 'b.png')
self.assertOutput("""
- subprocess.Popen(['dot', '-Tpng', '-ob.png', 'f.dot'])
- dot failed (exit code 1) while executing "dot -Tpng -ob.png f.dot"
+ subprocess.Popen(['@graphviz@/bin/dot', '-Tpng', '-ob.png', 'f.dot'])
+ dot failed (exit code 1) while executing "@graphviz@/bin/dot -Tpng -ob.png f.dot"
""")
- def test_present_png_no_dot(self):
+ @unittest.skip("empty $PATH has no effect")
+ def no_test_present_png_no_dot(self):
self.programsInPath([])
objgraph._present_graph('foo.dot', 'bar.png')
self.assertOutput("""
@@ -591,10 +592,11 @@ class PresentGraphTest(CaptureMixin, TemporaryDirectoryMixin,
objgraph._present_graph('foo.dot')
self.assertOutput("""
Graph viewer (xdot) not found, generating a png instead
- subprocess.Popen(['dot', '-Tpng', '-ofoo.png', 'foo.dot'])
+ subprocess.Popen(['@graphviz@/bin/dot', '-Tpng', '-ofoo.png', 'foo.dot'])
Image generated as foo.png
""")
+ @unittest.skip("empty $PATH has no effect")
def test_present_no_xdot_and_no_not(self):
self.programsInPath([])
objgraph._present_graph('foo.dot')

View File

@@ -1,6 +1,7 @@
{ lib
, buildPythonPackage
, fetchPypi
, six
, zope_testing
, setuptools
}:
@@ -14,7 +15,7 @@ buildPythonPackage rec {
sha256 = "db71bde0d4d3c273dbba8c7a2ab259a42f038eca74184da36c5aab61e90e8dd7";
};
propagatedBuildInputs = [ setuptools zope_testing ];
propagatedBuildInputs = [ six setuptools zope_testing ];
# Huge amount of testing dependencies (including Zope2)
doCheck = false;
@@ -24,4 +25,4 @@ buildPythonPackage rec {
homepage = https://github.com/plone/plone.testing;
license = lib.licenses.bsd3;
};
}
}

View File

@@ -1,23 +1,44 @@
{ lib
, buildPythonPackage
, fetchPypi
, substituteAll
, graphviz
, python
, chardet
, pyparsing
, graphviz
}:
buildPythonPackage rec {
pname = "pydot";
version = "1.4.0";
version = "1.4.1";
src = fetchPypi {
inherit pname version;
sha256 = "02yp2k7p1kh0azwd932jhvfc3nxxdv9dimh7hdgwdnmp05yms6cq";
sha256 = "d49c9d4dd1913beec2a997f831543c8cbd53e535b1a739e921642fe416235f01";
};
patches = [
(substituteAll {
src = ./hardcode-graphviz-path.patch;
inherit graphviz;
})
];
postPatch = ''
# test_graphviz_regression_tests also fails upstream: https://github.com/pydot/pydot/pull/198
substituteInPlace test/pydot_unittest.py \
--replace "test_graphviz_regression_tests" "no_test_graphviz_regression_tests"
'';
propagatedBuildInputs = [ pyparsing ];
checkInputs = [ chardet ];
# No tests in archive
doCheck = false;
propagatedBuildInputs = [pyparsing graphviz];
checkPhase = ''
cd test
${python.interpreter} pydot_unittest.py
'';
meta = {
homepage = https://github.com/erocarrera/pydot;
description = "Allows to easily create both directed and non directed graphs from Python";

View File

@@ -0,0 +1,13 @@
diff --git a/pydot.py b/pydot.py
index 3c7da4d..582c5bc 100644
--- a/pydot.py
+++ b/pydot.py
@@ -124,7 +124,7 @@ def call_graphviz(program, arguments, working_dir, **kwargs):
'LD_LIBRARY_PATH': os.environ.get('LD_LIBRARY_PATH', ''),
}
- program_with_args = [program, ] + arguments
+ program_with_args = ['@graphviz@/bin/' + program, ] + arguments
process = subprocess.Popen(
program_with_args,

View File

@@ -0,0 +1,51 @@
{ stdenv
, lib
, python
, buildPythonPackage
, fetchPypi
, radare2
, coreutils
}:
buildPythonPackage rec {
pname = "r2pipe";
version = "1.2.0";
postPatch = let
r2lib = "${lib.getOutput "lib" radare2}/lib";
libr_core = "${r2lib}/libr_core${stdenv.hostPlatform.extensions.sharedLibrary}";
in
''
# Fix find_library, can be removed after
# https://github.com/NixOS/nixpkgs/issues/7307 is resolved.
substituteInPlace r2pipe/native.py --replace "find_library('r_core')" "'${libr_core}'"
# Fix the default r2 executable
substituteInPlace r2pipe/open_sync.py --replace "r2e = 'radare2'" "r2e = '${radare2}/bin/radare2'"
substituteInPlace r2pipe/open_base.py --replace 'which("radare2")' "'${radare2}/bin/radare2'"
'';
src = fetchPypi {
inherit pname version;
sha256 = "1qs3xqmi9alahsgr8akzw06ia4c3554dz8pran1h7z5llk262nj4";
};
# Tiny sanity check to make sure r2pipe finds radare2 (since r2pipe doesn't
# provide its own tests):
# Analyze ls with the fastest analysis and do nothing with the result.
postCheck = ''
${python.interpreter} <<EOF
import r2pipe
r2 = r2pipe.open('${coreutils}/bin/ls')
r2.cmd('a')
r2.quit()
EOF
'';
meta = with stdenv.lib; {
description = "Interact with radare2";
homepage = https://github.com/radare/radare2-r2pipe;
license = licenses.mit;
maintainers = with maintainers; [ timokau ];
};
}

View File

@@ -25,6 +25,7 @@ buildPythonPackage rec {
preConfigure = ''
chmod +x ./deps/pjsip/configure ./deps/pjsip/aconfigure
export LD=$CC
'';
nativeBuildInputs = [ pkgs.pkgconfig ];

View File

@@ -9,11 +9,11 @@
buildPythonPackage rec {
pname = "xarray";
version = "0.11.0";
version = "0.11.2";
src = fetchPypi {
inherit pname version;
sha256 = "06580fg3kgnwci070ivgqzfilmldjk5lxb10jbbfb87wrjx68sb3";
sha256 = "1cnghx1xcgdq675abmrys311vspmzgjgiji4wh8iyw194qalfwdg";
};
checkInputs = [ pytest ];

View File

@@ -8,18 +8,19 @@
buildPythonPackage rec {
pname = "xdis";
version = "3.8.8";
version = "3.8.9";
src = fetchPypi {
inherit pname version;
sha256 = "4d212df8a85ab55a35f6ad71b2c29818d903c3e6a95e31eb26d5f3fc66a4e015";
sha256 = "1q2dg3hnsmmpjcc7lzjf5nd041mpbwa2bq3dgr4p6wv65vncny9v";
};
checkInputs = [ pytest ];
propagatedBuildInputs = [ six click ];
# newest release moves to pytest (tests not packaged with release)
doCheck = false;
checkPhase = ''
make check
'';
meta = with stdenv.lib; {
description = "Python cross-version byte-code disassembler and marshal routines";

View File

@@ -3,7 +3,6 @@
, fetchPypi
, setuptoolsDarcs
, pyutil
, argparse
, isPyPy
}:
@@ -18,7 +17,12 @@ buildPythonPackage rec {
};
buildInputs = [ setuptoolsDarcs ];
propagatedBuildInputs = [ pyutil argparse ];
propagatedBuildInputs = [ pyutil ];
# argparse is in the stdlib but zfec doesn't know that.
postPatch = ''
sed -i -e '/argparse/d' setup.py
'';
meta = with stdenv.lib; {
homepage = http://allmydata.org/trac/zfec;