mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-04 08:41:42 -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
137
default.nix
137
default.nix
|
@ -69,28 +69,28 @@ let
|
|||
baseOverlay = self: super:
|
||||
let
|
||||
getDep = depName: self.${depName};
|
||||
lockPkgs = builtins.listToAttrs
|
||||
(
|
||||
builtins.map
|
||||
(
|
||||
pkgMeta: rec {
|
||||
name = moduleName pkgMeta.name;
|
||||
value = self.mkPoetryDep
|
||||
(
|
||||
pkgMeta // {
|
||||
inherit pwd preferWheels;
|
||||
source = pkgMeta.source or null;
|
||||
files = lockFiles.${name};
|
||||
pythonPackages = self;
|
||||
sourceSpec = pyProject.tool.poetry.dependencies.${name} or pyProject.tool.poetry.dev-dependencies.${name};
|
||||
}
|
||||
);
|
||||
}
|
||||
) compatible
|
||||
);
|
||||
lockPkgs = builtins.listToAttrs (
|
||||
builtins.map
|
||||
(
|
||||
pkgMeta: rec {
|
||||
name = moduleName pkgMeta.name;
|
||||
value = self.mkPoetryDep (
|
||||
pkgMeta // {
|
||||
inherit pwd preferWheels;
|
||||
source = pkgMeta.source or null;
|
||||
files = lockFiles.${name};
|
||||
pythonPackages = self;
|
||||
sourceSpec = pyProject.tool.poetry.dependencies.${name} or pyProject.tool.poetry.dev-dependencies.${name};
|
||||
}
|
||||
);
|
||||
}
|
||||
)
|
||||
compatible
|
||||
);
|
||||
in
|
||||
lockPkgs;
|
||||
overlays = builtins.map getFunctorFn
|
||||
overlays = builtins.map
|
||||
getFunctorFn
|
||||
(
|
||||
[
|
||||
(
|
||||
|
@ -145,22 +145,23 @@ let
|
|||
, editablePackageSources ? { }
|
||||
}:
|
||||
let
|
||||
py = mkPoetryPackages
|
||||
(
|
||||
{
|
||||
inherit pyproject poetrylock overrides python pwd preferWheels;
|
||||
}
|
||||
);
|
||||
py = mkPoetryPackages (
|
||||
{
|
||||
inherit pyproject poetrylock overrides python pwd preferWheels;
|
||||
}
|
||||
);
|
||||
editablePackages = lib.mapAttrsToList
|
||||
(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" { } ''
|
||||
mkdir -p "$out/${py.python.sitePackages}"
|
||||
echo "${toString src}" > "$out/${py.python.sitePackages}/${name}.pth"
|
||||
'')
|
||||
) editablePackageSources;
|
||||
py.python.pkgs.toPythonModule (pkgs.runCommandNoCC "${name}-editable"
|
||||
{ } ''
|
||||
mkdir -p "$out/${py.python.sitePackages}"
|
||||
echo "${toString src}" > "$out/${py.python.sitePackages}/${name}.pth"
|
||||
''
|
||||
)
|
||||
)
|
||||
editablePackageSources;
|
||||
in
|
||||
py.python.withPackages (_: py.poetryPackages ++ editablePackages);
|
||||
|
||||
|
@ -214,54 +215,54 @@ 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
|
||||
(
|
||||
passedAttrs // {
|
||||
pname = moduleName pyProject.tool.poetry.name;
|
||||
version = pyProject.tool.poetry.version;
|
||||
app = py.pkgs.buildPythonPackage (
|
||||
passedAttrs // {
|
||||
pname = moduleName pyProject.tool.poetry.name;
|
||||
version = pyProject.tool.poetry.version;
|
||||
|
||||
inherit src;
|
||||
inherit src;
|
||||
|
||||
format = "pyproject";
|
||||
# Like buildPythonApplication, but without the toPythonModule part
|
||||
# Meaning this ends up looking like an application but it also
|
||||
# provides python modules
|
||||
namePrefix = "";
|
||||
format = "pyproject";
|
||||
# Like buildPythonApplication, but without the toPythonModule part
|
||||
# Meaning this ends up looking like an application but it also
|
||||
# provides python modules
|
||||
namePrefix = "";
|
||||
|
||||
buildInputs = mkInput "buildInputs" buildSystemPkgs;
|
||||
propagatedBuildInputs = mkInput "propagatedBuildInputs" (getDeps "dependencies") ++ ([ py.pkgs.setuptools ]);
|
||||
nativeBuildInputs = mkInput "nativeBuildInputs" [ pkgs.yj py.pkgs.removePathDependenciesHook ];
|
||||
checkInputs = mkInput "checkInputs" (getDeps "dev-dependencies");
|
||||
buildInputs = mkInput "buildInputs" buildSystemPkgs;
|
||||
propagatedBuildInputs = mkInput "propagatedBuildInputs" (getDeps "dependencies") ++ ([ py.pkgs.setuptools ]);
|
||||
nativeBuildInputs = mkInput "nativeBuildInputs" [ pkgs.yj py.pkgs.removePathDependenciesHook ];
|
||||
checkInputs = mkInput "checkInputs" (getDeps "dev-dependencies");
|
||||
|
||||
passthru = {
|
||||
python = py;
|
||||
dependencyEnv =
|
||||
(lib.makeOverridable
|
||||
({ app, ... }@attrs:
|
||||
let
|
||||
args = builtins.removeAttrs attrs [ "app" ] // {
|
||||
extraLibs = [ app ];
|
||||
};
|
||||
in
|
||||
py.buildEnv.override args)) { inherit app; };
|
||||
};
|
||||
passthru = {
|
||||
python = py;
|
||||
dependencyEnv = (
|
||||
lib.makeOverridable ({ app, ... }@attrs:
|
||||
let
|
||||
args = builtins.removeAttrs attrs [ "app" ] // {
|
||||
extraLibs = [ app ];
|
||||
};
|
||||
in
|
||||
py.buildEnv.override args)) { inherit app; };
|
||||
};
|
||||
|
||||
meta = meta // {
|
||||
inherit (pyProject.tool.poetry) description homepage;
|
||||
inherit (py.meta) platforms;
|
||||
license = getLicenseBySpdxId (pyProject.tool.poetry.license or "unknown");
|
||||
};
|
||||
meta = meta // {
|
||||
inherit (pyProject.tool.poetry) description homepage;
|
||||
inherit (py.meta) platforms;
|
||||
license = getLicenseBySpdxId (pyProject.tool.poetry.license or "unknown");
|
||||
};
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
in
|
||||
app;
|
||||
|
||||
|
|
26
flake.nix
26
flake.nix
|
@ -9,26 +9,24 @@
|
|||
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
|
||||
(
|
||||
system:
|
||||
import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ self.overlay ];
|
||||
}
|
||||
);
|
||||
nixpkgsFor = forAllSystems (
|
||||
system:
|
||||
import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ self.overlay ];
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
|
||||
overlay = import ./overlay.nix;
|
||||
|
||||
# TODO: I feel like `packages` is the wrong place for the poetry2nix attr
|
||||
packages = forAllSystems
|
||||
(
|
||||
system: {
|
||||
inherit (nixpkgsFor.${system}) poetry poetry2nix;
|
||||
}
|
||||
);
|
||||
packages = forAllSystems (
|
||||
system: {
|
||||
inherit (nixpkgsFor.${system}) poetry poetry2nix;
|
||||
}
|
||||
);
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,36 +14,39 @@ in
|
|||
removePathDependenciesHook = callPackage
|
||||
(
|
||||
{}:
|
||||
makeSetupHook {
|
||||
name = "remove-path-dependencies.sh";
|
||||
deps = [ ];
|
||||
substitutions = {
|
||||
inherit pythonInterpreter;
|
||||
yj = "${yj}/bin/yj";
|
||||
pyprojectPatchScript = "${./pyproject-without-path.py}";
|
||||
};
|
||||
} ./remove-path-dependencies.sh
|
||||
makeSetupHook
|
||||
{
|
||||
name = "remove-path-dependencies.sh";
|
||||
deps = [ ];
|
||||
substitutions = {
|
||||
inherit pythonInterpreter;
|
||||
yj = "${yj}/bin/yj";
|
||||
pyprojectPatchScript = "${./pyproject-without-path.py}";
|
||||
};
|
||||
} ./remove-path-dependencies.sh
|
||||
) { };
|
||||
|
||||
pipBuildHook = callPackage
|
||||
(
|
||||
{ pip, wheel }:
|
||||
makeSetupHook {
|
||||
name = "pip-build-hook.sh";
|
||||
deps = [ pip wheel ];
|
||||
substitutions = {
|
||||
inherit pythonInterpreter pythonSitePackages;
|
||||
};
|
||||
} ./pip-build-hook.sh
|
||||
makeSetupHook
|
||||
{
|
||||
name = "pip-build-hook.sh";
|
||||
deps = [ pip wheel ];
|
||||
substitutions = {
|
||||
inherit pythonInterpreter pythonSitePackages;
|
||||
};
|
||||
} ./pip-build-hook.sh
|
||||
) { };
|
||||
|
||||
poetry2nixFixupHook = callPackage
|
||||
(
|
||||
{}:
|
||||
makeSetupHook {
|
||||
name = "fixup-hook.sh";
|
||||
deps = [ ];
|
||||
} ./fixup-hook.sh
|
||||
makeSetupHook
|
||||
{
|
||||
name = "fixup-hook.sh";
|
||||
deps = [ ];
|
||||
} ./fixup-hook.sh
|
||||
) { };
|
||||
|
||||
}
|
||||
|
|
118
lib.nix
118
lib.nix
|
@ -20,7 +20,7 @@ let
|
|||
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);
|
||||
joinVersion (if major pyVer == major ver && minor pyVer == minor ver then ver else pyVer);
|
||||
|
||||
# Compare a semver expression with a version
|
||||
isCompatible = version:
|
||||
|
@ -45,28 +45,27 @@ 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
|
||||
(
|
||||
pkgs.runCommand "from-toml"
|
||||
{
|
||||
inherit toml;
|
||||
allowSubstitutes = false;
|
||||
preferLocalBuild = true;
|
||||
}
|
||||
''
|
||||
${pkgs.remarshal}/bin/remarshal \
|
||||
-if toml \
|
||||
-i <(echo "$toml") \
|
||||
-of json \
|
||||
-o $out
|
||||
''
|
||||
)
|
||||
toml: builtins.fromJSON (
|
||||
builtins.readFile (
|
||||
pkgs.runCommand "from-toml"
|
||||
{
|
||||
inherit toml;
|
||||
allowSubstitutes = false;
|
||||
preferLocalBuild = true;
|
||||
}
|
||||
''
|
||||
${pkgs.remarshal}/bin/remarshal \
|
||||
-if toml \
|
||||
-i <(echo "$toml") \
|
||||
-of json \
|
||||
-o $out
|
||||
''
|
||||
)
|
||||
)
|
||||
);
|
||||
readTOML = path: fromTOML (builtins.readFile path);
|
||||
|
||||
|
@ -88,11 +87,10 @@ let
|
|||
# file: filename including extension
|
||||
# hash: SRI hash
|
||||
# kind: Language implementation and version tag
|
||||
predictURLFromPypi = lib.makeOverridable
|
||||
(
|
||||
{ pname, file, hash, kind }:
|
||||
"https://files.pythonhosted.org/packages/${kind}/${lib.toLower (builtins.substring 0 1 file)}/${pname}/${file}"
|
||||
);
|
||||
predictURLFromPypi = lib.makeOverridable (
|
||||
{ pname, file, hash, kind }:
|
||||
"https://files.pythonhosted.org/packages/${kind}/${lib.toLower (builtins.substring 0 1 file)}/${pname}/${file}"
|
||||
);
|
||||
|
||||
|
||||
# Fetch the wheels from the PyPI index.
|
||||
|
@ -102,36 +100,35 @@ let
|
|||
# file: filename including extension
|
||||
# hash: SRI hash
|
||||
# kind: Language implementation and version tag
|
||||
fetchWheelFromPypi = lib.makeOverridable
|
||||
(
|
||||
{ pname, file, hash, kind, curlOpts ? "" }:
|
||||
let
|
||||
version = builtins.elemAt (builtins.split "-" file) 2;
|
||||
in
|
||||
(pkgs.stdenvNoCC.mkDerivation {
|
||||
name = file;
|
||||
nativeBuildInputs = [
|
||||
pkgs.curl
|
||||
pkgs.jq
|
||||
];
|
||||
isWheel = true;
|
||||
system = "builtin";
|
||||
fetchWheelFromPypi = lib.makeOverridable (
|
||||
{ pname, file, hash, kind, curlOpts ? "" }:
|
||||
let
|
||||
version = builtins.elemAt (builtins.split "-" file) 2;
|
||||
in
|
||||
(pkgs.stdenvNoCC.mkDerivation {
|
||||
name = file;
|
||||
nativeBuildInputs = [
|
||||
pkgs.curl
|
||||
pkgs.jq
|
||||
];
|
||||
isWheel = true;
|
||||
system = "builtin";
|
||||
|
||||
preferLocalBuild = true;
|
||||
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
|
||||
"NIX_CURL_FLAGS"
|
||||
];
|
||||
preferLocalBuild = true;
|
||||
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
|
||||
"NIX_CURL_FLAGS"
|
||||
];
|
||||
|
||||
predictedURL = predictURLFromPypi { inherit pname file hash kind; };
|
||||
inherit pname file version curlOpts;
|
||||
predictedURL = predictURLFromPypi { inherit pname file hash kind; };
|
||||
inherit pname file version curlOpts;
|
||||
|
||||
builder = ./fetch-wheel.sh;
|
||||
builder = ./fetch-wheel.sh;
|
||||
|
||||
outputHashMode = "flat";
|
||||
outputHashAlgo = "sha256";
|
||||
outputHash = hash;
|
||||
})
|
||||
);
|
||||
outputHashMode = "flat";
|
||||
outputHashAlgo = "sha256";
|
||||
outputHash = hash;
|
||||
})
|
||||
);
|
||||
|
||||
# Fetch the artifacts from the PyPI index. Since we get all
|
||||
# info we need from the lock file we don't use nixpkgs' fetchPyPi
|
||||
|
@ -143,16 +140,15 @@ 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
|
||||
(
|
||||
{ pname, file, hash, kind }:
|
||||
if lib.strings.hasSuffix "whl" file then fetchWheelFromPypi { inherit pname file hash kind; }
|
||||
else
|
||||
pkgs.fetchurl {
|
||||
url = predictURLFromPypi { inherit pname file hash kind; };
|
||||
inherit hash;
|
||||
}
|
||||
);
|
||||
fetchFromPypi = lib.makeOverridable (
|
||||
{ pname, file, hash, kind }:
|
||||
if lib.strings.hasSuffix "whl" file then fetchWheelFromPypi { inherit pname file hash kind; }
|
||||
else
|
||||
pkgs.fetchurl {
|
||||
url = predictURLFromPypi { inherit pname file hash kind; };
|
||||
inherit hash;
|
||||
}
|
||||
);
|
||||
getBuildSystemPkgs =
|
||||
{ pythonPackages
|
||||
, pyProject
|
||||
|
|
|
@ -58,7 +58,7 @@ pythonPackages.callPackage
|
|||
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
|
||||
|
@ -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 =
|
||||
|
|
1491
overrides.nix
1491
overrides.nix
File diff suppressed because it is too large
Load diff
55
pep508.nix
55
pep508.nix
|
@ -37,14 +37,17 @@ let
|
|||
# Make a tree out of expression groups (parens)
|
||||
findSubExpressions = expr:
|
||||
let
|
||||
acc = builtins.foldl' findSubExpressionsFun {
|
||||
exprs = [ ];
|
||||
expr = expr;
|
||||
pos = 0;
|
||||
openP = 0;
|
||||
exprPos = 0;
|
||||
startPos = 0;
|
||||
} (lib.stringToCharacters expr);
|
||||
acc = builtins.foldl'
|
||||
findSubExpressionsFun
|
||||
{
|
||||
exprs = [ ];
|
||||
expr = expr;
|
||||
pos = 0;
|
||||
openP = 0;
|
||||
exprPos = 0;
|
||||
startPos = 0;
|
||||
}
|
||||
(lib.stringToCharacters expr);
|
||||
tailExpr = (substr acc.exprPos acc.pos expr);
|
||||
tailExprs = if tailExpr != "" then [ tailExpr ] else [ ];
|
||||
in
|
||||
|
@ -53,7 +56,7 @@ let
|
|||
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: (
|
||||
|
@ -71,8 +74,9 @@ let
|
|||
in
|
||||
builtins.foldl'
|
||||
(
|
||||
acc: v: acc ++ ( if builtins.typeOf v == "string" then parse v else [ (parseExpressions v) ])
|
||||
) [ ] exprs;
|
||||
acc: v: acc ++ (if builtins.typeOf v == "string" then parse v else [ (parseExpressions v) ])
|
||||
) [ ]
|
||||
exprs;
|
||||
|
||||
# Transform individual expressions to structured expressions
|
||||
# This function also performs variable substitution, replacing environment markers with their explicit values
|
||||
|
@ -159,10 +163,9 @@ let
|
|||
let
|
||||
parts = builtins.splitVersion c;
|
||||
pruned = lib.take ((builtins.length parts) - 1) parts;
|
||||
upper = builtins.toString
|
||||
(
|
||||
(lib.toInt (builtins.elemAt pruned (builtins.length pruned - 1))) + 1
|
||||
);
|
||||
upper = builtins.toString (
|
||||
(lib.toInt (builtins.elemAt pruned (builtins.length pruned - 1))) + 1
|
||||
);
|
||||
upperConstraint = builtins.concatStringsSep "." (ireplace (builtins.length pruned - 1) upper pruned);
|
||||
in
|
||||
op.">=" v c && op."<" v upperConstraint;
|
||||
|
@ -207,10 +210,13 @@ let
|
|||
) else throw "Unsupported type"
|
||||
) else if builtins.typeOf v == "list" then (
|
||||
let
|
||||
ret = builtins.foldl' reduceExpressionsFun {
|
||||
value = true;
|
||||
cond = "and";
|
||||
} v;
|
||||
ret = builtins.foldl'
|
||||
reduceExpressionsFun
|
||||
{
|
||||
value = true;
|
||||
cond = "and";
|
||||
}
|
||||
v;
|
||||
in
|
||||
acc // {
|
||||
value = cond."${acc.cond}" acc.value ret.value;
|
||||
|
@ -219,10 +225,13 @@ let
|
|||
);
|
||||
in
|
||||
(
|
||||
builtins.foldl' reduceExpressionsFun {
|
||||
value = true;
|
||||
cond = "and";
|
||||
} exprs
|
||||
builtins.foldl'
|
||||
reduceExpressionsFun
|
||||
{
|
||||
value = true;
|
||||
cond = "and";
|
||||
}
|
||||
exprs
|
||||
).value;
|
||||
in
|
||||
e: builtins.foldl' (acc: v: v acc) e [
|
||||
|
|
12
semver.nix
12
semver.nix
|
@ -39,10 +39,9 @@ let
|
|||
# Prune constraint
|
||||
parts = builtins.splitVersion c;
|
||||
pruned = lib.take ((builtins.length parts) - 1) parts;
|
||||
upper = builtins.toString
|
||||
(
|
||||
(lib.toInt (builtins.elemAt pruned (builtins.length pruned - 1))) + 1
|
||||
);
|
||||
upper = builtins.toString (
|
||||
(lib.toInt (builtins.elemAt pruned (builtins.length pruned - 1))) + 1
|
||||
);
|
||||
upperConstraint = builtins.concatStringsSep "." (ireplace (builtins.length pruned - 1) upper pruned);
|
||||
in
|
||||
operators.">=" v c && operators."<" v upperConstraint;
|
||||
|
@ -69,7 +68,7 @@ let
|
|||
op = elemAt mPre 0;
|
||||
v = elemAt mPre 1;
|
||||
}
|
||||
# Infix operators are range matches
|
||||
# Infix operators are range matches
|
||||
else if mIn != null then {
|
||||
op = elemAt mIn 1;
|
||||
v = {
|
||||
|
@ -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,15 +11,14 @@ poetry2nix.mkPoetryApplication {
|
|||
(import ./poetry-git-overlay.nix { inherit pkgs; })
|
||||
(
|
||||
self: super: {
|
||||
pyramid-deferred-sqla = super.pyramid-deferred-sqla.overridePythonAttrs
|
||||
(
|
||||
old: {
|
||||
postPatch = ''
|
||||
touch LICENSE
|
||||
substituteInPlace setup.py --replace 'setup_requires=["pytest-runner"],' ""
|
||||
'';
|
||||
}
|
||||
);
|
||||
pyramid-deferred-sqla = super.pyramid-deferred-sqla.overridePythonAttrs (
|
||||
old: {
|
||||
postPatch = ''
|
||||
touch LICENSE
|
||||
substituteInPlace setup.py --replace 'setup_requires=["pytest-runner"],' ""
|
||||
'';
|
||||
}
|
||||
);
|
||||
}
|
||||
)
|
||||
];
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
{ pkgs }:
|
||||
self: super: {
|
||||
|
||||
pyramid-deferred-sqla = super.pyramid-deferred-sqla.overridePythonAttrs
|
||||
(
|
||||
_: {
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://github.com/niteoweb/pyramid_deferred_sqla.git";
|
||||
rev = "639b822d16aff7d732a4da2d3752cfdecee00aef";
|
||||
sha256 = "0k3azmnqkriy0nz8g2g8fjhfa25i0973pjqhqsfd33ir0prwllz7";
|
||||
};
|
||||
}
|
||||
);
|
||||
pyramid-deferred-sqla = super.pyramid-deferred-sqla.overridePythonAttrs (
|
||||
_: {
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://github.com/niteoweb/pyramid_deferred_sqla.git";
|
||||
rev = "639b822d16aff7d732a4da2d3752cfdecee00aef";
|
||||
sha256 = "0k3azmnqkriy0nz8g2g8fjhfa25i0973pjqhqsfd33ir0prwllz7";
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ pkgs ? import <nixpkgs> { } }:
|
||||
let
|
||||
poetry = pkgs.callPackage ../pkgs/poetry { python = pkgs.python3; inherit poetry2nix; };
|
||||
poetry2nix = import ./.. { inherit pkgs; inherit poetry; };
|
||||
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; };
|
||||
|
@ -15,7 +15,7 @@ builtins.removeAttrs
|
|||
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; };
|
||||
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 { };
|
||||
|
@ -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,16 +9,16 @@ let
|
|||
|
||||
# Test support for overriding the app passed to the environment
|
||||
overridden = (
|
||||
app.overrideAttrs
|
||||
(old: {
|
||||
name = "${old.pname}-overridden-${old.version}";
|
||||
})
|
||||
app.overrideAttrs (old: {
|
||||
name = "${old.pname}-overridden-${old.version}";
|
||||
})
|
||||
);
|
||||
depEnv = app.dependencyEnv.override {
|
||||
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,15 +1,14 @@
|
|||
{ pkgs }:
|
||||
self: super: {
|
||||
|
||||
alembic = super.alembic.overrideAttrs
|
||||
(
|
||||
_: {
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://github.com/sqlalchemy/alembic.git";
|
||||
rev = "8d6bb007a4de046c4d338f4b79b40c9fcbf73ab7";
|
||||
sha256 = "15q4dsn4b1cjf1a4cxymxl2gzdjnv9zlndk98jmpfhssqsr4ky3w";
|
||||
};
|
||||
}
|
||||
);
|
||||
alembic = super.alembic.overrideAttrs (
|
||||
_: {
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://github.com/sqlalchemy/alembic.git";
|
||||
rev = "8d6bb007a4de046c4d338f4b79b40c9fcbf73ab7";
|
||||
sha256 = "15q4dsn4b1cjf1a4cxymxl2gzdjnv9zlndk98jmpfhssqsr4ky3w";
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
@ -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,22 +7,21 @@ let
|
|||
pyproject = ./pyproject.toml;
|
||||
overrides = [
|
||||
(
|
||||
poetry2nix.defaultPoetryOverrides.overrideOverlay
|
||||
(
|
||||
self: super: {
|
||||
alembic = super.alembic.overrideAttrs
|
||||
(
|
||||
old: {
|
||||
TESTING_FOOBAR = 42;
|
||||
}
|
||||
);
|
||||
}
|
||||
)
|
||||
poetry2nix.defaultPoetryOverrides.overrideOverlay (
|
||||
self: super: {
|
||||
alembic = super.alembic.overrideAttrs (
|
||||
old: {
|
||||
TESTING_FOOBAR = 42;
|
||||
}
|
||||
);
|
||||
}
|
||||
)
|
||||
)
|
||||
];
|
||||
};
|
||||
in
|
||||
runCommand "test" { } ''
|
||||
runCommand "test"
|
||||
{ } ''
|
||||
x=${builtins.toString (p.python.pkgs.alembic.TESTING_FOOBAR)}
|
||||
[ "$x" = "42" ] || exit 1
|
||||
mkdir $out
|
||||
|
|
|
@ -5,20 +5,19 @@ let
|
|||
src = ./.;
|
||||
poetrylock = ./poetry.lock;
|
||||
pyproject = ./pyproject.toml;
|
||||
overrides = poetry2nix.overrides.withDefaults
|
||||
(
|
||||
self: super: {
|
||||
alembic = super.alembic.overrideAttrs
|
||||
(
|
||||
old: {
|
||||
TESTING_FOOBAR = 42;
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
overrides = poetry2nix.overrides.withDefaults (
|
||||
self: super: {
|
||||
alembic = super.alembic.overrideAttrs (
|
||||
old: {
|
||||
TESTING_FOOBAR = 42;
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
};
|
||||
in
|
||||
runCommand "test" { } ''
|
||||
runCommand "test"
|
||||
{ } ''
|
||||
x=${builtins.toString (p.python.pkgs.alembic.TESTING_FOOBAR)}
|
||||
[ "$x" = "42" ] || exit 1
|
||||
mkdir $out
|
||||
|
|
|
@ -17,4 +17,4 @@ let
|
|||
};
|
||||
isWheelAttr = drv.passthru.python.pkgs.maturin.src.isWheel or false;
|
||||
in
|
||||
assert isWheelAttr; drv
|
||||
assert isWheelAttr; drv
|
||||
|
|
|
@ -6,4 +6,4 @@ let
|
|||
};
|
||||
isWheelAttr = py.python.pkgs.tensorflow.src.isWheel or false;
|
||||
in
|
||||
assert isWheelAttr; (py.python.withPackages (_: py.poetryPackages)).override (args: { ignoreCollisions = true; })
|
||||
assert isWheelAttr; (py.python.withPackages (_: py.poetryPackages)).override (args: { ignoreCollisions = true; })
|
||||
|
|
|
@ -13,12 +13,11 @@ in
|
|||
|
||||
release =
|
||||
let
|
||||
pythonEnv = pkgs.python3.withPackages
|
||||
(
|
||||
ps: [
|
||||
ps.pythonix
|
||||
]
|
||||
);
|
||||
pythonEnv = pkgs.python3.withPackages (
|
||||
ps: [
|
||||
ps.pythonix
|
||||
]
|
||||
);
|
||||
in
|
||||
pkgs.writeScriptBin "poetry2nix-release" ''
|
||||
#!${pythonEnv.interpreter}
|
||||
|
@ -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