goa/tools/generate_schema_img.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 27 May 2009 16:36:17 +0200
branchstable
changeset 1967 28eed65ce1e6
parent 1802 d628defebc17
child 1977 606923dff11b
permissions -rw-r--r--
don't crash if inlined_relation is not defined on the form

import sys
from os.path import dirname, abspath, join
from yams import schema2dot

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,
                      skiprels=skip_rels, skipmeta=True)
print 'generated', path
path = join(APPLROOT, 'data', 'metaschema.png')
schema2dot.schema2dot(schema, path, #size=size,
                      skiprels=skip_rels, skipmeta=False)
print 'generated', path