Merge pull request #51315 from Mic92/python3-gdb

gdb: switch to python3
This commit is contained in:
Jörg Thalheim 2018-12-02 11:09:14 +00:00 committed by GitHub
commit 330ab9bc2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 212 additions and 364 deletions

View File

@ -0,0 +1,33 @@
{ lib
, buildPythonPackage
, fetchPypi
, flask
, python-socketio
, coverage
}:
buildPythonPackage rec {
pname = "Flask-SocketIO";
version = "3.1.0";
src = fetchPypi {
inherit pname version;
sha256 = "a7188b35f7874903f554b3a1a3a4465213e765c4f17182fa5cb3d9f6915da4c1";
};
propagatedBuildInputs = [
flask
python-socketio
];
checkInputs = [ coverage ];
# tests only on github, but lates release there is not tagged
doCheck = false;
meta = with lib; {
description = "Socket.IO integration for Flask applications";
homepage = http://github.com/miguelgrinberg/Flask-SocketIO/;
license = licenses.mit;
maintainers = [ maintainers.mic92 ];
};
}

View File

@ -0,0 +1,34 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, gdb
}:
buildPythonPackage rec {
pname = "pygdbmi";
version = "0.9.0.0";
src = fetchFromGitHub {
#inherit pname version;
#inherit pname version;
owner = "cs01";
repo = "pygdbmi";
rev = version;
sha256 = "12xq9iajgqz23dska5x63hrx75icr5bwwswnmba0y69y39s0jpsj";
};
checkInputs = [ gdb ];
postPatch = ''
# tries to execute flake8,
# which is likely to break on flake8 updates
echo "def main(): return 0" > tests/static_tests.py
'';
meta = with lib; {
description = "Parse gdb machine interface output with Python";
homepage = https://github.com/cs01/pygdbmi;
license = licenses.mit;
maintainers = [ maintainers.mic92 ];
};
}

View File

@ -0,0 +1,49 @@
{ stdenv
, lib
, buildPythonPackage
, fetchFromGitHub
, six
, eventlet
, mock
, iana-etc
, libredirect
, aiohttp
, tornado
}:
buildPythonPackage rec {
pname = "python-engineio";
version = "3.0.0";
src = fetchFromGitHub {
owner = "miguelgrinberg";
repo = "python-engineio";
rev = "v${version}";
sha256 = "1v510fhn0li808ar2cmwh5nijacy5x60q9x4gm0b34j6mkmc59ph";
};
propagatedBuildInputs = [
six
];
checkInputs = [
eventlet
mock
aiohttp
tornado
];
# make /etc/protocols accessible to fix socket.getprotobyname('tcp') in sandbox
preCheck = stdenv.lib.optionalString stdenv.isLinux ''
export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols \
LD_PRELOAD=${libredirect}/lib/libredirect.so
'';
postCheck = "unset NIX_REDIRECTS LD_PRELOAD";
meta = with stdenv.lib; {
description = "Engine.IO server";
homepage = http://github.com/miguelgrinberg/python-engineio/;
license = licenses.mit;
maintainers = [ maintainers.mic92 ];
};
}

View File

@ -0,0 +1,33 @@
{ lib
, buildPythonPackage
, fetchPypi
, six
, python-engineio
, mock
}:
buildPythonPackage rec {
pname = "python-socketio";
version = "2.1.0";
src = fetchPypi {
inherit pname version;
sha256 = "10457ahvi16iyshmynr0j9palfsbnpzya8p1nmlhzrcr11fsnkb7";
};
propagatedBuildInputs = [
six
python-engineio
];
checkInputs = [ mock ];
# tests only on github, but latest github release not tagged
doCheck = false;
meta = with lib; {
description = "Socket.IO server";
homepage = http://github.com/miguelgrinberg/python-socketio/;
license = licenses.mit;
maintainers = [ maintainers.mic92 ];
};
}

View File

