[Checkins] SVN: z3c.recipe.depgraph/tags/0.4/ New release 0.4

Sébastien Douche sdouche at free.fr
Wed Nov 4 12:58:50 EST 2009


Log message for revision 105481:
  New release 0.4
  

Changed:
  A   z3c.recipe.depgraph/tags/0.4/
  D   z3c.recipe.depgraph/tags/0.4/CHANGES.txt
  A   z3c.recipe.depgraph/tags/0.4/CHANGES.txt
  D   z3c.recipe.depgraph/tags/0.4/README.txt
  A   z3c.recipe.depgraph/tags/0.4/README.txt
  D   z3c.recipe.depgraph/tags/0.4/setup.py
  A   z3c.recipe.depgraph/tags/0.4/setup.py
  D   z3c.recipe.depgraph/tags/0.4/src/z3c/recipe/depgraph/recipe.py
  A   z3c.recipe.depgraph/tags/0.4/src/z3c/recipe/depgraph/recipe.py
  D   z3c.recipe.depgraph/tags/0.4/src/z3c/recipe/depgraph/runner.py
  A   z3c.recipe.depgraph/tags/0.4/src/z3c/recipe/depgraph/runner.py

-=-
Deleted: z3c.recipe.depgraph/tags/0.4/CHANGES.txt
===================================================================
--- z3c.recipe.depgraph/trunk/CHANGES.txt	2009-11-04 12:58:04 UTC (rev 105477)
+++ z3c.recipe.depgraph/tags/0.4/CHANGES.txt	2009-11-04 17:58:49 UTC (rev 105481)
@@ -1,28 +0,0 @@
-Changelog
-=========
-
-0.4 (unreleased)
-----------------
-
-
-0.3 (2009-07-23)
-----------------
-
-- Allow to pass in a ``package-map`` manually, mapping distribution names
-  to different package names.
-
-- Added additional ``extras`` option, to control wether or not extra
-  dependencies (like test requirements) should be included.
-
-- Corrected distribution name discovery to preserve case.
-
-0.2 (2009-05-24)
-----------------
-
-- Do not use ``-d`` option for degenerate nodes for sccmap, as this
-  creates way too much extra information.
-
-0.1 (2009-04-26)
-----------------
-
-- Initial implementation.

Copied: z3c.recipe.depgraph/tags/0.4/CHANGES.txt (from rev 105480, z3c.recipe.depgraph/trunk/CHANGES.txt)
===================================================================
--- z3c.recipe.depgraph/tags/0.4/CHANGES.txt	                        (rev 0)
+++ z3c.recipe.depgraph/tags/0.4/CHANGES.txt	2009-11-04 17:58:49 UTC (rev 105481)
@@ -0,0 +1,35 @@
+Changelog
+=========
+
+0.4 (2009-10-04)
+----------------
+- Added additional ``formats`` option, to control in which fileformats the output
+  is generated. [WouterVH]
+
+- Added additional ``re-exclude``, ``dead-ends`` and ``re-dead-ends`` options,
+  to control used eggs more precisely.
+
+- Added additional ``strict`` option, if you want graphs only for eggs 
+  in eggs option.
+
+0.3 (2009-07-23)
+----------------
+
+- Allow to pass in a ``package-map`` manually, mapping distribution names
+  to different package names.
+
+- Added additional ``extras`` option, to control wether or not extra
+  dependencies (like test requirements) should be included.
+
+- Corrected distribution name discovery to preserve case.
+
+0.2 (2009-05-24)
+----------------
+
+- Do not use ``-d`` option for degenerate nodes for sccmap, as this
+  creates way too much extra information.
+
+0.1 (2009-04-26)
+----------------
+
+- Initial implementation.

Deleted: z3c.recipe.depgraph/tags/0.4/README.txt
===================================================================
--- z3c.recipe.depgraph/trunk/README.txt	2009-11-04 12:58:04 UTC (rev 105477)
+++ z3c.recipe.depgraph/tags/0.4/README.txt	2009-11-04 17:58:49 UTC (rev 105481)
@@ -1,30 +0,0 @@
-z3c.recipe.depgraph
-===================
-
-This buildout recipe generates dependency graphs for packages.
-
-Options
--------
-
-eggs
-  The eggs for which graphs are generated. All dependencies of the eggs are
-  automatically included.
-
-exclude
-  A list of eggs which should be excluded from the graph processing.
-
-extras
-  A boolean determining if extra requirements should be included. Defaults
-  to False.
-
-package-map
-  An buildout section containing a mapping of distribution names to package
-  names.
-
-variants
-  A whitespace separated list of variants of graphs to create. The available
-  options are:
-
-    base - The basic full graphs.
-    tred - The transitive reduction of the graphs.
-    scc - Extracts graphs of strongly connected components.

