nixpkgs-fmt broke it's format yet again

This commit is contained in:
adisbladis 2020-04-29 14:12:59 +01:00
parent 807ab61e94
commit 4ebbfdacd1
No known key found for this signature in database
GPG key ID: 110BFAD44C6249B7
25 changed files with 1367 additions and 1319 deletions

View file

@ -11,12 +11,10 @@ let
/* The default list of poetry2nix override overlays */
defaultPoetryOverrides = (import ./overrides.nix { inherit pkgs lib; });
mkEvalPep508 = import ./pep508.nix {
inherit lib poetryLib;
stdenv = pkgs.stdenv;
};
getFunctorFn = fn: if builtins.typeOf fn == "set" then fn.__functor else fn;
# Map SPDX identifiers to license names
@ -38,13 +36,13 @@ let
}@attrs:
let
poetryPkg = poetry.override { inherit python; };
pyProject = readTOML pyproject;
poetryLock = readTOML poetrylock;
lockFiles = let
lockFiles =
let
lockfiles = lib.getAttrFromPath [ "metadata" "files" ] poetryLock;
in lib.listToAttrs (lib.mapAttrsToList (n: v: { name = moduleName n; value = v; }) lockfiles);
in
lib.listToAttrs (lib.mapAttrsToList (n: v: { name = moduleName n; value = v; }) lockfiles);
specialAttrs = [
"overrides"
"poetrylock"
@ -53,15 +51,14 @@ let
"preferWheels"
];
passedAttrs = builtins.removeAttrs attrs specialAttrs;
evalPep508 = mkEvalPep508 python;
# Filter packages by their PEP508 markers & pyproject interpreter version
partitions = let
partitions =
let
supportsPythonVersion = pkgMeta: if pkgMeta ? marker then (evalPep508 pkgMeta.marker) else true;
in
lib.partition supportsPythonVersion poetryLock.package;
compatible = partitions.right;
incompatible = partitions.wrong;
@ -72,12 +69,14 @@ let
baseOverlay = self: super:
let
getDep = depName: self.${depName};
lockPkgs = builtins.listToAttrs (
builtins.map (
lockPkgs = builtins.listToAttrs
(
builtins.map
(
pkgMeta: rec {
name = moduleName pkgMeta.name;
value = self.mkPoetryDep (
value = self.mkPoetryDep
(
pkgMeta // {
inherit pwd preferWheels;
source = pkgMeta.source or null;
@ -91,7 +90,8 @@ let
);
in
lockPkgs;
overlays = builtins.map getFunctorFn (
overlays = builtins.map getFunctorFn
(
[
(
self: super:
@ -116,9 +116,7 @@ let
] ++ # User provided overrides
overrides
);
packageOverrides = lib.foldr lib.composeExtensions (self: super: { }) overlays;
py = python.override { inherit packageOverrides; self = py; };
in
{
@ -143,7 +141,8 @@ let
, preferWheels ? false
}:
let
py = mkPoetryPackages (
py = mkPoetryPackages
(
{
inherit pyproject poetrylock overrides python pwd preferWheels;
}
@ -171,7 +170,6 @@ let
py = poetryPython.python;
inherit (poetryPython) pyProject;
specialAttrs = [
"overrides"
"poetrylock"
@ -189,25 +187,24 @@ let
deps = pyProject.tool.poetry.${depAttr} or { };
depAttrs = builtins.map (d: lib.toLower d) (builtins.attrNames deps);
in
builtins.map (
builtins.map
(
dep:
let
pkg = py.pkgs."${dep}";
constraints = deps.${dep}.python or "";
isCompat = compat constraints;
in
if isCompat then pkg else null
in if isCompat then pkg else null
) depAttrs;
getInputs = attr: attrs.${attr} or [ ];
mkInput = attr: extraInputs: getInputs attr ++ extraInputs;
buildSystemPkgs = poetryLib.getBuildSystemPkgs {
inherit pyProject;
pythonPackages = py.pkgs;
};
in
py.pkgs.buildPythonApplication (
py.pkgs.buildPythonApplication
(
passedAttrs // {
pname = moduleName pyProject.tool.poetry.name;
version = pyProject.tool.poetry.version;

View file

@ -9,7 +9,8 @@
systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
# Memoize nixpkgs for different platforms for efficiency.
nixpkgsFor = forAllSystems (
nixpkgsFor = forAllSystems
(
system:
import nixpkgs {
inherit system;
@ -22,7 +23,8 @@
overlay = import ./overlay.nix;
# TODO: I feel like `packages` is the wrong place for the poetry2nix attr
packages = forAllSystems (
packages = forAllSystems
(
system: {
inherit (nixpkgsFor.${system}) poetry poetry2nix;
}

View file

@ -11,7 +11,8 @@ let
in
{
removePathDependenciesHook = callPackage (
removePathDependenciesHook = callPackage
(
{}:
makeSetupHook {
name = "remove-path-dependencies.sh";
@ -24,7 +25,8 @@ in
} ./remove-path-dependencies.sh
) { };
pipBuildHook = callPackage (
pipBuildHook = callPackage
(
{ pip, wheel }:
makeSetupHook {
name = "pip-build-hook.sh";
@ -35,7 +37,8 @@ in
} ./pip-build-hook.sh
) { };
poetry2nixFixupHook = callPackage (
poetry2nixFixupHook = callPackage
(
{}:
makeSetupHook {
name = "fixup-hook.sh";

20
lib.nix
View file

@ -12,13 +12,15 @@ let
moduleName = name: lib.toLower (lib.replaceStrings [ "_" "." ] [ "-" "-" ] name);
# Get a full semver pythonVersion from a python derivation
getPythonVersion = python: let
getPythonVersion = python:
let
pyVer = lib.splitVersion python.pythonVersion ++ [ "0" ];
ver = lib.splitVersion python.version;
major = l: lib.elemAt l 0;
minor = l: lib.elemAt l 1;
joinVersion = v: lib.concatStringsSep "." v;
in joinVersion (if major pyVer == major ver && minor pyVer == minor ver then ver else pyVer);
in
joinVersion ( if major pyVer == major ver && minor pyVer == minor ver then ver else pyVer);
# Compare a semver expression with a version
isCompatible = version:
@ -43,13 +45,13 @@ let
state = operators."${operator}" acc.state (satisfiesSemver version v);
};
initial = { operator = "&&"; state = true; };
in
if expr == "" then true else (builtins.foldl' combine initial tokens).state;
in if expr == "" then true else (builtins.foldl' combine initial tokens).state;
fromTOML = builtins.fromTOML or
(
toml: builtins.fromJSON (
builtins.readFile (
toml: builtins.fromJSON
(
builtins.readFile
(
pkgs.runCommand "from-toml"
{
inherit toml;
@ -90,14 +92,14 @@ let
# 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 (
fetchFromPypi = lib.makeOverridable
(
{ pname, file, hash, kind }:
pkgs.fetchurl {
url = "https://files.pythonhosted.org/packages/${kind}/${lib.toLower (builtins.substring 0 1 file)}/${pname}/${file}";
inherit hash;
}
);
getBuildSystemPkgs =
{ pythonPackages
, pyProject

View file

@ -20,7 +20,8 @@
, ...
}:
pythonPackages.callPackage (
pythonPackages.callPackage
(
{ preferWheel ? preferWheels
, ...
}@args:
@ -32,41 +33,33 @@ pythonPackages.callPackage (
inherit (pkgs) stdenv;
}) selectWheel
;
fileCandidates = let
fileCandidates =
let
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;
in
builtins.filter (f: matchesVersion f.file && hasSupportedExtension f.file && isCompatibleEgg f.file) files;
toPath = s: pwd + "/${s}";
isSource = source != null;
isGit = isSource && source.type == "git";
isLocal = isSource && source.type == "directory";
localDepPath = toPath source.url;
pyProject = poetryLib.readTOML (localDepPath + "/pyproject.toml");
buildSystemPkgs = poetryLib.getBuildSystemPkgs {
inherit pythonPackages pyProject;
};
fileInfo = let
fileInfo =
let
isBdist = f: lib.strings.hasSuffix "whl" f.file;
isSdist = f: ! isBdist f && ! isEgg f;
isEgg = f: lib.strings.hasSuffix ".egg" f.file;
binaryDist = selectWheel fileCandidates;
sourceDist = builtins.filter isSdist fileCandidates;
eggs = builtins.filter isEgg fileCandidates;
entries = ( if preferWheel then binaryDist ++ sourceDist else sourceDist ++ binaryDist) ++ eggs;
lockFileEntry = builtins.head entries;
_isEgg = isEgg lockFileEntry;
in
rec {
@ -89,10 +82,8 @@ pythonPackages.callPackage (
"toml" # Toml is an extra for setuptools-scm
];
baseBuildInputs = lib.optional (! lib.elem name skipSetupToolsSCM) pythonPackages.setuptools-scm;
format = if isLocal then "pyproject" else if isGit then "pyproject" else fileInfo.format;
in
buildPythonPackage {
pname = moduleName name;
version = version;
@ -117,10 +108,13 @@ pythonPackages.callPackage (
++ lib.optional isLocal buildSystemPkgs
);
propagatedBuildInputs = let
propagatedBuildInputs =
let
compat = isCompatible (poetryLib.getPythonVersion python);
deps = lib.filterAttrs (n: v: v) (
lib.mapAttrs (
deps = lib.filterAttrs (n: v: v)
(
lib.mapAttrs
(
n: v:
let
constraints = v.python or "";
@ -145,7 +139,8 @@ pythonPackages.callPackage (
# We need to retrieve kind from the interpreter and the filename of the package
# Interpreters should declare what wheel types they're compatible with (python type + ABI)
# Here we can then choose a file based on that info.
src = if isGit then (
src =
if isGit then (
builtins.fetchGit {
inherit (source) url;
rev = source.reference;
@ -156,5 +151,4 @@ pythonPackages.callPackage (
inherit (fileInfo) file hash kind;
};
}
) { }

View file

@ -1,26 +1,20 @@
# This file has been generated by Niv.
let
#
# The fetchers. fetch_<type> fetches specs of type <type>.
#
fetch_file = pkgs: spec:
if spec.builtin or true then
builtins_fetchurl { inherit (spec) url sha256; }
else
pkgs.fetchurl { inherit (spec) url sha256; };
fetch_tarball = pkgs: spec:
if spec.builtin or true then
builtins_fetchTarball { inherit (spec) url sha256; }
else
pkgs.fetchzip { inherit (spec) url sha256; };
fetch_git = spec:
builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; };
fetch_builtin-tarball = spec:
builtins.trace
''
@ -31,7 +25,6 @@ let
$ niv modify <package> -a type=tarball -a builtin=true
''
builtins_fetchTarball { inherit (spec) url sha256; };
fetch_builtin-url = spec:
builtins.trace
''
@ -109,7 +102,8 @@ let
# Create the final "sources" from the config
mkSources = config:
mapAttrs (
mapAttrs
(
name: spec:
if builtins.hasAttr "outPath" spec
then abort

View file

@ -6,14 +6,16 @@
self: super:
{
astroid = super.astroid.overridePythonAttrs (
astroid = super.astroid.overridePythonAttrs
(
old: rec {
buildInputs = old.buildInputs ++ [ self.pytest-runner ];
doCheck = false;
}
);
av = super.av.overridePythonAttrs (
av = super.av.overridePythonAttrs
(
old: {
nativeBuildInputs = old.nativeBuildInputs ++ [
pkgs.pkgconfig
@ -22,7 +24,8 @@ self: super:
}
);
bcrypt = super.bcrypt.overridePythonAttrs (
bcrypt = super.bcrypt.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ [ pkgs.libffi ];
}
@ -31,14 +34,16 @@ self: super:
cffi =
# cffi is bundled with pypy
if self.python.implementation == "pypy" then null else (
super.cffi.overridePythonAttrs (
super.cffi.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ [ pkgs.libffi ];
}
)
);
cftime = super.cftime.overridePythonAttrs (
cftime = super.cftime.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ [
self.cython
@ -46,7 +51,8 @@ self: super:
}
);
configparser = super.configparser.overridePythonAttrs (
configparser = super.configparser.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ [
self.toml
@ -58,14 +64,16 @@ self: super:
}
);
cryptography = super.cryptography.overridePythonAttrs (
cryptography = super.cryptography.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ [ pkgs.openssl ];
}
);
django = (
super.django.overridePythonAttrs (
super.django.overridePythonAttrs
(
old: {
propagatedNativeBuildInputs = (old.propagatedNativeBuildInputs or [ ])
++ [ pkgs.gettext ];
@ -73,7 +81,8 @@ self: super:
)
);
django-bakery = super.django-bakery.overridePythonAttrs (
django-bakery = super.django-bakery.overridePythonAttrs
(
old: {
configurePhase = ''
if ! test -e LICENSE; then
@ -83,7 +92,8 @@ self: super:
}
);
dlib = super.dlib.overridePythonAttrs (
dlib = super.dlib.overridePythonAttrs
(
old: {
# Parallel building enabled
inherit (pkgs.python.pkgs.dlib) patches;
@ -99,14 +109,16 @@ 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;
faker = super.faker.overridePythonAttrs (
faker = super.faker.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ [ self.pytest-runner ];
doCheck = false;
}
);
fancycompleter = super.fancycompleter.overridePythonAttrs (
fancycompleter = super.fancycompleter.overridePythonAttrs
(
old: {
postPatch = ''
substituteInPlace setup.py \
@ -116,20 +128,23 @@ self: super:
}
);
fastparquet = super.fastparquet.overridePythonAttrs (
fastparquet = super.fastparquet.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ [ self.pytest-runner ];
}
);
grandalf = super.grandalf.overridePythonAttrs (
grandalf = super.grandalf.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ [ self.pytest-runner ];
doCheck = false;
}
);
h5py = super.h5py.overridePythonAttrs (
h5py = super.h5py.overridePythonAttrs
(
old: rec {
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.pkgconfig ];
buildInputs = old.buildInputs ++ [ pkgs.hdf5 self.pkgconfig self.cython ];
@ -140,20 +155,23 @@ self: super:
}
);
horovod = super.horovod.overridePythonAttrs (
horovod = super.horovod.overridePythonAttrs
(
old: {
propagatedBuildInputs = old.propagatedBuildInputs ++ [ pkgs.openmpi ];
}
);
# importlib-metadata has an incomplete dependency specification
importlib-metadata = super.importlib-metadata.overridePythonAttrs (
importlib-metadata = super.importlib-metadata.overridePythonAttrs
(
old: {
propagatedBuildInputs = old.propagatedBuildInputs ++ lib.optional self.python.isPy2 self.pathlib2;
}
);
jupyter = super.jupyter.overridePythonAttrs (
jupyter = super.jupyter.overridePythonAttrs
(
old: rec {
# jupyter is a meta-package. Everything relevant comes from the
# dependencies. It does however have a jupyter.py file that conflicts
@ -162,7 +180,8 @@ self: super:
}
);
kiwisolver = super.kiwisolver.overridePythonAttrs (
kiwisolver = super.kiwisolver.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ [
# cppy is at the time of writing not in nixpkgs
@ -171,7 +190,8 @@ self: super:
}
);
lap = super.lap.overridePythonAttrs (
lap = super.lap.overridePythonAttrs
(
old: {
propagatedBuildInputs = old.propagatedBuildInputs ++ [
self.numpy
@ -179,7 +199,8 @@ self: super:
}
);
llvmlite = super.llvmlite.overridePythonAttrs (
llvmlite = super.llvmlite.overridePythonAttrs
(
old: {
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.llvm ];
@ -202,26 +223,30 @@ self: super:
}
);
lockfile = super.lockfile.overridePythonAttrs (
lockfile = super.lockfile.overridePythonAttrs
(
old: {
propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.pbr ];
}
);
lxml = super.lxml.overridePythonAttrs (
lxml = super.lxml.overridePythonAttrs
(
old: {
nativeBuildInputs = with pkgs; old.nativeBuildInputs ++ [ pkgconfig libxml2.dev libxslt.dev ];
buildInputs = with pkgs; old.buildInputs ++ [ libxml2 libxslt ];
}
);
markupsafe = super.markupsafe.overridePythonAttrs (
markupsafe = super.markupsafe.overridePythonAttrs
(
old: {
src = old.src.override { pname = builtins.replaceStrings [ "markupsafe" ] [ "MarkupSafe" ] old.pname; };
}
);
matplotlib = super.matplotlib.overridePythonAttrs (
matplotlib = super.matplotlib.overridePythonAttrs
(
old:
let
enableGhostscript = old.passthru.enableGhostscript or false;
@ -262,14 +287,16 @@ self: super:
preferWheel = true;
};
mccabe = super.mccabe.overridePythonAttrs (
mccabe = super.mccabe.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ [ self.pytest-runner ];
doCheck = false;
}
);
netcdf4 = super.netcdf4.overridePythonAttrs (
netcdf4 = super.netcdf4.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ [
self.cython
@ -292,7 +319,8 @@ self: super:
}
);
numpy = super.numpy.overridePythonAttrs (
numpy = super.numpy.overridePythonAttrs
(
old:
let
blas = old.passthru.args.blas or pkgs.openblasCompat;
@ -326,14 +354,16 @@ self: super:
}
);
openexr = super.openexr.overridePythonAttrs (
openexr = super.openexr.overridePythonAttrs
(
old: rec {
buildInputs = old.buildInputs ++ [ pkgs.openexr pkgs.ilmbase ];
NIX_CFLAGS_COMPILE = [ "-I${pkgs.openexr.dev}/include/OpenEXR" "-I${pkgs.ilmbase.dev}/include/OpenEXR" ];
}
);
peewee = super.peewee.overridePythonAttrs (
peewee = super.peewee.overridePythonAttrs
(
old:
let
withPostgres = old.passthru.withPostgres or false;
@ -347,36 +377,41 @@ self: super:
}
);
pillow = super.pillow.overridePythonAttrs (
pillow = super.pillow.overridePythonAttrs
(
old: {
nativeBuildInputs = [ pkgs.pkgconfig ] ++ old.nativeBuildInputs;
buildInputs = with pkgs; [ freetype libjpeg zlib libtiff libwebp tcl lcms2 ] ++ old.buildInputs;
}
);
psycopg2 = super.psycopg2.overridePythonAttrs (
psycopg2 = super.psycopg2.overridePythonAttrs
(
old: {
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.postgresql ];
}
);
psycopg2-binary = super.psycopg2-binary.overridePythonAttrs (
psycopg2-binary = super.psycopg2-binary.overridePythonAttrs
(
old: {
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.postgresql ];
}
);
pyarrow = if lib.versionAtLeast super.pyarrow.version "0.16.0" then super.pyarrow.overridePythonAttrs (
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));
_arrow-cpp = pkgs.arrow-cpp.override { inherit (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 {
in
if arrowCppVersion != pyArrowVersion then throw errorMessage else {
nativeBuildInputs = old.nativeBuildInputs ++ [
self.cython
@ -407,7 +442,8 @@ self: super:
dontUseCmakeConfigure = true;
}
) else super.pyarrow.overridePythonAttrs (
) else super.pyarrow.overridePythonAttrs
(
old: {
nativeBuildInputs = old.nativeBuildInputs ++ [
self.cython
@ -415,14 +451,17 @@ self: super:
}
);
pycairo = (
pycairo =
(
drv: (
drv.overridePythonAttrs (
drv.overridePythonAttrs
(
_: {
format = "other";
}
)
).overridePythonAttrs (
).overridePythonAttrs
(
old: {
nativeBuildInputs = old.nativeBuildInputs ++ [
@ -441,7 +480,8 @@ self: super:
)
) super.pycairo;
pycocotools = super.pycocotools.overridePythonAttrs (
pycocotools = super.pycocotools.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ [
self.cython
@ -450,34 +490,39 @@ self: super:
}
);
pygobject = super.pygobject.overridePythonAttrs (
pygobject = super.pygobject.overridePythonAttrs
(
old: {
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.pkgconfig ];
buildInputs = old.buildInputs ++ [ pkgs.glib pkgs.gobject-introspection ];
}
);
pylint = super.pylint.overridePythonAttrs (
pylint = super.pylint.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ [ self.pytest-runner ];
doCheck = false;
}
);
pyopenssl = super.pyopenssl.overridePythonAttrs (
pyopenssl = super.pyopenssl.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ [ pkgs.openssl ];
}
);
pyqt5 = let
pyqt5 =
let
drv = super.pyqt5;
withConnectivity = drv.passthru.args.withConnectivity or false;
withMultimedia = drv.passthru.args.withMultimedia or false;
withWebKit = drv.passthru.args.withWebKit or false;
withWebSockets = drv.passthru.args.withWebSockets or false;
in
super.pyqt5.overridePythonAttrs (
super.pyqt5.overridePythonAttrs
(
old: {
format = "other";
@ -544,7 +589,8 @@ self: super:
EOF
'';
installCheckPhase = let
installCheckPhase =
let
modules = [
"PyQt5"
"PyQt5.QtCore"
@ -557,7 +603,6 @@ self: super:
++ lib.optional withMultimedia "PyQt5.QtMultimedia"
++ lib.optional withConnectivity "PyQt5.QtConnectivity"
;
imports = lib.concatMapStrings (module: "import ${module};") modules;
in
''
@ -571,7 +616,8 @@ self: super:
}
);
pytest-datadir = super.pytest-datadir.overridePythonAttrs (
pytest-datadir = super.pytest-datadir.overridePythonAttrs
(
old: {
postInstall = ''
rm -f $out/LICENSE
@ -579,7 +625,8 @@ self: super:
}
);
pytest = super.pytest.overridePythonAttrs (
pytest = super.pytest.overridePythonAttrs
(
old: {
doCheck = false;
}
@ -587,7 +634,8 @@ self: super:
pytest-runner = super.pytest-runner or super.pytestrunner;
python-jose = super.python-jose.overridePythonAttrs (
python-jose = super.python-jose.overridePythonAttrs
(
old: {
postPath = ''
substituteInPlace setup.py --replace "'pytest-runner'," ""
@ -596,7 +644,8 @@ self: super:
}
);
python-prctl = super.python-prctl.overridePythonAttrs (
python-prctl = super.python-prctl.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ [
pkgs.libcap
@ -604,14 +653,16 @@ self: super:
}
);
pyzmq = super.pyzmq.overridePythonAttrs (
pyzmq = super.pyzmq.overridePythonAttrs
(
old: {
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.pkgconfig ];
propagatedBuildInputs = old.propagatedBuildInputs ++ [ pkgs.zeromq ];
}
);
rockset = super.rockset.overridePythonAttrs (
rockset = super.rockset.overridePythonAttrs
(
old: rec {
postPatch = ''
cp ./setup_rockset.py ./setup.py
@ -619,7 +670,8 @@ self: super:
}
);
scaleapi = super.scaleapi.overridePythonAttrs (
scaleapi = super.scaleapi.overridePythonAttrs
(
old: {
postPatch = ''
substituteInPlace setup.py --replace "install_requires = ['requests>=2.4.2', 'enum34']" "install_requires = ['requests>=2.4.2']" || true
@ -627,7 +679,8 @@ self: super:
}
);
pandas = super.pandas.overridePythonAttrs (
pandas = super.pandas.overridePythonAttrs
(
old: {
nativeBuildInputs = old.nativeBuildInputs ++ [ self.cython ];
}
@ -635,7 +688,8 @@ self: super:
# Pybind11 is an undeclared dependency of scipy that we need to pick from nixpkgs
# Make it not fail with infinite recursion
pybind11 = super.pybind11.overridePythonAttrs (
pybind11 = super.pybind11.overridePythonAttrs
(
old: {
cmakeFlags = (old.cmakeFlags or [ ]) ++ [
"-DPYBIND11_TEST=off"
@ -644,7 +698,8 @@ self: super:
}
);
scipy = super.scipy.overridePythonAttrs (
scipy = super.scipy.overridePythonAttrs
(
old: {
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.gfortran ];
propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.pybind11 ];
@ -661,7 +716,8 @@ self: super:
}
);
scikit-learn = super.scikit-learn.overridePythonAttrs (
scikit-learn = super.scikit-learn.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ [
pkgs.gfortran
@ -678,22 +734,26 @@ self: super:
}
);
shapely = super.shapely.overridePythonAttrs (
shapely = super.shapely.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ [ pkgs.geos self.cython ];
inherit (pkgs.python3.pkgs.shapely) patches GEOS_LIBRARY_PATH;
}
);
shellingham = if lib.versionAtLeast super.shellingham.version "1.3.2" then (
super.shellingham.overridePythonAttrs (
shellingham =
if lib.versionAtLeast super.shellingham.version "1.3.2" then (
super.shellingham.overridePythonAttrs
(
old: {
format = "pyproject";
}
)
) else super.shellingham;
tables = super.tables.overridePythonAttrs (
tables = super.tables.overridePythonAttrs
(
old: {
HDF5_DIR = "${pkgs.hdf5}";
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.pkgconfig ];
@ -701,7 +761,8 @@ self: super:
}
);
tensorpack = super.tensorpack.overridePythonAttrs (
tensorpack = super.tensorpack.overridePythonAttrs
(
old: {
postPatch = ''
substituteInPlace setup.cfg --replace "# will call find_packages()" ""
@ -709,7 +770,8 @@ self: super:
}
);
urwidtrees = super.urwidtrees.overridePythonAttrs (
urwidtrees = super.urwidtrees.overridePythonAttrs
(
old: {
propagatedBuildInputs = old.propagatedBuildInputs ++ [
self.urwid
@ -717,7 +779,8 @@ self: super:
}
);
vose-alias-method = super.vose-alias-method.overridePythonAttrs (
vose-alias-method = super.vose-alias-method.overridePythonAttrs
(
old: {
postInstall = ''
rm -f $out/LICENSE
@ -725,7 +788,8 @@ self: super:
}
);
uvloop = super.uvloop.overridePythonAttrs (
uvloop = super.uvloop.overridePythonAttrs
(
old: {
buildInputs = old.buildInputs ++ lib.optionals stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.ApplicationServices
@ -739,7 +803,8 @@ self: super:
pkgs.python3.pkgs.override {
python = self.python;
}
).wheel.overridePythonAttrs (
).wheel.overridePythonAttrs
(
_: {
inherit (super.wheel) pname name version src;
}
@ -748,7 +813,8 @@ self: super:
zipp =
(
if lib.versionAtLeast super.zipp.version "2.0.0" then (
super.zipp.overridePythonAttrs (
super.zipp.overridePythonAttrs
(
old: {
prePatch = ''
substituteInPlace setup.py --replace \
@ -758,7 +824,8 @@ self: super:
}
)
) else super.zipp
).overridePythonAttrs (
).overridePythonAttrs
(
old: {
propagatedBuildInputs = old.propagatedBuildInputs ++ [
self.toml

View file

@ -13,7 +13,6 @@ let
minor = builtins.elemAt ver 1;
in
"cp${major}${minor}";
abiTag = "${pythonTag}m";
#
@ -61,12 +60,10 @@ let
selectWheel = files:
let
filesWithoutSources = (builtins.filter (x: hasSuffix ".whl" x.file) files);
isPyAbiCompatible = pyabi: x: x == "none" || pyabi == x;
withPython = ver: abi: x: (isPyVersionCompatible ver x.pyVer) && (isPyAbiCompatible abi x.abi);
withPlatform = if isLinux
withPlatform =
if isLinux
then (
x: x.platform == "manylinux1_${stdenv.platform.kernelArch}"
|| x.platform == "manylinux2010_${stdenv.platform.kernelArch}"
@ -74,15 +71,12 @@ let
|| x.platform == "any"
)
else (x: hasInfix "macosx" x.platform || x.platform == "any");
filterWheel = x:
let
f = toWheelAttrs x.file;
in
(withPython pythonTag abiTag f) && (withPlatform f);
filtered = builtins.filter filterWheel filesWithoutSources;
choose = files:
let
osxMatches = [ "10_12" "10_11" "10_10" "10_9" "any" ];

View file

@ -7,7 +7,6 @@ let
# Strip leading/trailing whitespace from string
stripStr = s: lib.elemAt (builtins.split "^ *" (lib.elemAt (builtins.split " *$" s) 0)) 2;
findSubExpressionsFun = acc: c: (
if c == "(" then (
let
@ -50,7 +49,6 @@ let
tailExprs = if tailExpr != "" then [ tailExpr ] else [ ];
in
acc.exprs ++ tailExprs;
parseExpressions = exprs:
let
splitCond = (
@ -58,7 +56,6 @@ let
(x: stripStr ( if builtins.typeOf x == "list" then (builtins.elemAt x 0) else x))
(builtins.split " (and|or) " (s + " "))
);
mapfn = expr: (
if (builtins.match "^ ?$" expr != null) then null # Filter empty
else if (builtins.elem expr [ "and" "or" ]) then {
@ -70,12 +67,11 @@ let
value = expr;
}
);
parse = expr: builtins.filter (x: x != null) (builtins.map mapfn (splitCond expr));
in
builtins.foldl' (
acc: v: acc ++ (
if builtins.typeOf v == "string" then parse v else [ (parseExpressions v) ]
builtins.foldl'
(
acc: v: acc ++ ( if builtins.typeOf v == "string" then parse v else [ (parseExpressions v) ]
)
) [ ] exprs;
@ -94,7 +90,8 @@ let
else throw "Unsupported platform"
);
platform_machine = stdenv.platform.kernelArch;
platform_python_implementation = let
platform_python_implementation =
let
impl = python.passthru.implementation;
in
(
@ -115,9 +112,7 @@ let
implementation_version = python.version;
extra = "";
};
substituteVar = value: if builtins.hasAttr value variables then (builtins.toJSON variables."${value}") else value;
processVar = value: builtins.foldl' (acc: v: v acc) value [
stripStr
substituteVar
@ -165,7 +160,8 @@ let
let
parts = builtins.splitVersion c;
pruned = lib.take ((builtins.length parts) - 1) parts;
upper = builtins.toString (
upper = builtins.toString
(
(lib.toInt (builtins.elemAt pruned (builtins.length pruned - 1))) + 1
);
upperConstraint = builtins.concatStringsSep "." (ireplace (builtins.length pruned - 1) upper pruned);

View file

@ -1,8 +1,8 @@
{ lib, ireplace }:
let
inherit (builtins) elemAt match;
operators = let
operators =
let
matchWildCard = s: match "([^\*])(\.[\*])" s;
mkComparison = ret: version: v: builtins.compareVersions version v == ret;
mkIdxComparison = idx: version: v:
@ -39,7 +39,8 @@ let
# Prune constraint
parts = builtins.splitVersion c;
pruned = lib.take ((builtins.length parts) - 1) parts;
upper = builtins.toString (
upper = builtins.toString
(
(lib.toInt (builtins.elemAt pruned (builtins.length pruned - 1))) + 1
);
upperConstraint = builtins.concatStringsSep "." (ireplace (builtins.length pruned - 1) upper pruned);
@ -51,12 +52,10 @@ let
"===" = v: c: v == c;
#
};
re = {
operators = "([=><!~\^]+)";
version = "([0-9\.\*x]+)";
};
parseConstraint = constraint:
let
constraintStr = builtins.replaceStrings [ " " ] [ "" ] constraint;
@ -80,11 +79,9 @@ let
}
else throw "Constraint \"${constraintStr}\" could not be parsed"
);
satisfiesSemver = version: constraint:
let
inherit (parseConstraint constraint) op v;
in
if constraint == "*" then true else operators."${op}" version v;
in if constraint == "*" then true else operators."${op}" version v;
in
{ inherit satisfiesSemver; }

View file

@ -11,7 +11,8 @@ poetry2nix.mkPoetryApplication {
(import ./poetry-git-overlay.nix { inherit pkgs; })
(
self: super: {
pyramid-deferred-sqla = super.pyramid-deferred-sqla.overridePythonAttrs (
pyramid-deferred-sqla = super.pyramid-deferred-sqla.overridePythonAttrs
(
old: {
postPatch = ''
touch LICENSE

View file

@ -1,7 +1,8 @@
{ pkgs }:
self: super: {
pyramid-deferred-sqla = super.pyramid-deferred-sqla.overridePythonAttrs (
pyramid-deferred-sqla = super.pyramid-deferred-sqla.overridePythonAttrs
(
_: {
src = pkgs.fetchgit {
url = "https://github.com/niteoweb/pyramid_deferred_sqla.git";

View file

@ -2,13 +2,10 @@
let
poetry = pkgs.callPackage ../pkgs/poetry { python = pkgs.python3; inherit poetry2nix; };
poetry2nix = import ./.. { inherit pkgs; inherit poetry; };
pep425 = pkgs.callPackage ../pep425.nix { };
pep425Python37 = pkgs.callPackage ../pep425.nix { python = pkgs.python37; };
pep425OSX = pkgs.callPackage ../pep425.nix { isLinux = false; };
skipTests = builtins.filter (t: builtins.typeOf t != "list") (builtins.split "," (builtins.getEnv "SKIP_TESTS"));
callTest = test: attrs: pkgs.callPackage test ({ inherit poetry2nix; } // attrs);
in
builtins.removeAttrs

View file

@ -1,7 +1,8 @@
{ pkgs }:
self: super: {
alembic = super.alembic.overrideAttrs (
alembic = super.alembic.overrideAttrs
(
_: {
src = pkgs.fetchgit {
url = "https://github.com/sqlalchemy/alembic.git";

View file

@ -7,9 +7,11 @@ let
pyproject = ./pyproject.toml;
overrides = [
(
poetry2nix.defaultPoetryOverrides.overrideOverlay (
poetry2nix.defaultPoetryOverrides.overrideOverlay
(
self: super: {
alembic = super.alembic.overrideAttrs (
alembic = super.alembic.overrideAttrs
(
old: {
TESTING_FOOBAR = 42;
}

View file

@ -8,7 +8,8 @@ let
overrides = poetry2nix.overrides.withDefaults
(
self: super: {
alembic = super.alembic.overrideAttrs (
alembic = super.alembic.overrideAttrs
(
old: {
TESTING_FOOBAR = 42;
}

View file

@ -15,7 +15,6 @@ let
}
);
};
url = lib.elemAt drv.passthru.python.pkgs.maturin.src.urls 0;
in
assert lib.hasSuffix "whl" url; drv

View file

@ -1,13 +1,10 @@
{ lib, poetry2nix, python3, runCommand }:
let
app = poetry2nix.mkPoetryApplication {
projectDir = ./.;
preferWheels = true;
};
url = lib.elemAt app.passthru.python.pkgs.tensorflow.src.urls 0;
in
assert lib.hasSuffix "whl" url; runCommand "prefer-wheels" { } ''
touch $out

View file

@ -5,7 +5,8 @@ poetry2nix.mkPoetryApplication {
projectDir = ./.;
# Assert expected ignored files not in sources
preConfigure = let
preConfigure =
let
assertNotExists = name: "! test -f ${name} || (echo ${name} exists && false)";
in
''

View file

@ -11,8 +11,10 @@ let
in
{
release = let
pythonEnv = pkgs.python3.withPackages (
release =
let
pythonEnv = pkgs.python3.withPackages
(
ps: [
ps.pythonix
]
@ -47,13 +49,13 @@ in
exit(p.returncode)
'';
flamegraph = let
flamegraph =
let
runtimeDeps = lib.makeBinPath [
pkgs.flamegraph
pkgs.python3
pkgs.nix
];
nixSrc = pkgs.runCommandNoCC "${pkgs.nix.name}-sources" { } ''
mkdir $out
tar -x --strip=1 -f ${pkgs.nix.src} -C $out