From 827b4f93e46f39e15979daa73748da4bfbabcdf0 Mon Sep 17 00:00:00 2001 From: Hilton Bristow Date: Mon, 18 Mar 2013 11:47:48 +1000 Subject: [PATCH] Stripped down jinja, added cmake support --- modules/matlab/CMakeLists.txt | 2 +- modules/matlab/generator/gen_matlab.py | 21 +- modules/matlab/generator/jinja/.gitignore | 8 - modules/matlab/generator/jinja/LICENSE | 31 -- modules/matlab/generator/jinja/Makefile | 15 - .../jinja/custom_fixers/fix_alt_unicode.py | 13 - .../custom_fixers/fix_broken_reraising.py | 21 -- .../jinja/custom_fixers/fix_xrange2.py | 11 - .../matlab/generator/jinja/jinja2-debug.py | 43 --- .../generator/jinja/scripts/make-release.py | 151 --------- .../matlab/generator/jinja/scripts/pylintrc | 301 ------------------ modules/matlab/generator/jinja/setup.cfg | 6 - modules/matlab/generator/jinja/setup.py | 110 ------- .../generator/{jinja => }/jinja2/__init__.py | 0 .../{jinja => }/jinja2/_debugsupport.c | 0 .../jinja2/_markupsafe/__init__.py | 0 .../{jinja => }/jinja2/_markupsafe/_bundle.py | 0 .../jinja2/_markupsafe/_constants.py | 0 .../{jinja => }/jinja2/_markupsafe/_native.py | 0 .../{jinja => }/jinja2/_markupsafe/tests.py | 0 .../{jinja => }/jinja2/_stringdefs.py | 0 .../generator/{jinja => }/jinja2/bccache.py | 0 .../generator/{jinja => }/jinja2/compiler.py | 0 .../generator/{jinja => }/jinja2/constants.py | 0 .../generator/{jinja => }/jinja2/debug.py | 0 .../generator/{jinja => }/jinja2/defaults.py | 0 .../{jinja => }/jinja2/environment.py | 0 .../{jinja => }/jinja2/exceptions.py | 0 .../generator/{jinja => }/jinja2/ext.py | 0 .../generator/{jinja => }/jinja2/filters.py | 0 .../generator/{jinja => }/jinja2/lexer.py | 0 .../generator/{jinja => }/jinja2/loaders.py | 0 .../generator/{jinja => }/jinja2/meta.py | 0 .../generator/{jinja => }/jinja2/nodes.py | 0 .../generator/{jinja => }/jinja2/optimizer.py | 0 .../generator/{jinja => }/jinja2/parser.py | 0 .../generator/{jinja => }/jinja2/runtime.py | 0 .../generator/{jinja => }/jinja2/sandbox.py | 0 .../generator/{jinja => }/jinja2/tests.py | 0 .../{jinja => }/jinja2/testsuite/__init__.py | 0 .../{jinja => }/jinja2/testsuite/api.py | 0 .../{jinja => }/jinja2/testsuite/core_tags.py | 0 .../{jinja => }/jinja2/testsuite/debug.py | 0 .../{jinja => }/jinja2/testsuite/doctests.py | 0 .../{jinja => }/jinja2/testsuite/ext.py | 0 .../{jinja => }/jinja2/testsuite/filters.py | 0 .../{jinja => }/jinja2/testsuite/imports.py | 0 .../jinja2/testsuite/inheritance.py | 0 .../{jinja => }/jinja2/testsuite/lexnparse.py | 0 .../{jinja => }/jinja2/testsuite/loader.py | 0 .../jinja2/testsuite/regression.py | 0 .../testsuite/res}/__init__.py | 0 .../testsuite/res/templates/broken.html | 0 .../testsuite/res/templates/foo/test.html | 0 .../testsuite/res/templates/syntaxerror.html | 0 .../jinja2/testsuite/res/templates/test.html | 0 .../{jinja => }/jinja2/testsuite/security.py | 0 .../{jinja => }/jinja2/testsuite/tests.py | 0 .../{jinja => }/jinja2/testsuite/utils.py | 0 .../generator/{jinja => }/jinja2/utils.py | 0 .../generator/{jinja => }/jinja2/visitor.py | 0 .../testsuite/res => templates}/__init__.py | 0 62 files changed, 20 insertions(+), 713 deletions(-) delete mode 100644 modules/matlab/generator/jinja/.gitignore delete mode 100644 modules/matlab/generator/jinja/LICENSE delete mode 100644 modules/matlab/generator/jinja/Makefile delete mode 100644 modules/matlab/generator/jinja/custom_fixers/fix_alt_unicode.py delete mode 100644 modules/matlab/generator/jinja/custom_fixers/fix_broken_reraising.py delete mode 100644 modules/matlab/generator/jinja/custom_fixers/fix_xrange2.py delete mode 100755 modules/matlab/generator/jinja/jinja2-debug.py delete mode 100644 modules/matlab/generator/jinja/scripts/make-release.py delete mode 100644 modules/matlab/generator/jinja/scripts/pylintrc delete mode 100644 modules/matlab/generator/jinja/setup.cfg delete mode 100644 modules/matlab/generator/jinja/setup.py rename modules/matlab/generator/{jinja => }/jinja2/__init__.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/_debugsupport.c (100%) rename modules/matlab/generator/{jinja => }/jinja2/_markupsafe/__init__.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/_markupsafe/_bundle.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/_markupsafe/_constants.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/_markupsafe/_native.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/_markupsafe/tests.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/_stringdefs.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/bccache.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/compiler.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/constants.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/debug.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/defaults.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/environment.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/exceptions.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/ext.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/filters.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/lexer.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/loaders.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/meta.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/nodes.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/optimizer.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/parser.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/runtime.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/sandbox.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/tests.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/__init__.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/api.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/core_tags.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/debug.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/doctests.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/ext.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/filters.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/imports.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/inheritance.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/lexnparse.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/loader.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/regression.py (100%) rename modules/matlab/generator/{jinja/custom_fixers => jinja2/testsuite/res}/__init__.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/res/templates/broken.html (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/res/templates/foo/test.html (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/res/templates/syntaxerror.html (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/res/templates/test.html (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/security.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/tests.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/testsuite/utils.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/utils.py (100%) rename modules/matlab/generator/{jinja => }/jinja2/visitor.py (100%) rename modules/matlab/generator/{jinja/jinja2/testsuite/res => templates}/__init__.py (100%) diff --git a/modules/matlab/CMakeLists.txt b/modules/matlab/CMakeLists.txt index fdf0d7f92..0defd6aea 100644 --- a/modules/matlab/CMakeLists.txt +++ b/modules/matlab/CMakeLists.txt @@ -36,7 +36,7 @@ if(HAVE_opencv_nonfree) # add the python generator to the python path set(PYPATH_CACHE $ENV{PYTHONPATH}) -set(ENV{PYTHONPATH} ${OPENCV_MODULE_opencv_python_LOCATION}/src2 $ENV{PYTHONPATH}) +set(ENV{PYTHONPATH} ${OPENCV_MODULE_opencv_python_LOCATION}/src2:$ENV{PYTHONPATH}) # synthesise the matlab sources execute_process( diff --git a/modules/matlab/generator/gen_matlab.py b/modules/matlab/generator/gen_matlab.py index 4f6b858b5..faeca150f 100644 --- a/modules/matlab/generator/gen_matlab.py +++ b/modules/matlab/generator/gen_matlab.py @@ -4,6 +4,8 @@ import sys, re, os.path from string import Template from hdr_parser import CppHeaderParser from parse_tree import ParseTree, todict +from filters import * +from jinja2 import Environment, PackageLoader class MatlabWrapperGenerator(object): @@ -20,5 +22,20 @@ class MatlabWrapperGenerator(object): # cleanify the parser output parse_tree = ParseTree() parse_tree.build(ns) - - print parse_tree + + # setup the template engine + jtemplate = Environment(loader=PackageLoader('templates', '')) + + # add the custom filters + jtemplate.filters['toUpperCamelCase'] = toUpperCamelCase + jtemplate.filters['toLowerCamelCase'] = toLowerCamelCase + jtemplate.filters['toUnderCase'] = toUnderCase + jtemplate.filters['comment'] = comment + + # load the templates + function = jtemplate.get_template('template_function_base.cpp') + classm = jtemplate.get_template('template_class_base.m') + classc = jtemplate.get_template('template_class_base.cpp') + doc = jtemplate.get_template('template_doc_base.m') + + # populate! diff --git a/modules/matlab/generator/jinja/.gitignore b/modules/matlab/generator/jinja/.gitignore deleted file mode 100644 index 95e76b2e0..000000000 --- a/modules/matlab/generator/jinja/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -*.so -docs/_build -*.pyc -*.pyo -*.egg-info -build -dist -.DS_Store diff --git a/modules/matlab/generator/jinja/LICENSE b/modules/matlab/generator/jinja/LICENSE deleted file mode 100644 index 31bf900e5..000000000 --- a/modules/matlab/generator/jinja/LICENSE +++ /dev/null @@ -1,31 +0,0 @@ -Copyright (c) 2009 by the Jinja Team, see AUTHORS for more details. - -Some rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * The names of the contributors may not be used to endorse or - promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/modules/matlab/generator/jinja/Makefile b/modules/matlab/generator/jinja/Makefile deleted file mode 100644 index 0d89eda7e..000000000 --- a/modules/matlab/generator/jinja/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -test: - python setup.py test - -release: - python scripts/make-release.py - -upload-docs: - $(MAKE) -C docs html dirhtml latex - $(MAKE) -C docs/_build/latex all-pdf - cd docs/_build/; mv html jinja-docs; zip -r jinja-docs.zip jinja-docs; mv jinja-docs html - scp -r docs/_build/dirhtml/* pocoo.org:/var/www/jinja.pocoo.org/docs/ - scp -r docs/_build/latex/Jinja2.pdf pocoo.org:/var/www/jinja.pocoo.org/docs/jinja-docs.pdf - scp -r docs/_build/jinja-docs.zip pocoo.org:/var/www/jinja.pocoo.org/docs/ - -.PHONY: test diff --git a/modules/matlab/generator/jinja/custom_fixers/fix_alt_unicode.py b/modules/matlab/generator/jinja/custom_fixers/fix_alt_unicode.py deleted file mode 100644 index 96a81c16e..000000000 --- a/modules/matlab/generator/jinja/custom_fixers/fix_alt_unicode.py +++ /dev/null @@ -1,13 +0,0 @@ -from lib2to3 import fixer_base -from lib2to3.fixer_util import Name, BlankLine - - -class FixAltUnicode(fixer_base.BaseFix): - PATTERN = """ - func=funcdef< 'def' name='__unicode__' - parameters< '(' NAME ')' > any+ > - """ - - def transform(self, node, results): - name = results['name'] - name.replace(Name('__str__', prefix=name.prefix)) diff --git a/modules/matlab/generator/jinja/custom_fixers/fix_broken_reraising.py b/modules/matlab/generator/jinja/custom_fixers/fix_broken_reraising.py deleted file mode 100644 index fd0ea6881..000000000 --- a/modules/matlab/generator/jinja/custom_fixers/fix_broken_reraising.py +++ /dev/null @@ -1,21 +0,0 @@ -from lib2to3 import fixer_base, pytree -from lib2to3.fixer_util import Name, BlankLine, Name, Attr, ArgList - - -class FixBrokenReraising(fixer_base.BaseFix): - PATTERN = """ - raise_stmt< 'raise' any ',' val=any ',' tb=any > - """ - - # run before the broken 2to3 checker with the same goal - # tries to rewrite it with a rule that does not work out for jinja - run_order = 1 - - def transform(self, node, results): - tb = results['tb'].clone() - tb.prefix = '' - with_tb = Attr(results['val'].clone(), Name('with_traceback')) + \ - [ArgList([tb])] - new = pytree.Node(self.syms.simple_stmt, [Name("raise")] + with_tb) - new.prefix = node.prefix - return new diff --git a/modules/matlab/generator/jinja/custom_fixers/fix_xrange2.py b/modules/matlab/generator/jinja/custom_fixers/fix_xrange2.py deleted file mode 100644 index 5d35e5051..000000000 --- a/modules/matlab/generator/jinja/custom_fixers/fix_xrange2.py +++ /dev/null @@ -1,11 +0,0 @@ -from lib2to3 import fixer_base -from lib2to3.fixer_util import Name, BlankLine - - -# whyever this is necessary.. - -class FixXrange2(fixer_base.BaseFix): - PATTERN = "'xrange'" - - def transform(self, node, results): - node.replace(Name('range', prefix=node.prefix)) diff --git a/modules/matlab/generator/jinja/jinja2-debug.py b/modules/matlab/generator/jinja/jinja2-debug.py deleted file mode 100755 index 80bbc628a..000000000 --- a/modules/matlab/generator/jinja/jinja2-debug.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" - Jinja2 Debug Interface - ~~~~~~~~~~~~~~~~~~~~~~ - - Helper script for internal Jinja2 debugging. Requires Werkzeug. - - :copyright: Copyright 2010 by Armin Ronacher. - :license: BSD. -""" -import sys -import jinja2 -from werkzeug import script - -env = jinja2.Environment(extensions=['jinja2.ext.i18n', 'jinja2.ext.do', - 'jinja2.ext.loopcontrols', - 'jinja2.ext.with_', - 'jinja2.ext.autoescape'], - autoescape=True) - -def shell_init_func(): - def _compile(x): - print env.compile(x, raw=True) - result = { - 'e': env, - 'c': _compile, - 't': env.from_string, - 'p': env.parse - } - for key in jinja2.__all__: - result[key] = getattr(jinja2, key) - return result - - -def action_compile(): - print env.compile(sys.stdin.read(), raw=True) - -action_shell = script.make_shell(shell_init_func) - - -if __name__ == '__main__': - script.run() diff --git a/modules/matlab/generator/jinja/scripts/make-release.py b/modules/matlab/generator/jinja/scripts/make-release.py deleted file mode 100644 index 1b863eaad..000000000 --- a/modules/matlab/generator/jinja/scripts/make-release.py +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" - make-release - ~~~~~~~~~~~~ - - Helper script that performs a release. Does pretty much everything - automatically for us. - - :copyright: (c) 2011 by Armin Ronacher. - :license: BSD, see LICENSE for more details. -""" -import sys -import os -import re -from datetime import datetime, date -from subprocess import Popen, PIPE - - -def parse_changelog(): - with open('CHANGES') as f: - lineiter = iter(f) - for line in lineiter: - match = re.search('^Version\s+(.*)', line.strip()) - if match is None: - continue - length = len(match.group(1)) - version = match.group(1).strip() - if lineiter.next().count('-') != len(match.group(0)): - continue - while 1: - change_info = lineiter.next().strip() - if change_info: - break - - match = re.search(r'(?:codename (.*),\s*)?' - r'released on (\w+\s+\d+\w+\s+\d+)(?i)', - change_info) - if match is None: - continue - - codename, datestr = match.groups() - return version, parse_date(datestr), codename - - -def bump_version(version): - try: - parts = map(int, version.split('.')) - except ValueError: - fail('Current version is not numeric') - parts[-1] += 1 - return '.'.join(map(str, parts)) - - -def parse_date(string): - string = string.replace('th ', ' ').replace('nd ', ' ') \ - .replace('rd ', ' ').replace('st ', ' ') - return datetime.strptime(string, '%B %d %Y') - - -def set_filename_version(filename, version_number, pattern): - changed = [] - def inject_version(match): - before, old, after = match.groups() - changed.append(True) - return before + version_number + after - with open(filename) as f: - contents = re.sub(r"^(\s*%s\s*=\s*')(.+?)(')(?sm)" % pattern, - inject_version, f.read()) - - if not changed: - fail('Could not find %s in %s', pattern, filename) - - with open(filename, 'w') as f: - f.write(contents) - - -def set_init_version(version): - info('Setting __init__.py version to %s', version) - set_filename_version('jinja2/__init__.py', version, '__version__') - - -def set_setup_version(version): - info('Setting setup.py version to %s', version) - set_filename_version('setup.py', version, 'version') - - -def build_and_upload(): - Popen([sys.executable, 'setup.py', 'release', 'sdist', 'upload']).wait() - - -def fail(message, *args): - print >> sys.stderr, 'Error:', message % args - sys.exit(1) - - -def info(message, *args): - print >> sys.stderr, message % args - - -def get_git_tags(): - return set(Popen(['git', 'tag'], stdout=PIPE).communicate()[0].splitlines()) - - -def git_is_clean(): - return Popen(['git', 'diff', '--quiet']).wait() == 0 - - -def make_git_commit(message, *args): - message = message % args - Popen(['git', 'commit', '-am', message]).wait() - - -def make_git_tag(tag): - info('Tagging "%s"', tag) - Popen(['git', 'tag', tag]).wait() - - -def main(): - os.chdir(os.path.join(os.path.dirname(__file__), '..')) - - rv = parse_changelog() - if rv is None: - fail('Could not parse changelog') - - version, release_date, codename = rv - dev_version = bump_version(version) + '-dev' - - info('Releasing %s (codename %s, release date %s)', - version, codename, release_date.strftime('%d/%m/%Y')) - tags = get_git_tags() - - if version in tags: - fail('Version "%s" is already tagged', version) - if release_date.date() != date.today(): - fail('Release date is not today (%s != %s)') - - if not git_is_clean(): - fail('You have uncommitted changes in git') - - set_init_version(version) - set_setup_version(version) - make_git_commit('Bump version number to %s', version) - make_git_tag(version) - build_and_upload() - set_init_version(dev_version) - set_setup_version(dev_version) - - -if __name__ == '__main__': - main() diff --git a/modules/matlab/generator/jinja/scripts/pylintrc b/modules/matlab/generator/jinja/scripts/pylintrc deleted file mode 100644 index 4f85b4906..000000000 --- a/modules/matlab/generator/jinja/scripts/pylintrc +++ /dev/null @@ -1,301 +0,0 @@ -# lint Python modules using external checkers. -# -# This is the main checker controling the other ones and the reports -# generation. It is itself both a raw checker and an astng checker in order -# to: -# * handle message activation / deactivation at the module level -# * handle some basic but necessary stats'data (number of classes, methods...) -# -[MASTER] - -# Specify a configuration file. -#rcfile= - -# Profiled execution. -profile=no - -# Add to the black list. It should be a base name, not a -# path. You may set this option multiple times. -ignore=.svn - -# Pickle collected data for later comparisons. -persistent=yes - -# Set the cache size for astng objects. -cache-size=500 - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - - -[MESSAGES CONTROL] - -# Enable only checker(s) with the given id(s). This option conflict with the -# disable-checker option -#enable-checker= - -# Enable all checker(s) except those with the given id(s). This option conflict -# with the disable-checker option -#disable-checker= - -# Enable all messages in the listed categories. -#enable-msg-cat= - -# Disable all messages in the listed categories. -#disable-msg-cat= - -# Enable the message(s) with the given id(s). -#enable-msg= - -# Disable the message(s) with the given id(s). -disable-msg=C0323,W0142,C0301,C0103,C0111,E0213,C0302,C0203,W0703,R0201 - - -[REPORTS] - -# set the output format. Available formats are text, parseable, colorized and -# html -output-format=colorized - -# Include message's id in output -include-ids=yes - -# Put messages in a separate file for each module / package specified on the -# command line instead of printing them on stdout. Reports (if any) will be -# written in a file name "pylint_global.[txt|html]". -files-output=no - -# Tells wether to display a full report or only the messages -reports=yes - -# Python expression which should return a note less than 10 (10 is the highest -# note).You have access to the variables errors warning, statement which -# respectivly contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (R0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# Add a comment according to your evaluation note. This is used by the global -# evaluation report (R0004). -comment=no - -# Enable the report(s) with the given id(s). -#enable-report= - -# Disable the report(s) with the given id(s). -#disable-report= - - -# checks for -# * unused variables / imports -# * undefined variables -# * redefinition of variable from builtins or from an outer scope -# * use of variable before assigment -# -[VARIABLES] - -# Tells wether we should check for unused import in __init__ files. -init-import=no - -# A regular expression matching names used for dummy variables (i.e. not used). -dummy-variables-rgx=_|dummy - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - - -# try to find bugs in the code using type inference -# -[TYPECHECK] - -# Tells wether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# When zope mode is activated, consider the acquired-members option to ignore -# access to some undefined attributes. -zope=no - -# List of members which are usually get through zope's acquisition mecanism and -# so shouldn't trigger E0201 when accessed (need zope=yes to be considered). -acquired-members=REQUEST,acl_users,aq_parent - - -# checks for : -# * doc strings -# * modules / classes / functions / methods / arguments / variables name -# * number of arguments, local variables, branchs, returns and statements in -# functions, methods -# * required module attributes -# * dangerous default values as arguments -# * redefinition of function / method / class -# * uses of the global statement -# -[BASIC] - -# Required attributes for module, separated by a comma -required-attributes= - -# Regular expression which should only match functions or classes name which do -# not require a docstring -no-docstring-rgx=__.*__ - -# Regular expression which should only match correct module names -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Regular expression which should only match correct module level names -const-rgx=(([A-Z_][A-Z1-9_]*)|(__.*__))$ - -# Regular expression which should only match correct class names -class-rgx=[A-Z_][a-zA-Z0-9]+$ - -# Regular expression which should only match correct function names -function-rgx=[a-z_][a-z0-9_]*$ - -# Regular expression which should only match correct method names -method-rgx=[a-z_][a-z0-9_]*$ - -# Regular expression which should only match correct instance attribute names -attr-rgx=[a-z_][a-z0-9_]*$ - -# Regular expression which should only match correct argument names -argument-rgx=[a-z_][a-z0-9_]*$ - -# Regular expression which should only match correct variable names -variable-rgx=[a-z_][a-z0-9_]*$ - -# Regular expression which should only match correct list comprehension / -# generator expression variable names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ - -# Good variable names which should always be accepted, separated by a comma -good-names=i,j,k,ex,Run,_ - -# Bad variable names which should always be refused, separated by a comma -bad-names=foo,bar,baz,toto,tutu,tata - -# List of builtins function names that should not be used, separated by a comma -bad-functions=apply,input - - -# checks for sign of poor/misdesign: -# * number of methods, attributes, local variables... -# * size, complexity of functions, methods -# -[DESIGN] - -# Maximum number of arguments for function / method -max-args=12 - -# Maximum number of locals for function / method body -max-locals=30 - -# Maximum number of return / yield for function / method body -max-returns=12 - -# Maximum number of branch for function / method body -max-branchs=30 - -# Maximum number of statements in function / method body -max-statements=60 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of attributes for a class (see R0902). -max-attributes=20 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=0 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - - -# checks for -# * external modules dependencies -# * relative / wildcard imports -# * cyclic imports -# * uses of deprecated modules -# -[IMPORTS] - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub,string,TERMIOS,Bastion,rexec - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report R0402 must not be disabled) -import-graph= - -# Create a graph of external dependencies in the given file (report R0402 must -# not be disabled) -ext-import-graph= - -# Create a graph of internal dependencies in the given file (report R0402 must -# not be disabled) -int-import-graph= - - -# checks for : -# * methods without self as first argument -# * overridden methods signature -# * access only to existant members via self -# * attributes not defined in the __init__ method -# * supported interfaces implementation -# * unreachable code -# -[CLASSES] - -# List of interface methods to ignore, separated by a comma. This is used for -# instance to not check methods defines in Zope's Interface base class. -ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp - - -# checks for similarities and duplicated code. This computation may be -# memory / CPU intensive, so you should disable it if you experiments some -# problems. -# -[SIMILARITIES] - -# Minimum lines number of a similarity. -min-similarity-lines=10 - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - - -# checks for: -# * warning notes in the code like FIXME, XXX -# * PEP 263: source code with non ascii character but no encoding declaration -# -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME,XXX,TODO - - -# checks for : -# * unauthorized constructions -# * strict indentation -# * line length -# * use of <> instead of != -# -[FORMAT] - -# Maximum number of characters on a single line. -max-line-length=90 - -# Maximum number of lines in a module -max-module-lines=1000 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' diff --git a/modules/matlab/generator/jinja/setup.cfg b/modules/matlab/generator/jinja/setup.cfg deleted file mode 100644 index 2d74c58f2..000000000 --- a/modules/matlab/generator/jinja/setup.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[egg_info] -tag_build = dev -tag_date = true - -[aliases] -release = egg_info -RDb '' diff --git a/modules/matlab/generator/jinja/setup.py b/modules/matlab/generator/jinja/setup.py deleted file mode 100644 index 414795620..000000000 --- a/modules/matlab/generator/jinja/setup.py +++ /dev/null @@ -1,110 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Jinja2 -~~~~~~ - -Jinja2 is a template engine written in pure Python. It provides a -`Django`_ inspired non-XML syntax but supports inline expressions and -an optional `sandboxed`_ environment. - -Nutshell --------- - -Here a small example of a Jinja template:: - - {% extends 'base.html' %} - {% block title %}Memberlist{% endblock %} - {% block content %} - - {% endblock %} - -Philosophy ----------- - -Application logic is for the controller but don't try to make the life -for the template designer too hard by giving him too few functionality. - -For more informations visit the new `Jinja2 webpage`_ and `documentation`_. - -.. _sandboxed: http://en.wikipedia.org/wiki/Sandbox_(computer_security) -.. _Django: http://www.djangoproject.com/ -.. _Jinja2 webpage: http://jinja.pocoo.org/ -.. _documentation: http://jinja.pocoo.org/2/documentation/ -""" -import sys - -from setuptools import setup, Extension, Feature - -debugsupport = Feature( - 'optional C debug support', - standard=False, - ext_modules = [ - Extension('jinja2._debugsupport', ['jinja2/_debugsupport.c']), - ], -) - - -# tell distribute to use 2to3 with our own fixers. -extra = {} -if sys.version_info >= (3, 0): - extra.update( - use_2to3=True, - use_2to3_fixers=['custom_fixers'] - ) - -# ignore the old '--with-speedups' flag -try: - speedups_pos = sys.argv.index('--with-speedups') -except ValueError: - pass -else: - sys.argv[speedups_pos] = '--with-debugsupport' - sys.stderr.write('*' * 74 + '\n') - sys.stderr.write('WARNING:\n') - sys.stderr.write(' the --with-speedups flag is deprecated, assuming ' - '--with-debugsupport\n') - sys.stderr.write(' For the actual speedups install the MarkupSafe ' - 'package.\n') - sys.stderr.write('*' * 74 + '\n') - - -setup( - name='Jinja2', - version='2.7-dev', - url='http://jinja.pocoo.org/', - license='BSD', - author='Armin Ronacher', - author_email='armin.ronacher@active-4.com', - description='A small but fast and easy to use stand-alone template ' - 'engine written in pure python.', - long_description=__doc__, - # jinja is egg safe. But we hate eggs - zip_safe=False, - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', - 'Topic :: Software Development :: Libraries :: Python Modules', - 'Topic :: Text Processing :: Markup :: HTML' - ], - packages=['jinja2', 'jinja2.testsuite', 'jinja2.testsuite.res', - 'jinja2._markupsafe'], - extras_require={'i18n': ['Babel>=0.8']}, - test_suite='jinja2.testsuite.suite', - include_package_data=True, - entry_points=""" - [babel.extractors] - jinja2 = jinja2.ext:babel_extract[i18n] - """, - features={'debugsupport': debugsupport}, - **extra -) diff --git a/modules/matlab/generator/jinja/jinja2/__init__.py b/modules/matlab/generator/jinja2/__init__.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/__init__.py rename to modules/matlab/generator/jinja2/__init__.py diff --git a/modules/matlab/generator/jinja/jinja2/_debugsupport.c b/modules/matlab/generator/jinja2/_debugsupport.c similarity index 100% rename from modules/matlab/generator/jinja/jinja2/_debugsupport.c rename to modules/matlab/generator/jinja2/_debugsupport.c diff --git a/modules/matlab/generator/jinja/jinja2/_markupsafe/__init__.py b/modules/matlab/generator/jinja2/_markupsafe/__init__.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/_markupsafe/__init__.py rename to modules/matlab/generator/jinja2/_markupsafe/__init__.py diff --git a/modules/matlab/generator/jinja/jinja2/_markupsafe/_bundle.py b/modules/matlab/generator/jinja2/_markupsafe/_bundle.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/_markupsafe/_bundle.py rename to modules/matlab/generator/jinja2/_markupsafe/_bundle.py diff --git a/modules/matlab/generator/jinja/jinja2/_markupsafe/_constants.py b/modules/matlab/generator/jinja2/_markupsafe/_constants.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/_markupsafe/_constants.py rename to modules/matlab/generator/jinja2/_markupsafe/_constants.py diff --git a/modules/matlab/generator/jinja/jinja2/_markupsafe/_native.py b/modules/matlab/generator/jinja2/_markupsafe/_native.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/_markupsafe/_native.py rename to modules/matlab/generator/jinja2/_markupsafe/_native.py diff --git a/modules/matlab/generator/jinja/jinja2/_markupsafe/tests.py b/modules/matlab/generator/jinja2/_markupsafe/tests.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/_markupsafe/tests.py rename to modules/matlab/generator/jinja2/_markupsafe/tests.py diff --git a/modules/matlab/generator/jinja/jinja2/_stringdefs.py b/modules/matlab/generator/jinja2/_stringdefs.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/_stringdefs.py rename to modules/matlab/generator/jinja2/_stringdefs.py diff --git a/modules/matlab/generator/jinja/jinja2/bccache.py b/modules/matlab/generator/jinja2/bccache.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/bccache.py rename to modules/matlab/generator/jinja2/bccache.py diff --git a/modules/matlab/generator/jinja/jinja2/compiler.py b/modules/matlab/generator/jinja2/compiler.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/compiler.py rename to modules/matlab/generator/jinja2/compiler.py diff --git a/modules/matlab/generator/jinja/jinja2/constants.py b/modules/matlab/generator/jinja2/constants.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/constants.py rename to modules/matlab/generator/jinja2/constants.py diff --git a/modules/matlab/generator/jinja/jinja2/debug.py b/modules/matlab/generator/jinja2/debug.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/debug.py rename to modules/matlab/generator/jinja2/debug.py diff --git a/modules/matlab/generator/jinja/jinja2/defaults.py b/modules/matlab/generator/jinja2/defaults.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/defaults.py rename to modules/matlab/generator/jinja2/defaults.py diff --git a/modules/matlab/generator/jinja/jinja2/environment.py b/modules/matlab/generator/jinja2/environment.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/environment.py rename to modules/matlab/generator/jinja2/environment.py diff --git a/modules/matlab/generator/jinja/jinja2/exceptions.py b/modules/matlab/generator/jinja2/exceptions.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/exceptions.py rename to modules/matlab/generator/jinja2/exceptions.py diff --git a/modules/matlab/generator/jinja/jinja2/ext.py b/modules/matlab/generator/jinja2/ext.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/ext.py rename to modules/matlab/generator/jinja2/ext.py diff --git a/modules/matlab/generator/jinja/jinja2/filters.py b/modules/matlab/generator/jinja2/filters.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/filters.py rename to modules/matlab/generator/jinja2/filters.py diff --git a/modules/matlab/generator/jinja/jinja2/lexer.py b/modules/matlab/generator/jinja2/lexer.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/lexer.py rename to modules/matlab/generator/jinja2/lexer.py diff --git a/modules/matlab/generator/jinja/jinja2/loaders.py b/modules/matlab/generator/jinja2/loaders.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/loaders.py rename to modules/matlab/generator/jinja2/loaders.py diff --git a/modules/matlab/generator/jinja/jinja2/meta.py b/modules/matlab/generator/jinja2/meta.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/meta.py rename to modules/matlab/generator/jinja2/meta.py diff --git a/modules/matlab/generator/jinja/jinja2/nodes.py b/modules/matlab/generator/jinja2/nodes.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/nodes.py rename to modules/matlab/generator/jinja2/nodes.py diff --git a/modules/matlab/generator/jinja/jinja2/optimizer.py b/modules/matlab/generator/jinja2/optimizer.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/optimizer.py rename to modules/matlab/generator/jinja2/optimizer.py diff --git a/modules/matlab/generator/jinja/jinja2/parser.py b/modules/matlab/generator/jinja2/parser.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/parser.py rename to modules/matlab/generator/jinja2/parser.py diff --git a/modules/matlab/generator/jinja/jinja2/runtime.py b/modules/matlab/generator/jinja2/runtime.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/runtime.py rename to modules/matlab/generator/jinja2/runtime.py diff --git a/modules/matlab/generator/jinja/jinja2/sandbox.py b/modules/matlab/generator/jinja2/sandbox.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/sandbox.py rename to modules/matlab/generator/jinja2/sandbox.py diff --git a/modules/matlab/generator/jinja/jinja2/tests.py b/modules/matlab/generator/jinja2/tests.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/tests.py rename to modules/matlab/generator/jinja2/tests.py diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/__init__.py b/modules/matlab/generator/jinja2/testsuite/__init__.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/__init__.py rename to modules/matlab/generator/jinja2/testsuite/__init__.py diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/api.py b/modules/matlab/generator/jinja2/testsuite/api.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/api.py rename to modules/matlab/generator/jinja2/testsuite/api.py diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/core_tags.py b/modules/matlab/generator/jinja2/testsuite/core_tags.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/core_tags.py rename to modules/matlab/generator/jinja2/testsuite/core_tags.py diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/debug.py b/modules/matlab/generator/jinja2/testsuite/debug.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/debug.py rename to modules/matlab/generator/jinja2/testsuite/debug.py diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/doctests.py b/modules/matlab/generator/jinja2/testsuite/doctests.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/doctests.py rename to modules/matlab/generator/jinja2/testsuite/doctests.py diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/ext.py b/modules/matlab/generator/jinja2/testsuite/ext.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/ext.py rename to modules/matlab/generator/jinja2/testsuite/ext.py diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/filters.py b/modules/matlab/generator/jinja2/testsuite/filters.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/filters.py rename to modules/matlab/generator/jinja2/testsuite/filters.py diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/imports.py b/modules/matlab/generator/jinja2/testsuite/imports.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/imports.py rename to modules/matlab/generator/jinja2/testsuite/imports.py diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/inheritance.py b/modules/matlab/generator/jinja2/testsuite/inheritance.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/inheritance.py rename to modules/matlab/generator/jinja2/testsuite/inheritance.py diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/lexnparse.py b/modules/matlab/generator/jinja2/testsuite/lexnparse.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/lexnparse.py rename to modules/matlab/generator/jinja2/testsuite/lexnparse.py diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/loader.py b/modules/matlab/generator/jinja2/testsuite/loader.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/loader.py rename to modules/matlab/generator/jinja2/testsuite/loader.py diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/regression.py b/modules/matlab/generator/jinja2/testsuite/regression.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/regression.py rename to modules/matlab/generator/jinja2/testsuite/regression.py diff --git a/modules/matlab/generator/jinja/custom_fixers/__init__.py b/modules/matlab/generator/jinja2/testsuite/res/__init__.py similarity index 100% rename from modules/matlab/generator/jinja/custom_fixers/__init__.py rename to modules/matlab/generator/jinja2/testsuite/res/__init__.py diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/res/templates/broken.html b/modules/matlab/generator/jinja2/testsuite/res/templates/broken.html similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/res/templates/broken.html rename to modules/matlab/generator/jinja2/testsuite/res/templates/broken.html diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/res/templates/foo/test.html b/modules/matlab/generator/jinja2/testsuite/res/templates/foo/test.html similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/res/templates/foo/test.html rename to modules/matlab/generator/jinja2/testsuite/res/templates/foo/test.html diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/res/templates/syntaxerror.html b/modules/matlab/generator/jinja2/testsuite/res/templates/syntaxerror.html similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/res/templates/syntaxerror.html rename to modules/matlab/generator/jinja2/testsuite/res/templates/syntaxerror.html diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/res/templates/test.html b/modules/matlab/generator/jinja2/testsuite/res/templates/test.html similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/res/templates/test.html rename to modules/matlab/generator/jinja2/testsuite/res/templates/test.html diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/security.py b/modules/matlab/generator/jinja2/testsuite/security.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/security.py rename to modules/matlab/generator/jinja2/testsuite/security.py diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/tests.py b/modules/matlab/generator/jinja2/testsuite/tests.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/tests.py rename to modules/matlab/generator/jinja2/testsuite/tests.py diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/utils.py b/modules/matlab/generator/jinja2/testsuite/utils.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/utils.py rename to modules/matlab/generator/jinja2/testsuite/utils.py diff --git a/modules/matlab/generator/jinja/jinja2/utils.py b/modules/matlab/generator/jinja2/utils.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/utils.py rename to modules/matlab/generator/jinja2/utils.py diff --git a/modules/matlab/generator/jinja/jinja2/visitor.py b/modules/matlab/generator/jinja2/visitor.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/visitor.py rename to modules/matlab/generator/jinja2/visitor.py diff --git a/modules/matlab/generator/jinja/jinja2/testsuite/res/__init__.py b/modules/matlab/generator/templates/__init__.py similarity index 100% rename from modules/matlab/generator/jinja/jinja2/testsuite/res/__init__.py rename to modules/matlab/generator/templates/__init__.py