diff options
Diffstat (limited to 'nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix')
-rw-r--r-- | nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix | 482 |
1 files changed, 376 insertions, 106 deletions
diff --git a/nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix b/nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix index d722ec71b9af..16d66c48af8b 100644 --- a/nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix +++ b/nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix @@ -68,12 +68,32 @@ self: super: } ); + cairocffi = super.cairocffi.overridePythonAttrs ( + old: { + inherit (pkgs.python3.pkgs.cairocffi) patches; + buildInputs = old.buildInputs ++ [ self.pytest-runner ]; + } + ); + + cairosvg = super.cairosvg.overridePythonAttrs ( + old: { + buildInputs = old.buildInputs ++ [ self.pytest-runner ]; + } + ); + + cssselect2 = super.cssselect2.overridePythonAttrs ( + old: { + buildInputs = old.buildInputs ++ [ self.pytest-runner ]; + } + ); + cffi = # cffi is bundled with pypy - if self.python.implementation == "pypy" then null else ( + if self.python.implementation == "pypy" then null else + ( super.cffi.overridePythonAttrs ( old: { - buildInputs = old.buildInputs ++ [ pkgs.libffi ]; + buildInputs = old.buildInputs or [ ] ++ [ pkgs.libffi ]; } ) ); @@ -86,6 +106,12 @@ self: super: } ); + colour = super.colour.overridePythonAttrs ( + old: { + buildInputs = old.buildInputs ++ [ self.d2to1 ]; + } + ); + configparser = super.configparser.overridePythonAttrs ( old: { buildInputs = old.buildInputs ++ [ @@ -100,10 +126,19 @@ self: super: cryptography = super.cryptography.overridePythonAttrs ( old: { + nativeBuildInputs = old.nativeBuildInputs or [ ] + ++ stdenv.lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) self.python.pythonForBuild.pkgs.cffi; buildInputs = old.buildInputs ++ [ pkgs.openssl ]; } ); + dictdiffer = super.dictdiffer.overridePythonAttrs ( + old: { + buildInputs = old.buildInputs ++ [ self.pytest-runner ]; + propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.setuptools ]; + } + ); + django = ( super.django.overridePythonAttrs ( old: { @@ -139,6 +174,24 @@ self: super: # Environment markers are not always included (depending on how a dep was defined) enum34 = if self.pythonAtLeast "3.4" then null else super.enum34; + eth-hash = super.eth-hash.overridePythonAttrs { + preConfigure = '' + substituteInPlace setup.py --replace \'setuptools-markdown\' "" + ''; + }; + + eth-keyfile = super.eth-keyfile.overridePythonAttrs { + preConfigure = '' + substituteInPlace setup.py --replace \'setuptools-markdown\' "" + ''; + }; + + eth-keys = super.eth-keys.overridePythonAttrs { + preConfigure = '' + substituteInPlace setup.py --replace \'setuptools-markdown\' "" + ''; + }; + faker = super.faker.overridePythonAttrs ( old: { buildInputs = old.buildInputs ++ [ self.pytest-runner ]; @@ -272,6 +325,30 @@ self: super: } ); + # disable the removal of pyproject.toml, required because of setuptools_scm + jaraco-functools = super.jaraco-functools.overridePythonAttrs ( + old: { + dontPreferSetupPy = true; + } + ); + + jira = super.jira.overridePythonAttrs ( + old: { + inherit (pkgs.python3Packages.jira) patches; + buildInputs = old.buildInputs ++ [ + self.pytestrunner + self.cryptography + self.pyjwt + ]; + } + ); + + jsonpickle = super.jsonpickle.overridePythonAttrs ( + old: { + dontPreferSetupPy = true; + } + ); + jupyter = super.jupyter.overridePythonAttrs ( old: rec { # jupyter is a meta-package. Everything relevant comes from the @@ -281,6 +358,17 @@ self: super: } ); + keyring = super.keyring.overridePythonAttrs ( + old: { + buildInputs = old.buildInputs ++ [ + self.toml + ]; + postPatch = '' + substituteInPlace setup.py --replace 'setuptools.setup()' 'setuptools.setup(version="${old.version}")' + ''; + } + ); + kiwisolver = super.kiwisolver.overridePythonAttrs ( old: { buildInputs = old.buildInputs ++ [ @@ -408,21 +496,58 @@ self: super: ); molecule = - if lib.versionOlder super.molecule.version "3.0.0" then (super.molecule.overridePythonAttrs ( - old: { - patches = (old.patches or [ ]) ++ [ - # Fix build with more recent setuptools versions - (pkgs.fetchpatch { - url = "https://github.com/ansible-community/molecule/commit/c9fee498646a702c77b5aecf6497cff324acd056.patch"; - sha256 = "1g1n45izdz0a3c9akgxx14zhdw6c3dkb48j8pq64n82fa6ndl1b7"; - excludes = [ "pyproject.toml" ]; - }) - ]; + if lib.versionOlder super.molecule.version "3.0.0" then + (super.molecule.overridePythonAttrs ( + old: { + patches = (old.patches or [ ]) ++ [ + # Fix build with more recent setuptools versions + (pkgs.fetchpatch { + url = "https://github.com/ansible-community/molecule/commit/c9fee498646a702c77b5aecf6497cff324acd056.patch"; + sha256 = "1g1n45izdz0a3c9akgxx14zhdw6c3dkb48j8pq64n82fa6ndl1b7"; + excludes = [ "pyproject.toml" ]; + }) + ]; + buildInputs = old.buildInputs ++ [ self.setuptools-scm-git-archive ]; + } + )) else + super.molecule.overridePythonAttrs (old: { buildInputs = old.buildInputs ++ [ self.setuptools-scm-git-archive ]; - } - )) else super.molecule.overridePythonAttrs (old: { - buildInputs = old.buildInputs ++ [ self.setuptools-scm-git-archive ]; - }); + }); + + mongomock = super.mongomock.overridePythonAttrs (oa: { + buildInputs = oa.buildInputs ++ [ self.pbr ]; + }); + + mpi4py = super.mpi4py.overridePythonAttrs ( + old: + let + cfg = pkgs.writeTextFile { + name = "mpi.cfg"; + text = ( + lib.generators.toINI + { } + { + mpi = { + mpicc = "${pkgs.openmpi.outPath}/bin/mpicc"; + }; + } + ); + }; + in + { + propagatedBuildInputs = old.propagatedBuildInputs ++ [ pkgs.openmpi ]; + enableParallelBuilding = true; + preBuild = '' + ln -sf ${cfg} mpi.cfg + ''; + } + ); + + multiaddr = super.multiaddr.overridePythonAttrs ( + old: { + buildInputs = old.buildInputs ++ [ self.pytest-runner ]; + } + ); netcdf4 = super.netcdf4.overridePythonAttrs ( old: { @@ -456,15 +581,16 @@ self: super: name = "site.cfg"; text = ( lib.generators.toINI - { } { - ${blasImplementation} = { - include_dirs = "${blas}/include"; - library_dirs = "${blas}/lib"; - } // lib.optionalAttrs (blasImplementation == "mkl") { - mkl_libs = "mkl_rt"; - lapack_libs = ""; - }; - } + { } + { + ${blasImplementation} = { + include_dirs = "${blas}/include"; + library_dirs = "${blas}/lib"; + } // lib.optionalAttrs (blasImplementation == "mkl") { + mkl_libs = "mkl_rt"; + lapack_libs = ""; + }; + } ); }; in @@ -502,8 +628,8 @@ self: super: withMysql = old.passthru.withMysql or false; in { - buildInputs = old.buildInputs ++ [ self.cython pkgs.sqlite ]; - propagatedBuildInputs = old.propagatedBuildInputs + buildInputs = old.buildInputs or [ ] ++ [ pkgs.sqlite ]; + propagatedBuildInputs = old.propagatedBuildInputs or [ ] ++ lib.optional withPostgres self.psycopg2 ++ lib.optional withMysql self.mysql-connector; } @@ -516,6 +642,29 @@ self: super: } ); + poetry-core = super.poetry-core.overridePythonAttrs (old: { + # "Vendor" dependencies (for build-system support) + postPatch = '' + echo "import sys" >> poetry/__init__.py + for path in $propagatedBuildInputs; do + echo "sys.path.insert(0, \"$path\")" >> poetry/__init__.py + done + ''; + + # Propagating dependencies leads to issues downstream + # We've already patched poetry to prefer "vendored" dependencies + postFixup = '' + rm $out/nix-support/propagated-build-inputs + ''; + }); + + # disable the removal of pyproject.toml, required because of setuptools_scm + portend = super.portend.overridePythonAttrs ( + old: { + dontPreferSetupPy = true; + } + ); + psycopg2 = super.psycopg2.overridePythonAttrs ( old: { buildInputs = old.buildInputs @@ -533,61 +682,65 @@ self: super: ); pyarrow = - if lib.versionAtLeast super.pyarrow.version "0.16.0" then super.pyarrow.overridePythonAttrs ( - old: - let - parseMinor = drv: lib.concatStringsSep "." (lib.take 2 (lib.splitVersion drv.version)); - - # Starting with nixpkgs revision f149c7030a7, pyarrow takes "python3" as an argument - # instead of "python". Below we inspect function arguments to maintain compatibilitiy. - _arrow-cpp = pkgs.arrow-cpp.override ( - builtins.intersectAttrs - (lib.functionArgs pkgs.arrow-cpp.override) { python = self.python; python3 = self.python; } - ); - - ARROW_HOME = _arrow-cpp; - arrowCppVersion = parseMinor pkgs.arrow-cpp; - pyArrowVersion = parseMinor super.pyarrow; - errorMessage = "arrow-cpp version (${arrowCppVersion}) mismatches pyarrow version (${pyArrowVersion})"; - in - if arrowCppVersion != pyArrowVersion then throw errorMessage else { + if lib.versionAtLeast super.pyarrow.version "0.16.0" then + super.pyarrow.overridePythonAttrs + ( + old: + let + parseMinor = drv: lib.concatStringsSep "." (lib.take 2 (lib.splitVersion drv.version)); + + # Starting with nixpkgs revision f149c7030a7, pyarrow takes "python3" as an argument + # instead of "python". Below we inspect function arguments to maintain compatibilitiy. + _arrow-cpp = pkgs.arrow-cpp.override ( + builtins.intersectAttrs + (lib.functionArgs pkgs.arrow-cpp.override) + { python = self.python; python3 = self.python; } + ); + + ARROW_HOME = _arrow-cpp; + arrowCppVersion = parseMinor pkgs.arrow-cpp; + pyArrowVersion = parseMinor super.pyarrow; + errorMessage = "arrow-cpp version (${arrowCppVersion}) mismatches pyarrow version (${pyArrowVersion})"; + in + if arrowCppVersion != pyArrowVersion then throw errorMessage else { - nativeBuildInputs = old.nativeBuildInputs ++ [ - self.cython - pkgs.pkgconfig - pkgs.cmake - ]; + nativeBuildInputs = old.nativeBuildInputs ++ [ + self.cython + pkgs.pkgconfig + pkgs.cmake + ]; - preBuild = '' - export PYARROW_PARALLEL=$NIX_BUILD_CORES - ''; + preBuild = '' + export PYARROW_PARALLEL=$NIX_BUILD_CORES + ''; - PARQUET_HOME = _arrow-cpp; - inherit ARROW_HOME; + PARQUET_HOME = _arrow-cpp; + inherit ARROW_HOME; - buildInputs = old.buildInputs ++ [ - pkgs.arrow-cpp - ]; + buildInputs = old.buildInputs ++ [ + pkgs.arrow-cpp + ]; - PYARROW_BUILD_TYPE = "release"; - PYARROW_WITH_PARQUET = true; - PYARROW_CMAKE_OPTIONS = [ - "-DCMAKE_INSTALL_RPATH=${ARROW_HOME}/lib" + PYARROW_BUILD_TYPE = "release"; + PYARROW_WITH_PARQUET = true; + PYARROW_CMAKE_OPTIONS = [ + "-DCMAKE_INSTALL_RPATH=${ARROW_HOME}/lib" - # This doesn't use setup hook to call cmake so we need to workaround #54606 - # ourselves - "-DCMAKE_POLICY_DEFAULT_CMP0025=NEW" - ]; + # This doesn't use setup hook to call cmake so we need to workaround #54606 + # ourselves + "-DCMAKE_POLICY_DEFAULT_CMP0025=NEW" + ]; - dontUseCmakeConfigure = true; - } - ) else super.pyarrow.overridePythonAttrs ( - old: { - nativeBuildInputs = old.nativeBuildInputs ++ [ - self.cython - ]; - } - ); + dontUseCmakeConfigure = true; + } + ) else + super.pyarrow.overridePythonAttrs ( + old: { + nativeBuildInputs = old.nativeBuildInputs ++ [ + self.cython + ]; + } + ); pycairo = ( drv: ( @@ -647,20 +800,22 @@ self: super: # Tests fail because of no audio device and display. doCheck = false; preConfigure = '' - sed \ - -e "s/origincdirs = .*/origincdirs = []/" \ - -e "s/origlibdirs = .*/origlibdirs = []/" \ - -e "/'\/lib\/i386-linux-gnu', '\/lib\/x86_64-linux-gnu']/d" \ - -e "/\/include\/smpeg/d" \ - -i buildconfig/config_unix.py - ${lib.concatMapStrings (dep: '' - sed \ - -e "/origincdirs =/a\ origincdirs += ['${lib.getDev dep}/include']" \ - -e "/origlibdirs =/a\ origlibdirs += ['${lib.getLib dep}/lib']" \ - -i buildconfig/config_unix.py - '') buildInputs - } - LOCALBASE=/ ${self.python.interpreter} buildconfig/config.py + sed \ + -e "s/origincdirs = .*/origincdirs = []/" \ + -e "s/origlibdirs = .*/origlibdirs = []/" \ + -e "/'\/lib\/i386-linux-gnu', '\/lib\/x86_64-linux-gnu']/d" \ + -e "/\/include\/smpeg/d" \ + -i buildconfig/config_unix.py + ${lib.concatMapStrings + (dep: '' + sed \ + -e "/origincdirs =/a\ origincdirs += ['${lib.getDev dep}/include']" \ + -e "/origlibdirs =/a\ origlibdirs += ['${lib.getLib dep}/lib']" \ + -i buildconfig/config_unix.py + '') + buildInputs + } + LOCALBASE=/ ${self.python.interpreter} buildconfig/config.py ''; } ); @@ -685,6 +840,14 @@ self: super: } ); + python-bugzilla = super.python-bugzilla.overridePythonAttrs ( + old: { + nativeBuildInputs = old.nativeBuildInputs ++ [ + self.docutils + ]; + } + ); + python-ldap = super.python-ldap.overridePythonAttrs ( old: { buildInputs = old.buildInputs ++ [ pkgs.openldap pkgs.cyrus_sasl ]; @@ -813,6 +976,15 @@ self: super: } ); + pytest-django = super.pytest-django.overridePythonAttrs ( + old: { + postPatch = '' + substituteInPlace setup.py --replace "'pytest>=3.6'," "" + substituteInPlace setup.py --replace "'pytest>=3.6'" "" + ''; + } + ); + pytest-runner = super.pytest-runner or super.pytestrunner; python-jose = super.python-jose.overridePythonAttrs ( @@ -884,6 +1056,12 @@ self: super: } ); + rlp = super.rlp.overridePythonAttrs { + preConfigure = '' + substituteInPlace setup.py --replace \'setuptools-markdown\' "" + ''; + }; + scipy = super.scipy.overridePythonAttrs ( old: if old.format != "wheel" then { @@ -927,13 +1105,14 @@ self: super: ); shellingham = - if lib.versionAtLeast super.shellingham.version "1.3.2" then ( - super.shellingham.overridePythonAttrs ( - old: { - format = "pyproject"; - } - ) - ) else super.shellingham; + if lib.versionAtLeast super.shellingham.version "1.3.2" then + ( + super.shellingham.overridePythonAttrs ( + old: { + format = "pyproject"; + } + ) + ) else super.shellingham; tables = super.tables.overridePythonAttrs ( old: { @@ -943,6 +1122,13 @@ self: super: } ); + # disable the removal of pyproject.toml, required because of setuptools_scm + tempora = super.tempora.overridePythonAttrs ( + old: { + dontPreferSetupPy = true; + } + ); + tensorflow = super.tensorflow.overridePythonAttrs ( old: { postInstall = '' @@ -959,6 +1145,49 @@ self: super: } ); + tinycss2 = super.tinycss2.overridePythonAttrs ( + old: { + buildInputs = old.buildInputs ++ [ self.pytest-runner ]; + } + ); + + torch = lib.makeOverridable + ({ enableCuda ? false + , cudatoolkit ? pkgs.cudatoolkit_10_1 + , pkg ? super.torch + }: pkg.overrideAttrs (old: + { + preConfigure = + if (!enableCuda) then '' + export USE_CUDA=0 + '' else '' + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${cudatoolkit}/targets/x86_64-linux/lib" + ''; + preFixup = lib.optionalString (!enableCuda) '' + # For some reason pytorch retains a reference to libcuda even if it + # is explicitly disabled with USE_CUDA=0. + find $out -name "*.so" -exec ${pkgs.patchelf}/bin/patchelf --remove-needed libcuda.so.1 {} \; + ''; + buildInputs = old.buildInputs ++ lib.optionals enableCuda [ + pkgs.linuxPackages.nvidia_x11 + pkgs.nccl.dev + pkgs.nccl.out + ]; + propagatedBuildInputs = [ + super.numpy + super.future + ]; + }) + ) + { }; + + typeguard = super.typeguard.overridePythonAttrs (old: { + postPatch = '' + substituteInPlace setup.py \ + --replace 'setup()' 'setup(version="${old.version}")' + ''; + }); + # nix uses a dash, poetry uses an underscore typing_extensions = super.typing_extensions or self.typing-extensions; @@ -1004,6 +1233,20 @@ self: super: python = self.python; }).wheel; }; + + weasyprint = super.weasyprint.overridePythonAttrs ( + old: { + inherit (pkgs.python3.pkgs.weasyprint) patches; + buildInputs = old.buildInputs ++ [ self.pytest-runner ]; + } + ); + + web3 = super.web3.overridePythonAttrs { + preConfigure = '' + substituteInPlace setup.py --replace \'setuptools-markdown\' "" + ''; + }; + wheel = let isWheel = super.wheel.src.isWheel or false; @@ -1026,9 +1269,10 @@ self: super: in if isWheel then wheelPackage else sourcePackage; - zipp = - ( - if lib.versionAtLeast super.zipp.version "2.0.0" then ( + zipp = if super.zipp == null then null else + ( + if lib.versionAtLeast super.zipp.version "2.0.0" then + ( super.zipp.overridePythonAttrs ( old: { prePatch = '' @@ -1039,12 +1283,38 @@ self: super: } ) ) else super.zipp - ).overridePythonAttrs ( - old: { - propagatedBuildInputs = old.propagatedBuildInputs ++ [ - self.toml - ]; - } - ); + ).overridePythonAttrs ( + old: { + propagatedBuildInputs = old.propagatedBuildInputs ++ [ + self.toml + ]; + } + ); + credis = super.credis.overridePythonAttrs ( + old: { + buildInputs = old.buildInputs ++ [ self.cython ]; + } + ); + + hashids = super.hashids.overridePythonAttrs ( + old: { + buildInputs = old.buildInputs ++ [ self.flit-core ]; + } + ); + + supervisor = super.supervisor.overridePythonAttrs ( + old: { + propagatedBuildInputs = old.propagatedBuildInputs ++ [ + self.meld3 + self.setuptools + ]; + } + ); + + cytoolz = super.cytoolz.overridePythonAttrs ( + old: { + propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.toolz ]; + } + ); } |