Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Wed, 29 Aug 2012 21:03:25
Commit: 883ce3acb6cb760e8b8ef3238141243f74da8878
https://github.com/geany/geany/commit/883ce3acb6cb760e8b8ef3238141243f74da8…
Log Message:
-----------
Add method to generate also tags for __builtins__
This way we get easily also tags for standard exceptions and a few builtin types.
Modified Paths:
--------------
scripts/create_py_tags.py
Modified: scripts/create_py_tags.py
22 files changed, 21 insertions(+), 1 deletions(-)
===================================================================
@@ -133,7 +133,10 @@ def _add_tag(self, obj, tag_type, parent=''):
args = '(%s)' % parent
else:
scope = '%s%s' % (TA_SCOPE, parent)
- tagname = obj.__name__
+ if isinstance(obj, basestring):
+ tagname = obj
+ else:
+ tagname = obj.__name__
# check for duplicates
if len(tagname) < 4:
# skip short tags
@@ -208,6 +211,22 @@ def process_file(self, filename):
filep.close()
#----------------------------------------------------------------------
+ def add_builtins(self):
+ """
+ Add the contents of __builtins__ as simple tags
+ """
+ for tag_name in dir(__builtins__):
+ # check if the tag name starts with upper case, then we assume it is a class
+ # note that this is a very very simple heuristic to determine the type and will give
+ # false positives
+ if tag_name[0].isupper():
+ tag_type = TYPE_CLASS
+ else:
+ tag_type = TYPE_FUNCTION
+
+ self._add_tag(tag_name, tag_type)
+
+ #----------------------------------------------------------------------
def write_to_file(self, filename):
"""
Sort the found tags and write them into the file specified by filename
@@ -266,6 +285,7 @@ def main():
args = get_module_filenames(PYTHON_LIB_DIRECTORY)
parser = Parser()
+ parser.add_builtins()
for filename in args:
parser.process_file(filename)
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Wed, 29 Aug 2012 20:40:54
Commit: 29f0d02be3072c25e1ccc27258621703830cc623
https://github.com/geany/geany/commit/29f0d02be3072c25e1ccc27258621703830cc…
Log Message:
-----------
Add a warning about running this script with its potential side effects
Modified Paths:
--------------
scripts/create_py_tags.py
Modified: scripts/create_py_tags.py
11 files changed, 11 insertions(+), 0 deletions(-)
===================================================================
@@ -11,6 +11,17 @@
# Parses all files given on command line for Python classes or functions and write
# them into data/python.tags (internal tagmanager format).
# If called without command line arguments, a preset of common Python libs is used.
+#
+# WARNING
+# Be aware that running this script will actually *import* modules in the specified directory
+# or in the standard library path of your Python installation. Dependent on what Python modules
+# you have installed, this might not be want you want and can have weird side effects.
+# You have been warned.
+#
+# It should be however relatively safe to execute this script from a fresh Python installation
+# installed into a dedicated prefix. Then nothing else is necessary as to change the interpreter
+# with which you start this script.
+#
import datetime
import imp
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Wed, 29 Aug 2012 20:22:57
Commit: f1cb61f6cbe7e52c33eed60fa36b40826a792258
https://github.com/geany/geany/commit/f1cb61f6cbe7e52c33eed60fa36b40826a792…
Log Message:
-----------
Ignore tag names starting a Python keyword
This removes tags like 'pass_', 'pass_stmt' or 'return_stmt' which are quite annoying
when typing the actual keywords and pressing Enter afterwards.
Also add some more modules and packages to the ignore list to avoid weird side effects
when importing them (even though antigravity is funny).
Modified Paths:
--------------
scripts/create_py_tags.py
Modified: scripts/create_py_tags.py
17 files changed, 14 insertions(+), 3 deletions(-)
===================================================================
@@ -21,9 +21,14 @@
import types
PYTHON_LIB_DIRECTORY = os.path.dirname(os.__file__)
-PYTHON_LIB_IGNORE_PACKAGES = (u'test', u'dist-packages', u'site-packages')
-# multiprocessing.util registers an atexit function which breaks this script on exit
-PYTHON_LIB_IGNORE_MODULES = (u'multiprocessing/util.py',)
+PYTHON_LIB_IGNORE_PACKAGES = (u'test', u'dist-packages', u'site-packages', 'Tools')
+# some modules execute funky code when they are imported which we really don't want here
+# (though if you feel funny, try: 'import antigravity')
+PYTHON_LIB_IGNORE_MODULES = (u'antigravity.py', u'idlelib/idle.py', u'multiprocessing/util.py')
+PYTHON_KEYWORDS = ('and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif',
+ 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import',
+ 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try',
+ 'while', 'with', 'yield', 'False', 'None', 'True')
# (from tagmanager/tm_tag.c:32)
TA_NAME = '%c' % 200,
@@ -123,6 +128,12 @@ def _add_tag(self, obj, tag_type, parent=''):
# skip short tags
return
tag = '%s%s%s%s%s%s\n' % (tagname, TA_TYPE, tag_type, TA_ARGLIST, args, scope)
+ for keyword in PYTHON_KEYWORDS:
+ # ignore tags which start with a keyword to avoid
+ # annoying completions of 'pass_' and similar ones
+ if tagname.startswith(keyword):
+ return
+
if not tagname in self.tags:
self.tags[tagname] = tag
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Wed, 29 Aug 2012 20:14:49
Commit: fd8b20c80b5aa3a0e75b5662cf2fcba769d7d937
https://github.com/geany/geany/commit/fd8b20c80b5aa3a0e75b5662cf2fcba769d7d…
Log Message:
-----------
Add 'memoryview' identifier as found in Python2.7
Modified Paths:
--------------
data/filetypes.python
Modified: data/filetypes.python
4 files changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -22,8 +22,8 @@ decorator=decorator
# all items must be in one line
primary=and as assert break class continue def del elif else except exec finally for from global if import in is lambda not or pass print raise return try while with yield False None True
# additional keywords, will be highlighted with style "word2"
-# these are the builtins for Python 2.5 created with ' '.join(dir(__builtins__))
-identifiers=ArithmeticError AssertionError AttributeError BaseException BufferError BytesWarning DeprecationWarning EOFError Ellipsis EnvironmentError Exception False FloatingPointError FutureWarning GeneratorExit IOError ImportError ImportWarning IndentationError IndexError KeyError KeyboardInterrupt LookupError MemoryError NameError None NotImplemented NotImplementedError OSError OverflowError PendingDeprecationWarning ReferenceError RuntimeError RuntimeWarning StandardError StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError True TypeError UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning ValueError Warning ZeroDivisionError __debug__ __doc__ __import__ __name__ __package__ abs all any apply basestring bin bool buffer bytearray bytes callable chr classmethod cmp coerce compile complex copyright credits delattr dict dir divmod enumerate eval execfile exit file filter float format frozenset geta
ttr globals hasattr hash help hex id input int intern isinstance issubclass iter len license list locals long map max min next object oct open ord pow print property quit range raw_input reduce reload repr reversed round set setattr slice sorted staticmethod str sum super tuple type unichr unicode vars xrange zip
+# these are the builtins for Python 2.7 created with ' '.join(dir(__builtins__))
+identifiers=ArithmeticError AssertionError AttributeError BaseException BufferError BytesWarning DeprecationWarning EOFError Ellipsis EnvironmentError Exception False FloatingPointError FutureWarning GeneratorExit IOError ImportError ImportWarning IndentationError IndexError KeyError KeyboardInterrupt LookupError MemoryError NameError None NotImplemented NotImplementedError OSError OverflowError PendingDeprecationWarning ReferenceError RuntimeError RuntimeWarning StandardError StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError True TypeError UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning ValueError Warning ZeroDivisionError __debug__ __doc__ __import__ __name__ __package__ abs all any apply basestring bin bool buffer bytearray bytes callable chr classmethod cmp coerce compile complex copyright credits delattr dict dir divmod enumerate eval execfile exit file filter float format frozenset geta
ttr globals hasattr hash help hex id input int intern isinstance issubclass iter len license list locals long map max memoryview min next object oct open ord pow print property quit range raw_input reduce reload repr reversed round set setattr slice sorted staticmethod str sum super tuple type unichr unicode vars xrange zip
[lexer_properties]
fold.comment.python=1
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Sat, 25 Aug 2012 14:02:21
Commit: 484f6fcdef245a1501bc93a124a68f0f3d273b5d
https://github.com/geany/geany/commit/484f6fcdef245a1501bc93a124a68f0f3d273…
Log Message:
-----------
Make sure to only use as much data as it was actually read
When reading a C macro, make sure to only use as much byes we actually
got and not as much as we requested. This should not be a problem
anymore now 61c5216 fixed a too long read, but it's safer anyway.
Modified Paths:
--------------
tagmanager/ctags/get.c
Modified: tagmanager/ctags/get.c
8 files changed, 5 insertions(+), 3 deletions(-)
===================================================================
@@ -722,10 +722,12 @@ extern char *getArglistFromFilePos(MIOPos startPosition, const char *tokenName)
if (pos2 > pos1)
{
- result = (char *) g_malloc(sizeof(char ) * (pos2 - pos1 + 1));
- if (result != NULL && mio_read(File.mio, result, sizeof(char), pos2 - pos1) > 0)
+ size_t len = pos2 - pos1;
+
+ result = (char *) g_malloc(len + 1);
+ if (result != NULL && (len = mio_read(File.mio, result, 1, len)) > 0)
{
- result[pos2-pos1] = '\0';
+ result[len] = '\0';
arglist = getArglistFromStr(result, tokenName);
}
g_free(result);
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).