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

@ -1,4 +1,4 @@
{ pkgs ? import <nixpkgs> {}
{ pkgs ? import <nixpkgs> { }
, lib ? pkgs.lib
, version
}:

View file

@ -1,4 +1,4 @@
{ pkgs ? import <nixpkgs> {}
{ pkgs ? import <nixpkgs> { }
, lib ? pkgs.lib
, poetry ? null
, poetryLib ? import ./lib.nix { inherit lib pkgs; }
@ -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,12 +90,13 @@ let
);
in
lockPkgs;
overlays = builtins.map getFunctorFn (
overlays = builtins.map getFunctorFn
(
[
(
self: super:
let
hooks = self.callPackage ./hooks {};
hooks = self.callPackage ./hooks { };
in
{
mkPoetryDep = self.callPackage ./mk-poetry-dep.nix {
@ -116,9 +116,7 @@ let
] ++ # User provided overrides
overrides
);
packageOverrides = lib.foldr lib.composeExtensions (self: super: {}) overlays;
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;
}
@ -158,7 +157,7 @@ let
, pyproject ? projectDir + "/pyproject.toml"
, poetrylock ? projectDir + "/poetry.lock"
, overrides ? [ defaultPoetryOverrides ]
, meta ? {}
, meta ? { }
, python ? pkgs.python3
, pwd ? projectDir
, preferWheels ? false
@ -171,7 +170,6 @@ let
py = poetryPython.python;
inherit (poetryPython) pyProject;
specialAttrs = [
"overrides"
"poetrylock"
@ -186,28 +184,27 @@ let
getDeps = depAttr:
let
compat = isCompatible (poetryLib.getPythonVersion py);
deps = pyProject.tool.poetry.${depAttr} or {};
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 [];
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,20 +11,22 @@ let
in
{
removePathDependenciesHook = callPackage (
removePathDependenciesHook = callPackage
(
{}:
makeSetupHook {
name = "remove-path-dependencies.sh";
deps = [];
deps = [ ];
substitutions = {
inherit pythonInterpreter;
yj = "${yj}/bin/yj";
pyprojectPatchScript = "${./pyproject-without-path.py}";
};
} ./remove-path-dependencies.sh
) {};
) { };
pipBuildHook = callPackage (
pipBuildHook = callPackage
(
{ pip, wheel }:
makeSetupHook {
name = "pip-build-hook.sh";
@ -33,14 +35,15 @@ in
inherit pythonInterpreter pythonSitePackages;
};
} ./pip-build-hook.sh
) {};
) { };
poetry2nixFixupHook = callPackage (
poetry2nixFixupHook = callPackage
(
{}:
makeSetupHook {
name = "fixup-hook.sh";
deps = [];
deps = [ ];
} ./fixup-hook.sh
) {};
) { };
}

26
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;
@ -78,7 +80,7 @@ let
if lib.strings.hasInfix "manylinux1" f then { pkg = [ ml.manylinux1 ]; str = "1"; }
else if lib.strings.hasInfix "manylinux2010" f then { pkg = [ ml.manylinux2010 ]; str = "2010"; }
else if lib.strings.hasInfix "manylinux2014" f then { pkg = [ ml.manylinux2014 ]; str = "2014"; }
else { pkg = []; str = null; };
else { pkg = [ ]; str = null; };
# Fetch the artifacts from the PyPI index. Since we get all
# info we need from the lock file we don't use nixpkgs' fetchPyPi
@ -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
@ -106,7 +108,7 @@ let
buildSystem = lib.attrByPath [ "build-system" "build-backend" ] "" pyProject;
drvAttr = moduleName (builtins.elemAt (builtins.split "\\.|:" buildSystem) 0);
in
if buildSystem == "" then [] else (
if buildSystem == "" then [ ] else (
[ pythonPackages.${drvAttr} or (throw "unsupported build system ${buildSystem}") ]
);
@ -117,7 +119,7 @@ let
gitIgnore = path + "/.gitignore";
isGitRoot = builtins.pathExists (path + "/.git");
hasGitIgnore = builtins.pathExists gitIgnore;
gitIgnores = if hasGitIgnore then [ gitIgnore ] else [];
gitIgnores = if hasGitIgnore then [ gitIgnore ] else [ ];
in
lib.optionals (builtins.toString path != "/" && ! isGitRoot) (findGitIgnores parent) ++ gitIgnores;

View file

@ -10,7 +10,7 @@
, version
, files
, source
, dependencies ? {}
, dependencies ? { }
, pythonPackages
, python-versions
, pwd
@ -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;
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 "";
@ -134,7 +128,7 @@ pythonPackages.callPackage (
meta = {
broken = ! isCompatible (poetryLib.getPythonVersion python) python-versions;
license = [];
license = [ ];
inherit (python.meta) platforms;
};
@ -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
''
@ -51,14 +44,14 @@ let
mkPkgs = sources:
let
sourcesNixpkgs =
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {};
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { };
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
in
if builtins.hasAttr "nixpkgs" sources
then sourcesNixpkgs
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
import <nixpkgs> {}
import <nixpkgs> { }
else
abort
''
@ -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
@ -131,4 +125,4 @@ let
inherit pkgs;
};
in
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
mkSources (mkConfig { }) // { __functor = _: settings: mkSources (mkConfig settings); }

View file

@ -1,4 +1,4 @@
{ pkgs ? import <nixpkgs> {}
{ pkgs ? import <nixpkgs> { }
, lib ? pkgs.lib
, stdenv ? pkgs.stdenv
}:
@ -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,22 +64,25 @@ 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 [])
propagatedNativeBuildInputs = (old.propagatedNativeBuildInputs or [ ])
++ [ pkgs.gettext ];
}
)
);
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;
@ -300,7 +328,7 @@ self: super:
cfg = pkgs.writeTextFile {
name = "site.cfg";
text = (
lib.generators.toINI {} {
lib.generators.toINI { } {
${blasImplementation} = {
include_dirs = "${blas}/include";
library_dirs = "${blas}/lib";
@ -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 ++ [
@ -436,12 +475,13 @@ self: super:
pkgs.xlibsWrapper
];
mesonFlags = [ "-Dpython=${if self.isPy3k then "python3" else "python"}" ];
mesonFlags = [ "-Dpython=${ if self.isPy3k then "python3" else "python"}" ];
}
)
) 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";
@ -511,7 +556,7 @@ self: super:
;
# Fix dbus mainloop
patches = pkgs.python3.pkgs.pyqt5.patches or [];
patches = pkgs.python3.pkgs.pyqt5.patches or [ ];
configurePhase = ''
runHook preConfigure
@ -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,16 +688,18 @@ 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 []) ++ [
cmakeFlags = (old.cmakeFlags or [ ]) ++ [
"-DPYBIND11_TEST=off"
];
doCheck = false; # Circular test dependency
}
);
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";
#
@ -43,7 +42,7 @@ let
vs = lib.lists.tail versions;
in
if (builtins.length versions == 0)
then []
then [ ]
else (builtins.filter (x: hasInfix v x.file) candidates) ++ (findBestMatches vs candidates);
# pyver = "cpXX"
@ -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" ];
@ -95,7 +89,7 @@ let
else chooseOSX files;
in
if (builtins.length filtered == 0)
then []
then [ ]
else choose (filtered);
in
{

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
@ -39,7 +38,7 @@ let
findSubExpressions = expr:
let
acc = builtins.foldl' findSubExpressionsFun {
exprs = [];
exprs = [ ];
expr = expr;
pos = 0;
openP = 0;
@ -47,18 +46,16 @@ let
startPos = 0;
} (lib.stringToCharacters expr);
tailExpr = (substr acc.exprPos acc.pos expr);
tailExprs = if tailExpr != "" then [ tailExpr ] else [];
tailExprs = if tailExpr != "" then [ tailExpr ] else [ ];
in
acc.exprs ++ tailExprs;
parseExpressions = exprs:
let
splitCond = (
s: builtins.map
(x: stripStr (if builtins.typeOf x == "list" then (builtins.elemAt x 0) else x))
(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,14 +67,13 @@ 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;
) [ ] exprs;
# Transform individual expressions to structured expressions
# This function also performs variable substitution, replacing environment markers with their explicit values
@ -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

@ -1,43 +1,40 @@
{ pkgs ? import <nixpkgs> {} }:
{ pkgs ? import <nixpkgs> { } }:
let
poetry = pkgs.callPackage ../pkgs/poetry { python = pkgs.python3; inherit poetry2nix; };
poetry2nix = import ./.. { inherit pkgs; inherit poetry; };
pep425 = pkgs.callPackage ../pep425.nix {};
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
{
trivial = callTest ./trivial {};
override = callTest ./override-support {};
override-default = callTest ./override-default-support {};
top-packages-1 = callTest ./common-pkgs-1 {};
top-packages-2 = callTest ./common-pkgs-2 {};
{
trivial = callTest ./trivial { };
override = callTest ./override-support { };
override-default = callTest ./override-default-support { };
top-packages-1 = callTest ./common-pkgs-1 { };
top-packages-2 = callTest ./common-pkgs-2 { };
pep425 = pkgs.callPackage ./pep425 { inherit pep425; inherit pep425OSX; inherit pep425Python37; };
env = callTest ./env {};
git-deps = callTest ./git-deps {};
git-deps-pinned = callTest ./git-deps-pinned {};
env = callTest ./env { };
git-deps = callTest ./git-deps { };
git-deps-pinned = callTest ./git-deps-pinned { };
cli = poetry2nix;
path-deps = callTest ./path-deps {};
path-deps-level2 = callTest ./path-deps-level2 {};
operators = callTest ./operators {};
preferWheel = callTest ./prefer-wheel {};
prefer-wheels = callTest ./prefer-wheels {};
path-deps = callTest ./path-deps { };
path-deps-level2 = callTest ./path-deps-level2 { };
operators = callTest ./operators { };
preferWheel = callTest ./prefer-wheel { };
prefer-wheels = callTest ./prefer-wheels { };
closure-size = callTest ./closure-size {
inherit poetry;
inherit (pkgs) postgresql;
};
pyqt5 = callTest ./pyqt5 {};
eggs = callTest ./eggs {};
extras = callTest ./extras {};
source-filter = callTest ./source-filter {};
canonical-module-names = callTest ./canonical-module-names {};
wandb = callTest ./wandb {};
pyqt5 = callTest ./pyqt5 { };
eggs = callTest ./eggs { };
extras = callTest ./extras { };
source-filter = callTest ./source-filter { };
canonical-module-names = callTest ./canonical-module-names { };
wandb = callTest ./wandb { };
# Test building poetry
inherit poetry;
@ -49,5 +46,5 @@ builtins.removeAttrs
# manylinux requires nixpkgs with https://github.com/NixOS/nixpkgs/pull/75763
# Once this is available in 19.09 and unstable we can re-enable the manylinux test
manylinux = callTest ./manylinux {};
} skipTests
manylinux = callTest ./manylinux { };
} skipTests

View file

@ -7,7 +7,7 @@ let
src = lib.cleanSource ./.;
};
in
runCommandNoCC "egg-test" {} ''
runCommandNoCC "egg-test" { } ''
${drv}/bin/egg-test
touch $out
''

View file

@ -6,7 +6,7 @@ let
poetrylock = ./poetry.lock;
};
in
runCommand "env-test" {} ''
runCommand "env-test" { } ''
${env}/bin/python -c 'import alembic'
touch $out
''

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

@ -8,7 +8,7 @@ let
};
p = pkg.python.withPackages (ps: [ ps.numpy ps.opencv-python ]);
in
runCommand "test" {} ''
runCommand "test" { } ''
${p}/bin/python -c "import cv2"
touch $out
''

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;
}
@ -20,7 +22,7 @@ let
];
};
in
runCommand "test" {} ''
runCommand "test" { } ''
x=${builtins.toString (p.python.pkgs.alembic.TESTING_FOOBAR)}
[ "$x" = "42" ] || exit 1
mkdir $out

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;
}
@ -17,7 +18,7 @@ let
);
};
in
runCommand "test" {} ''
runCommand "test" { } ''
x=${builtins.toString (p.python.pkgs.alembic.TESTING_FOOBAR)}
[ "$x" = "42" ] || exit 1
mkdir $out

