mirror of
https://github.com/nix-community/dream2nix.git
synced 2025-01-06 05:58:34 +03:00
python: implement extraSetupDeps, remove extraRequirements
This commit is contained in:
parent
da52cf49f4
commit
6f7199e060
@ -39,14 +39,16 @@ in {
|
|||||||
outputFile=$WORKDIR/$(jq '.outputFile' -c -r $jsonInput)
|
outputFile=$WORKDIR/$(jq '.outputFile' -c -r $jsonInput)
|
||||||
source="$(jq '.source' -c -r $jsonInput)/$(jq '.project.relPath' -c -r $jsonInput)"
|
source="$(jq '.source' -c -r $jsonInput)/$(jq '.project.relPath' -c -r $jsonInput)"
|
||||||
name="$(jq '.project.name' -c -r $jsonInput)"
|
name="$(jq '.project.name' -c -r $jsonInput)"
|
||||||
pythonAttr=$(jq '.project.subsystemInfo.pythonAttr' -c -r $jsonInput)
|
pythonAttr=$(jq '.pythonAttr' -c -r $jsonInput)
|
||||||
extraRequirements=$(jq '.project.subsystemInfo.extraRequirements' -c -r $jsonInput)
|
extraSetupDeps=$(jq '[.extraSetupDeps[]] | join(" ")' -c -r $jsonInput)
|
||||||
|
|
||||||
|
sitePackages=$(nix eval --impure --raw --expr "(import <nixpkgs> {}).$pythonAttr.sitePackages")
|
||||||
|
|
||||||
# build python and pip executables
|
# build python and pip executables
|
||||||
tmpBuild=$(mktemp -d)
|
tmpBuild=$(mktemp -d)
|
||||||
nix build \
|
nix build \
|
||||||
--impure \
|
--impure \
|
||||||
--expr "(import <nixpkgs> {}).$pythonAttr.withPackages (ps: with ps; [pip setuptools $extraRequirements])" \
|
--expr "(import <nixpkgs> {}).$pythonAttr.withPackages (ps: with ps; [pip setuptools])" \
|
||||||
-o $tmpBuild/python
|
-o $tmpBuild/python
|
||||||
python=$tmpBuild/python/bin/python
|
python=$tmpBuild/python/bin/python
|
||||||
|
|
||||||
@ -57,6 +59,12 @@ in {
|
|||||||
cp -r $source ./source
|
cp -r $source ./source
|
||||||
chmod +w -R ./source
|
chmod +w -R ./source
|
||||||
|
|
||||||
|
# install setup dependencies from extraSetupDeps
|
||||||
|
echo "$(jq '.extraSetupDeps[]' -c -r $jsonInput)" > __extra_setup_reqs.txt
|
||||||
|
$python -m pip install \
|
||||||
|
--prefix ./install \
|
||||||
|
-r __extra_setup_reqs.txt
|
||||||
|
|
||||||
# download setup dependencies from pyproject.toml
|
# download setup dependencies from pyproject.toml
|
||||||
toml2json ./source/pyproject.toml | jq '."build-system".requires[]' -r > __setup_reqs.txt || :
|
toml2json ./source/pyproject.toml | jq '."build-system".requires[]' -r > __setup_reqs.txt || :
|
||||||
$python -m pip download \
|
$python -m pip download \
|
||||||
@ -65,6 +73,7 @@ in {
|
|||||||
-r __setup_reqs.txt
|
-r __setup_reqs.txt
|
||||||
|
|
||||||
# download files according to requirements
|
# download files according to requirements
|
||||||
|
PYTHONPATH=$(realpath ./install/$sitePackages) \
|
||||||
$python -m pip download \
|
$python -m pip download \
|
||||||
--dest $tmp \
|
--dest $tmp \
|
||||||
--progress-bar off \
|
--progress-bar off \
|
||||||
@ -95,8 +104,8 @@ in {
|
|||||||
type = "argument";
|
type = "argument";
|
||||||
};
|
};
|
||||||
|
|
||||||
extraRequirements = {
|
extraSetupDeps = {
|
||||||
default = "";
|
default = [];
|
||||||
description = "a list of extra requirements to add";
|
description = "a list of extra requirements to add";
|
||||||
examples = [
|
examples = [
|
||||||
"cython"
|
"cython"
|
||||||
|
Loading…
Reference in New Issue
Block a user