Merge pull request #45890 from lopsided98/buildbot-python3

buildbot: Python 3 support and other improvements
This commit is contained in:
Silvan Mosberger
2018-10-12 14:06:41 +02:00
committed by GitHub
25 changed files with 658 additions and 462 deletions

View File

@@ -0,0 +1,39 @@
{ lib, fetchPypi, buildPythonPackage, pythonOlder, isPyPy
, lazy-object-proxy, six, wrapt, enum34, singledispatch, backports_functools_lru_cache
, pytest
}:
buildPythonPackage rec {
pname = "astroid";
version = "1.6.5";
src = fetchPypi {
inherit pname version;
sha256 = "0fir4b67sm7shcacah9n61pvq313m523jb4q80sycrh3p8nmi6zw";
};
# From astroid/__pkginfo__.py
propagatedBuildInputs = [
lazy-object-proxy
six
wrapt
enum34
singledispatch
backports_functools_lru_cache
];
checkInputs = [ pytest ];
checkPhase = ''
# test_builtin_help is broken
pytest -k "not test_builtin_help" astroid
'';
meta = with lib; {
description = "An abstract syntax tree for Python with inference support";
homepage = https://github.com/PyCQA/astroid;
license = licenses.lgpl2;
platforms = platforms.all;
maintainers = with maintainers; [ nand0p ];
};
}

View File