Copied: z3c.recipe.depgraph/tags/0.4/README.txt (from rev 105478, z3c.recipe.depgraph/trunk/README.txt)
===================================================================
--- z3c.recipe.depgraph/tags/0.4/README.txt	                        (rev 0)
+++ z3c.recipe.depgraph/tags/0.4/README.txt	2009-11-04 17:58:49 UTC (rev 105481)
@@ -0,0 +1,51 @@
+z3c.recipe.depgraph
+===================
+
+This buildout recipe generates dependency graphs for packages.
+
+Options
+-------
+
+eggs
+  The eggs for which graphs are generated. All dependencies of the eggs are
+  automatically included.
+
+exclude
+  A list of eggs which should be excluded from the graph processing.
+
+re-exclude
+  A list of eggs' regular expressions which should be excluded.
+
+dead-ends
+  A list of eggs which dependencies should be excluded.
+
+re-dead-ends
+  A list of eggs' regular expressions which dependencies should be excluded.
+
+extras
+  A boolean determining if extra requirements should be included. Defaults
+  to False.
+
+package-map
+  An buildout section containing a mapping of distribution names to package
+  names.
+
+variants
+  A whitespace separated list of variants of graphs to create. The available
+  options are::
+
+    base - The basic full graphs.
+    tred - The transitive reduction of the graphs.
+    scc - Extracts graphs of strongly connected components.
+
+formats
+  A whitespace separated list of output-formats to create. Defaults to svg.
+  Please consult the manpages for the dot-command or visit the graphviz-website
+  for a full list_. Most commonly used options are::
+
+    svg - Scalable Vector Graphics
+    png - Portable Network Graphics
+    gif - Graphics Interchange Format
+
+
+ .. _list: http://www.graphviz.org/cvs/doc/info/output.html

Deleted: z3c.recipe.depgraph/tags/0.4/setup.py
===================================================================
--- z3c.recipe.depgraph/trunk/setup.py	2009-11-04 12:58:04 UTC (rev 105477)
+++ z3c.recipe.depgraph/tags/0.4/setup.py	2009-11-04 17:58:49 UTC (rev 105481)
@@ -1,37 +0,0 @@
-from setuptools import setup, find_packages
-
-
-setup(
-    name='z3c.recipe.depgraph',
-    version = '0.4dev',
-    author='Zope Community',
-    author_email='zope-dev at zope.org',
-    description='Buildout recipe to generate dependency graphs.',
-    url='http://pypi.python.org/pypi/z3c.recipe.depgraph',
-    long_description= (
-        open('README.txt').read()
-        + '\n\n'
-        + open('CHANGES.txt').read()),
-    keywords = "egg dependency",
-    classifiers = [
-        'Intended Audience :: Developers',
-        'License :: OSI Approved :: Zope Public License',
-        'Programming Language :: Python',
-        'Operating System :: OS Independent',
-        ],
-    license='ZPL 2.1',
-    packages=find_packages('src'),
-    package_dir = {'': 'src'},
-    namespace_packages=['z3c', 'z3c.recipe'],
-    install_requires=[
-        'setuptools',
-        'zc.buildout',
-        'zc.recipe.egg',
-        'tl.eggdeps',
-        ],
-    entry_points = {
-        'zc.buildout': ['default = z3c.recipe.depgraph.recipe:Recipe'],
-        },
-    include_package_data = True,
-    zip_safe = False,
-)

Copied: z3c.recipe.depgraph/tags/0.4/setup.py (from rev 105480, z3c.recipe.depgraph/trunk/setup.py)
===================================================================
--- z3c.recipe.depgraph/tags/0.4/setup.py	                        (rev 0)
+++ z3c.recipe.depgraph/tags/0.4/setup.py	2009-11-04 17:58:49 UTC (rev 105481)
@@ -0,0 +1,37 @@
+from setuptools import setup, find_packages
+
+
+setup(
+    name='z3c.recipe.depgraph',
+    version = '0.4',
+    author='Zope Community',
+    author_email='zope-dev at zope.org',
+    description='Buildout recipe to generate dependency graphs.',
+    url='http://pypi.python.org/pypi/z3c.recipe.depgraph',
+    long_description= (
+        open('README.txt').read()
+        + '\n\n'
+        + open('CHANGES.txt').read()),
+    keywords = "egg dependency",
+    classifiers = [
+        'Intended Audience :: Developers',
+        'License :: OSI Approved :: Zope Public License',
+        'Programming Language :: Python',
+        'Operating System :: OS Independent',
+        ],
+    license='ZPL 2.1',
+    packages=find_packages('src'),
+    package_dir = {'': 'src'},
+    namespace_packages=['z3c', 'z3c.recipe'],
+    install_requires=[
+        'setuptools',
+        'zc.buildout',
+        'zc.recipe.egg',
+        'tl.eggdeps',
+        ],
+    entry_points = {
+        'zc.buildout': ['default = z3c.recipe.depgraph.recipe:Recipe'],
+        },
+    include_package_data = True,
+    zip_safe = False,
+)