@ -1,4 +1,4 @@
{ stdenv, buildPythonPackage, fetchPypi, isPy3k }:
{ stdenv, buildPackages, buildPythonPackage, fetchPypi, isPy3k }:
buildPythonPackage rec {
name = "${pname}-${version}";
@ -10,7 +10,8 @@ buildPythonPackage rec {
sha256 = "0a5b4vh734b3wfkgapzzf8x18rimpmzvwwkly56da84n27wfw9bg";
};
disabled = isPy3k;
# needs python2 at build time
PYTHON="${buildPackages.python2.interpreter}";
setupPyBuildFlags = [ "--plat-name" "linux" ];

View File

@ -6,7 +6,7 @@
# Run time
, ncurses, readline, gmp, mpfr, expat, zlib, dejagnu
, pythonSupport ? stdenv.hostPlatform == stdenv.buildPlatform && !stdenv.hostPlatform.isCygwin, python ? null
, pythonSupport ? stdenv.hostPlatform == stdenv.buildPlatform && !stdenv.hostPlatform.isCygwin, python3 ? null
, guile ? null
}:
@ -16,7 +16,7 @@ let
version = "8.2";
in
assert pythonSupport -> python != null;
assert pythonSupport -> python3 != null;
stdenv.mkDerivation rec {
name =
@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkgconfig texinfo perl setupDebugInfoDirs ];
buildInputs = [ ncurses readline gmp mpfr expat zlib guile ]
++ stdenv.lib.optional pythonSupport python
++ stdenv.lib.optional pythonSupport python3
++ stdenv.lib.optional doCheck dejagnu;
propagatedNativeBuildInputs = [ setupDebugInfoDirs ];

View File

