Skip to content

Commit

Permalink
support zc.buildout 1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
garyposter committed Aug 29, 2010
1 parent 500ceda commit da85787
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 30 deletions.
7 changes: 4 additions & 3 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
CHANGES
=======

0.3.1 (unreleased)
0.4.0 (unreleased)
------------------

* ...
* Support new script features from zc.buildout 1.5 and higher. This version
requires zc.buildout 1.5 or higher.

* Also index Mako and HTML files with id-utils.

Expand All @@ -17,7 +18,7 @@ CHANGES

* Also index Javascript, CSS and ReStructuredText files with id-utils.

* Define a default entry point for zc.buildout, so you can simply say
* Define a default entry point for zc.buildout, so you can simply say::

[ctags]
recipe = z3c.recipe.tag
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def read(*rnames):

setup(
name="z3c.recipe.tag",
version='0.3.1dev',
version='0.4.0dev',
author="Ignas Mikalajūnas and the Zope Community",
description="Generate ctags from eggs for development.",
long_description=(read('README.txt')
Expand All @@ -57,13 +57,13 @@ def read(*rnames):
package_dir={'': 'src'},
namespace_packages=['z3c','z3c.recipe'],
install_requires=['setuptools',
'zc.buildout',
'zc.buildout >= 1.5.0',
#these two come from apt-get!
#'id-utils',
#'ctags-exuberant'
# alternately, on Mac, use macports (macports.org) and
# ``sudo port install ctags idutils``
'zc.recipe.egg'],
'z3c.recipe.scripts >= 1.0.0'],
entry_points="""
[zc.buildout]
default = z3c.recipe.tag:TagsMaker
Expand Down
46 changes: 22 additions & 24 deletions src/z3c/recipe/tag/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,33 @@
import sys

import zc.buildout.easy_install
import zc.recipe.egg
import z3c.recipe.scripts.scripts

class TagsMaker(object):

def __init__(self, buildout, name, options):
self.buildout = buildout
self.name = name
self.options = options
# We do this early so the "extends" functionality works before we get
# to the other options below.
self._delegated = z3c.recipe.scripts.scripts.Base(
buildout, name, 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',))
generated = []
eggs, ws = self._delegated.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)
if not os.path.exists(options['parts-directory']):
os.mkdir(options['parts-directory'])
generated.append(options['parts-directory'])

initialization = initialization_template % self.buildout['buildout']['directory']
initialization = initialization_template % (
self.buildout['buildout']['directory'])

env_section = options.get('environment', '').strip()
if env_section:
Expand All @@ -61,15 +56,18 @@ def install(self):
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,
generated.extend(zc.buildout.easy_install.sitepackage_safe_scripts(
self.buildout['buildout']['bin-directory'], ws,
options['executable'], options['parts-directory'],
reqs=[(options['script'], 'z3c.recipe.tag', 'build_tags')],
extra_paths=self._delegated.extra_paths,
include_site_packages=self._delegated.include_site_packages,
exec_sitecustomize=self._delegated.exec_sitecustomize,
relative_paths=self._delegated._relative_paths,
script_initialization=initialization,
))

return dest
return generated

update = install

Expand Down

0 comments on commit da85787

Please sign in to comment.