[Checkins] SVN: Sandbox/pcardune/z3c.recipe.tag/ add a recipe I got
from ignas for smartly generating the right ctags from
installed eggs for a package.
Paul Carduner
paulcarduner at gmail.com
Sun Mar 16 14:59:40 EDT 2008
Log message for revision 84715:
add a recipe I got from ignas for smartly generating the right ctags from installed eggs for a package.
Changed:
A Sandbox/pcardune/z3c.recipe.tag/
A Sandbox/pcardune/z3c.recipe.tag/README.txt
A Sandbox/pcardune/z3c.recipe.tag/bootstrap.py
A Sandbox/pcardune/z3c.recipe.tag/buildout.cfg
A Sandbox/pcardune/z3c.recipe.tag/setup.py
A Sandbox/pcardune/z3c.recipe.tag/src/
A Sandbox/pcardune/z3c.recipe.tag/src/z3c/
A Sandbox/pcardune/z3c.recipe.tag/src/z3c/__init__.py
A Sandbox/pcardune/z3c.recipe.tag/src/z3c/recipe/
A Sandbox/pcardune/z3c.recipe.tag/src/z3c/recipe/__init__.py
A Sandbox/pcardune/z3c.recipe.tag/src/z3c/recipe/tag/
A Sandbox/pcardune/z3c.recipe.tag/src/z3c/recipe/tag/__init__.py
A Sandbox/pcardune/z3c.recipe.tag/src/z3c/recipe/tag/id-lang.map
-=-
Added: Sandbox/pcardune/z3c.recipe.tag/README.txt
===================================================================
--- Sandbox/pcardune/z3c.recipe.tag/README.txt (rev 0)
+++ Sandbox/pcardune/z3c.recipe.tag/README.txt 2008-03-16 18:59:39 UTC (rev 84715)
@@ -0,0 +1 @@
+TODO
Property changes on: Sandbox/pcardune/z3c.recipe.tag/README.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/pcardune/z3c.recipe.tag/bootstrap.py
===================================================================
--- Sandbox/pcardune/z3c.recipe.tag/bootstrap.py (rev 0)
+++ Sandbox/pcardune/z3c.recipe.tag/bootstrap.py 2008-03-16 18:59:39 UTC (rev 84715)
@@ -0,0 +1,124 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+"""
+import os, shutil, sys, tempfile, urllib2
+
+join = os.path.join
+py_version = 'python%s.%s' % (sys.version_info[0], sys.version_info[1])
+
+def mkdir(path):
+ if not os.path.exists(path):
+ print 'Creating %s' % path
+ os.makedirs(path)
+
+def symlink(src, dest):
+ if not os.path.exists(dest):
+ os.symlink(src, dest)
+ else:
+ print 'Symlink %s already exists' % dest
+
+
+def rmtree(dir):
+ if os.path.exists(dir):
+ print 'Deleting tree %s' % dir
+ shutil.rmtree(dir)
+
+def make_exe(fn):
+ if os.name == 'posix':
+ oldmode = os.stat(fn).st_mode & 07777
+ newmode = (oldmode | 0555) & 07777
+ os.chmod(fn, newmode)
+
+def make_virtual_python():
+ if os.name != 'posix':
+ print "This script only works on Unix-like platforms, sorry."
+ return
+
+ lib_dir = join('python', 'lib', py_version)
+ inc_dir = join('python', 'include', py_version)
+ bin_dir = join('python', 'bin')
+
+ if sys.executable.startswith(bin_dir):
+ print 'Please use the *system* python to run this script'
+ return
+
+ mkdir('python')
+ prefix = sys.prefix
+ mkdir(lib_dir)
+ stdlib_dir = join(prefix, 'lib', py_version)
+ for fn in os.listdir(stdlib_dir):
+ if fn != 'site-packages':
+ symlink(join(stdlib_dir, fn), join(lib_dir, fn))
+
+ mkdir(join(lib_dir, 'site-packages'))
+
+ mkdir(inc_dir)
+ stdinc_dir = join(prefix, 'include', py_version)
+ for fn in os.listdir(stdinc_dir):
+ symlink(join(stdinc_dir, fn), join(inc_dir, fn))
+
+ if sys.exec_prefix != sys.prefix:
+ exec_dir = join(sys.exec_prefix, 'lib', py_version)
+ for fn in os.listdir(exec_dir):
+ symlink(join(exec_dir, fn), join(lib_dir, fn))
+
+ mkdir(bin_dir)
+ print 'Copying %s to %s' % (sys.executable, bin_dir)
+ py_executable = join(bin_dir, 'python')
+ if sys.executable != py_executable:
+ shutil.copyfile(sys.executable, py_executable)
+ make_exe(py_executable)
+
+
+if __name__ == "__main__":
+ if sys.executable != os.path.abspath('python/bin/python'):
+ make_virtual_python()
+ sys.exit(os.spawnve(
+ os.P_WAIT, 'python/bin/python',
+ ['python/bin/python'] + sys.argv, os.environ))
+
+ tmpeggs = tempfile.mkdtemp()
+
+ ez = {}
+ exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+ ).read() in ez
+ ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+ import pkg_resources
+
+ cmd = 'from setuptools.command.easy_install import main; main()'
+ if sys.platform == 'win32':
+ cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ ws = pkg_resources.working_set
+ assert os.spawnle(
+ os.P_WAIT, sys.executable, sys.executable,
+ '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+ dict(os.environ,
+ PYTHONPATH=
+ ws.find(pkg_resources.Requirement.parse('setuptools')).location
+ ),
+ ) == 0
+
+ ws.add_entry(tmpeggs)
+ ws.require('zc.buildout')
+ import zc.buildout.buildout
+ zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+ shutil.rmtree(tmpeggs)
Property changes on: Sandbox/pcardune/z3c.recipe.tag/bootstrap.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: Sandbox/pcardune/z3c.recipe.tag/buildout.cfg
===================================================================
--- Sandbox/pcardune/z3c.recipe.tag/buildout.cfg (rev 0)
+++ Sandbox/pcardune/z3c.recipe.tag/buildout.cfg 2008-03-16 18:59:39 UTC (rev 84715)
@@ -0,0 +1,15 @@
+[buildout]
+index = http://download.zope.org/zope3.4
+develop = .
+parts = z3c.recipe.tag test
+newest = false
+
+[z3c.recipe.tag]
+recipe = zc.recipe.egg
+unzip = true
+eggs = z3c.recipe.tag
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = z3c.recipe.tag
+defaults = ['--exit-with-status', '--tests-pattern', '^f?tests$', '-v']
Property changes on: Sandbox/pcardune/z3c.recipe.tag/buildout.cfg
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/pcardune/z3c.recipe.tag/setup.py
===================================================================
--- Sandbox/pcardune/z3c.recipe.tag/setup.py (rev 0)
+++ Sandbox/pcardune/z3c.recipe.tag/setup.py 2008-03-16 18:59:39 UTC (rev 84715)
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# Check python version
+
+import sys
+if sys.version_info < (2, 4):
+ print >> sys.stderr, '%s: need Python 2.4 or later.' % sys.argv[0]
+ print >> sys.stderr, 'Your python is %s' % sys.version
+ sys.exit(1)
+
+import os
+from setuptools import setup, find_packages
+
+setup(
+ name="z3c.recipe.tag",
+ author="Ignas",
+ description="Generate ctags from eggs for development.",
+ version='0.1.0-dev',
+ url='http://svn.zope.org/Sanbox/pcardune/z3c.recipe.tag/',
+ license="ZPL",
+ maintainer="Paul Carduner",
+ maintainer_email="zope-dev at zope.org",
+ platforms=["any"],
+ classifiers=["Development Status :: 4 - Beta",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: GNU General Public License (GPL)",
+ "Operating System :: OS Independent",
+ "Programming Language :: Python",
+ "Programming Language :: Zope"],
+ package_dir={'': 'src'},
+ packages=find_packages('src'),
+ namespace_packages=['z3c','z3c.recipe'],
+ install_requires=['setuptools',
+ 'zc.buildout',
+ 'zc.recipe.egg'],
+ entry_points="""
+ [zc.buildout]
+ tags = z3c.recipe.tag:TagsMaker
+
+ [console_scripts]
+ build_tags = z3c.recipe.tag:build_tags
+ """,
+ zip_safe=False,
+ include_package_data=True,
+ )
Property changes on: Sandbox/pcardune/z3c.recipe.tag/setup.py
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: Sandbox/pcardune/z3c.recipe.tag/src/z3c/__init__.py
===================================================================
--- Sandbox/pcardune/z3c.recipe.tag/src/z3c/__init__.py (rev 0)
+++ Sandbox/pcardune/z3c.recipe.tag/src/z3c/__init__.py 2008-03-16 18:59:39 UTC (rev 84715)
@@ -0,0 +1,22 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+$Id$
+"""
+
+# this is a namespace package
+try:
+ __import__('pkg_resources').declare_namespace(__name__)
+except ImportError:
+ pass
Property changes on: Sandbox/pcardune/z3c.recipe.tag/src/z3c/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: Sandbox/pcardune/z3c.recipe.tag/src/z3c/recipe/__init__.py
===================================================================
--- Sandbox/pcardune/z3c.recipe.tag/src/z3c/recipe/__init__.py (rev 0)
+++ Sandbox/pcardune/z3c.recipe.tag/src/z3c/recipe/__init__.py 2008-03-16 18:59:39 UTC (rev 84715)
@@ -0,0 +1,22 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+$Id$
+"""
+
+# this is a namespace package
+try:
+ __import__('pkg_resources').declare_namespace(__name__)
+except ImportError:
+ pass
Property changes on: Sandbox/pcardune/z3c.recipe.tag/src/z3c/recipe/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: Sandbox/pcardune/z3c.recipe.tag/src/z3c/recipe/tag/__init__.py
===================================================================
--- Sandbox/pcardune/z3c.recipe.tag/src/z3c/recipe/tag/__init__.py (rev 0)
+++ Sandbox/pcardune/z3c.recipe.tag/src/z3c/recipe/tag/__init__.py 2008-03-16 18:59:39 UTC (rev 84715)
@@ -0,0 +1,88 @@
+import os, sys
+import pkg_resources
+
+import zc.buildout.easy_install
+import zc.recipe.egg
+
+
+
+class TagsMaker(object):
+
+ def __init__(self, buildout, name, options):
+ self.buildout = buildout
+ self.name = name
+ self.options = options
+ options['script'] = os.path.join(buildout['buildout']['bin-directory'],
+ options.get('script', self.name),
+ )
+
+ if not options.get('working-directory', ''):
+ options['location'] = os.path.join(
+ buildout['buildout']['parts-directory'], name)
+ self.egg = zc.recipe.egg.Egg(buildout, name, options)
+
+ def install(self):
+ options = self.options
+ dest = []
+ eggs, ws = self.egg.working_set(('z3c.recipe.tag',))
+
+ wd = options.get('working-directory', '')
+ if not wd:
+ wd = options['location']
+ if os.path.exists(wd):
+ assert os.path.isdir(wd)
+ else:
+ os.mkdir(wd)
+ dest.append(wd)
+
+ initialization = initialization_template % self.buildout['buildout']['directory']
+
+ env_section = options.get('environment', '').strip()
+ if env_section:
+ env = self.buildout[env_section]
+ for key, value in env.items():
+ initialization += env_template % (key, value)
+
+ initialization_section = options.get('initialization', '').strip()
+ if initialization_section:
+ initialization += initialization_section
+
+ dest.extend(zc.buildout.easy_install.scripts(
+ [(options['script'], 'z3c.recipe.tag', 'build_tags')],
+ ws, options['executable'],
+ self.buildout['buildout']['bin-directory'],
+ extra_paths=self.egg.extra_paths,
+ initialization = initialization,
+ ))
+
+ return dest
+
+ update = install
+
+
+initialization_template = """import os
+sys.argv[0] = os.path.abspath(sys.argv[0])
+os.chdir(%r)
+"""
+
+env_template = """os.environ['%s'] = %r
+"""
+
+
+def build_tags():
+ paths = [path for path in sys.path
+ if not path.endswith('.zip')]
+ paths = " ".join(paths)
+
+ map = pkg_resources.resource_filename("z3c.recipe.tag", "id-lang.map")
+ command = "mkid -m %s -o ID.new %s" % (map, paths)
+ if os.system(command) == 0:
+ os.system("mv ID.new ID")
+
+ command = "ctags-exuberant -R --languages=-JavaScript -f tags.new %s" % paths
+ if os.system(command) == 0:
+ os.system("mv tags.new tags")
+
+ command = "ctags-exuberant -e -R --languages=-JavaScript -f TAGS.new %s" % paths
+ if os.system(command) == 0:
+ os.system("mv TAGS.new TAGS")
Property changes on: Sandbox/pcardune/z3c.recipe.tag/src/z3c/recipe/tag/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: Sandbox/pcardune/z3c.recipe.tag/src/z3c/recipe/tag/id-lang.map
===================================================================
--- Sandbox/pcardune/z3c.recipe.tag/src/z3c/recipe/tag/id-lang.map (rev 0)
+++ Sandbox/pcardune/z3c.recipe.tag/src/z3c/recipe/tag/id-lang.map 2008-03-16 18:59:39 UTC (rev 84715)
@@ -0,0 +1,97 @@
+# Welcome to the mkid language mapper.
+#
+# The format of each line is:
+#
+# <pattern> <language> [options]
+#
+# Filenames are matched top-to-bottom against the patterns, and the
+# first match is chosen. The special language `IGNORE' means that
+# this file should be ignored by mkid. The options are
+# language-specific command-line options to mkid.
+#
+# If a file name doesn't match any pattern, it is assigned the default
+# language. The default language may be specified here with the
+# special pattern `**', or overridden from the mkid command-line with
+# the `--default-lang=LANG' option.
+#
+# The special pattern `***' means to include the named file that
+# immediately follows. If no file is named, then the default system
+# language mapper file (i.e., this file) is included.
+
+# Default language
+** IGNORE # Although this is listed first,
+ # the default language pattern is
+ # logically matched last.
+
+#.svn/* IGNORE
+#{arch}/ IGNORE
+*.py text
+*.zcml text
+*.pt text
+*.zpt text
+
+# Backup files
+*~ IGNORE
+*.bak IGNORE
+*.bk[0-9] IGNORE
+
+# SCCS files
+[sp].* IGNORE
+
+# C dependencies created by automake
+*/.deps/* IGNORE
+
+*.h C
+*.h.in C
+*.H C++
+*.hh C++
+*.hpp C++
+*.hxx C++
+
+*.l C
+*.lex C
+*.y C
+*.yacc C
+
+*.c C
+*.C C++
+*.cc C++
+*.cpp C++
+*.CPP C++
+*.cxx C++
+
+ChangeLog* Cdoc
+
+*.[sS] asm --comment=;
+*.asm asm --comment=;
+
+# [nt]roff
+*.[0-9] roff
+*.ms roff
+*.me roff
+*.mm roff
+
+*.tex TeX
+*.ltx TeX
+*.texi texinfo
+*.texinfo texinfo
+
+# portable object (i18n)
+*.po po
+
+*.el elisp
+*.lisp text
+
+*.am make
+Makefile make
+Makefile.* make
+
+*.doc text
+*.txt text
+
+*.m4 m4
+
+*.pl perl
+
+*.gz FILTER gzip -d <%s
+*.Z FILTER gzip -d <%s
Property changes on: Sandbox/pcardune/z3c.recipe.tag/src/z3c/recipe/tag/id-lang.map
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the Checkins
mailing list