@ -1,21 +1,41 @@
{ stdenv, python27Packages, gdb, pkgs }:
let
deps = import ./requirements.nix { inherit pkgs; };
in
python27Packages.buildPythonApplication rec {
{ stdenv
, buildPythonApplication
, fetchPypi
, gdb
, iana-etc
, libredirect
, flask
, flask-socketio
, flask-compress
, pygdbmi
, pygments
, gevent
, breakpointHook
, }:
buildPythonApplication rec {
pname = "gdbgui";
version = "0.13.0.0";
version = "0.13.1.1";
buildInputs = [ gdb ];
propagatedBuildInputs = builtins.attrValues deps.packages;
propagatedBuildInputs = [
flask
flask-socketio
flask-compress
pygdbmi
pygments
gevent
];
src = python27Packages.fetchPypi {
src = fetchPypi {
inherit pname version;
sha256 = "16a46kabhfqsgsks5l25kpgrvrkdah3h5f5m6ams2z9nzbrxl8bz";
sha256 = "1ypxgkxwb443ndyrmsa7zx2hn0d9b3s7n2w49ngfghd3l8k0yvi2";
};
postPatch = ''
echo ${version} > gdbgui/VERSION.txt
# remove upper version bound
sed -ie 's!, <.*"!"!' setup.py
'';
postInstall = ''
@ -23,15 +43,8 @@ python27Packages.buildPythonApplication rec {
--prefix PATH : ${stdenv.lib.makeBinPath [ gdb ]}
'';
# make /etc/protocols accessible to fix socket.getprotobyname('tcp') in sandbox
preCheck = stdenv.lib.optionalString stdenv.isLinux ''
export NIX_REDIRECTS=/etc/protocols=${pkgs.iana-etc}/etc/protocols \
LD_PRELOAD=${pkgs.libredirect}/lib/libredirect.so
'';
postCheck = stdenv.lib.optionalString stdenv.isLinux ''
unset NIX_REDIRECTS LD_PRELOAD
'';
# tests do not work without stdout/stdin
doCheck = false;
meta = with stdenv.lib; {
description = "A browser-based frontend for GDB";

View File

@ -1,336 +0,0 @@
# generated using pypi2nix tool (version: 1.8.1)
# See more at: https://github.com/garbas/pypi2nix
#
# COMMAND:
# pypi2nix -V 2.7 -r requirements.txt
#
{ pkgs ? import <nixpkgs> {}
}:
let
inherit (pkgs) makeWrapper;
inherit (pkgs.stdenv.lib) fix' extends;
pythonPackages =
import "${toString pkgs.path}/pkgs/top-level/python-packages.nix" {
inherit pkgs;
inherit (pkgs) stdenv;
python = pkgs.python27Full;
# patching pip so it does not try to remove files when running nix-shell
overrides =
self: super: {
bootstrapped-pip = super.bootstrapped-pip.overrideDerivation (old: {
patchPhase = old.patchPhase + ''
sed -i -e "s|paths_to_remove.remove(auto_confirm)|#paths_to_remove.remove(auto_confirm)|" -e "s|self.uninstalled = paths_to_remove|#self.uninstalled = paths_to_remove|" $out/${pkgs.python35.sitePackages}/pip/req/req_install.py
'';
});
};
};
commonBuildInputs = [];
commonDoCheck = false;
withPackages = pkgs':
let
pkgs = builtins.removeAttrs pkgs' ["__unfix__"];
interpreter = pythonPackages.buildPythonPackage {
name = "python27Full-interpreter";
buildInputs = [ makeWrapper ] ++ (builtins.attrValues pkgs);
buildCommand = ''
mkdir -p $out/bin
ln -s ${pythonPackages.python.interpreter} $out/bin/${pythonPackages.python.executable}
for dep in ${builtins.concatStringsSep " " (builtins.attrValues pkgs)}; do
if [ -d "$dep/bin" ]; then
for prog in "$dep/bin/"*; do
if [ -f $prog ]; then
ln -s $prog $out/bin/`basename $prog`
fi
done
fi
done
for prog in "$out/bin/"*; do
wrapProgram "$prog" --prefix PYTHONPATH : "$PYTHONPATH"
done
pushd $out/bin
ln -s ${pythonPackages.python.executable} python
ln -s ${pythonPackages.python.executable} python2
popd
'';
passthru.interpreter = pythonPackages.python;
};
in {
__old = pythonPackages;
inherit interpreter;
mkDerivation = pythonPackages.buildPythonPackage;
packages = pkgs;
overrideDerivation = drv: f:
pythonPackages.buildPythonPackage (drv.drvAttrs // f drv.drvAttrs // { meta = drv.meta; });
withPackages = pkgs'':
withPackages (pkgs // pkgs'');
};
python = withPackages {};
generated = self: {
"Flask" = python.mkDerivation {
name = "Flask-0.12.2";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/eb/12/1c7bd06fcbd08ba544f25bf2c6612e305a70ea51ca0eda8007344ec3f123/Flask-0.12.2.tar.gz"; sha256 = "49f44461237b69ecd901cc7ce66feea0319b9158743dd27a2899962ab214dac1"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [
self."Jinja2"
self."Werkzeug"
self."click"
self."itsdangerous"
];
meta = with pkgs.stdenv.lib; {
homepage = "http://github.com/pallets/flask/";
license = licenses.bsdOriginal;
description = "A microframework based on Werkzeug, Jinja2 and good intentions";
};
};
"Flask-Compress" = python.mkDerivation {
name = "Flask-Compress-1.4.0";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/0e/2a/378bd072928f6d92fd8c417d66b00c757dc361c0405a46a0134de6fd323d/Flask-Compress-1.4.0.tar.gz"; sha256 = "468693f4ddd11ac6a41bca4eb5f94b071b763256d54136f77957cfee635badb3"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [
self."Flask"
];
meta = with pkgs.stdenv.lib; {
homepage = "https://libwilliam.github.io/flask-compress/";
license = licenses.mit;
description = "Compress responses in your Flask app with gzip.";
};
};
"Flask-SocketIO" = python.mkDerivation {
name = "Flask-SocketIO-2.9.3";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/a0/ac/4024b73e071d5a000a998d6f26ba0a090011d5abdc7aa41f2774173c3276/Flask-SocketIO-2.9.3.tar.gz"; sha256 = "df23f790db8529c543bd0b54165215c342cf6955a4a1f605650e759197a46d59"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [
self."Flask"
self."python-socketio"
];
meta = with pkgs.stdenv.lib; {
homepage = "http://github.com/miguelgrinberg/Flask-SocketIO/";
license = licenses.mit;
description = "Socket.IO integration for Flask applications";
};
};
"Jinja2" = python.mkDerivation {
name = "Jinja2-2.10";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/56/e6/332789f295cf22308386cf5bbd1f4e00ed11484299c5d7383378cf48ba47/Jinja2-2.10.tar.gz"; sha256 = "f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [
self."MarkupSafe"
];
meta = with pkgs.stdenv.lib; {
homepage = "http://jinja.pocoo.org/";
license = licenses.bsdOriginal;
description = "A small but fast and easy to use stand-alone template engine written in pure python.";
};
};
"MarkupSafe" = python.mkDerivation {
name = "MarkupSafe-1.0";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/4d/de/32d741db316d8fdb7680822dd37001ef7a448255de9699ab4bfcbdf4172b/MarkupSafe-1.0.tar.gz"; sha256 = "a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [ ];
meta = with pkgs.stdenv.lib; {
homepage = "http://github.com/pallets/markupsafe";
license = licenses.bsdOriginal;
description = "Implements a XML/HTML/XHTML Markup safe string for Python";
};
};
"Pygments" = python.mkDerivation {
name = "Pygments-2.2.0";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/71/2a/2e4e77803a8bd6408a2903340ac498cb0a2181811af7c9ec92cb70b0308a/Pygments-2.2.0.tar.gz"; sha256 = "dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [ ];
meta = with pkgs.stdenv.lib; {
homepage = "http://pygments.org/";
license = licenses.bsdOriginal;
description = "Pygments is a syntax highlighting package written in Python.";
};
};
"Werkzeug" = python.mkDerivation {
name = "Werkzeug-0.14.1";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/9f/08/a3bb1c045ec602dc680906fc0261c267bed6b3bb4609430aff92c3888ec8/Werkzeug-0.14.1.tar.gz"; sha256 = "c3fd7a7d41976d9f44db327260e263132466836cef6f91512889ed60ad26557c"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [ ];
meta = with pkgs.stdenv.lib; {
homepage = "https://www.palletsprojects.org/p/werkzeug/";
license = licenses.bsdOriginal;
description = "The comprehensive WSGI web application library.";
};
};
"click" = python.mkDerivation {
name = "click-6.7";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/95/d9/c3336b6b5711c3ab9d1d3a80f1a3e2afeb9d8c02a7166462f6cc96570897/click-6.7.tar.gz"; sha256 = "f15516df478d5a56180fbf80e68f206010e6d160fc39fa508b65e035fd75130b"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [ ];
meta = with pkgs.stdenv.lib; {
homepage = "http://github.com/mitsuhiko/click";
license = licenses.bsdOriginal;
description = "A simple wrapper around optparse for powerful command line utilities.";
};
};
"gevent" = python.mkDerivation {
name = "gevent-1.2.2";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/1b/92/b111f76e54d2be11375b47b213b56687214f258fd9dae703546d30b837be/gevent-1.2.2.tar.gz"; sha256 = "4791c8ae9c57d6f153354736e1ccab1e2baf6c8d9ae5a77a9ac90f41e2966b2d"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [
self."greenlet"
];
meta = with pkgs.stdenv.lib; {
homepage = "http://www.gevent.org/";
license = licenses.mit;
description = "Coroutine-based network library";
};
};
"greenlet" = python.mkDerivation {
name = "greenlet-0.4.12";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/be/76/82af375d98724054b7e273b5d9369346937324f9bcc20980b45b068ef0b0/greenlet-0.4.12.tar.gz"; sha256 = "e4c99c6010a5d153d481fdaf63b8a0782825c0721506d880403a3b9b82ae347e"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [ ];
meta = with pkgs.stdenv.lib; {
homepage = "https://github.com/python-greenlet/greenlet";
license = licenses.mit;
description = "Lightweight in-process concurrent programming";
};
};
"itsdangerous" = python.mkDerivation {
name = "itsdangerous-0.24";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/dc/b4/a60bcdba945c00f6d608d8975131ab3f25b22f2bcfe1dab221165194b2d4/itsdangerous-0.24.tar.gz"; sha256 = "cbb3fcf8d3e33df861709ecaf89d9e6629cff0a217bc2848f1b41cd30d360519"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [ ];
meta = with pkgs.stdenv.lib; {
homepage = "http://github.com/mitsuhiko/itsdangerous";
license = licenses.bsdOriginal;
description = "Various helpers to pass trusted data to untrusted environments and back.";
};
};
"pygdbmi" = python.mkDerivation {
name = "pygdbmi-0.8.2.0";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/4e/34/a8c86d85e0d3d8df2c289657a55c19408dbdbf0b1468859e7f1a745ae8ff/pygdbmi-0.8.2.0.tar.gz"; sha256 = "47cece65808ca42edf6966ac48e2aedca7ae1c675c4d2f0d001c7f3a7fa245fe"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [ ];
meta = with pkgs.stdenv.lib; {
homepage = "https://github.com/cs01/pygdbmi";
license = licenses.mit;
description = "Parse gdb machine interface output with Python";
};
};
"python-engineio" = python.mkDerivation {
name = "python-engineio-2.0.2";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/e5/91/f6fd80298e68b4ca22a1a9cc3091116e2fef22fd8fb017ad9e5c6ec6ddcc/python-engineio-2.0.2.tar.gz"; sha256 = "46c710a72c3b2a8511b0d7963c46e200010f8ea3eb0721ce15603d0f23e993c4"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [
self."six"
];
meta = with pkgs.stdenv.lib; {
homepage = "http://github.com/miguelgrinberg/python-engineio/";
license = licenses.mit;
description = "Engine.IO server";
};
};
"python-socketio" = python.mkDerivation {
name = "python-socketio-1.8.4";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/58/a9/52af6a7ad0805977afc838ed394f8d26d078ef61e8c1bdd632801c58ef3a/python-socketio-1.8.4.tar.gz"; sha256 = "13807ce17e85371d15b31295a43b1fac1c0dba1eb5fc233353a3efd53aa122cc"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [
self."python-engineio"
self."six"
];
meta = with pkgs.stdenv.lib; {
homepage = "http://github.com/miguelgrinberg/python-socketio/";
license = licenses.mit;
description = "Socket.IO server";
};
};
"six" = python.mkDerivation {
name = "six-1.11.0";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/16/d8/bc6316cf98419719bd59c91742194c111b6f2e85abac88e496adefaf7afe/six-1.11.0.tar.gz"; sha256 = "70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [ ];
meta = with pkgs.stdenv.lib; {
homepage = "http://pypi.python.org/pypi/six/";
license = licenses.mit;
description = "Python 2 and 3 compatibility utilities";
};
};
};
localOverridesFile = ./requirements_override.nix;
overrides = import localOverridesFile { inherit pkgs python; };
commonOverrides = [
];
allOverrides =
(if (builtins.pathExists localOverridesFile)
then [overrides] else [] ) ++ commonOverrides;
in python.withPackages
(fix' (pkgs.lib.fold
extends
generated
allOverrides
)
)

