From 6f3faa30c12da17363cb6c8f22e5e51dfa8db7de Mon Sep 17 00:00:00 2001 From: katta Date: Wed, 22 Apr 2020 13:05:35 +0200 Subject: [PATCH] - m2r & sphinx>=3.0 are not compatible (more info in pr in progress in m2r: https://github.com/miyakogi/m2r/pull/55) - add path in conf.py to find the nmodl module - removed various doxygen warnings due to unacceptable keywords in configuration files - adjust checkparent_visitor sphinx autodoc /copybrief - reduce the maxium number of processors used to build documentation (it was freezing my workstation) --- .travis.yml | 10 +++++- CONTRIBUTING.md | 2 +- docs/DoxygenLayout.xml | 33 +------------------ docs/conf.py | 6 ++++ setup.py | 6 ++-- src/codegen/codegen_c_visitor.hpp | 2 +- src/language/templates/ast/ast.hpp | 4 +-- .../visitors/checkparent_visitor.hpp | 2 +- src/visitors/sympy_solver_visitor.cpp | 2 +- src/visitors/sympy_solver_visitor.hpp | 2 +- 10 files changed, 26 insertions(+), 43 deletions(-) diff --git a/.travis.yml b/.travis.yml index cd4ea07be1..0bcbcf9a69 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,6 +43,8 @@ addons: - python3-pip - doxygen - pandoc + - texlive-base + - dvipng # for Mac builds, we use Homebrew homebrew: packages: @@ -77,7 +79,13 @@ install: - pip3 install -U pip setuptools - pip3 install Jinja2 PyYAML pytest sympy --user - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - pip3 install -U --user sphinx nbsphinx>=0.3.2 m2r sphinx-rtd-theme jupyter; + # there is a bug in m2r if sphinx>2.4.4. There is a pr in m2r to solve the + # issue here: https://github.com/miyakogi/m2r/pull/55 . When it is done + # I will remove the sphinx downgrade. Change setup.py requirements when it + # be the case + # + # Katta + pip3 install -U --user sphinx==2.4.4 nbsphinx>=0.3.2 m2r sphinx-rtd-theme jupyter; fi #============================================================================= diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 17b7f7519a..5de8a733c1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -107,7 +107,7 @@ repository: If you are developing NMODL, make sure to enable both `NMODL_FORMATTING` and `NMODL_PRECOMMIT` CMake variables to ensure that your contributions follow the coding conventions of this project: -```cmake +``` cmake -DNMODL_FORMATTING:BOOL=ON -DNMODL_PRECOMMIT:BOOL=ON ``` diff --git a/docs/DoxygenLayout.xml b/docs/DoxygenLayout.xml index 7ad780b56b..258ae9d3b0 100644 --- a/docs/DoxygenLayout.xml +++ b/docs/DoxygenLayout.xml @@ -1,5 +1,6 @@ + @@ -9,26 +10,12 @@ - - - - - - - - - - - - - - @@ -102,13 +89,8 @@ - - - - - @@ -117,8 +99,6 @@ - - @@ -135,16 +115,11 @@ - - - - - @@ -154,8 +129,6 @@ - - @@ -176,8 +149,6 @@ - - @@ -196,8 +167,6 @@ - - diff --git a/docs/conf.py b/docs/conf.py index 80522afaa5..e02ba1793d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -17,11 +17,17 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # + + + import os import subprocess import sys import textwrap +# The project needs to be built before documentation in the usual build folder +sys.path.insert(0, os.path.abspath('../build/lib/python')) + import nmodl # isort:skip # Run doxygen diff --git a/setup.py b/setup.py index e769a4609f..f755560de3 100644 --- a/setup.py +++ b/setup.py @@ -100,7 +100,7 @@ def build_extension(self, ext): build_args += ["--", "/m"] else: cmake_args += ["-DCMAKE_BUILD_TYPE=" + cfg] - build_args += ["--", "-j{}".format(max(1, os.cpu_count() - 1))] + build_args += ["--", "-j{}".format(max(1, os.cpu_count() - 3))] env = os.environ.copy() env["CXXFLAGS"] = '{} -DVERSION_INFO=\\"{}\\"'.format( @@ -147,7 +147,7 @@ def run(self): ) -install_requirements = ["jinja2>=2.9", "PyYAML>=3.13", "sympy>=1.3"] +install_requirements = ["jinja2>=2.9.3", "PyYAML>=3.13", "sympy>=1.3"] setup( name="NMODL", @@ -167,7 +167,7 @@ def run(self): buildhtml=get_sphinx_command, ), zip_safe=False, - setup_requires=["nbsphinx>=0.3.2", "m2r", "sphinx-rtd-theme", "sphinx>=2.0"] + setup_requires=["nbsphinx>=0.3.2", "m2r", "sphinx-rtd-theme", "sphinx>=2.0", "sphinx<3.0"] + install_requirements, install_requires=install_requirements, tests_require=["pytest>=3.7.2"], diff --git a/src/codegen/codegen_c_visitor.hpp b/src/codegen/codegen_c_visitor.hpp index 62515f5af6..4b5e670d56 100644 --- a/src/codegen/codegen_c_visitor.hpp +++ b/src/codegen/codegen_c_visitor.hpp @@ -1785,7 +1785,7 @@ class CodegenCVisitor: public visitor::AstVisitor { * Find unique variable name defined in nmodl::utils::SingletonRandomString by the * nmodl::visitor::SympySolverVisitor * @param original_name Original name of variable to change - * @return std::string Unique name produced as _ + * @return std::string Unique name produced as "original_string"_"random_string" */ std::string find_var_unique_name(const std::string& original_name); diff --git a/src/language/templates/ast/ast.hpp b/src/language/templates/ast/ast.hpp index a8378df45a..3b62cf74a8 100644 --- a/src/language/templates/ast/ast.hpp +++ b/src/language/templates/ast/ast.hpp @@ -333,7 +333,7 @@ struct Ast: public std::enable_shared_from_this { * returning a raw pointer may create less problems that the * shared_from_this from the parent. * - * \ref Check Ast::parent for more information + * Check \ref Ast::parent for more information */ virtual Ast* get_parent() const; @@ -345,7 +345,7 @@ struct Ast: public std::enable_shared_from_this { * we set children parents directly in the parent constructor using * set_parent_in_children() * - * \ref Check Ast::parent for more information + * Check \ref Ast::parent for more information */ virtual void set_parent(Ast* p); }; diff --git a/src/language/templates/visitors/checkparent_visitor.hpp b/src/language/templates/visitors/checkparent_visitor.hpp index 83dfc68bb7..9c71a09d95 100644 --- a/src/language/templates/visitors/checkparent_visitor.hpp +++ b/src/language/templates/visitors/checkparent_visitor.hpp @@ -17,7 +17,7 @@ * \brief Auto generated visitors * * \file - * \brief \copybrief nmodl::visitor::CheckParentVisitor + * \brief \copybrief nmodl::visitor::test::CheckParentVisitor */ #include "visitors/ast_visitor.hpp" diff --git a/src/visitors/sympy_solver_visitor.cpp b/src/visitors/sympy_solver_visitor.cpp index f0e2d29df4..aa97fd3913 100644 --- a/src/visitors/sympy_solver_visitor.cpp +++ b/src/visitors/sympy_solver_visitor.cpp @@ -159,7 +159,7 @@ std::string SympySolverVisitor::suffix_random_string(const std::string& original auto singleton_random_string_class = nmodl::utils::SingletonRandomString<4>::instance(); // Check if there is a variable defined in the mod file as original_string and if yes // try to use a different string for the matrices created by sympy in the form - // _ + // "original_string"_"random_string" while (vars.find(new_string) != vars.end()) { random_string = singleton_random_string_class->reset_random_string(original_string); new_string = original_string; diff --git a/src/visitors/sympy_solver_visitor.hpp b/src/visitors/sympy_solver_visitor.hpp index b2d066191c..ecfa8422e2 100644 --- a/src/visitors/sympy_solver_visitor.hpp +++ b/src/visitors/sympy_solver_visitor.hpp @@ -109,7 +109,7 @@ class SympySolverVisitor: public AstVisitor { const std::string& original_string, const std::string& substitution_string) const; - /// Return a std::string in the form _, where + /// Return a std::string in the form "original_string"_"random_string", where /// random_string is a string defined in the nmodl::utils::SingletonRandomString /// for the original_string std::string suffix_random_string(const std::string& original_string) const;