Deleted: z3c.recipe.depgraph/tags/0.4/src/z3c/recipe/depgraph/recipe.py
===================================================================
--- z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/recipe.py	2009-11-04 12:58:04 UTC (rev 105477)
+++ z3c.recipe.depgraph/tags/0.4/src/z3c/recipe/depgraph/recipe.py	2009-11-04 17:58:49 UTC (rev 105481)
@@ -1,79 +0,0 @@
-import os
-
-from zc.buildout import easy_install
-from zc.recipe.egg import Egg
-
-EXCLUDE_PACKAGES = set((
-    'lxml',
-    'pytz',
-    'setuptools',
-    'tl.eggdeps',
-    'z3c.recipe.depgraph',
-    'zc.buildout',
-    'zc.recipe.egg',
-))
-
-
-class Recipe(object):
-
-    def __init__(self, buildout, name, options):
-        self.buildout = buildout
-        self.name = name
-        self.options = options
-        self.egg = Egg(buildout, options['recipe'], options)
-        exclude = self.options.get('exclude', '')
-        self.exclude = set(exclude.split())
-        self.output = self.options.get(
-            'output', os.path.join(
-            self.buildout['buildout']['parts-directory'], self.name))
-        extras = self.options.get('extras', 'false')
-        self.extras = extras.lower() in ('1', 'true', 'yes')
-
-    def install(self):
-        options = self.options
-        reqs, ws = self.egg.working_set(['z3c.recipe.depgraph'])
-
-        if not os.path.exists(self.output):
-            os.mkdir(self.output)
-
-        variants = options.get('variants', 'base tred scc')
-        variants = [v.strip() for v in variants.split()]
-
-        # Install an interpreter
-        packages = set([dist.project_name for dist in ws.by_key.values()])
-        packages = packages - EXCLUDE_PACKAGES - self.exclude
-        packages = list(packages)
-
-        # Allow to map distribution names to different package names
-        pmap = dict()
-        package_map = options.get('package-map', '').strip()
-        if package_map:
-            pmap = self.buildout[package_map]
-        packages.sort()
-
-        easy_install.scripts(
-            [('graph-%s' % self.name, 'z3c.recipe.depgraph.runner', 'main')],
-            ws, options['executable'], options['bin-directory'],
-            arguments=dict(
-                packages=packages,
-                package_map=package_map,
-                name=self.name,
-                path=self.output,
-                variants=variants,
-                extras=self.extras,
-                ),
-            )
-
-        reqs = ['tl.eggdeps']
-        scripts = {
-            'eggdeps' : '%s-eggdeps' % self.name
-        }
-
-        easy_install.scripts(
-            reqs, ws, options['executable'], options['bin-directory'],
-            scripts=scripts,
-            )
-        return self.output
-
-    def update(self):
-        self.install()

