Unverified Commit 41d21a82 authored by Markus Kowalewski's avatar Markus Kowalewski Committed by GitHub
Browse files

Merge pull request #331723 from sheepforce/openbabel-fix

openbabel: fix build errors with python 3.12
parents 284db721 35255195
Loading
Loading
Loading
Loading
+28 −10
Original line number Diff line number Diff line
{ stdenv, lib, fetchFromGitHub, cmake, perl, zlib, libxml2, eigen, python, cairo, pcre, pkg-config, swig, rapidjson }:
{ stdenv
, lib
, fetchFromGitHub
, cmake
, perl
, zlib
, libxml2
, eigen
, python
, cairo
, pcre
, pkg-config
, swig
, rapidjson
, boost
, maeparser
, coordgenlibs
}:

stdenv.mkDerivation rec {
  pname = "openbabel";
@@ -15,22 +32,23 @@ stdenv.mkDerivation rec {
    sed '1i#include <ctime>' -i include/openbabel/obutil.h # gcc12
  '';

  buildInputs = [ perl zlib libxml2 eigen python cairo pcre swig rapidjson ];
  buildInputs = [ perl zlib libxml2 eigen python cairo pcre swig rapidjson boost maeparser coordgenlibs ];

  nativeBuildInputs = [ cmake pkg-config ];

  pythonMajorMinor = "${python.sourceVersion.major}.${python.sourceVersion.minor}";

  cmakeFlags = [
  preConfigure = ''
    cmakeFlagsArray+=(
      "-DRUN_SWIG=ON"
      "-DPYTHON_BINDINGS=ON"
  ];
      "-DPYTHON_INSTDIR=$out/${python.sitePackages}"
    )
  '';

  # Setuptools only accepts PEP 440 version strings. The "unstable" identifier
  # can not be used. Instead we pretend to be the 3.2 beta release.
  postFixup = ''
    cat <<EOF > $out/lib/python$pythonMajorMinor/site-packages/setup.py
    from distutils.core import setup
    cat << EOF > $out/${python.sitePackages}/setup.py
    from setuptools import setup

    setup(
        name = 'pyopenbabel',
+2 −2
Original line number Diff line number Diff line
@@ -8,9 +8,9 @@
buildPythonPackage rec {
  inherit (openbabel) pname version;

  src = "${openbabel}/lib/python${python.sourceVersion.major}.${python.sourceVersion.minor}/site-packages";
  src = "${openbabel}/${python.sitePackages}";

  nativeBuildInputs = [ openbabel ];
  buildInputs = [ openbabel ];

  # these env variables are used by the bindings to find libraries
  # they need to be included explicitly in your nix-shell for