From eb398dcc531c970083f6bb7f2b68b7b0147b3b26 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 23 Nov 2020 23:23:02 +0800 Subject: [PATCH] artiq-full: package wand --- artiq-full.nix | 5 +++-- artiq-full/extras.nix | 18 +++++++++++++++++ artiq-full/wand-fix-config-dir.patch | 30 ++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 artiq-full/wand-fix-config-dir.patch diff --git a/artiq-full.nix b/artiq-full.nix index 7514b61..510c988 100644 --- a/artiq-full.nix +++ b/artiq-full.nix @@ -8,8 +8,9 @@ let mkdir $out cp -a ${} $out/fast - cp ${./artiq-full/conda-artiq-board.nix} $out/conda-artiq-board.nix - cp ${./artiq-full/extras.nix} $out/extras.nix + cp ${./artiq-full}/conda-artiq-board.nix $out + cp ${./artiq-full}/extras.nix $out + cp ${./artiq-full}/*.patch $out REV=`git --git-dir ${sinaraSystemsSrc}/.git rev-parse HEAD` SINARA_SRC_CLEAN=`mktemp -d` diff --git a/artiq-full/extras.nix b/artiq-full/extras.nix index 38cc512..49b07fa 100644 --- a/artiq-full/extras.nix +++ b/artiq-full/extras.nix @@ -203,4 +203,22 @@ in dependencies = [ "sipyco" "numpy" "aiohttp >=3" ]; }; }; + } // { + wand = pkgs.python3Packages.buildPythonApplication rec { + name = "wand"; + version = "0.4.dev"; + src = pkgs.fetchFromGitHub { + owner = "OxfordIonTrapGroup"; + repo = "wand"; + rev = "0bf1cfef4aa37e5761c20ac8702abec125b45e23"; + sha256 = "0jfw6w6id7qkx2f6rklrmp13b2hsnvii1qbls60ampx399lcb43g"; + }; + patches = [ ./wand-fix-config-dir.patch ]; + nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ]; + dontWrapQtApps = true; + postFixup = '' + wrapQtApp "$out/bin/wand_gui" + ''; + propagatedBuildInputs = [ artiq pkgs.python3Packages.numpy pkgs.python3Packages.scipy pkgs.python3Packages.influxdb pkgs.python3Packages.setuptools ]; + }; } diff --git a/artiq-full/wand-fix-config-dir.patch b/artiq-full/wand-fix-config-dir.patch new file mode 100644 index 0000000..44ee805 --- /dev/null +++ b/artiq-full/wand-fix-config-dir.patch @@ -0,0 +1,30 @@ +diff --git a/wand/tools.py b/wand/tools.py +index a51dabd..4d5a9d1 100644 +--- a/wand/tools.py ++++ b/wand/tools.py +@@ -6,6 +6,7 @@ import shutil + import logging + + from sipyco import pyon ++from artiq.appdirs import user_config_dir + import wand + + logger = logging.getLogger(__name__) +@@ -26,10 +27,15 @@ class LockException(Exception): + pass + + ++def get_user_config_dir(): ++ dir = user_config_dir("wand", "oitg", "1") ++ os.makedirs(dir, exist_ok=True) ++ return dir ++ ++ + def get_config_path(args, name_suffix=""): + config_file = "{}{}_config.pyon".format(args.name, name_suffix) +- wand_dir = os.path.dirname(wand.__file__) +- config_path = os.path.join(wand_dir, config_file) ++ config_path = os.path.join(get_user_config_dir(), config_file) + + if args.backup_dir == "": + backup_path = ""