git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #80467 from danieldk/fix-python-vowpalwabbit

python3Packages.vowpalwabbit: fix build

commit47ab49ac44bb114943d7f84b05ea458d6f17e4a7 authorSamuel Leathers <disasm@gmail.com> dateWed 19 Feb 2020, 12:46 (7 years ago) parentc82021a0688cba
2 files changed+34−50
pkgs/development/python-modules/vowpalwabbit/default.nix+34−16 pkgs/development/python-modules/vowpalwabbit/vowpal-wabbit-find-boost.diff−34
pkgs/development/python-modules/vowpalwabbit/default.nix+34−16
@@ -1,5 +1,17 @@
1−{ stdenv, lib, buildPythonPackage, fetchPypi, python, zlib, clang
2−, ncurses, pytest, docutils, pygments, numpy, scipy, scikitlearn }:
1+{ stdenv
2+, lib
3+, fetchPypi
4+, buildPythonPackage
5+, cmake
6+, python
7+, zlib
8+, ncurses
9+, pytest
10+, docutils
11+, pygments
12+, numpy
13+, scipy
14+, scikitlearn }:
315
416buildPythonPackage rec {
517 pname = "vowpalwabbit";
@@ -10,21 +22,27 @@ buildPythonPackage rec {
1022 sha256 = "bd4c7e49a6ddaa1afedf97b22b822c7322328d686d45151b47a5127fc409c2af";
1123 };
1224
13− # Should be fixed in next Python release after 8.5.0:
14− # https://github.com/JohnLangford/vowpal_wabbit/pull/1533
15− patches = [
16− ./vowpal-wabbit-find-boost.diff
25+ nativeBuildInputs = [
26+ cmake
1727 ];
1828
19− # vw tries to write some explicit things to home
20− # python installed: The directory '/homeless-shelter/.cache/pip/http'
21− preInstall = ''
22− export HOME=$PWD
23− '';
29+ buildInputs = [
30+ docutils
31+ ncurses
32+ pygments
33+ python.pkgs.boost
34+ zlib.dev
35+ ];
36+
37+ propagatedBuildInputs = [
38+ numpy
39+ scikitlearn
40+ scipy
41+ ];
2442
25− nativeBuildInputs = [ clang ];
26− buildInputs = [ python.pkgs.boost zlib.dev ncurses pytest docutils pygments ];
27− propagatedBuildInputs = [ numpy scipy scikitlearn ];
43+ # Python build script uses CMake, but we don't want CMake to do the
44+ # configuration.
45+ dontUseCmakeConfigure = true;
2846
2947 # Python ctypes.find_library uses DYLD_LIBRARY_PATH.
3048 preConfigure = lib.optionalString stdenv.isDarwin ''
@@ -34,12 +52,12 @@ buildPythonPackage rec {
3452 checkPhase = ''
3553 # check-manifest requires a git clone, not a tarball
3654 # check-manifest --ignore "Makefile,PACKAGE.rst,*.cc,tox.ini,tests*,examples*,src*"
37− ${python.interpreter} setup.py check -mrs
55+ ${python.interpreter} setup.py check -ms
3856 '';
3957
4058 meta = with lib; {
4159 description = "Vowpal Wabbit is a fast machine learning library for online learning, and this is the python wrapper for the project.";
42− homepage = https://github.com/JohnLangford/vowpal_wabbit;
60+ homepage = "https://github.com/JohnLangford/vowpal_wabbit";
4361 license = licenses.bsd3;
4462 broken = stdenv.isAarch64;
4563 maintainers = with maintainers; [ teh ];
pkgs/development/python-modules/vowpalwabbit/vowpal-wabbit-find-boost.diffdeleted−34
@@ -1,34 +0,0 @@
1−--- vowpalwabbit-8.5.0.orig/setup.py 2018-09-03 20:32:39.000000000 +0200
2−+++ vowpalwabbit-8.5.0/setup.py 2018-09-03 20:34:09.000000000 +0200
3−@@ -23,18 +23,11 @@
4−
5− def find_boost():
6− """Find correct boost-python library information """
7−- if system == 'Linux':
8−+ if system == 'Linux' or system == 'Darwin':
9− # use version suffix if present
10−- boost_lib = 'boost_python-py{v[0]}{v[1]}'.format(v=sys.version_info)
11−- if sys.version_info.major == 3:
12−- for candidate in ['-py36', '-py35', '-py34', '3']:
13−- boost_lib = 'boost_python{}'.format(candidate)
14−- if find_library(boost_lib):
15−- exit
16−+ boost_lib = 'boost_python{v[0]}{v[1]}'.format(v=sys.version_info)
17− if not find_library(boost_lib):
18− boost_lib = "boost_python"
19−- elif system == 'Darwin':
20−- boost_lib = 'boost_python-mt' if sys.version_info[0] == 2 else 'boost_python3-mt'
21− elif system == 'Cygwin':
22− boost_lib = 'boost_python-mt' if sys.version_info[0] == 2 else 'boost_python3-mt'
23− else:
24−--- vowpalwabbit-8.5.0.orig/src/Makefile 2018-09-03 20:32:40.000000000 +0200
25−+++ vowpalwabbit-8.5.0/src/Makefile 2018-09-03 21:42:30.000000000 +0200
26−@@ -37,7 +37,7 @@
27− NPROCS:=$(shell grep -c ^processor /proc/cpuinfo)
28− endif
29− ifeq ($(UNAME), Darwin)
30−- LIBS = -lboost_program_options-mt -lboost_serialization-mt -l pthread -l z
31−+ LIBS = -lboost_program_options -lboost_serialization -l pthread -l z
32− # On Macs, the location isn't always clear
33− # brew uses /usr/local
34− # but /opt/local seems to be preferred by some users