# Copyright (c) 2000-2004 LOGILAB S.A. (Paris, FRANCE). # http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. """generate a xmi-uml database and an argouml project file if a diagrams definiton is given (see diadef.dtd), the matching pgml file are generated, """ __revision__ = '$Id: pyargo.py,v 1.27 2005/04/15 11:00:41 syt Exp $' from pyreverse.utils import RunHelper from logilab.common.astng.inspector import Linker from pyreverse.visitors.xmi_uml import XMIUMLVisitor from pyreverse.extensions.diadefslib import DiadefsHandler from pyreverse.extensions.argoutils import ArgoWriter class Run(RunHelper): """Main helper""" def __init__(self): self.visitor = XMIUMLVisitor() self.diadefs_h = DiadefsHandler() self.writer = ArgoWriter() RunHelper.__init__(self, "parse python sources files and extract an \ ArgoUML project files from them", (self.diadefs_h, self.visitor, self.writer)) def do_run(self, project): """link project, build xmi and then write the argo project""" linker = Linker(project, tag=1) linker.visit_project(project) # transform into xmi-uml xmi_doc = self.visitor.visit(project, linker.id_count) UUID_format = self.visitor.UUID_format diadefs = self.diadefs_h.get_diadefs(project, linker) # write argo uml files self.writer.write(project, xmi_doc, diadefs, UUID_format) if __name__ == "__main__": Run()