mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-04 16:51:40 -05:00
Format with nixpkgs-fmt 0.9
This commit is contained in:
parent
08446e038a
commit
db06bdd6e7
24 changed files with 994 additions and 1050 deletions
39
default.nix
39
default.nix
|
@ -69,14 +69,12 @@ let
|
|||
baseOverlay = self: super:
|
||||
let
|
||||
getDep = depName: self.${depName};
|
||||
lockPkgs = builtins.listToAttrs
|
||||
(
|
||||
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;
|
||||
|
@ -86,11 +84,13 @@ let
|
|||
}
|
||||
);
|
||||
}
|
||||
) compatible
|
||||
)
|
||||
compatible
|
||||
);
|
||||
in
|
||||
lockPkgs;
|
||||
overlays = builtins.map getFunctorFn
|
||||
overlays = builtins.map
|
||||
getFunctorFn
|
||||
(
|
||||
[
|
||||
(
|
||||
|
@ -145,8 +145,7 @@ let
|
|||
, editablePackageSources ? { }
|
||||
}:
|
||||
let
|
||||
py = mkPoetryPackages
|
||||
(
|
||||
py = mkPoetryPackages (
|
||||
{
|
||||
inherit pyproject poetrylock overrides python pwd preferWheels;
|
||||
}
|
||||
|
@ -155,12 +154,14 @@ let
|
|||
(name: src:
|
||||
# Creates a "fake" python module that just points to the editable source directory
|
||||
# See https://docs.python.org/3.8/library/site.html for info on such .pth files
|
||||
py.python.pkgs.toPythonModule
|
||||
(pkgs.runCommandNoCC "${name}-editable" { } ''
|
||||
py.python.pkgs.toPythonModule (pkgs.runCommandNoCC "${name}-editable"
|
||||
{ } ''
|
||||
mkdir -p "$out/${py.python.sitePackages}"
|
||||
echo "${toString src}" > "$out/${py.python.sitePackages}/${name}.pth"
|
||||
'')
|
||||
) editablePackageSources;
|
||||
''
|
||||
)
|
||||
)
|
||||
editablePackageSources;
|
||||
in
|
||||
py.python.withPackages (_: py.poetryPackages ++ editablePackages);
|
||||
|
||||
|
@ -214,16 +215,17 @@ let
|
|||
pkg = py.pkgs."${dep}";
|
||||
constraints = deps.${dep}.python or "";
|
||||
isCompat = compat constraints;
|
||||
in if isCompat then pkg else null
|
||||
) depAttrs;
|
||||
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;
|
||||
};
|
||||
app = py.pkgs.buildPythonPackage
|
||||
(
|
||||
app = py.pkgs.buildPythonPackage (
|
||||
passedAttrs // {
|
||||
pname = moduleName pyProject.tool.poetry.name;
|
||||
version = pyProject.tool.poetry.version;
|
||||
|
@ -243,9 +245,8 @@ let
|
|||
|
||||
passthru = {
|
||||
python = py;
|
||||
dependencyEnv =
|
||||
(lib.makeOverridable
|
||||
({ app, ... }@attrs:
|
||||
dependencyEnv = (
|
||||
lib.makeOverridable ({ app, ... }@attrs:
|
||||
let
|
||||
args = builtins.removeAttrs attrs [ "app" ] // {
|
||||
extraLibs = [ app ];
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
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;
|
||||
|
@ -23,8 +22,7 @@
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,8 @@ in
|
|||
removePathDependenciesHook = callPackage
|
||||
(
|
||||
{}:
|
||||
makeSetupHook {
|
||||
makeSetupHook
|
||||
{
|
||||
name = "remove-path-dependencies.sh";
|
||||
deps = [ ];
|
||||
substitutions = {
|
||||
|
@ -28,7 +29,8 @@ in
|
|||
pipBuildHook = callPackage
|
||||
(
|
||||
{ pip, wheel }:
|
||||
makeSetupHook {
|
||||
makeSetupHook
|
||||
{
|
||||
name = "pip-build-hook.sh";
|
||||
deps = [ pip wheel ];
|
||||
substitutions = {
|
||||
|
@ -40,7 +42,8 @@ in
|
|||
poetry2nixFixupHook = callPackage
|
||||
(
|
||||
{}:
|
||||
makeSetupHook {
|
||||
makeSetupHook
|
||||
{
|
||||
name = "fixup-hook.sh";
|
||||
deps = [ ];
|
||||
} ./fixup-hook.sh
|
||||
|
|
18
lib.nix
18
lib.nix
|
@ -45,13 +45,12 @@ 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;
|
||||
|
@ -88,8 +87,7 @@ let
|
|||
# file: filename including extension
|
||||
# hash: SRI hash
|
||||
# kind: Language implementation and version tag
|
||||
predictURLFromPypi = lib.makeOverridable
|
||||
(
|
||||
predictURLFromPypi = lib.makeOverridable (
|
||||
{ pname, file, hash, kind }:
|
||||
"https://files.pythonhosted.org/packages/${kind}/${lib.toLower (builtins.substring 0 1 file)}/${pname}/${file}"
|
||||
);
|
||||
|
@ -102,8 +100,7 @@ let
|
|||
# file: filename including extension
|
||||
# hash: SRI hash
|
||||
# kind: Language implementation and version tag
|
||||
fetchWheelFromPypi = lib.makeOverridable
|
||||
(
|
||||
fetchWheelFromPypi = lib.makeOverridable (
|
||||
{ pname, file, hash, kind, curlOpts ? "" }:
|
||||
let
|
||||
version = builtins.elemAt (builtins.split "-" file) 2;
|
||||
|
@ -143,8 +140,7 @@ 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 }:
|
||||
if lib.strings.hasSuffix "whl" file then fetchWheelFromPypi { inherit pname file hash kind; }
|
||||
else
|
||||
|
|
|
@ -111,7 +111,8 @@ pythonPackages.callPackage
|
|||
propagatedBuildInputs =
|
||||
let
|
||||
compat = isCompatible (poetryLib.getPythonVersion python);
|
||||
deps = lib.filterAttrs (n: v: v)
|
||||
deps = lib.filterAttrs
|
||||
(n: v: v)
|
||||
(
|
||||
lib.mapAttrs
|
||||
(
|
||||
|
@ -120,7 +121,8 @@ pythonPackages.callPackage
|
|||
constraints = v.python or "";
|
||||
in
|
||||
compat constraints
|
||||
) dependencies
|
||||
)
|
||||
dependencies
|
||||
);
|
||||
depAttrs = lib.attrNames deps;
|
||||
in
|
||||
|
|
|
@ -110,7 +110,8 @@ let
|
|||
"The values in sources.json should not have an 'outPath' attribute"
|
||||
else
|
||||
spec // { outPath = fetch config.pkgs name spec; }
|
||||
) config.sources;
|
||||
)
|
||||
config.sources;
|
||||
|
||||
# The "config" used by the fetchers
|
||||
mkConfig =
|
||||
|
|
207
overrides.nix
207
overrides.nix
|
@ -6,16 +6,14 @@
|
|||
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
|
||||
|
@ -24,8 +22,7 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
bcrypt = super.bcrypt.overridePythonAttrs
|
||||
(
|
||||
bcrypt = super.bcrypt.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs ++ [ pkgs.libffi ];
|
||||
}
|
||||
|
@ -34,16 +31,14 @@ 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
|
||||
|
@ -51,8 +46,7 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
configparser = super.configparser.overridePythonAttrs
|
||||
(
|
||||
configparser = super.configparser.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs ++ [
|
||||
self.toml
|
||||
|
@ -64,16 +58,14 @@ 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 ];
|
||||
|
@ -81,8 +73,7 @@ self: super:
|
|||
)
|
||||
);
|
||||
|
||||
django-bakery = super.django-bakery.overridePythonAttrs
|
||||
(
|
||||
django-bakery = super.django-bakery.overridePythonAttrs (
|
||||
old: {
|
||||
configurePhase = ''
|
||||
if ! test -e LICENSE; then
|
||||
|
@ -92,8 +83,7 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
dlib = super.dlib.overridePythonAttrs
|
||||
(
|
||||
dlib = super.dlib.overridePythonAttrs (
|
||||
old: {
|
||||
# Parallel building enabled
|
||||
inherit (pkgs.python.pkgs.dlib) patches;
|
||||
|
@ -109,16 +99,14 @@ 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 \
|
||||
|
@ -128,23 +116,20 @@ 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:
|
||||
if old.format != "wheel" then rec {
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.pkgconfig ];
|
||||
|
@ -156,15 +141,13 @@ self: super:
|
|||
} else old
|
||||
);
|
||||
|
||||
horovod = super.horovod.overridePythonAttrs
|
||||
(
|
||||
horovod = super.horovod.overridePythonAttrs (
|
||||
old: {
|
||||
propagatedBuildInputs = old.propagatedBuildInputs ++ [ pkgs.openmpi ];
|
||||
}
|
||||
);
|
||||
|
||||
imagecodecs = super.imagecodecs.overridePythonAttrs
|
||||
(
|
||||
imagecodecs = super.imagecodecs.overridePythonAttrs (
|
||||
old: {
|
||||
patchPhase = ''
|
||||
substituteInPlace setup.py \
|
||||
|
@ -222,22 +205,19 @@ self: super:
|
|||
);
|
||||
|
||||
# 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;
|
||||
}
|
||||
);
|
||||
|
||||
isort = super.isort.overridePythonAttrs
|
||||
(
|
||||
isort = super.isort.overridePythonAttrs (
|
||||
old: {
|
||||
propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.setuptools ];
|
||||
}
|
||||
);
|
||||
|
||||
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
|
||||
|
@ -246,8 +226,7 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
kiwisolver = super.kiwisolver.overridePythonAttrs
|
||||
(
|
||||
kiwisolver = super.kiwisolver.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs ++ [
|
||||
# cppy is at the time of writing not in nixpkgs
|
||||
|
@ -256,8 +235,7 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
lap = super.lap.overridePythonAttrs
|
||||
(
|
||||
lap = super.lap.overridePythonAttrs (
|
||||
old: {
|
||||
propagatedBuildInputs = old.propagatedBuildInputs ++ [
|
||||
self.numpy
|
||||
|
@ -265,8 +243,7 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
llvmlite = super.llvmlite.overridePythonAttrs
|
||||
(
|
||||
llvmlite = super.llvmlite.overridePythonAttrs (
|
||||
old: {
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.llvm ];
|
||||
|
||||
|
@ -289,30 +266,26 @@ 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;
|
||||
|
@ -353,16 +326,14 @@ 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
|
||||
|
@ -385,8 +356,7 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
numpy = super.numpy.overridePythonAttrs
|
||||
(
|
||||
numpy = super.numpy.overridePythonAttrs (
|
||||
old:
|
||||
let
|
||||
blas = old.passthru.args.blas or pkgs.openblasCompat;
|
||||
|
@ -394,7 +364,8 @@ self: super:
|
|||
cfg = pkgs.writeTextFile {
|
||||
name = "site.cfg";
|
||||
text = (
|
||||
lib.generators.toINI { } {
|
||||
lib.generators.toINI
|
||||
{ } {
|
||||
${blasImplementation} = {
|
||||
include_dirs = "${blas}/include";
|
||||
library_dirs = "${blas}/lib";
|
||||
|
@ -420,16 +391,14 @@ 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;
|
||||
|
@ -443,31 +412,27 @@ 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
|
||||
(
|
||||
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));
|
||||
|
@ -508,8 +473,7 @@ self: super:
|
|||
|
||||
dontUseCmakeConfigure = true;
|
||||
}
|
||||
) else super.pyarrow.overridePythonAttrs
|
||||
(
|
||||
) else super.pyarrow.overridePythonAttrs (
|
||||
old: {
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [
|
||||
self.cython
|
||||
|
@ -517,17 +481,14 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
pycairo =
|
||||
(
|
||||
pycairo = (
|
||||
drv: (
|
||||
drv.overridePythonAttrs
|
||||
(
|
||||
drv.overridePythonAttrs (
|
||||
_: {
|
||||
format = "other";
|
||||
}
|
||||
)
|
||||
).overridePythonAttrs
|
||||
(
|
||||
).overridePythonAttrs (
|
||||
old: {
|
||||
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [
|
||||
|
@ -544,10 +505,10 @@ self: super:
|
|||
mesonFlags = [ "-Dpython=${if self.isPy3k then "python3" else "python"}" ];
|
||||
}
|
||||
)
|
||||
) super.pycairo;
|
||||
)
|
||||
super.pycairo;
|
||||
|
||||
pycocotools = super.pycocotools.overridePythonAttrs
|
||||
(
|
||||
pycocotools = super.pycocotools.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs ++ [
|
||||
self.cython
|
||||
|
@ -556,24 +517,21 @@ 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 ];
|
||||
}
|
||||
|
@ -587,8 +545,7 @@ self: super:
|
|||
withWebKit = drv.passthru.args.withWebKit or false;
|
||||
withWebSockets = drv.passthru.args.withWebSockets or false;
|
||||
in
|
||||
super.pyqt5.overridePythonAttrs
|
||||
(
|
||||
super.pyqt5.overridePythonAttrs (
|
||||
old: {
|
||||
format = "other";
|
||||
|
||||
|
@ -682,8 +639,7 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
pytest-datadir = super.pytest-datadir.overridePythonAttrs
|
||||
(
|
||||
pytest-datadir = super.pytest-datadir.overridePythonAttrs (
|
||||
old: {
|
||||
postInstall = ''
|
||||
rm -f $out/LICENSE
|
||||
|
@ -691,8 +647,7 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
pytest = super.pytest.overridePythonAttrs
|
||||
(
|
||||
pytest = super.pytest.overridePythonAttrs (
|
||||
old: {
|
||||
doCheck = false;
|
||||
}
|
||||
|
@ -700,8 +655,7 @@ 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'," ""
|
||||
|
@ -710,8 +664,7 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
python-prctl = super.python-prctl.overridePythonAttrs
|
||||
(
|
||||
python-prctl = super.python-prctl.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs ++ [
|
||||
pkgs.libcap
|
||||
|
@ -719,16 +672,14 @@ 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
|
||||
|
@ -736,8 +687,7 @@ 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
|
||||
|
@ -745,15 +695,13 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
pandas = super.pandas.overridePythonAttrs
|
||||
(
|
||||
pandas = super.pandas.overridePythonAttrs (
|
||||
old: {
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [ self.cython ];
|
||||
}
|
||||
);
|
||||
|
||||
panel = super.panel.overridePythonAttrs
|
||||
(
|
||||
panel = super.panel.overridePythonAttrs (
|
||||
old: {
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.nodejs ];
|
||||
}
|
||||
|
@ -761,8 +709,7 @@ 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"
|
||||
|
@ -771,8 +718,7 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
scipy = super.scipy.overridePythonAttrs
|
||||
(
|
||||
scipy = super.scipy.overridePythonAttrs (
|
||||
old:
|
||||
if old.format != "wheel" then {
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.gfortran ];
|
||||
|
@ -790,8 +736,7 @@ self: super:
|
|||
} else old
|
||||
);
|
||||
|
||||
scikit-learn = super.scikit-learn.overridePythonAttrs
|
||||
(
|
||||
scikit-learn = super.scikit-learn.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs ++ [
|
||||
pkgs.gfortran
|
||||
|
@ -808,8 +753,7 @@ 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;
|
||||
|
@ -818,16 +762,14 @@ self: super:
|
|||
|
||||
shellingham =
|
||||
if lib.versionAtLeast super.shellingham.version "1.3.2" then (
|
||||
super.shellingham.overridePythonAttrs
|
||||
(
|
||||
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 ];
|
||||
|
@ -835,8 +777,7 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
tensorpack = super.tensorpack.overridePythonAttrs
|
||||
(
|
||||
tensorpack = super.tensorpack.overridePythonAttrs (
|
||||
old: {
|
||||
postPatch = ''
|
||||
substituteInPlace setup.cfg --replace "# will call find_packages()" ""
|
||||
|
@ -844,8 +785,7 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
urwidtrees = super.urwidtrees.overridePythonAttrs
|
||||
(
|
||||
urwidtrees = super.urwidtrees.overridePythonAttrs (
|
||||
old: {
|
||||
propagatedBuildInputs = old.propagatedBuildInputs ++ [
|
||||
self.urwid
|
||||
|
@ -853,8 +793,7 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
vose-alias-method = super.vose-alias-method.overridePythonAttrs
|
||||
(
|
||||
vose-alias-method = super.vose-alias-method.overridePythonAttrs (
|
||||
old: {
|
||||
postInstall = ''
|
||||
rm -f $out/LICENSE
|
||||
|
@ -862,8 +801,7 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
uvloop = super.uvloop.overridePythonAttrs
|
||||
(
|
||||
uvloop = super.uvloop.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs ++ lib.optionals stdenv.isDarwin [
|
||||
pkgs.darwin.apple_sdk.frameworks.ApplicationServices
|
||||
|
@ -877,8 +815,7 @@ self: super:
|
|||
pkgs.python3.pkgs.override {
|
||||
python = self.python;
|
||||
}
|
||||
).wheel.overridePythonAttrs
|
||||
(
|
||||
).wheel.overridePythonAttrs (
|
||||
old:
|
||||
if old.format == "other" then old else {
|
||||
inherit (super.wheel) pname name version src;
|
||||
|
@ -888,8 +825,7 @@ 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 \
|
||||
|
@ -899,8 +835,7 @@ self: super:
|
|||
}
|
||||
)
|
||||
) else super.zipp
|
||||
).overridePythonAttrs
|
||||
(
|
||||
).overridePythonAttrs (
|
||||
old: {
|
||||
propagatedBuildInputs = old.propagatedBuildInputs ++ [
|
||||
self.toml
|
||||
|
|
27
pep508.nix
27
pep508.nix
|
@ -37,14 +37,17 @@ let
|
|||
# Make a tree out of expression groups (parens)
|
||||
findSubExpressions = expr:
|
||||
let
|
||||
acc = builtins.foldl' findSubExpressionsFun {
|
||||
acc = builtins.foldl'
|
||||
findSubExpressionsFun
|
||||
{
|
||||
exprs = [ ];
|
||||
expr = expr;
|
||||
pos = 0;
|
||||
openP = 0;
|
||||
exprPos = 0;
|
||||
startPos = 0;
|
||||
} (lib.stringToCharacters expr);
|
||||
}
|
||||
(lib.stringToCharacters expr);
|
||||
tailExpr = (substr acc.exprPos acc.pos expr);
|
||||
tailExprs = if tailExpr != "" then [ tailExpr ] else [ ];
|
||||
in
|
||||
|
@ -72,7 +75,8 @@ let
|
|||
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
|
||||
|
@ -159,8 +163,7 @@ 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);
|
||||
|
@ -207,10 +210,13 @@ let
|
|||
) else throw "Unsupported type"
|
||||
) else if builtins.typeOf v == "list" then (
|
||||
let
|
||||
ret = builtins.foldl' reduceExpressionsFun {
|
||||
ret = builtins.foldl'
|
||||
reduceExpressionsFun
|
||||
{
|
||||
value = true;
|
||||
cond = "and";
|
||||
} v;
|
||||
}
|
||||
v;
|
||||
in
|
||||
acc // {
|
||||
value = cond."${acc.cond}" acc.value ret.value;
|
||||
|
@ -219,10 +225,13 @@ let
|
|||
);
|
||||
in
|
||||
(
|
||||
builtins.foldl' reduceExpressionsFun {
|
||||
builtins.foldl'
|
||||
reduceExpressionsFun
|
||||
{
|
||||
value = true;
|
||||
cond = "and";
|
||||
} exprs
|
||||
}
|
||||
exprs
|
||||
).value;
|
||||
in
|
||||
e: builtins.foldl' (acc: v: v acc) e [
|
||||
|
|
|
@ -39,8 +39,7 @@ 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);
|
||||
|
@ -82,6 +81,7 @@ let
|
|||
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; }
|
||||
|
|
|
@ -11,8 +11,7 @@ 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
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
{ 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";
|
||||
|
|
|
@ -49,4 +49,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
|
||||
}
|
||||
skipTests
|
||||
|
|
|
@ -9,8 +9,7 @@ let
|
|||
|
||||
# Test support for overriding the app passed to the environment
|
||||
overridden = (
|
||||
app.overrideAttrs
|
||||
(old: {
|
||||
app.overrideAttrs (old: {
|
||||
name = "${old.pname}-overridden-${old.version}";
|
||||
})
|
||||
);
|
||||
|
@ -18,7 +17,8 @@ let
|
|||
app = overridden;
|
||||
};
|
||||
in
|
||||
runCommand "app-env-test" { } ''
|
||||
runCommand "app-env-test"
|
||||
{ } ''
|
||||
${depEnv}/bin/gunicorn --bind=unix:socket trivial:app &
|
||||
sleep 1
|
||||
${curl}/bin/curl --unix-socket socket localhost
|
||||
|
|
|
@ -13,7 +13,8 @@ let
|
|||
};
|
||||
};
|
||||
in
|
||||
runCommand "env-test" { } ''
|
||||
runCommand "env-test"
|
||||
{ } ''
|
||||
cp -r --no-preserve=mode ${./src} src
|
||||
echo 'print("Changed")' > src/trivial/__main__.py
|
||||
if [[ $(${env}/bin/python -m trivial) != "Changed" ]]; then
|
||||
|
|
|
@ -7,7 +7,8 @@ let
|
|||
src = lib.cleanSource ./.;
|
||||
};
|
||||
in
|
||||
runCommandNoCC "egg-test" { } ''
|
||||
runCommandNoCC "egg-test"
|
||||
{ } ''
|
||||
${drv}/bin/egg-test
|
||||
touch $out
|
||||
''
|
||||
|
|
3
tests/env/default.nix
vendored
3
tests/env/default.nix
vendored
|
@ -6,7 +6,8 @@ let
|
|||
poetrylock = ./poetry.lock;
|
||||
};
|
||||
in
|
||||
runCommand "env-test" { } ''
|
||||
runCommand "env-test"
|
||||
{ } ''
|
||||
${env}/bin/python -c 'import alembic'
|
||||
touch $out
|
||||
''
|
||||
|
|
|
@ -6,7 +6,6 @@ poetry2nix.mkPoetryApplication {
|
|||
poetrylock = ./poetry.lock;
|
||||
src = lib.cleanSource ./.;
|
||||
|
||||
overrides = poetry2nix.overrides.withDefaults
|
||||
(import ./poetry-git-overlay.nix { inherit pkgs; });
|
||||
overrides = poetry2nix.overrides.withDefaults (import ./poetry-git-overlay.nix { inherit pkgs; });
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
{ pkgs }:
|
||||
self: super: {
|
||||
|
||||
alembic = super.alembic.overrideAttrs
|
||||
(
|
||||
alembic = super.alembic.overrideAttrs (
|
||||
_: {
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://github.com/sqlalchemy/alembic.git";
|
||||
|
|
|
@ -8,7 +8,8 @@ let
|
|||
};
|
||||
p = pkg.python.withPackages (ps: [ ps.numpy ps.opencv-python ]);
|
||||
in
|
||||
runCommand "test" { } ''
|
||||
runCommand "test"
|
||||
{ } ''
|
||||
${p}/bin/python -c "import cv2"
|
||||
touch $out
|
||||
''
|
||||
|
|
|
@ -7,11 +7,9 @@ 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;
|
||||
}
|
||||
|
@ -22,7 +20,8 @@ let
|
|||
];
|
||||
};
|
||||
in
|
||||
runCommand "test" { } ''
|
||||
runCommand "test"
|
||||
{ } ''
|
||||
x=${builtins.toString (p.python.pkgs.alembic.TESTING_FOOBAR)}
|
||||
[ "$x" = "42" ] || exit 1
|
||||
mkdir $out
|
||||
|
|
|
@ -5,11 +5,9 @@ let
|
|||
src = ./.;
|
||||
poetrylock = ./poetry.lock;
|
||||
pyproject = ./pyproject.toml;
|
||||
overrides = poetry2nix.overrides.withDefaults
|
||||
(
|
||||
overrides = poetry2nix.overrides.withDefaults (
|
||||
self: super: {
|
||||
alembic = super.alembic.overrideAttrs
|
||||
(
|
||||
alembic = super.alembic.overrideAttrs (
|
||||
old: {
|
||||
TESTING_FOOBAR = 42;
|
||||
}
|
||||
|
@ -18,7 +16,8 @@ let
|
|||
);
|
||||
};
|
||||
in
|
||||
runCommand "test" { } ''
|
||||
runCommand "test"
|
||||
{ } ''
|
||||
x=${builtins.toString (p.python.pkgs.alembic.TESTING_FOOBAR)}
|
||||
[ "$x" = "42" ] || exit 1
|
||||
mkdir $out
|
||||
|
|
|
@ -13,8 +13,7 @@ in
|
|||
|
||||
release =
|
||||
let
|
||||
pythonEnv = pkgs.python3.withPackages
|
||||
(
|
||||
pythonEnv = pkgs.python3.withPackages (
|
||||
ps: [
|
||||
ps.pythonix
|
||||
]
|
||||
|
@ -56,7 +55,8 @@ in
|
|||
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
|
||||
'';
|
||||
|
|
Loading…
Add table
Reference in a new issue