From 9af1d5bf306da7cda8ccfa92268225802b67b297 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 26 Feb 2019 17:28:44 +0800 Subject: [PATCH] merge artiq-manual dependencies into python-deps --- artiq/default.nix | 2 +- artiq/pkgs/artiq-manual.nix | 91 ++----------------------------------- artiq/pkgs/python-deps.nix | 34 ++++++++++++-- 3 files changed, 34 insertions(+), 93 deletions(-) diff --git a/artiq/default.nix b/artiq/default.nix index 9adc4f5..32cb4fa 100644 --- a/artiq/default.nix +++ b/artiq/default.nix @@ -37,7 +37,7 @@ in llvm-or1k = callPackage ./pkgs/llvm-or1k.nix { inherit llvm-src; }; llvmlite-artiq = callPackage ./pkgs/llvmlite-artiq.nix { inherit llvm-or1k; }; artiq = callPackage ./pkgs/artiq.nix { inherit binutils-or1k; inherit llvm-or1k; inherit llvmlite-artiq; }; - artiq-manual = callPackage ./pkgs/artiq-manual.nix { }; + artiq-manual = callPackage ./pkgs/artiq-manual.nix { inherit (pythonDeps) sphinx-argparse sphinxcontrib-wavedrom; }; openocd = callPackage ./pkgs/openocd.nix {}; conda-artiq = import ./conda-artiq.nix { inherit pkgs; }; } // boardPackages diff --git a/artiq/pkgs/artiq-manual.nix b/artiq/pkgs/artiq-manual.nix index f04b260..a659608 100644 --- a/artiq/pkgs/artiq-manual.nix +++ b/artiq/pkgs/artiq-manual.nix @@ -1,92 +1,9 @@ -{ stdenv, lib, - git, fetchFromGitHub, fetchgit, - python3Packages, texlive, texinfo -}: +{ stdenv, lib, fetchgit, python3Packages, texlive, texinfo, sphinx-argparse, sphinxcontrib-wavedrom }: -with python3Packages; let artiqVersion = import ./artiq-version.nix; - # TODO: sphinx-argparse will be available from nixos-19.XX - sphinx-argparse = buildPythonPackage rec { - pname = "sphinx-argparse"; - version = "0.2.5"; - - src = fetchPypi { - inherit pname version; - sha256 = "05wc8f5hb3jsg2vh2jf7jsyan8d4i09ifrz2c8fp6f7x1zw9iav0"; - }; - - checkInputs = [ - pytest - ]; - - checkPhase = "py.test"; - - propagatedBuildInputs = [ - sphinx - ]; - - meta = { - description = "A sphinx extension that automatically documents argparse commands and options"; - homepage = https://github.com/ribozz/sphinx-argparse; - license = lib.licenses.mit; - maintainers = with lib.maintainers; [ clacke ]; - }; - }; - - wavedrom = buildPythonPackage rec { - pname = "wavedrom"; - version = "0.1"; - - src = fetchPypi { - inherit pname version; - sha256 = "006w683zlmmwcw5xz1n5dwg34ims5jg3gl2700ql4wr0myjz6710"; - }; - - buildInputs = [ setuptools_scm ]; - propagatedBuildInputs = [ - svgwrite attrdict - ]; - doCheck = false; - }; - - sphinxcontrib-wavedrom-1_3_1 = buildPythonPackage rec { - pname = "sphinxcontrib-wavedrom"; - version = "1.3.1"; - - src = fetchPypi { - inherit pname version; - sha256 = "1q2hk630nz734cln2wwngjidlb7xyk6ly8qqlpsj259n9n2iab6v"; - }; - - buildInputs = [ setuptools_scm ]; - propagatedBuildInputs = [ - sphinx - ]; - doCheck = false; - }; - - sphinxcontrib-wavedrom-2_0_0 = buildPythonPackage rec { - pname = "sphinxcontrib-wavedrom"; - version = "2.0.0"; - - src = fetchPypi { - inherit pname version; - sha256 = "0nk36zqq5ipxqx9izz2iazb3iraasanv3nm05bjr21gw42zgkz22"; - }; - - buildInputs = [ setuptools_scm ]; - propagatedBuildInputs = [ - sphinx wavedrom xcffib cairosvg - ]; - doCheck = false; - }; - - sphinxcontrib-wavedrom = - if builtins.compareVersions sphinx.version "1.8" == -1 - then sphinxcontrib-wavedrom-1_3_1 - else sphinxcontrib-wavedrom-2_0_0; + isLatexPdfTarget = target: builtins.match "latexpdf.*" target != null; latex = texlive.combine { inherit (texlive) @@ -95,15 +12,13 @@ let upquote capt-of needspace; }; - isLatexPdfTarget = target: builtins.match "latexpdf.*" target != null; - artiq-manual = target: stdenv.mkDerivation rec { name = "artiq-manual-${target}"; version = artiqVersion; src = import ./artiq-src.nix { inherit fetchgit; }; buildInputs = [ - sphinx sphinx_rtd_theme + python3Packages.sphinx python3Packages.sphinx_rtd_theme sphinx-argparse sphinxcontrib-wavedrom ] ++ lib.optional (isLatexPdfTarget target) latex ++ diff --git a/artiq/pkgs/python-deps.nix b/artiq/pkgs/python-deps.nix index c36001f..2084ebe 100644 --- a/artiq/pkgs/python-deps.nix +++ b/artiq/pkgs/python-deps.nix @@ -192,7 +192,7 @@ rec { # Documentation building dependencies - # sphinx-argparse will be included in nixpkgs 19.03 + # TODO: sphinx-argparse will be available from nixos-19.XX sphinx-argparse = python3Packages.buildPythonPackage rec { pname = "sphinx-argparse"; version = "0.2.5"; @@ -203,6 +203,7 @@ rec { }; checkInputs = [ python3Packages.pytest ]; + checkPhase = "py.test"; propagatedBuildInputs = [ python3Packages.sphinx ]; @@ -226,7 +227,6 @@ rec { buildInputs = [ python3Packages.setuptools_scm ]; propagatedBuildInputs = with python3Packages; [ svgwrite attrdict ]; - doCheck = false; meta = with stdenv.lib; { @@ -236,7 +236,7 @@ rec { }; }; - sphinxcontrib-wavedrom = python3Packages.buildPythonPackage rec { + sphinxcontrib-wavedrom-1_3_1 = python3Packages.buildPythonPackage rec { pname = "sphinxcontrib-wavedrom"; version = "1.3.1"; @@ -246,7 +246,8 @@ rec { }; buildInputs = [ python3Packages.setuptools_scm ]; - propagatedBuildInputs = [ wavedrom ] ++ (with python3Packages; [ sphinx cairosvg xcffib ]); + propagatedBuildInputs = [ python3Packages.sphinx ]; + doCheck = false; meta = with stdenv.lib; { description = "A Sphinx extension that allows including WaveDrom diagrams"; @@ -254,4 +255,29 @@ rec { license = licenses.mit; }; }; + + sphinxcontrib-wavedrom-2_0_0 = python3Packages.buildPythonPackage rec { + pname = "sphinxcontrib-wavedrom"; + version = "2.0.0"; + + src = python3Packages.fetchPypi { + inherit pname version; + sha256 = "0nk36zqq5ipxqx9izz2iazb3iraasanv3nm05bjr21gw42zgkz22"; + }; + + buildInputs = [ python3Packages.setuptools_scm ]; + propagatedBuildInputs = [ wavedrom ] ++ (with python3Packages; [ sphinx xcffib cairosvg ]); + doCheck = false; + + meta = with stdenv.lib; { + description = "A Sphinx extension that allows including WaveDrom diagrams"; + homepage = "https://pypi.org/project/sphinxcontrib-wavedrom/"; + license = licenses.mit; + }; + }; + + sphinxcontrib-wavedrom = + if builtins.compareVersions python3Packages.sphinx.version "1.8" == -1 + then sphinxcontrib-wavedrom-1_3_1 + else sphinxcontrib-wavedrom-2_0_0; }