From 30c6234e1549a67c931c046620b307bd27aa186a Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sun, 23 Dec 2018 22:56:58 +0100 Subject: [PATCH] python3Packages.pyaxmlparser: fix build The build is currently broken on master[1] due to a major bump of `click` in fe0af1ce777abf99a3fd851a86f2000326153207. Manually patching `setup.py` temporarily fixes the issue. To ensure that succeeding builds don't deliver packages breaking at runtime due to dependency issues I switched to the GitHub archive as source since it contains tests as well. Additionally, Python 2.7 support has been dropped. It seems as it was never intended to support Python3 here, I simply forgot to disable the Python2 build. ``` TypeError: AXMLParser object is not an iterator ``` [1] https://hydra.nixos.org/build/86108813 --- .../python-modules/pyaxmlparser/default.nix | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/pkgs/development/python-modules/pyaxmlparser/default.nix b/pkgs/development/python-modules/pyaxmlparser/default.nix index 9ea3a3eda071..0721c0d449c7 100644 --- a/pkgs/development/python-modules/pyaxmlparser/default.nix +++ b/pkgs/development/python-modules/pyaxmlparser/default.nix @@ -1,16 +1,30 @@ -{ buildPythonPackage, stdenv, lxml, click, fetchPypi }: +{ buildPythonPackage, stdenv, lxml, click, fetchFromGitHub, pytest, isPy3k }: buildPythonPackage rec { version = "0.3.13"; pname = "pyaxmlparser"; - src = fetchPypi { - inherit pname version; - sha256 = "1mzdrifnaky57vkmdvg0rgjss55xkxaramci3wpv4h65lmk95988"; + # the PyPI tarball doesn't ship tests. + src = fetchFromGitHub { + owner = "appknox"; + repo = pname; + rev = "v${version}"; + sha256 = "0jfjhxc6b57npsidknxmhj1x813scg47aaw90ybyr90fpdz5rlwk"; }; + disabled = !isPy3k; + + postPatch = '' + substituteInPlace setup.py --replace "click==6.7" "click" + ''; + propagatedBuildInputs = [ lxml click ]; + checkInputs = [ pytest ]; + checkPhase = '' + py.test tests/ + ''; + meta = with stdenv.lib; { description = "Python3 Parser for Android XML file and get Application Name without using Androguard"; homepage = https://github.com/appknox/pyaxmlparser;