From 30842a71743f9fdfe0c7c5aa997c994bbb724326 Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 22 Oct 2015 17:18:59 +0300 Subject: [PATCH] conda: include udev rules and artiq_flash.sh in artiq package. --- artiq/frontend/artiq_flash.sh | 16 ++++++++++++++-- conda/artiq/build.sh | 12 ++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/artiq/frontend/artiq_flash.sh b/artiq/frontend/artiq_flash.sh index 881e5a616..155fcb422 100755 --- a/artiq/frontend/artiq_flash.sh +++ b/artiq/frontend/artiq_flash.sh @@ -1,5 +1,16 @@ -#!/bin/bash +#!/usr/bin/env python +# conda-build requires all scripts to have a python shebang. +# see https://github.com/conda/conda-build/blob/6921f067a/conda_build/noarch_python.py#L36-L38 +def run(script): + import sys, tempfile, subprocess + file = tempfile.NamedTemporaryFile(mode='w+t', suffix='sh') + file.write(script) + file.flush() + subprocess.run(["/bin/bash", file.name] + sys.argv[1:]) + file.close() + +run(""" # exit on error set -e # print commands @@ -72,7 +83,7 @@ do echo "" echo "To flash everything, do not use any of the -b|-B|-r option." echo "" - echo "usage: $0 [-b] [-B] [-r] [-h] [-m nist_qc1|nist_qc2] [-t kc705|pipistrello] [-d path] [-f path]" + echo "usage: artiq_flash.sh [-b] [-B] [-r] [-h] [-m nist_qc1|nist_qc2] [-t kc705|pipistrello] [-d path] [-f path]" echo "-b Flash bitstream" echo "-B Flash BIOS" echo "-r Flash ARTIQ runtime" @@ -193,3 +204,4 @@ then fi echo "Done." xc3sprog -v -c $CABLE -R > /dev/null 2>&1 +""") diff --git a/conda/artiq/build.sh b/conda/artiq/build.sh index 3786386a7..1bbc544de 100755 --- a/conda/artiq/build.sh +++ b/conda/artiq/build.sh @@ -1,3 +1,15 @@ #!/bin/bash +ARTIQ_PREFIX=$PREFIX/lib/python3.5/site-packages/artiq + $PYTHON setup.py install --single-version-externally-managed --record=record.txt + +# install scripts + +cp artiq/frontend/artiq_flash.sh $PREFIX/bin + +# install udev rules + +mkdir -p $ARTIQ_PREFIX/misc +cp misc/99-papilio.rules $ARTIQ_PREFIX/misc/ +cp misc/99-kc705.rules $ARTIQ_PREFIX/misc/