diff --git a/pysmell.vim b/pysmell.vim index e8a079c..9714f77 100644 --- a/pysmell.vim +++ b/pysmell.vim @@ -34,12 +34,24 @@ if !exists('g:pysmell_matcher') endif python << eopython -from pysmell import vimhelper, idehelper import vim +try: + from pysmell import vimhelper, idehelper + vim.command('let g:pysmell_exists=1') +except: + pass + import string TRANSLATEQUOTES = string.maketrans("\'\"", "\"\'") eopython +if !exists('g:pysmell_exists') + if g:pysmell_debug == 1 + echo "Error: Required pysmell" + endif + finish +endif + function! pysmell#Complete(findstart, base) "findstart = 1 when we need to get the text length if a:findstart == 1 diff --git a/setup.py b/setup.py index eb576e7..980d3c1 100644 --- a/setup.py +++ b/setup.py @@ -69,3 +69,27 @@ def run(self): ) + +setup( + cmdclass={'install': install}, + name='mktags', + version='0.1', + packages = ['tags'], + entry_points={ + 'console_scripts':[ + 'mktags = tags.tag:mktags', + ] + }, +) + +setup( + cmdclass={'install': install}, + name='rmtags', + version='0.1', + packages = ['tags'], + entry_points={ + 'console_scripts':[ + 'rmtags = tags.tag:rmtags', + ] + }, +) diff --git a/tags/__init__.py b/tags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tags/tag.py b/tags/tag.py new file mode 100644 index 0000000..6ae94ec --- /dev/null +++ b/tags/tag.py @@ -0,0 +1,29 @@ +from subprocess import * +import os +import sys +sys.path.append(os.path.abspath(os.path.curdir)) +import settings + +def run(command): + proc = Popen(command.split(' '), stdout=PIPE) + output = proc.communicate()[0] + if output.strip(): + print output + +def rmtags(): + for root, dirs, files in os.walk('.'): + for name in files: + if name.startswith('PYSMELLTAGS') or name == 'tags': + run('rm {0}'.format(name)) + +def mktags(): + rmtags() + + path = '{0}/lib/python{1}.{2}/site-packages'.format(os.environ['VIRTUAL_ENV'], *sys.version_info[:2]) + + for package in settings.packages: + run('ctags -aR %(path)s/%(package)s' % locals()) + run('pysmell -o PYSMELLTAGS.%(package)s %(path)s/%(package)s' % locals()) + + run('ctags -aR .') + run('pysmell .')