View File

@ -1,4 +1,18 @@
{ stdenv, fetchFromGitHub, pythonPackages, makeWrapper, gdb }:
{ stdenv
, fetchFromGitHub
, makeWrapper
, gdb
, future
, isort
, psutil
, pycparser
, pyelftools
, python-ptrace
, ROPGadget
, six
, unicorn
, pygments
, }:
stdenv.mkDerivation rec {
name = "pwndbg-${version}";
@ -13,7 +27,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ makeWrapper ];
propagatedBuildInputs = with pythonPackages; [
propagatedBuildInputs = [
future
isort
psutil
@ -24,7 +38,6 @@ stdenv.mkDerivation rec {
six
unicorn
pygments
enum34
];
installPhase = ''

View File

@ -4978,7 +4978,7 @@ with pkgs;
pwnat = callPackage ../tools/networking/pwnat { };
pwndbg = callPackage ../development/tools/misc/pwndbg { };
pwndbg = python3Packages.callPackage ../development/tools/misc/pwndbg { };
pycangjie = pythonPackages.pycangjie;
@ -8522,7 +8522,7 @@ with pkgs;
gede = libsForQt59.callPackage ../development/tools/misc/gede { };
gdbgui = callPackage ../development/tools/misc/gdbgui { };
gdbgui = python3Packages.callPackage ../development/tools/misc/gdbgui { };
pmd = callPackage ../development/tools/analysis/pmd { };

View File

@ -554,6 +554,8 @@ in {
pygame_sdl2 = callPackage ../development/python-modules/pygame_sdl2 { };
pygdbmi = callPackage ../development/python-modules/pygdbmi { };
pygmo = callPackage ../development/python-modules/pygmo { };
pygobject2 = callPackage ../development/python-modules/pygobject { };
@ -633,6 +635,8 @@ in {
python-binance = callPackage ../development/python-modules/python-binance { };
python-engineio = callPackage ../development/python-modules/python-engineio { };
python-hosts = callPackage ../development/python-modules/python-hosts { };
python-lz4 = callPackage ../development/python-modules/python-lz4 { };
@ -660,6 +664,8 @@ in {
python-stdnum = callPackage ../development/python-modules/python-stdnum { };
python-socketio = callPackage ../development/python-modules/python-socketio { };
python-utils = callPackage ../development/python-modules/python-utils { };
pytimeparse = callPackage ../development/python-modules/pytimeparse { };
@ -2363,6 +2369,8 @@ in {
flask-silk = callPackage ../development/python-modules/flask-silk { };
flask-socketio = callPackage ../development/python-modules/flask-socketio { };
flask_sqlalchemy = callPackage ../development/python-modules/flask-sqlalchemy { };
flask_testing = callPackage ../development/python-modules/flask-testing { };