[Checkins] SVN: z3c.recipe.depgraph/trunk/ Initial implementation

Hanno Schlichting plone at hannosch.info
Mon Mar 30 18:24:39 EDT 2009


Log message for revision 98649:
  Initial implementation
  

Changed:
  _U  z3c.recipe.depgraph/trunk/
  A   z3c.recipe.depgraph/trunk/CHANGES.txt
  A   z3c.recipe.depgraph/trunk/README.txt
  A   z3c.recipe.depgraph/trunk/setup.py
  A   z3c.recipe.depgraph/trunk/src/
  A   z3c.recipe.depgraph/trunk/src/z3c/
  A   z3c.recipe.depgraph/trunk/src/z3c/__init__.py
  A   z3c.recipe.depgraph/trunk/src/z3c/recipe/
  A   z3c.recipe.depgraph/trunk/src/z3c/recipe/__init__.py
  A   z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/
  A   z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/__init__.py
  A   z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/recipe.py
  A   z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/runner.py

-=-

Property changes on: z3c.recipe.depgraph/trunk
___________________________________________________________________
Added: svn:ignore
   + develop-eggs
eggs
fake-eggs
bin
parts
downloads
var
build
dist
local.cfg
*.egg-info
.installed.cfg
*.pyc
.Python
include
lib


Added: z3c.recipe.depgraph/trunk/CHANGES.txt
===================================================================
--- z3c.recipe.depgraph/trunk/CHANGES.txt	                        (rev 0)
+++ z3c.recipe.depgraph/trunk/CHANGES.txt	2009-03-30 22:24:38 UTC (rev 98649)
@@ -0,0 +1,7 @@
+Changelog
+=========
+
+0.1 (unreleased)
+----------------
+
+- Initial implementation.


Property changes on: z3c.recipe.depgraph/trunk/CHANGES.txt
___________________________________________________________________
Added: svn:eol-style
   + native

Added: z3c.recipe.depgraph/trunk/README.txt
===================================================================
--- z3c.recipe.depgraph/trunk/README.txt	                        (rev 0)
+++ z3c.recipe.depgraph/trunk/README.txt	2009-03-30 22:24:38 UTC (rev 98649)
@@ -0,0 +1,14 @@
+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.


Property changes on: z3c.recipe.depgraph/trunk/README.txt
___________________________________________________________________
Added: svn:eol-style
   + native

Added: z3c.recipe.depgraph/trunk/setup.py
===================================================================
--- z3c.recipe.depgraph/trunk/setup.py	                        (rev 0)
+++ z3c.recipe.depgraph/trunk/setup.py	2009-03-30 22:24:38 UTC (rev 98649)
@@ -0,0 +1,37 @@
+from setuptools import setup, find_packages
+
+
+setup(
+    name='z3c.recipe.depgraph',
+    version = '0.1dev',
+    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,
+)


Property changes on: z3c.recipe.depgraph/trunk/setup.py
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: z3c.recipe.depgraph/trunk/src
___________________________________________________________________
Added: svn:ignore
   + build
dist
*.egg-info
*.pyc


Added: z3c.recipe.depgraph/trunk/src/z3c/__init__.py
===================================================================
--- z3c.recipe.depgraph/trunk/src/z3c/__init__.py	                        (rev 0)
+++ z3c.recipe.depgraph/trunk/src/z3c/__init__.py	2009-03-30 22:24:38 UTC (rev 98649)
@@ -0,0 +1 @@
+__import__('pkg_resources').declare_namespace(__name__)


Property changes on: z3c.recipe.depgraph/trunk/src/z3c/__init__.py
___________________________________________________________________
Added: svn:eol-style
   + native

Added: z3c.recipe.depgraph/trunk/src/z3c/recipe/__init__.py
===================================================================
--- z3c.recipe.depgraph/trunk/src/z3c/recipe/__init__.py	                        (rev 0)
+++ z3c.recipe.depgraph/trunk/src/z3c/recipe/__init__.py	2009-03-30 22:24:38 UTC (rev 98649)
@@ -0,0 +1 @@
+__import__('pkg_resources').declare_namespace(__name__)
\ No newline at end of file


Property changes on: z3c.recipe.depgraph/trunk/src/z3c/recipe/__init__.py
___________________________________________________________________
Added: svn:eol-style
   + native

Added: z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/__init__.py
===================================================================
--- z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/__init__.py	                        (rev 0)
+++ z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/__init__.py	2009-03-30 22:24:38 UTC (rev 98649)
@@ -0,0 +1 @@
+#
\ No newline at end of file


Property changes on: z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/__init__.py
___________________________________________________________________
Added: svn:eol-style
   + native

Added: z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/recipe.py
===================================================================
--- z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/recipe.py	                        (rev 0)
+++ z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/recipe.py	2009-03-30 22:24:38 UTC (rev 98649)
@@ -0,0 +1,59 @@
+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))
+
+    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)
+
+        # Install an interpreter
+        packages = set(ws.by_key.keys()) - EXCLUDE_PACKAGES - self.exclude
+        packages = list(packages)
+        packages.sort()
+        easy_install.scripts(
+            [('graph-%s' % self.name, 'z3c.recipe.depgraph.runner', 'main')],
+            ws, options['executable'], options['bin-directory'],
+            arguments=dict(packages=packages, name=self.name, path=self.output),
+            )
+
+        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()


Property changes on: z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/recipe.py
___________________________________________________________________
Added: svn:eol-style
   + native

Added: z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/runner.py
===================================================================
--- z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/runner.py	                        (rev 0)
+++ z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/runner.py	2009-03-30 22:24:38 UTC (rev 98649)
@@ -0,0 +1,44 @@
+import os
+
+GENERATE = "./bin/%(scriptname)s -x -d %(package)s -i setuptools > %(output)s"
+TRED = "tred %(input)s > %(output)s"
+GRAPH = "dot -Tsvg %(input)s > %(output)s"
+
+PACKAGE_EXCEPTIONS = {
+    'Plone' : 'Products.CMFPlone',
+}
+
+def execute(template, **kwargs):
+    os.system(template % kwargs)
+
+
+def main(args):
+    name = args.get('name')
+    packages = args.get('packages')
+    path = args.get('path')
+    scriptname = name + '-eggdeps'
+
+    for package in packages:
+        package = PACKAGE_EXCEPTIONS.get(package, package)
+        deeppath = os.path.join(path, package.replace('.', os.sep))
+
+        if not os.path.exists(deeppath):
+            os.makedirs(deeppath)
+
+        specfile = os.path.join(deeppath, 'spec')
+        execute(GENERATE,
+            scriptname=scriptname,
+            package=package,
+            output=specfile + '.dot')
+
+        execute(GRAPH,
+            input=specfile + '.dot',
+            output=specfile + '.svg')
+
+        execute(TRED,
+            input=specfile + '.dot',
+            output=specfile + '-tred.dot')
+
+        execute(GRAPH,
+            input=specfile + '-tred.dot',
+            output=specfile + '-tred.svg')


Property changes on: z3c.recipe.depgraph/trunk/src/z3c/recipe/depgraph/runner.py
___________________________________________________________________
Added: svn:eol-style
   + native



More information about the Checkins mailing list