View file

@ -15,7 +15,7 @@ lib.debug.runTests {
in
{
expr = (pep425.selectWheel cs);
expected = [ { file = "grpcio-1.25.0-cp27-cp27m-manylinux2010_x86_64.whl"; } ];
expected = [{ file = "grpcio-1.25.0-cp27-cp27m-manylinux2010_x86_64.whl"; }];
};
testOSXSimple =
@ -27,7 +27,7 @@ lib.debug.runTests {
in
{
expr = (pep425OSX.selectWheel cs);
expected = [ { file = "grpcio-1.25.0-cp27-cp27m-macosx_10_10_x86_64.whl"; } ];
expected = [{ file = "grpcio-1.25.0-cp27-cp27m-macosx_10_10_x86_64.whl"; }];
};
testLinuxPickPython37 =
@ -43,7 +43,7 @@ lib.debug.runTests {
in
{
expr = (pep425Python37.selectWheel cs);
expected = [ { file = "grpcio-1.25.0-cp37-cp37m-manylinux2010_x86_64.whl"; } ];
expected = [{ file = "grpcio-1.25.0-cp37-cp37m-manylinux2010_x86_64.whl"; }];
};
testOSXPreferNewer =
@ -55,7 +55,7 @@ lib.debug.runTests {
in
{
expr = (pep425OSX.selectWheel cs);
expected = [ { file = "grpcio-1.25.0-cp27-cp27m-macosx_10_12_x86_64.whl"; } ];
expected = [{ file = "grpcio-1.25.0-cp27-cp27m-macosx_10_12_x86_64.whl"; }];
};
testOSXNoMatch =
@ -67,7 +67,7 @@ lib.debug.runTests {
in
{
expr = (pep425OSX.selectWheel cs);
expected = [];
expected = [ ];
};
testLinuxPreferOlder =
@ -79,7 +79,7 @@ lib.debug.runTests {
in
{
expr = (pep425.selectWheel cs);
expected = [ { file = "grpcio-1.25.0-cp27-cp27m-manylinux1_x86_64.whl"; } ];
expected = [{ file = "grpcio-1.25.0-cp27-cp27m-manylinux1_x86_64.whl"; }];
};
testLinuxNoMatch =
@ -91,17 +91,17 @@ lib.debug.runTests {
in
{
expr = (pep425.selectWheel cs);
expected = [];
expected = [ ];
};
testLinuxEmptyList = {
expr = pep425.selectWheel [];
expected = [];
expr = pep425.selectWheel [ ];
expected = [ ];
};
testOSXEmptyList = {
expr = pep425OSX.selectWheel [];
expected = [];
expr = pep425OSX.selectWheel [ ];
expected = [ ];
};
testLinuxCffiWhlFiles =
@ -144,7 +144,7 @@ lib.debug.runTests {
in
{
expr = pep425.selectWheel cs;
expected = [ { file = "cffi-1.13.2-cp27-cp27m-manylinux1_x86_64.whl"; } ];
expected = [{ file = "cffi-1.13.2-cp27-cp27m-manylinux1_x86_64.whl"; }];
};
testMsgPack =
@ -175,7 +175,7 @@ lib.debug.runTests {
in
{
expr = pep425Python37.selectWheel cs;
expected = [ { file = "msgpack-0.6.2-cp37-cp37m-manylinux1_x86_64.whl"; } ];
expected = [{ file = "msgpack-0.6.2-cp37-cp37m-manylinux1_x86_64.whl"; }];
};
testNonManyLinuxWheels =
@ -187,7 +187,7 @@ lib.debug.runTests {
in
{
expr = pep425Python37.selectWheel cs;
expected = [ { file = "tensorboard-1.14.0-py3-none-any.whl"; } ];
expected = [{ file = "tensorboard-1.14.0-py3-none-any.whl"; }];
};
testPy2Py3Wheels =
@ -198,7 +198,7 @@ lib.debug.runTests {
in
{
expr = pep425Python37.selectWheel cs;
expected = [ { file = "tensorboard-1.14.0-py2.py3-none-any.whl"; } ];
expected = [{ file = "tensorboard-1.14.0-py2.py3-none-any.whl"; }];
};
#

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,14 +1,11 @@
{ 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" {} ''
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,14 +49,14 @@ in
exit(p.returncode)
'';
flamegraph = let
flamegraph =
let
runtimeDeps = lib.makeBinPath [
pkgs.flamegraph
pkgs.python3
pkgs.nix
];
nixSrc = pkgs.runCommandNoCC "${pkgs.nix.name}-sources" {} ''
nixSrc = pkgs.runCommandNoCC "${pkgs.nix.name}-sources" { } ''
mkdir $out
tar -x --strip=1 -f ${pkgs.nix.src} -C $out
'';