Copied: z3c.recipe.depgraph/tags/0.4/src/z3c/recipe/depgraph/recipe.py (from rev 105478, z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/recipe.py)
===================================================================
--- z3c.recipe.depgraph/tags/0.4/src/z3c/recipe/depgraph/recipe.py	                        (rev 0)
+++ z3c.recipe.depgraph/tags/0.4/src/z3c/recipe/depgraph/recipe.py	2009-11-04 17:58:49 UTC (rev 105481)
@@ -0,0 +1,122 @@
+import os
+import re
+
+from zc.buildout import easy_install
+from zc.recipe.egg import Egg
+
+EXCLUDE_PACKAGES = set((
+    'lxml',
+    'pytz',
+    'setuptools',
+    'tl.eggdeps',
+    'z3c.recipe.depgraph',
+    'zc.buildout',
+    'zc.recipe.egg',
+))
+
+
+class Recipe(object):
+
+    def __init__(self, buildout, name, options):
+        self.buildout = buildout
+        self.name = name
+        self.options = options
+        self.egg = Egg(buildout, options['recipe'], options)
+        self.eggs = self.options.get('eggs', '').split()
+        self.strict = self.options.get('strict', '').lower() in ('1', 'true', 'yes')
+
+        exclude = self.options.get('exclude', '')
+        re_exclude = self.options.get('re-exclude', '')
+        dead_ends = self.options.get('dead-ends', '')
+        re_dead_ends = self.options.get('re-dead-ends', '')
+
+        self.exclude = set(exclude.split())
+        self.re_exclude = set(re_exclude.split())
+        self.dead_ends = set(dead_ends.split())
+        self.re_dead_ends = set(re_dead_ends.split())
+
+        self.output = self.options.get(
+            'output', os.path.join(
+                self.buildout['buildout']['parts-directory'], self.name))
+        extras = self.options.get('extras', 'false')
+        self.extras = extras.lower() in ('1', 'true', 'yes')
+        self.formats = self.options.get('formats', 'svg').split()
+
+    def install(self):
+        options = self.options
+        reqs, ws = self.egg.working_set(['z3c.recipe.depgraph'])
+
+        if not os.path.exists(self.output):
+            os.mkdir(self.output)
+
+        variants = options.get('variants', 'base tred scc')
+        variants = [v.strip() for v in variants.split()]
+
+
+        def matcher(names, patterns):
+            names = set(names)
+            matched_names = set()
+            compiled_patterns = [re.compile(pattern) for pattern in patterns]
+
+            def match(name, compiled_patterns):
+                for pattern in compiled_patterns:
+                    if pattern.search(name):
+                         # matching one pattern is sufficient
+                        matched_names.add(name)
+                        return
+
+            for name in names:
+                match(name, compiled_patterns)
+            return matched_names
+
+        if self.strict:
+            # use only eggs in the list
+            packages = self.eggs
+
+        else:
+            # Install an interpreter to find eggs
+            packages = set([dist.project_name for dist in ws.by_key.values()])
+            # Remove eggs listed in exclude option
+            packages = packages - EXCLUDE_PACKAGES - self.exclude
+            # Remove eggs listed in re-exclude option
+            packages = packages - matcher(packages, self.re_exclude)
+            packages = list(packages)
+
+        # Allow to map distribution names to different package names
+        pmap = dict()
+        package_map = options.get('package-map', '').strip()
+        if package_map:
+            pmap = self.buildout[package_map]
+        packages.sort()
+
+        easy_install.scripts(
+            [('graph-%s' % self.name, 'z3c.recipe.depgraph.runner', 'main')],
+            ws, options['executable'], options['bin-directory'],
+            arguments=dict(
+                packages=packages,
+                package_map=package_map,
+                name=self.name,
+                path=self.output,
+                variants=variants,
+                formats=self.formats,
+                extras=self.extras,
+                exclude = self.exclude,
+                re_exclude = self.re_exclude,
+                dead_ends = self.dead_ends,
+                re_dead_ends = self.re_dead_ends
+                ),
+        )
+
+        reqs = ['tl.eggdeps']
+        scripts = {
+            'eggdeps' : '%s-eggdeps' % self.name
+        }
+
+        easy_install.scripts(
+            reqs, ws, options['executable'], options['bin-directory'],
+            scripts=scripts,
+        )
+        return self.output
+
+    def update(self):
+        self.install()

