diff options
author | David Lord <davidism@gmail.com> | 2020-01-10 12:58:38 -0800 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2020-01-10 12:58:38 -0800 |
commit | e492255f270add52d051ef4f8e87899f40e57687 (patch) | |
tree | 5c32f9e526b2efae6d901bc4dd77655dbf8ab3b5 /scripts | |
parent | 143667d95d73730415bb1281d1cd5e439b366fec (diff) | |
download | jinja2-e492255f270add52d051ef4f8e87899f40e57687.tar.gz |
remove old scripts and examples
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/jinja2-debug.py | 50 | ||||
-rw-r--r-- | scripts/make-release.py | 178 | ||||
-rw-r--r-- | scripts/pylintrc | 301 |
3 files changed, 0 insertions, 529 deletions
diff --git a/scripts/jinja2-debug.py b/scripts/jinja2-debug.py deleted file mode 100755 index 96628dd..0000000 --- a/scripts/jinja2-debug.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" - Jinja Debug Interface - ~~~~~~~~~~~~~~~~~~~~~ - - Helper script for internal Jinja debugging. Requires Werkzeug. - - :copyright: Copyright 2010 by Armin Ronacher. - :license: BSD. -""" -from __future__ import print_function - -import sys - -from werkzeug import script - -import jinja2 - -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/scripts/make-release.py b/scripts/make-release.py deleted file mode 100644 index de36ae1..0000000 --- a/scripts/make-release.py +++ /dev/null @@ -1,178 +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. -""" -from __future__ import print_function - -import os -import re -import sys -from datetime import date -from datetime import datetime -from subprocess import PIPE -from subprocess import Popen - -_date_strip_re = re.compile(r"(?<=\d)(st|nd|rd|th)") - - -def parse_changelog(): - with open("CHANGES.rst") as f: - lineiter = iter(f) - for line in lineiter: - match = re.search(r"^Version\s+(.*)", line.strip()) - - if match is None: - continue - - version = match.group(1).strip() - - if next(lineiter).count("-") != len(match.group(0)): - continue - - while 1: - change_info = next(lineiter).strip() - - if change_info: - break - - match = re.search( - r"(?:codename (.*),\s*)?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 = [int(i) for i in version.split(".")] - except ValueError: - fail("Current version is not numeric") - - parts[-1] += 1 - return ".".join(map(str, parts)) - - -def parse_date(string): - string = _date_strip_re.sub("", string) - 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(): - cmd = [sys.executable, "setup.py", "sdist", "bdist_wheel"] - Popen(cmd).wait() - - -def fail(message, *args): - print("Error:", message % args, file=sys.stderr) - sys.exit(1) - - -def info(message, *args): - print(message % args, file=sys.stderr) - - -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)", release_date.date(), date.today()) - - if not git_is_clean(): - fail("You have uncommitted changes in git") - - try: - __import__("wheel") - except ImportError: - fail("You need to install the wheel package.") - - 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/scripts/pylintrc b/scripts/pylintrc deleted file mode 100644 index 16c01fb..0000000 --- a/scripts/pylintrc +++ /dev/null @@ -1,301 +0,0 @@ -# lint Python modules using external checkers. -# -# This is the main checker controlling 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 whether 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 -# respectively 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 assignment -# -[VARIABLES] - -# Tells whether 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 whether 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 gotten through zope's acquisition mechanism -# 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 existent 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=' ' |