Stripped down jinja, added cmake support
This commit is contained in:
parent
09e294711d
commit
827b4f93e4
@ -36,7 +36,7 @@ if(HAVE_opencv_nonfree)
|
|||||||
|
|
||||||
# add the python generator to the python path
|
# add the python generator to the python path
|
||||||
set(PYPATH_CACHE $ENV{PYTHONPATH})
|
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
|
# synthesise the matlab sources
|
||||||
execute_process(
|
execute_process(
|
||||||
|
@ -4,6 +4,8 @@ import sys, re, os.path
|
|||||||
from string import Template
|
from string import Template
|
||||||
from hdr_parser import CppHeaderParser
|
from hdr_parser import CppHeaderParser
|
||||||
from parse_tree import ParseTree, todict
|
from parse_tree import ParseTree, todict
|
||||||
|
from filters import *
|
||||||
|
from jinja2 import Environment, PackageLoader
|
||||||
|
|
||||||
class MatlabWrapperGenerator(object):
|
class MatlabWrapperGenerator(object):
|
||||||
|
|
||||||
@ -21,4 +23,19 @@ class MatlabWrapperGenerator(object):
|
|||||||
parse_tree = ParseTree()
|
parse_tree = ParseTree()
|
||||||
parse_tree.build(ns)
|
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!
|
||||||
|
8
modules/matlab/generator/jinja/.gitignore
vendored
8
modules/matlab/generator/jinja/.gitignore
vendored
@ -1,8 +0,0 @@
|
|||||||
*.so
|
|
||||||
docs/_build
|
|
||||||
*.pyc
|
|
||||||
*.pyo
|
|
||||||
*.egg-info
|
|
||||||
build
|
|
||||||
dist
|
|
||||||
.DS_Store
|
|
@ -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.
|
|
@ -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
|
|
@ -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))
|
|
@ -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
|
|
@ -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))
|
|
@ -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()
|
|
@ -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()
|
|
@ -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 <file or directory> 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=' '
|
|
@ -1,6 +0,0 @@
|
|||||||
[egg_info]
|
|
||||||
tag_build = dev
|
|
||||||
tag_date = true
|
|
||||||
|
|
||||||
[aliases]
|
|
||||||
release = egg_info -RDb ''
|
|
@ -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 %}
|
|
||||||
<ul>
|
|
||||||
{% for user in users %}
|
|
||||||
<li><a href="{{ user.url }}">{{ user.username }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% 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
|
|
||||||
)
|
|
Loading…
x
Reference in New Issue
Block a user