Deleted: z3c.recipe.depgraph/tags/0.4/src/z3c/recipe/depgraph/runner.py
===================================================================
--- z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/runner.py	2009-11-04 12:58:04 UTC (rev 105477)
+++ z3c.recipe.depgraph/tags/0.4/src/z3c/recipe/depgraph/runner.py	2009-11-04 17:58:49 UTC (rev 105481)
@@ -1,63 +0,0 @@
-import os
-
-GENERATE = "./bin/%(scriptname)s %(extras)s-d %(package)s -i setuptools > %(output)s"
-TRED = "tred %(input)s > %(output)s"
-GRAPH = "dot -Tsvg %(input)s > %(output)s"
-SCCMAP = "sccmap %(input)s > %(output)s"
-SCCGRAPH = "dot -Tsvg %(input)s -O"
-
-
-def execute(template, **kwargs):
-    os.system(template % kwargs)
-
-
-def main(args):
-    name = args.get('name')
-    packages = args.get('packages')
-    package_map = args.get('package_map')
-    path = args.get('path')
-    scriptname = name + '-eggdeps'
-    variants = args.get('variants', ['base', 'tred', 'scc'])
-    extras = args.get('extras')
-
-    for package in packages:
-        name = package
-        if name in package_map:
-            name = package_map[name]
-        deeppath = os.path.join(path, name.replace('.', os.sep))
-
-        if not os.path.exists(deeppath):
-            os.makedirs(deeppath)
-
-        if extras:
-            extras = '-x '
-        else:
-            extras = ''
-
-        specfile = os.path.join(deeppath, 'spec')
-        execute(GENERATE,
-            extras=extras,
-            scriptname=scriptname,
-            package=package,
-            output=specfile + '.dot')
-
-        execute(GRAPH,
-            input=specfile + '.dot',
-            output=specfile + '.svg')
-
-        if 'tred' in variants:
-            execute(TRED,
-                input=specfile + '.dot',
-                output=specfile + '-tred.dot')
-
-            execute(GRAPH,
-                input=specfile + '-tred.dot',
-                output=specfile + '-tred.svg')
-
-        if 'scc' in variants:
-            execute(SCCMAP,
-                input=specfile + '.dot',
-                output=specfile + '-sccmap')
-
-            execute(SCCGRAPH,
-                input=specfile + '-sccmap')

Copied: z3c.recipe.depgraph/tags/0.4/src/z3c/recipe/depgraph/runner.py (from rev 105478, z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/runner.py)
===================================================================
--- z3c.recipe.depgraph/tags/0.4/src/z3c/recipe/depgraph/runner.py	                        (rev 0)
+++ z3c.recipe.depgraph/tags/0.4/src/z3c/recipe/depgraph/runner.py	2009-11-04 17:58:49 UTC (rev 105481)
@@ -0,0 +1,85 @@
+import os
+
+GENERATE = "./bin/%(scriptname)s %(exclude)s %(re_exclude)s %(dead_ends)s %(re_dead_ends)s %(extras)s-d %(package)s -i setuptools > %(output)s"
+TRED = "tred %(input)s > %(output)s"
+GRAPH = "dot -T%(format)s %(input)s > %(output)s"
+SCCMAP = "sccmap %(input)s > %(output)s"
+SCCGRAPH = "dot -T%(format)s %(input)s -O"
+
+
+def execute(template, **kwargs):
+    os.system(template % kwargs)
+
+
+def build_option(option, pattern):
+    result = ''
+    for i in pattern:
+        result += '%s %s ' % (option, i)
+    return result
+
+
+def main(args):
+    name = args.get('name')
+    packages = args.get('packages')
+    package_map = args.get('package_map')
+    path = args.get('path')
+    scriptname = name + '-eggdeps'
+    variants = args.get('variants', ['base', 'tred', 'scc'])
+    formats = args.get('formats', ['svg'])
+    extras = args.get('extras')
+    exclude = build_option('-i', args.get('exclude'))
+    re_exclude = build_option('-I', args.get('re_exclude'))
+    dead_ends = build_option('-e', args.get('dead_ends'))
+    re_dead_ends = build_option('-E', args.get('re_dead_ends'))
+
+    for package in packages:
+        name = package
+        if name in package_map:
+            name = package_map[name]
+        deeppath = os.path.join(path, name.replace('.', os.sep))
+
+        if not os.path.exists(deeppath):
+            os.makedirs(deeppath)
+
+        if extras:
+            extras = '-x '
+        else:
+            extras = ''
+
+        specfile = os.path.join(deeppath, 'spec')
+        execute(GENERATE,
+            extras=extras,
+            scriptname=scriptname,
+            package=package,
+            exclude=exclude,
+            re_exclude=re_exclude,
+            dead_ends=dead_ends,
+            re_dead_ends=re_dead_ends,
+            output=specfile + '.dot')
+
+        for format in formats:
+            execute(GRAPH,
+                format=format,
+                input=specfile + '.dot',
+                output=specfile + '.%s' % format)
+
+        if 'tred' in variants:
+            execute(TRED,
+                input=specfile + '.dot',
+                output=specfile + '-tred.dot')
+
+            for format in formats:
+                execute(GRAPH,
+                    format=format,
+                    input=specfile + '-tred.dot',
+                    output=specfile + '-tred.%s' % format)
+
+        if 'scc' in variants:
+            execute(SCCMAP,
+                input=specfile + '.dot',
+                output=specfile + '-sccmap')
+
+            for format in formats:
+                execute(SCCGRAPH,
+                    format=format,
+                    input=specfile + '-sccmap')



More information about the checkins mailing list