diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/default.nix b/pkgs/development/tools/poetry2nix/poetry2nix/default.nix index 62063ff09947..9b55b72c2fa0 100644 --- a/pkgs/development/tools/poetry2nix/poetry2nix/default.nix +++ b/pkgs/development/tools/poetry2nix/poetry2nix/default.nix @@ -5,7 +5,7 @@ }: let # Poetry2nix version - version = "1.16.1"; + version = "1.17.0"; inherit (poetryLib) isCompatible readTOML moduleName; @@ -163,7 +163,7 @@ lib.makeScope pkgs.newScope (self: { compatible = partitions.right; incompatible = partitions.wrong; - # Create an overriden version of pythonPackages + # Create an overridden version of pythonPackages # # We need to avoid mixing multiple versions of pythonPackages in the same # closure as python can only ever have one version of a dependency @@ -229,7 +229,12 @@ lib.makeScope pkgs.newScope (self: { inputAttrs = mkInputAttrs { inherit py pyProject; attrs = { }; includeBuildSystem = false; }; - storePackages = builtins.foldl' (acc: v: acc ++ v) [ ] (lib.attrValues inputAttrs); + requiredPythonModules = python.pkgs.requiredPythonModules; + /* Include all the nested dependencies which are required for each package. + This guarantees that using the "poetryPackages" attribute will return + complete list of dependencies for the poetry project to be portable. + */ + storePackages = requiredPythonModules (builtins.foldl' (acc: v: acc ++ v) [ ] (lib.attrValues inputAttrs)); in { python = py; diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/fetch-wheel.sh b/pkgs/development/tools/poetry2nix/poetry2nix/fetch-from-pypi.sh similarity index 86% rename from pkgs/development/tools/poetry2nix/poetry2nix/fetch-wheel.sh rename to pkgs/development/tools/poetry2nix/poetry2nix/fetch-from-pypi.sh index 97f54b23416d..e56dee6849b2 100644 --- a/pkgs/development/tools/poetry2nix/poetry2nix/fetch-wheel.sh +++ b/pkgs/development/tools/poetry2nix/poetry2nix/fetch-from-pypi.sh @@ -9,12 +9,12 @@ curl="curl \ --cookie-jar cookies \ --insecure \ --speed-time 5 \ - -# \ + --progress-bar \ --fail \ $curlOpts \ $NIX_CURL_FLAGS" -echo "Trying to fetch wheel with predicted URL: $predictedURL" +echo "Trying to fetch with predicted URL: $predictedURL" $curl $predictedURL --output $out && exit 0 diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/fetch_from_legacy.py b/pkgs/development/tools/poetry2nix/poetry2nix/fetch_from_legacy.py new file mode 100644 index 000000000000..5931d4c92708 --- /dev/null +++ b/pkgs/development/tools/poetry2nix/poetry2nix/fetch_from_legacy.py @@ -0,0 +1,72 @@ +# Some repositories (such as Devpi) expose the Pypi legacy API +# (https://warehouse.pypa.io/api-reference/legacy.html). +# +# Note it is not possible to use pip +# https://discuss.python.org/t/pip-download-just-the-source-packages-no-building-no-metadata-etc/4651/12 + +import sys +from urllib.parse import urlparse +from html.parser import HTMLParser +import urllib.request +import shutil +import ssl +import os + + +# Parse the legacy index page to extract the href and package names +class Pep503(HTMLParser): + def __init__(self): + super().__init__() + self.sources = {} + self.url = None + self.name = None + + def handle_data(self, data): + if self.url is not None: + self.name = data + + def handle_starttag(self, tag, attrs): + if tag == "a": + for name, value in attrs: + if name == "href": + self.url = value + + def handle_endtag(self, tag): + if self.url is not None: + self.sources[self.name] = self.url + self.url = None + + +url = sys.argv[1] +package_name = sys.argv[2] +index_url = url + "/" + package_name +package_filename = sys.argv[3] + +print("Reading index %s" % index_url) + +response = urllib.request.urlopen( + index_url, + context=ssl.CERT_NONE) +index = response.read() + +parser = Pep503() +parser.feed(str(index)) +if package_filename not in parser.sources: + print("The file %s has not be found in the index %s" % ( + package_filename, index_url)) + exit(1) + +package_file = open(package_filename, "wb") +# Sometimes the href is a relative path +if urlparse(parser.sources[package_filename]).netloc == '': + package_url = index_url + "/" + parser.sources[package_filename] +else: + package_url = parser.sources[package_filename] +print("Downloading %s" % package_url) + +response = urllib.request.urlopen( + package_url, + context=ssl.CERT_NONE) + +with response as r: + shutil.copyfileobj(r, package_file) diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/lib.nix b/pkgs/development/tools/poetry2nix/poetry2nix/lib.nix index 6af37b395e0c..cb1cd8af1316 100644 --- a/pkgs/development/tools/poetry2nix/poetry2nix/lib.nix +++ b/pkgs/development/tools/poetry2nix/poetry2nix/lib.nix @@ -93,17 +93,19 @@ let ); - # Fetch the wheels from the PyPI index. - # We need to first get the proper URL to the wheel. + # Fetch from the PyPI index. + # At first we try to fetch the predicated URL but if that fails we + # will use the Pypi API to determine the correct URL. # Args: # pname: package name # file: filename including extension + # version: the version string of the dependency # hash: SRI hash # kind: Language implementation and version tag - fetchWheelFromPypi = lib.makeOverridable ( - { pname, file, hash, kind, curlOpts ? "" }: + fetchFromPypi = lib.makeOverridable ( + { pname, file, version, hash, kind, curlOpts ? "" }: let - version = builtins.elemAt (builtins.split "-" file) 2; + predictedURL = predictURLFromPypi { inherit pname file hash kind; }; in (pkgs.stdenvNoCC.mkDerivation { name = file; @@ -111,7 +113,7 @@ let pkgs.curl pkgs.jq ]; - isWheel = true; + isWheel = lib.strings.hasSuffix "whl" file; system = "builtin"; preferLocalBuild = true; @@ -119,36 +121,35 @@ let "NIX_CURL_FLAGS" ]; - predictedURL = predictURLFromPypi { inherit pname file hash kind; }; - inherit pname file version curlOpts; + inherit pname file version curlOpts predictedURL; - builder = ./fetch-wheel.sh; + builder = ./fetch-from-pypi.sh; outputHashMode = "flat"; outputHashAlgo = "sha256"; outputHash = hash; + + passthru = { + urls = [ predictedURL ]; # retain compatibility with nixpkgs' fetchurl + }; }) ); - # Fetch the artifacts from the PyPI index. Since we get all - # info we need from the lock file we don't use nixpkgs' fetchPyPi - # as it modifies casing while not providing anything we don't already - # have. - # - # Args: - # pname: package name - # file: filename including extension - # hash: SRI hash - # kind: Language implementation and version tag https://www.python.org/dev/peps/pep-0427/#file-name-convention - fetchFromPypi = lib.makeOverridable ( - { pname, file, hash, kind }: - if lib.strings.hasSuffix "whl" file then fetchWheelFromPypi { inherit pname file hash kind; } - else - pkgs.fetchurl { - url = predictURLFromPypi { inherit pname file hash kind; }; - inherit hash; - } + fetchFromLegacy = lib.makeOverridable ( + { python, pname, url, file, hash }: + pkgs.runCommand file + { + nativeBuildInputs = [ python ]; + impureEnvVars = lib.fetchers.proxyImpureEnvVars; + outputHashMode = "flat"; + outputHashAlgo = "sha256"; + outputHash = hash; + } '' + python ${./fetch_from_legacy.py} ${url} ${pname} ${file} + mv ${file} $out + '' ); + getBuildSystemPkgs = { pythonPackages , pyProject @@ -215,7 +216,7 @@ in { inherit fetchFromPypi - fetchWheelFromPypi + fetchFromLegacy getManyLinuxDeps isCompatible readTOML diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/mk-poetry-dep.nix b/pkgs/development/tools/poetry2nix/poetry2nix/mk-poetry-dep.nix index bb7b4e39b037..b403e9941f34 100644 --- a/pkgs/development/tools/poetry2nix/poetry2nix/mk-poetry-dep.nix +++ b/pkgs/development/tools/poetry2nix/poetry2nix/mk-poetry-dep.nix @@ -28,7 +28,7 @@ pythonPackages.callPackage }@args: let inherit (pkgs) stdenv; - inherit (poetryLib) isCompatible getManyLinuxDeps fetchFromPypi moduleName; + inherit (poetryLib) isCompatible getManyLinuxDeps fetchFromLegacy fetchFromPypi moduleName; inherit (import ./pep425.nix { inherit lib poetryLib python; @@ -37,7 +37,7 @@ pythonPackages.callPackage ; fileCandidates = let - supportedRegex = ("^.*?(" + builtins.concatStringsSep "|" supportedExtensions + ")"); + supportedRegex = ("^.*(" + builtins.concatStringsSep "|" supportedExtensions + ")"); matchesVersion = fname: builtins.match ("^.*" + builtins.replaceStrings [ "." ] [ "\\." ] version + ".*$") fname != null; hasSupportedExtension = fname: builtins.match supportedRegex fname != null; isCompatibleEgg = fname: ! lib.strings.hasSuffix ".egg" fname || lib.strings.hasSuffix "py${python.pythonVersion}.egg" fname; @@ -48,6 +48,7 @@ pythonPackages.callPackage isGit = isSource && source.type == "git"; isUrl = isSource && source.type == "url"; isLocal = isSource && source.type == "directory"; + isLegacy = isSource && source.type == "legacy"; localDepPath = toPath source.url; buildSystemPkgs = @@ -171,10 +172,19 @@ pythonPackages.callPackage } else if isLocal then (poetryLib.cleanPythonSources { src = localDepPath; }) + else if isLegacy then + fetchFromLegacy + { + pname = name; + inherit python; + inherit (fileInfo) file hash; + inherit (source) url; + } else fetchFromPypi { pname = name; inherit (fileInfo) file hash kind; + inherit version; }; } ) diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix b/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix index f217aefc2d26..ea0045c11474 100644 --- a/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix +++ b/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix @@ -8,7 +8,13 @@ self: super: { automat = super.automat.overridePythonAttrs ( old: rec { - propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.m2r ]; + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.m2r ]; + } + ); + + aiohttp-swagger3 = super.aiohttp-swagger3.overridePythonAttrs ( + old: { + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.pytest-runner ]; } ); @@ -21,7 +27,7 @@ self: super: # Inputs copied from nixpkgs as ansible doesn't specify it's dependencies # in a correct manner. - propagatedBuildInputs = old.propagatedBuildInputs ++ [ + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.pycrypto self.paramiko self.jinja2 @@ -170,7 +176,7 @@ self: super: dictdiffer = super.dictdiffer.overridePythonAttrs ( old: { buildInputs = (old.buildInputs or [ ]) ++ [ self.pytest-runner ]; - propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.setuptools ]; + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.setuptools ]; } ); @@ -178,7 +184,7 @@ self: super: super.django.overridePythonAttrs ( old: { propagatedNativeBuildInputs = (old.propagatedNativeBuildInputs or [ ]) - ++ [ pkgs.gettext ]; + ++ [ pkgs.gettext self.pytest-runner ]; } ) ); @@ -193,6 +199,36 @@ self: super: } ); + django-cors-headers = super.django-cors-headers.overridePythonAttrs ( + old: { + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.pytest-runner ]; + } + ); + + django-hijack = super.django-hijack.overridePythonAttrs ( + old: { + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.pytest-runner ]; + } + ); + + django-prometheus = super.django-prometheus.overridePythonAttrs ( + old: { + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.pytest-runner ]; + } + ); + + django-rosetta = super.django-rosetta.overridePythonAttrs ( + old: { + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.pytest-runner ]; + } + ); + + django-stubs-ext = super.django-stubs-ext.overridePythonAttrs ( + old: { + prePatch = (old.prePatch or "") + "touch ../LICENSE.txt"; + } + ); + dlib = super.dlib.overridePythonAttrs ( old: { # Parallel building enabled @@ -227,6 +263,16 @@ self: super: ''; }; + # remove eth-hash dependency because eth-hash also depends on eth-utils causing a cycle. + eth-utils = super.eth-utils.overridePythonAttrs (old: { + propagatedBuildInputs = + builtins.filter (i: i.pname != "eth-hash") old.propagatedBuildInputs; + preConfigure = '' + ${old.preConfigure or ""} + sed -i '/eth-hash/d' setup.py + ''; + }); + faker = super.faker.overridePythonAttrs ( old: { buildInputs = (old.buildInputs or [ ]) ++ [ self.pytest-runner ]; @@ -244,6 +290,10 @@ self: super: } ); + fastecdsa = super.fastecdsa.overridePythonAttrs (old: { + buildInputs = old.buildInputs ++ [ pkgs.gmp.dev ]; + }); + fastparquet = super.fastparquet.overridePythonAttrs ( old: { buildInputs = (old.buildInputs or [ ]) ++ [ self.pytest-runner ]; @@ -313,11 +363,11 @@ self: super: nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.pkg-config ]; buildInputs = (old.buildInputs or [ ]) - ++ [ pkgs.hdf5 self.pkg-config self.cython ] + ++ [ pkgs.hdf5 self.pkgconfig self.cython ] ++ lib.optional mpiSupport mpi ; propagatedBuildInputs = - old.propagatedBuildInputs + (old.propagatedBuildInputs or [ ]) ++ lib.optionals mpiSupport [ self.mpi4py self.openssh ] ; preBuild = if mpiSupport then "export CC=${mpi}/bin/mpicc" else ""; @@ -333,9 +383,25 @@ self: super: ) else old ); + hid = super.hid.overridePythonAttrs ( + old: { + postPatch = '' + found= + for name in libhidapi-hidraw libhidapi-libusb libhidapi-iohidmanager libhidapi; do + full_path=${pkgs.hidapi.out}/lib/$name${pkgs.stdenv.hostPlatform.extensions.sharedLibrary} + if test -f $full_path; then + found=t + sed -i -e "s|'$name\..*'|'$full_path'|" hid/__init__.py + fi + done + test -n "$found" || { echo "ERROR: No known libraries found in ${pkgs.hidapi.out}/lib, please update/fix this build expression."; exit 1; } + ''; + } + ); + horovod = super.horovod.overridePythonAttrs ( old: { - propagatedBuildInputs = old.propagatedBuildInputs ++ [ pkgs.mpi ]; + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ pkgs.mpi ]; } ); @@ -399,7 +465,10 @@ self: super: # importlib-metadata has an incomplete dependency specification importlib-metadata = super.importlib-metadata.overridePythonAttrs ( old: { - propagatedBuildInputs = old.propagatedBuildInputs ++ lib.optional self.python.isPy2 self.pathlib2; + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ lib.optional self.python.isPy2 self.pathlib2; + + # disable the removal of pyproject.toml, required because of setuptools_scm + dontPreferSetupPy = true; } ); @@ -411,7 +480,7 @@ self: super: isort = super.isort.overridePythonAttrs ( old: { - propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.setuptools ]; + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.setuptools ]; } ); @@ -453,7 +522,7 @@ self: super: ); jsonslicer = super.jsonslicer.overridePythonAttrs (old: { - nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.pkg-config ]; + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.pkgconfig ]; buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.yajl ]; }); @@ -487,7 +556,7 @@ self: super: lap = super.lap.overridePythonAttrs ( old: { - propagatedBuildInputs = old.propagatedBuildInputs ++ [ + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.numpy ]; } @@ -512,7 +581,7 @@ self: super: # Set directory containing llvm-config binary preConfigure = '' - export LLVM_CONFIG=${pkgs.llvm.dev}/bin/llvm-config + export LLVM_CONFIG=${pkgs.llvm}/bin/llvm-config ''; __impureHostDeps = lib.optionals pkgs.stdenv.isDarwin [ "/usr/lib/libm.dylib" ]; @@ -523,7 +592,7 @@ self: super: lockfile = super.lockfile.overridePythonAttrs ( old: { - propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.pbr ]; + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.pbr ]; } ); @@ -570,7 +639,7 @@ self: super: EOF ''; - propagatedBuildInputs = old.propagatedBuildInputs ++ [ + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ pkgs.libpng pkgs.freetype ] @@ -650,7 +719,7 @@ self: super: }; in { - propagatedBuildInputs = old.propagatedBuildInputs ++ [ pkgs.mpi ]; + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ pkgs.mpi ]; enableParallelBuilding = true; preBuild = '' ln -sf ${cfg} mpi.cfg @@ -670,8 +739,15 @@ self: super: } ); + mypy = super.mypy.overridePythonAttrs ( + old: { + MYPY_USE_MYPYC = pkgs.stdenv.buildPlatform.is64bit; + } + ); + mysqlclient = super.mysqlclient.overridePythonAttrs ( old: { + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.libmysqlclient ]; buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.libmysqlclient ]; } ); @@ -682,7 +758,7 @@ self: super: self.cython ]; - propagatedBuildInputs = old.propagatedBuildInputs ++ [ + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ pkgs.zlib pkgs.netcdf pkgs.hdf5 @@ -769,7 +845,7 @@ self: super: in { buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.sqlite ]; - propagatedBuildInputs = old.propagatedBuildInputs or [ ] + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ lib.optional withPostgres self.psycopg2 ++ lib.optional withMysql self.mysql-connector; } @@ -777,7 +853,7 @@ self: super: pillow = super.pillow.overridePythonAttrs ( old: { - nativeBuildInputs = [ pkgs.pkg-config ] ++ (old.nativeBuildInputs or [ ]); + nativeBuildInputs = [ pkgs.pkg-config self.pytest-runner ] ++ (old.nativeBuildInputs or [ ]); buildInputs = with pkgs; [ freetype libjpeg zlib libtiff libwebp tcl lcms2 ] ++ (old.buildInputs or [ ]); } ); @@ -924,7 +1000,7 @@ self: super: pkgs.pkg-config ]; - propagatedBuildInputs = old.propagatedBuildInputs ++ [ + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ pkgs.cairo pkgs.xlibsWrapper ]; @@ -1028,6 +1104,16 @@ self: super: } ); + pyproject-flake8 = super.pyproject-flake8.overridePythonAttrs ( + old: { + buildInputs = (old.buildInputs or [ ]) ++ [ self.flit-core ]; + } + ); + + pytezos = super.pytezos.override (old: { + buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.libsodium ]; + }); + python-bugzilla = super.python-bugzilla.overridePythonAttrs ( old: { nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ @@ -1214,6 +1300,12 @@ self: super: } ); + python-snappy = super.python-snappy.overridePythonAttrs ( + old: { + buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.snappy ]; + } + ); + ffmpeg-python = super.ffmpeg-python.overridePythonAttrs ( old: { buildInputs = (old.buildInputs or [ ]) ++ [ self.pytest-runner ]; @@ -1228,10 +1320,20 @@ self: super: } ); + pyusb = super.pyusb.overridePythonAttrs ( + old: { + postPatch = '' + libusb=${pkgs.libusb1.out}/lib/libusb-1.0${pkgs.stdenv.hostPlatform.extensions.sharedLibrary} + test -f $libusb || { echo "ERROR: $libusb doesn't exist, please update/fix this build expression."; exit 1; } + sed -i -e "s|find_library=None|find_library=lambda _:\"$libusb\"|" usb/backend/libusb1.py + ''; + } + ); + pyzmq = super.pyzmq.overridePythonAttrs ( old: { nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.pkg-config ]; - propagatedBuildInputs = old.propagatedBuildInputs ++ [ pkgs.zeromq ]; + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ pkgs.zeromq ]; } ); @@ -1298,7 +1400,7 @@ self: super: old: if old.format != "wheel" then { nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.gfortran ]; - propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.pybind11 ]; + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.pybind11 ]; setupPyBuildFlags = [ "--fcompiler='gnu95'" ]; enableParallelBuilding = true; buildInputs = (old.buildInputs or [ ]) ++ [ self.numpy.blas ]; @@ -1329,6 +1431,17 @@ self: super: } ); + secp256k1 = super.secp256k1.overridePythonAttrs (old: { + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.pkgconfig pkgs.autoconf pkgs.automake pkgs.libtool ]; + buildInputs = (old.buildInputs or [ ]) ++ [ self.pytest-runner ]; + doCheck = false; + # Local setuptools versions like "x.y.post0" confuse an internal check + postPatch = '' + substituteInPlace setup.py \ + --replace 'setuptools_version.' '"${self.setuptools.version}".' + ''; + }); + shapely = super.shapely.overridePythonAttrs ( old: { buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.geos self.cython ]; @@ -1387,6 +1500,14 @@ self: super: } ); + # The tokenizers build requires a complex rust setup (cf. nixpkgs override) + # + # Instead of providing a full source build, we use a wheel to keep + # the complexity manageable for now. + tokenizers = super.tokenizers.override { + preferWheel = true; + }; + torch = lib.makeOverridable ({ enableCuda ? false , cudatoolkit ? pkgs.cudatoolkit_10_1 @@ -1415,11 +1536,34 @@ self: super: propagatedBuildInputs = [ self.numpy self.future + self.typing-extensions ]; }) ) { }; + torchvision = lib.makeOverridable + ({ enableCuda ? false + , cudatoolkit ? pkgs.cudatoolkit_10_1 + , pkg ? super.torchvision + }: pkg.overrideAttrs (old: { + + # without that autoPatchelfHook will fail because cudatoolkit is not in LD_LIBRARY_PATH + autoPatchelfIgnoreMissingDeps = true; + buildInputs = (old.buildInputs or [ ]) + ++ [ self.torch ] + ++ lib.optionals enableCuda [ + cudatoolkit + ]; + preConfigure = + if (enableCuda) then '' + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${self.torch}/${self.python.sitePackages}/torch/lib:${lib.makeLibraryPath [ cudatoolkit "${cudatoolkit}" ]}" + '' else '' + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${self.torch}/${self.python.sitePackages}/torch/lib" + ''; + })) + { }; + typeguard = super.typeguard.overridePythonAttrs (old: { postPatch = '' substituteInPlace setup.py \ @@ -1427,12 +1571,18 @@ self: super: ''; }); + typed_ast = super.typed-ast.overridePythonAttrs (old: { + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ + self.pytest-runner + ]; + }); + # nix uses a dash, poetry uses an underscore typing_extensions = super.typing_extensions or self.typing-extensions; urwidtrees = super.urwidtrees.overridePythonAttrs ( old: { - propagatedBuildInputs = old.propagatedBuildInputs ++ [ + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.urwid ]; } @@ -1476,6 +1626,7 @@ self: super: weasyprint = super.weasyprint.overridePythonAttrs ( old: { inherit (pkgs.python3.pkgs.weasyprint) patches; + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.pytest-runner ]; buildInputs = (old.buildInputs or [ ]) ++ [ self.pytest-runner ]; } ); @@ -1524,7 +1675,7 @@ self: super: ) else super.zipp ).overridePythonAttrs ( old: { - propagatedBuildInputs = old.propagatedBuildInputs ++ [ + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.toml ]; } @@ -1551,9 +1702,38 @@ self: super: } ); + psutil = super.psutil.overridePythonAttrs ( + old: { + buildInputs = (old.buildInputs or [ ]) ++ + lib.optional stdenv.isDarwin pkgs.darwin.apple_sdk.frameworks.IOKit; + } + ); + + sentencepiece = super.sentencepiece.overridePythonAttrs ( + old: { + dontUseCmakeConfigure = true; + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ + pkgs.pkg-config + pkgs.cmake + pkgs.gperftools + ]; + buildInputs = (old.buildInputs or [ ]) ++ [ + pkgs.sentencepiece + ]; + } + ); + + sentence-transformers = super.sentence-transformers.overridePythonAttrs ( + old: { + buildInputs = + (old.buildInputs or [ ]) + ++ [ self.typing-extensions ]; + } + ); + supervisor = super.supervisor.overridePythonAttrs ( old: { - propagatedBuildInputs = old.propagatedBuildInputs ++ [ + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.meld3 self.setuptools ]; @@ -1562,7 +1742,7 @@ self: super: cytoolz = super.cytoolz.overridePythonAttrs ( old: { - propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.toolz ]; + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.toolz ]; } ); @@ -1607,5 +1787,52 @@ self: super: } ); + wxpython = super.wxpython.overridePythonAttrs (old: + let + localPython = self.python.withPackages (ps: with ps; [ + setuptools + numpy + six + ]); + in + { + DOXYGEN = "${pkgs.doxygen}/bin/doxygen"; + + nativeBuildInputs = with pkgs; [ + which + doxygen + gtk3 + pkg-config + autoPatchelfHook + ] ++ (old.nativeBuildInputs or [ ]); + + buildInputs = with pkgs; [ + gtk3 + webkitgtk + ncurses + SDL2 + xorg.libXinerama + xorg.libSM + xorg.libXxf86vm + xorg.libXtst + xorg.xorgproto + gst_all_1.gstreamer + gst_all_1.gst-plugins-base + libGLU + libGL + libglvnd + mesa + ] ++ old.buildInputs; + + buildPhase = '' + ${localPython.interpreter} build.py -v build_wx + ${localPython.interpreter} build.py -v dox etg --nodoc sip + ${localPython.interpreter} build.py -v build_py + ''; + + installPhase = '' + ${localPython.interpreter} setup.py install --skip-build --prefix=$out + ''; + }); } diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix b/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix index dc9cd2936d06..a5ec51a1345b 100644 --- a/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix +++ b/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix @@ -129,7 +129,7 @@ let if exprs.type == "expr" then ( let - mVal = ''[a-zA-Z0-9\'"_\. ]+''; + mVal = ''[a-zA-Z0-9\'"_\. \-]+''; mOp = "in|[!=<>]+"; e = stripStr exprs.value; m = builtins.map stripStr (builtins.match ''^(${mVal}) *(${mOp}) *(${mVal})$'' e);