Michael Pasternak has uploaded a new change for review.

Change subject: codegen: compile generated sources
......................................................................

codegen: compile generated sources

compile generated sources so the changes will be visible
to the consuming code that already loaded this module

Change-Id: Ic90104ef9b86f6362a749246be6c87b1a8146577
Signed-off-by: Michael pasternak <mpast...@redhat.com>
---
M src/codegen/rsdl/rsdlcodegen.py
M src/codegen/xsd/xsdcodegen.py
2 files changed, 14 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-sdk refs/changes/88/17688/1

diff --git a/src/codegen/rsdl/rsdlcodegen.py b/src/codegen/rsdl/rsdlcodegen.py
index 0d3a3f4..a7467b1 100644
--- a/src/codegen/rsdl/rsdlcodegen.py
+++ b/src/codegen/rsdl/rsdlcodegen.py
@@ -265,7 +265,7 @@
                     sub_root_coll = StringUtils.toSingular(
                            root_coll, 
RsdlCodegen.COLLECTION_TO_ENTITY_EXCEPTIONS
                     ) + self.__toResourceType(sub_coll)
-                    sub_res_coll = self.__toResourceType(resources.keys()[i-1])
+                    sub_res_coll = self.__toResourceType(resources.keys()[i - 
1])
 
                     if (v is None and self.__isCollection(link)):
                         self.__extendSubCollection(sub_root_coll, 
sub_res_coll, url, rel, http_method,
@@ -536,3 +536,11 @@
         @param path: path to clean
         '''
         FileUtils.delete(RsdlCodegen.BROKERS_FILE)
+
+    def doPreGenerate(self):
+        '''
+        Pre-generate call
+        '''
+
+        # refreshes previously generated sources
+        reload(params)
diff --git a/src/codegen/xsd/xsdcodegen.py b/src/codegen/xsd/xsdcodegen.py
index acdd7c0..5b1de65 100644
--- a/src/codegen/xsd/xsdcodegen.py
+++ b/src/codegen/xsd/xsdcodegen.py
@@ -17,6 +17,7 @@
 from codegen.xsd.abstractxsdcodegen import AbstractXsdCodegen
 from codegen.utils.fileutils import FileUtils
 from codegen.xsd.genparams import paramsHandle
+import py_compile
 
 class XsdCodegen(AbstractXsdCodegen):
     '''
@@ -66,3 +67,7 @@
 
         FileUtils.delete(XsdCodegen.XML_PARAMS_TMP_FILE)
         FileUtils.delete(XsdCodegen.SCHEMA_TMP_FILE)
+
+        # compile generated sources so the changes will be visible
+        # to the consuming code that already loaded this module
+        py_compile.compile(self.path)


-- 
To view, visit http://gerrit.ovirt.org/17688
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic90104ef9b86f6362a749246be6c87b1a8146577
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-sdk
Gerrit-Branch: master
Gerrit-Owner: Michael Pasternak <mpast...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to