goa/tools/generate_schema_img.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 24 Jul 2009 17:50:31 +0200
changeset 2493 9806571ea790
parent 2126 a25859917ccc
child 4212 ab6573088b4a
permissions -rw-r--r--
major refactoring of database dump/restore: * new hooks server_backup/server_restore called to allow cubes to add custom stuff to backup * each source may be backuped/restored * new --restore-all option to restore to restore everything, not only the system database (still the default behaviour)

"""

:organization: Logilab
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
"""
import sys
from os.path import dirname, abspath, join
from yams import schema2dot
from cubicweb.web.views.schema import SKIP_TYPES

APPLROOT = abspath(join(dirname(abspath(__file__)), '..'))

try:
    import custom
except ImportError:
    sys.path.insert(0, APPLROOT)
    import custom


schema = custom.SCHEMA
skip_rels = ('owned_by', 'created_by', 'identity', 'is', 'is_instance_of')
path = join(APPLROOT, 'data', 'schema.png')
schema2dot.schema2dot(schema, path, #size=size,
                      skiptypes=SKIP_TYPES)
print 'generated', path
path = join(APPLROOT, 'data', 'metaschema.png')
schema2dot.schema2dot(schema, path)
print 'generated', path