[commit] r1637 - trunk/Install/Build

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Fri Oct 14 16:18:08 CDT 2011


Author: ksmyth
Date: Fri Oct 14 16:18:08 2011
New Revision: 1637

Log:
Read GUID from mta instead of registry

Modified:
   trunk/Install/Build/build.py
   trunk/Install/Build/tools.py

Modified: trunk/Install/Build/build.py
==============================================================================
--- trunk/Install/Build/build.py	Fri Oct 14 15:32:27 2011	(r1636)
+++ trunk/Install/Build/build.py	Fri Oct 14 16:18:08 2011	(r1637)
@@ -19,6 +19,17 @@
 #
 GME_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
 
+paradigms_root = os.path.join(GME_ROOT, "Paradigms")
+METAGME_XMP = os.path.join(paradigms_root, "MetaGME", "MetaGME.xmp")
+UML_XMP = os.path.join(paradigms_root, "UML", "UML.xmp")
+SF_XMP = os.path.join(paradigms_root, "SF", "SF.xmp")
+HFSM_XMP = os.path.join(paradigms_root, "HFSM", "HFSM.xmp")
+def replace_ext(file, newext):
+    import os.path
+    return os.path.splitext(file)[0] + "." + newext
+def mta_for_xmp(file):
+    return replace_ext(file, "mta")
+
 #
 # Build steps
 #
@@ -163,8 +174,7 @@
 def generate_meta_files():
     "Generate meta files (mta/mga)"
     meta_root = os.path.join(GME_ROOT, "Paradigms", "MetaGME")
-    meta_file = os.path.join(meta_root, "MetaGME.xmp")
-    tools.xmp2mta(meta_file, "MetaGME")
+    tools.xmp2mta(METAGME_XMP, "MetaGME")
     meta_file = os.path.join(meta_root, "MetaGME-model.xme")
     tools.xme2mga(meta_file, "MetaGME")
 
@@ -176,16 +186,14 @@
     # SF Paradigm
     sample_file = os.path.join(samples_root, "SF", "SFMeta.xme")
     tools.xme2mga(sample_file, "MetaGME")
-    sample_file = os.path.join(samples_root, "SF", "SF.xmp")
-    tools.xmp2mta(sample_file, "SF") 
+    tools.xmp2mta(SF_XMP, "SF") 
     sample_file = os.path.join(samples_root, "SF", "SFDemo.xme")
     tools.xme2mga(sample_file, "SF")
 
     # HFSM Paradigm
     sample_file = os.path.join(samples_root, "HFSM", "HFSM-Meta.xme")
     tools.xme2mga(sample_file, "MetaGME")
-    sample_file = os.path.join(samples_root, "HFSM", "HFSM.xmp")
-    tools.xmp2mta(sample_file, "HFSM") 
+    tools.xmp2mta(HFSM_XMP, "HFSM") 
     sample_file = os.path.join(samples_root, "HFSM", "HFSM-Demo01.xme")
     tools.xme2mga(sample_file, "HFSM")
     sample_file = os.path.join(samples_root, "HFSM", "HFSM-Demo02.xme")
@@ -194,8 +202,7 @@
     # UML Paradigm
     sample_file = os.path.join(samples_root, "UML", "UMLMeta.xme")
     tools.xme2mga(sample_file, "MetaGME")
-    sample_file = os.path.join(samples_root, "UML", "UML.xmp")
-    tools.xmp2mta(sample_file, "UML")
+    tools.xmp2mta(UML_XMP, "UML")
 
 
 def build_msi():
@@ -206,10 +213,10 @@
     print >> f, "<!-- DO NOT EDIT THIS FILE. WILL BE REGENERATED BY THE BUILD SCRIPTS -->"
     print >> f, "<Include>"
     print >> f, "   <?define VERSIONSTR='%s' ?>" % (prefs["version_string"])
-    print >> f, "   <?define GUIDSTRMETAGME='%s' ?>" % (tools.query_GUID("MetaGME"))
-    print >> f, "   <?define GUIDSTRHFSM='%s' ?>" % (tools.query_GUID("HFSM")) 
-    print >> f, "   <?define GUIDSTRSF='%s' ?>" % (tools.query_GUID("SF"))
-    print >> f, "   <?define GUIDSTRUML='%s' ?>" % (tools.query_GUID("UML"))
+    print >> f, "   <?define GUIDSTRMETAGME='%s' ?>" % (tools.query_GUID(mta_for_xmp(METAGME_XMP)))
+    print >> f, "   <?define GUIDSTRHFSM='%s' ?>" % (tools.query_GUID(mta_for_xmp(HFSM_XMP)))
+    print >> f, "   <?define GUIDSTRSF='%s' ?>" % (tools.query_GUID(mta_for_xmp(SF_XMP)))
+    print >> f, "   <?define GUIDSTRUML='%s' ?>" % (tools.query_GUID(mta_for_xmp(UML_XMP)))
     print >> f, "</Include>" 
     f.close()
    

Modified: trunk/Install/Build/tools.py
==============================================================================
--- trunk/Install/Build/tools.py	Fri Oct 14 15:32:27 2011	(r1636)
+++ trunk/Install/Build/tools.py	Fri Oct 14 16:18:08 2011	(r1637)
@@ -153,19 +153,21 @@
     regsitrar.RegisterParadigmFromData( "XML=" + xml_file, paradigm, 2 )
 
 
-def query_GUID(paradigm ):
+def query_GUID(mta_file):
     """
     Queries the current GUID of the specified paradigm.
-    In order to work properly the paradigm must be registered (system-wide)
-    before (see: xmp2mta).
     params
         paradigm    : the name of the paradigm to be queried
     
     returns the GUID as a string
     """ 
-    regsitrar = win32com.client.Dispatch( "MGA.MgaRegistrar" )
-    return regsitrar.ParadigmGUIDString(2, paradigm)
-
+    metaproject = win32com.client.Dispatch("MGA.MgaMetaProject")
+    metaproject.Open('MGA=' + mta_file)
+    try:
+        import uuid
+        return '{' + str(uuid.UUID(bytes_le=metaproject.GUID)).upper() + '}'
+    finally:
+        metaproject.Close()
 
 def test_WiX():
     "Test for WiX. Raises exception if not found."


More information about the gme-commit mailing list