mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 07:00:43 +00:00
or-tools: Add Python bindings
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
parent
373488e6f4
commit
08e9273e29
|
@ -1,5 +1,7 @@
|
|||
{ stdenv, fetchFromGitHub, cmake, google-gflags, which
|
||||
, lsb-release, glog, protobuf, cbc, zlib, python3 }:
|
||||
, lsb-release, glog, protobuf, cbc, zlib
|
||||
, ensureNewerSourcesForZipFilesHook, python, swig
|
||||
, pythonProtobuf }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "or-tools-${version}";
|
||||
|
@ -25,23 +27,36 @@ stdenv.mkDerivation rec {
|
|||
EOF
|
||||
'';
|
||||
|
||||
makeFlags = [ "prefix=${placeholder "out"}" ];
|
||||
buildFlags = [ "cc" ];
|
||||
makeFlags = [
|
||||
"prefix=${placeholder "out"}"
|
||||
"PROTOBUF_PYTHON_DESC=${pythonProtobuf}/${python.sitePackages}/google/protobuf/descriptor_pb2.py"
|
||||
];
|
||||
buildFlags = [ "cc" "pypi_archive" ];
|
||||
|
||||
checkTarget = "test_cc";
|
||||
doCheck = true;
|
||||
|
||||
installTargets = [ "install_cc" ];
|
||||
# The upstream install_python target installs to $HOME.
|
||||
postInstall = ''
|
||||
mkdir -p "$python/${python.sitePackages}"
|
||||
(cd temp_python/ortools; PYTHONPATH="$python/${python.sitePackages}:$PYTHONPATH" python setup.py install '--prefix=$python')
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake lsb-release which zlib python3
|
||||
cmake lsb-release swig which zlib python
|
||||
ensureNewerSourcesForZipFilesHook
|
||||
python.pkgs.setuptools python.pkgs.wheel
|
||||
];
|
||||
propagatedBuildInputs = [
|
||||
google-gflags glog protobuf cbc
|
||||
pythonProtobuf python.pkgs.six
|
||||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
outputs = [ "out" "python" ];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = https://github.com/google/or-tools;
|
||||
license = licenses.asl20;
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
diff --git a/ortools/data/jobshop_scheduling_parser.cc b/ortools/data/jobshop_scheduling_parser.cc
|
||||
index cb0a360b..c2f055eb 100644
|
||||
--- a/ortools/data/jobshop_scheduling_parser.cc
|
||||
+++ b/ortools/data/jobshop_scheduling_parser.cc
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "ortools/data/jobshop_scheduling_parser.h"
|
||||
|
||||
#include <cmath>
|
||||
+#include <gflags/gflags.h>
|
||||
|
||||
#include "google/protobuf/wrappers.pb.h"
|
||||
#include "ortools/base/filelineiter.h"
|
|
@ -21750,7 +21750,9 @@ in
|
|||
|
||||
nauty = callPackage ../applications/science/math/nauty {};
|
||||
|
||||
or-tools = callPackage ../development/libraries/science/math/or-tools {};
|
||||
or-tools = callPackage ../development/libraries/science/math/or-tools {
|
||||
pythonProtobuf = pythonPackages.protobuf;
|
||||
};
|
||||
|
||||
rubiks = callPackage ../development/libraries/science/math/rubiks { };
|
||||
|
||||
|
|
|
@ -551,6 +551,11 @@ in {
|
|||
|
||||
ordered-set = callPackage ../development/python-modules/ordered-set { };
|
||||
|
||||
ortools = (toPythonModule (pkgs.or-tools.override {
|
||||
inherit (self) python;
|
||||
pythonProtobuf = self.protobuf;
|
||||
})).python;
|
||||
|
||||
osmnx = callPackage ../development/python-modules/osmnx { };
|
||||
|
||||
outcome = callPackage ../development/python-modules/outcome {};
|
||||
|
|
Loading…
Reference in a new issue