build ARTIQ conda package

release-7
Sebastien Bourdeauducq 2022-02-12 17:43:12 +08:00
parent d2d79b180c
commit b01ba6c43a
1 changed files with 94 additions and 2 deletions

View File

@ -40,14 +40,106 @@
name = "conda-builder-env";
targetPkgs = pkgs: condaDeps ++ [ condaInstalled ];
};
makeCondaRecipe = (constituent:
''
# conda build breaks if write permissions aren't set on source files.
cp --no-preserve=mode,ownership -R ${constituent.src} workaround-conda
cd workaround-conda
tar cf ../${constituent.name}.tar .
cd ..
rm -rf workaround-conda
mkdir -p conda/${constituent.name}
cat << EOF > conda/${constituent.name}/meta.yaml
package:
name: ${constituent.name}
version: ${constituent.version}
source:
url: ../../${constituent.name}.tar
{% set data = load_setup_py_data() %}
build:
noarch: python
entry_points:
# NOTE: conda-build cannot distinguish between console and gui scripts
{% for entry_point_type, entry_points in data.get("entry_points", dict()).items() -%}
{% for entry_point in entry_points -%}
- {{ entry_point }}
{% endfor %}
{% endfor %}
ignore_prefix_files: True
requirements:
run:
${pkgs.lib.concatStringsSep "\n" (map (s: " - ${s}") constituent.dependencies)}
EOF
cat << EOF > conda/${constituent.name}/build.sh
#!/bin/bash
set -e
python setup.py install \
--prefix=\$PREFIX \
--single-version-externally-managed \
--record=record.txt \
--no-compile
EOF
chmod 755 conda/${constituent.name}/build.sh
''
);
makeCondaChannel = constituents: pkgs.stdenvNoCC.mkDerivation {
name = "conda-channel";
buildInputs = [ condaBuilderEnv ];
phases = [ "buildPhase" "installPhase" ];
buildPhase = pkgs.lib.concatStringsSep "\n" (map makeCondaRecipe constituents);
installPhase =
''
HOME=`pwd`
mkdir $out
conda-builder-env -c "
${pkgs.lib.concatStringsSep "\n"
(map (constituent: "conda build --no-anaconda-upload --no-test --output-folder $out conda/${constituent.name}") constituents)}
"
mkdir $out/nix-support
for package in $out/*/*.tar.bz2; do
echo file conda $package >> $out/nix-support/hydra-build-products
done
'';
};
in rec {
packages.x86_64-linux = {
inherit condaBuilderEnv;
condaChannel = makeCondaChannel [
{
name = "artiq";
version = artiq.packages.x86_64-linux.artiq.version;
src = artiq.packages.x86_64-linux.artiq.src;
dependencies = [
"pythonparser"
"scipy"
"numpy"
"prettytable"
"h5py"
"python-dateutil"
"pyqt"
"qasync"
"pyqtgraph"
"pygit2"
"python-levenshtein"
"sipyco"
"llvmlite"
"llvm-tools"
"lld"
];
}
];
};
hydraJobs = {
inherit (packages.x86_64-linux) condaBuilderEnv;
inherit (packages.x86_64-linux) condaChannel;
};
};
}