@@ -22,8 +22,8 @@ buildPythonPackage rec {
checkInputs = [ pytestrunner pytest ];
meta = with lib; {
description = "A abstract syntax tree for Python with inference support";
homepage = https://bitbucket.org/logilab/astroid;
description = "An abstract syntax tree for Python with inference support";
homepage = https://github.com/PyCQA/astroid;
license = licenses.lgpl2;
platforms = platforms.all;
maintainers = with maintainers; [ nand0p ];

View File

@@ -1,7 +1,6 @@
{ stdenv, buildPythonPackage, fetchPypi, isPy3k, isPy33,
unittest2, mock, pytest, trollius, asyncio,
pytest-asyncio, futures, cffi,
six, twisted, txaio, zope_interface
{ lib, buildPythonPackage, fetchPypi, isPy3k, isPy33,
six, txaio, twisted, zope_interface, cffi, asyncio, trollius, futures,
mock, pytest
}:
buildPythonPackage rec {
pname = "autobahn";
@@ -12,21 +11,18 @@ buildPythonPackage rec {
sha256 = "b69858e0be4bff8437b0bd82a0db1cbef7405e16bd9354ba587c043d6d5e1ad9";
};
# Upstream claim python2 support, but tests require pytest-asyncio which
# is pythn3 only. Therefore, tests are skipped for python2.
doCheck = isPy3k;
checkInputs = stdenv.lib.optionals isPy3k [ unittest2 mock pytest pytest-asyncio ];
propagatedBuildInputs = [ cffi six twisted zope_interface txaio ] ++
(stdenv.lib.optional isPy33 asyncio) ++
(stdenv.lib.optionals (!isPy3k) [ trollius futures ]);
propagatedBuildInputs = [ six txaio twisted zope_interface cffi ] ++
(lib.optional isPy33 asyncio) ++
(lib.optionals (!isPy3k) [ trollius futures ]);
checkInputs = [ mock pytest ];
checkPhase = ''
runHook preCheck
USE_TWISTED=true py.test $out
runHook postCheck
'';
meta = with stdenv.lib; {
meta = with lib; {
description = "WebSocket and WAMP in Python for Twisted and asyncio.";
homepage = "https://crossbar.io/autobahn";
license = licenses.mit;

View File

@@ -0,0 +1,94 @@
{ stdenv, lib, buildPythonPackage, fetchPypi, makeWrapper, isPy3k,
python, twisted, jinja2, zope_interface, future, sqlalchemy,
sqlalchemy_migrate, dateutil, txaio, autobahn, pyjwt, treq, txrequests,
txgithub, pyjade, boto3, moto, mock, lz4, setuptoolsTrial, isort, pylint,
flake8, buildbot-worker, buildbot-pkg, glibcLocales }:
let
withPlugins = plugins: buildPythonPackage {
name = "${package.name}-with-plugins";
phases = [ "installPhase" "fixupPhase" ];
buildInputs = [ makeWrapper ];
propagatedBuildInputs = plugins ++ package.propagatedBuildInputs;
installPhase = ''
makeWrapper ${package}/bin/buildbot $out/bin/buildbot \
--prefix PYTHONPATH : "${package}/${python.sitePackages}:$PYTHONPATH"
ln -sfv ${package}/lib $out/lib
'';
passthru = package.passthru // {
withPlugins = morePlugins: withPlugins (morePlugins ++ plugins);
};
};
package = buildPythonPackage rec {
pname = "buildbot";
version = "1.4.0";
src = fetchPypi {
inherit pname version;
sha256 = "0dfa926nh642i3bnpzlz0q347zicyx6wswjfqbniri59ya64fncx";
};
propagatedBuildInputs = [
# core
twisted
jinja2
zope_interface
future
sqlalchemy
sqlalchemy_migrate
dateutil
txaio
autobahn
pyjwt
# tls
twisted.extras.tls
];
checkInputs = [
treq
txrequests
pyjade
boto3
moto
mock
lz4
setuptoolsTrial
isort
pylint
flake8
buildbot-worker
buildbot-pkg
glibcLocales
];
patches = [
# This patch disables the test that tries to read /etc/os-release which
# is not accessible in sandboxed builds.
./skip_test_linux_distro.patch
];
LC_ALL = "en_US.UTF-8";
# TimeoutErrors on slow machines -> aarch64
doCheck = !stdenv.isAarch64;
postPatch = ''
substituteInPlace buildbot/scripts/logwatcher.py --replace '/usr/bin/tail' "$(type -P tail)"
'';
passthru = {
inherit withPlugins;
};
meta = with lib; {
homepage = http://buildbot.net/;
description = "Buildbot is an open-source continuous integration framework for automating software build, test, and release processes";
maintainers = with maintainers; [ nand0p ryansydnor ];
license = licenses.gpl2;
};
};
in package

View File

@@ -0,0 +1,24 @@
{ lib, buildPythonPackage, fetchPypi, setuptools }:
buildPythonPackage rec {
pname = "buildbot-pkg";
version = "1.4.0";
src = fetchPypi {
inherit pname version;
sha256 = "06f4jvczbg9km0gfmcd1ljplf5w8za27i9ap9jnyqgh3j77smd7a";
};
postPatch = ''
# Their listdir function filters out `node_modules` folders.
# Do we have to care about that with Nix...?
substituteInPlace buildbot_pkg.py --replace "os.listdir = listdir" ""
'';
meta = with lib; {
homepage = http://buildbot.net/;
description = "Buildbot Packaging Helper";
maintainers = with maintainers; [ nand0p ryansydnor ];
license = licenses.gpl2;
};
}

View File

@@ -0,0 +1,103 @@
{ lib, buildPythonPackage, fetchPypi, buildbot, buildbot-pkg }:
{
www = buildPythonPackage rec {
pname = "buildbot_www";
inherit (buildbot-pkg) version;
# NOTE: wheel is used due to buildbot circular dependency
format = "wheel";
src = fetchPypi {
inherit pname version format;
sha256 = "1m5dsp1gn9m5vfh5hnqp8g6hmhw1f1ydnassd33nhk521f2akz0v";
};
meta = with lib; {
homepage = http://buildbot.net/;
description = "Buildbot UI";
maintainers = with maintainers; [ nand0p ryansydnor ];
license = licenses.gpl2;
};
};
console-view = buildPythonPackage rec {
pname = "buildbot-console-view";
inherit (buildbot-pkg) version;
src = fetchPypi {
inherit pname version;
sha256 = "0vblaxmihgb4w9aa5q0wcgvxs7qzajql8s22w0pl9qs494g05s9r";
};
propagatedBuildInputs = [ buildbot-pkg ];
checkInputs = [ buildbot ];
meta = with lib; {
homepage = http://buildbot.net/;
description = "Buildbot Console View Plugin";
maintainers = with maintainers; [ nand0p ryansydnor ];
license = licenses.gpl2;
};
};
waterfall-view = buildPythonPackage rec {
pname = "buildbot-waterfall-view";
inherit (buildbot-pkg) version;
src = fetchPypi {
inherit pname version;
sha256 = "18v1a6dapwjc2s9hi0cv3ry3s048w84md908zwaa3033gz3zwzy7";
};
propagatedBuildInputs = [ buildbot-pkg ];
checkInputs = [ buildbot ];
meta = with lib; {
homepage = http://buildbot.net/;
description = "Buildbot Waterfall View Plugin";
maintainers = with maintainers; [ nand0p ryansydnor ];
license = licenses.gpl2;
};
};
grid-view = buildPythonPackage rec {
pname = "buildbot-grid-view";
inherit (buildbot-pkg) version;
src = fetchPypi {
inherit pname version;
sha256 = "0iawsy892v6rn88hsgiiwaf689jqzhnb2wbxh6zkz3c0hvq4g0qd";
};
propagatedBuildInputs = [ buildbot-pkg ];
checkInputs = [ buildbot ];
meta = with lib; {
homepage = http://buildbot.net/;
description = "Buildbot Grid View Plugin";
maintainers = with maintainers; [ nand0p ];
license = licenses.gpl2;
};
};
wsgi-dashboards = buildPythonPackage rec {
pname = "buildbot-wsgi-dashboards";
inherit (buildbot-pkg) version;
src = fetchPypi {
inherit pname version;
sha256 = "00cpjna3bffh1qbq6a3sqffd1g7qhbrmn9gpzxf9k38jam6jgfpz";
};
propagatedBuildInputs = [ buildbot-pkg ];
checkInputs = [ buildbot ];
meta = with lib; {
homepage = http://buildbot.net/;
description = "Buildbot WSGI dashboards Plugin";
maintainers = with maintainers; [ ];
license = licenses.gpl2;
};
};
}

View File

@@ -0,0 +1,11 @@
diff -Nur buildbot-0.9.6/buildbot/test/unit/test_buildbot_net_usage_data.py buildbot-0.9.6.patched/buildbot/test/unit/test_buildbot_net_usage_data.py
--- buildbot-0.9.6/buildbot/test/unit/test_buildbot_net_usage_data.py 2017-04-19 16:57:02.000000000 +0200
+++ buildbot-0.9.6.patched/buildbot/test/unit/test_buildbot_net_usage_data.py 2017-05-04 12:22:54.575762551 +0200
@@ -147,6 +147,7 @@
_sendBuildbotNetUsageData({'foo': 'bar'})
def test_linux_distro(self):
+ raise SkipTest("NixOS sandboxed builds hides /etc/os-release")
system = platform.system()
if system != "Linux":
raise SkipTest("test is only for linux")

View File

@@ -0,0 +1,26 @@
{ lib, buildPythonPackage, fetchPypi, python, setuptoolsTrial, mock, twisted, future }:
buildPythonPackage (rec {
pname = "buildbot-worker";
version = "1.4.0";
src = fetchPypi {
inherit pname version;
sha256 = "12zvf4c39b6s4g1f2w407q8kkw602m88rc1ggi4w9pkw3bwbxrgy";
};
propagatedBuildInputs = [ twisted future ];
checkInputs = [ setuptoolsTrial mock ];
postPatch = ''
substituteInPlace buildbot_worker/scripts/logwatcher.py --replace '/usr/bin/tail' "$(type -P tail)"
'';
meta = with lib; {
homepage = http://buildbot.net/;
description = "Buildbot Worker Daemon";
maintainers = with maintainers; [ nand0p ryansydnor ];
license = licenses.gpl2;
};
})

View File

@@ -11,12 +11,6 @@ buildPythonPackage rec {
propagatedBuildInputs = [ idna ];
checkInputs = [ pytest ];
checkPhase = ''
py.test $out
'';
meta = with stdenv.lib; {
description = "A featureful, correct URL for Python";
license = licenses.mit;

View File

@@ -0,0 +1,49 @@
{ stdenv, lib, buildPythonPackage, fetchPypi, python, astroid, six, isort,
mccabe, configparser, backports_functools_lru_cache, singledispatch,
pytest, pytestrunner, pyenchant }:
buildPythonPackage rec {
pname = "pylint";
version = "1.9.2";
src = fetchPypi {
inherit pname version;
sha256 = "1cxr1j037hsm4spmvl64v2j2rdq72pc2z0gnn3iggd4np6y21wpz";
};
checkInputs = [ pytest pytestrunner pyenchant ];
propagatedBuildInputs = [ astroid six isort mccabe configparser backports_functools_lru_cache singledispatch ];
postPatch = lib.optionalString stdenv.isDarwin ''
# Remove broken darwin test
rm -vf pylint/test/test_functional.py
'';
checkPhase = ''
pytest pylint/test -k "not ${lib.concatStringsSep " and not " (
[ # Broken test
"test_good_comprehension_checks"
# See PyCQA/pylint#2535
"test_libmodule" ] ++
# Disable broken darwin tests
lib.optionals stdenv.isDarwin [
"test_parallel_execution"
"test_py3k_jobs_option"
]
)}"
'';
postInstall = ''
mkdir -p $out/share/emacs/site-lisp
cp "elisp/"*.el $out/share/emacs/site-lisp/
'';
meta = with lib; {
homepage = https://github.com/PyCQA/pylint;
description = "A bug and style checker for Python";
platforms = platforms.all;
license = licenses.gpl1Plus;
maintainers = with maintainers; [ nand0p ];
};
}

View File

@@ -1,5 +1,5 @@
{ stdenv, buildPythonPackage, fetchPypi, python, pythonOlder, astroid, isort,
pytest, pytestrunner, mccabe, pytest_xdist, pyenchant }:
{ stdenv, lib, buildPythonPackage, fetchPypi, python, pythonOlder, astroid,
isort, mccabe, pytest, pytestrunner, pyenchant }:
buildPythonPackage rec {
pname = "pylint";
@@ -12,21 +12,25 @@ buildPythonPackage rec {
sha256 = "31142f764d2a7cd41df5196f9933b12b7ee55e73ef12204b648ad7e556c119fb";
};
checkInputs = [ pytest pytestrunner pytest_xdist pyenchant ];
checkInputs = [ pytest pytestrunner pyenchant ];
propagatedBuildInputs = [ astroid isort mccabe ];
postPatch = ''
postPatch = lib.optionalString stdenv.isDarwin ''
# Remove broken darwin test
rm -vf pylint/test/test_functional.py
'';
checkPhase = ''
cat pylint/test/test_self.py
# Disable broken darwin tests
pytest pylint/test -k "not test_parallel_execution \
and not test_py3k_jobs_option \
and not test_good_comprehension_checks"
pytest pylint/test -k "not ${lib.concatStringsSep " and not " (
# Broken test
[ "test_good_comprehension_checks" ] ++
# Disable broken darwin tests
lib.optionals stdenv.isDarwin [
"test_parallel_execution"
"test_py3k_jobs_option"
]
)}"
'';
postInstall = ''
@@ -34,8 +38,8 @@ buildPythonPackage rec {
cp "elisp/"*.el $out/share/emacs/site-lisp/
'';
meta = with stdenv.lib; {
homepage = https://www.logilab.org/project/pylint;
meta = with lib; {
homepage = https://github.com/PyCQA/pylint;
description = "A bug and style checker for Python";
platforms = platforms.all;
license = licenses.gpl1Plus;

View File

@@ -0,0 +1,27 @@
{ lib, buildPythonPackage, fetchPypi, pbr, sphinx, sphinx-testing, nose, glibcLocales }:
buildPythonPackage rec {
pname = "sphinx-jinja";
version = "1.1.0";
src = fetchPypi {
inherit pname version;
sha256 = "02pgp9pbn0zrs0lggrc74mv6cvlnlq8wib84ga6yjvq30gda9v8q";
};
buildInputs = [ pbr ];
propagatedBuildInputs = [ sphinx ];
checkInputs = [ sphinx-testing nose glibcLocales ];
checkPhase = ''
# Zip (epub) does not support files with epoch timestamp
LC_ALL="en_US.UTF-8" nosetests -e test_build_epub
'';
meta = with lib; {
description = "Sphinx extension to include jinja templates in documentation";
maintainers = with maintainers; [ nand0p ];
license = licenses.mit;
};
}

View File

@@ -1,4 +1,4 @@
{ stdenv, buildPythonPackage, fetchPypi, python
{ stdenv, buildPythonPackage, fetchPypi, fetchpatch, python
, unittest2, scripttest, pytz, pylint, mock
, testtools, pbr, tempita, decorator, sqlalchemy
, six, sqlparse, testrepository
@@ -12,6 +12,12 @@ buildPythonPackage rec {
sha256 = "0ld2bihp9kmf57ykgzrfgxs4j9kxlw79sgdj9sfn47snw3izb2p6";
};
# See: https://review.openstack.org/#/c/608382/
patches = [ (fetchpatch {
url = https://github.com/openstack/sqlalchemy-migrate/pull/18.patch;
sha256 = "1qyfq2m7w7xqf0r9bc2x42qcra4r9k9l9g1jy5j0fvlb6bvvjj07";
}) ];
checkInputs = [ unittest2 scripttest pytz mock testtools testrepository ];
propagatedBuildInputs = [ pbr tempita decorator sqlalchemy six sqlparse ];
@@ -32,10 +38,8 @@ buildPythonPackage rec {
${python.interpreter} setup.py test
'';
doCheck = true;
meta = with stdenv.lib; {
homepage = http://code.google.com/p/sqlalchemy-migrate/;
homepage = https://github.com/openstack/sqlalchemy-migrate;
description = "Schema migration tools for SQLAlchemy";
license = licenses.asl20;
maintainers = with maintainers; [ makefu ];

View File

@@ -0,0 +1,21 @@
{ lib, buildPythonPackage, fetchFromGitHub, nose }:
buildPythonPackage rec {
version = "0.5.3-2016-09-28";
name = "tempita-${version}";
src = fetchFromGitHub {
owner = "gjhiggins";
repo = "tempita";
rev = "47414a7c6e46a9a9afe78f0bce2ea299fa84d10";
sha256 = "0f33jjjs5rvp7ar2j6ggyfykcrsrn04jaqcq71qfvycf6b7nw3rn";
};
buildInputs = [ nose ];
meta = {
homepage = https://github.com/gjhiggins/tempita;
description = "A very small text templating language";
license = lib.licenses.mit;
};
}

View File

@@ -1,45 +1,49 @@
{ lib, stdenv, buildPythonPackage, fetchPypi, isPy27, isPyPy, mock, futures }:
{ lib, stdenv, buildPythonPackage, fetchPypi, isPy3k, mock, unittest2, six, futures }:
buildPythonPackage rec {
pname = "trollius";
version = "1.0.4";
version = "2.2";
src = fetchPypi {
inherit pname version;
sha256 = "0xny8y12x3wrflmyn6xi8a7n3m3ac80fgmgzphx5jbbaxkjcm148";
sha256 = "093978388qvw5hyscbbj062dbdc2761xs9yzrq26mh63g689lnxk";
};
checkInputs = [ mock ];
checkInputs = [ mock ] ++ lib.optional (!isPy3k) unittest2;
propagatedBuildInputs = lib.optionals (isPy27 || isPyPy) [ futures ];
propagatedBuildInputs = [ six ] ++ lib.optional (!isPy3k) futures;
patches = [
./tests.patch
];
# Some of the tests fail on darwin with `error: AF_UNIX path too long'
# because of the *long* path names for sockets
patchPhase = lib.optionalString stdenv.isDarwin ''
sed -i -e "s|test_create_ssl_unix_connection|skip_test_create_ssl_unix_connection|g" tests/test_events.py
sed -i -e "s|test_create_unix_connection|skip_test_create_unix_connection|g" tests/test_events.py
sed -i -e "s|test_create_unix_server_existing_path_nonsock|skip_test_create_unix_server_existing_path_nonsock|g" tests/test_unix_events.py
sed -i -e "s|test_create_unix_server_existing_path_sock|skip_test_create_unix_server_existing_path_sock|g" tests/test_unix_events.py
sed -i -e "s|test_create_unix_server_ssl_verified|skip_test_create_unix_server_ssl_verified|g" tests/test_events.py
sed -i -e "s|test_create_unix_server_ssl_verify_failed|skip_test_create_unix_server_ssl_verify_failed|g" tests/test_events.py
sed -i -e "s|test_create_unix_server_ssl|skip_test_create_unix_server_ssl|g" tests/test_events.py
sed -i -e "s|test_create_unix_server|skip_test_create_unix_server|g" tests/test_events.py
sed -i -e "s|test_open_unix_connection_error|skip_test_open_unix_connection_error|g" tests/test_streams.py
sed -i -e "s|test_open_unix_connection_no_loop_ssl|skip_test_open_unix_connection_no_loop_ssl|g" tests/test_streams.py
sed -i -e "s|test_open_unix_connection|skip_test_open_unix_connection|g" tests/test_streams.py
sed -i -e "s|test_pause_reading|skip_test_pause_reading|g" tests/test_subprocess.py
sed -i -e "s|test_read_pty_output|skip_test_read_pty_output|g" tests/test_events.py
sed -i -e "s|test_start_unix_server|skip_test_start_unix_server|g" tests/test_streams.py
sed -i -e "s|test_unix_sock_client_ops|skip_test_unix_sock_client_ops|g" tests/test_events.py
sed -i -e "s|test_write_pty|skip_test_write_pty|g" tests/test_events.py
postPatch = ''
# Overrides PYTHONPATH causing dependencies not to be found
sed -i -e "s|test_env_var_debug|skip_test_env_var_debug|g" tests/test_tasks.py
'' + lib.optionalString stdenv.isDarwin ''
# Some of the tests fail on darwin with `error: AF_UNIX path too long'
# because of the *long* path names for sockets
sed -i -e "s|test_create_ssl_unix_connection|skip_test_create_ssl_unix_connection|g" tests/test_events.py
sed -i -e "s|test_create_unix_connection|skip_test_create_unix_connection|g" tests/test_events.py
sed -i -e "s|test_create_unix_server_existing_path_nonsock|skip_test_create_unix_server_existing_path_nonsock|g" tests/test_unix_events.py
sed -i -e "s|test_create_unix_server_existing_path_sock|skip_test_create_unix_server_existing_path_sock|g" tests/test_unix_events.py
sed -i -e "s|test_create_unix_server_ssl_verified|skip_test_create_unix_server_ssl_verified|g" tests/test_events.py
sed -i -e "s|test_create_unix_server_ssl_verify_failed|skip_test_create_unix_server_ssl_verify_failed|g" tests/test_events.py
sed -i -e "s|test_create_unix_server_ssl|skip_test_create_unix_server_ssl|g" tests/test_events.py
sed -i -e "s|test_create_unix_server|skip_test_create_unix_server|g" tests/test_events.py
sed -i -e "s|test_open_unix_connection_error|skip_test_open_unix_connection_error|g" tests/test_streams.py
sed -i -e "s|test_open_unix_connection_no_loop_ssl|skip_test_open_unix_connection_no_loop_ssl|g" tests/test_streams.py
sed -i -e "s|test_open_unix_connection|skip_test_open_unix_connection|g" tests/test_streams.py
sed -i -e "s|test_pause_reading|skip_test_pause_reading|g" tests/test_subprocess.py
sed -i -e "s|test_read_pty_output|skip_test_read_pty_output|g" tests/test_events.py
sed -i -e "s|test_start_unix_server|skip_test_start_unix_server|g" tests/test_streams.py
sed -i -e "s|test_unix_sock_client_ops|skip_test_unix_sock_client_ops|g" tests/test_events.py
sed -i -e "s|test_write_pty|skip_test_write_pty|g" tests/test_events.py
'';
meta = with stdenv.lib; {
description = "Port of the Tulip project (asyncio module, PEP 3156) on Python 2";
homepage = "https://bitbucket.org/enovance/trollius";
description = "Port of the asyncio project to Python 2.7";
homepage = https://github.com/vstinner/trollius;
license = licenses.asl20;
maintainers = with maintainers; [ garbas ];
};