summaryrefslogtreecommitdiff
path: root/config/makeprops.py
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2014-09-02 14:22:34 +0200
committerJose <jose@zeroc.com>2014-09-02 14:22:34 +0200
commitfef794cdd1f8eb698fa3ccfe6f4cacba88030e9d (patch)
tree8e0c3c353dbbaa57d60a1da49c13b4153e918763 /config/makeprops.py
parentFix (ICE-3445) - consider not installing internal header files (diff)
downloadice-fef794cdd1f8eb698fa3ccfe6f4cacba88030e9d.tar.bz2
ice-fef794cdd1f8eb698fa3ccfe6f4cacba88030e9d.tar.xz
ice-fef794cdd1f8eb698fa3ccfe6f4cacba88030e9d.zip
Fixed (ICE-5654) - Update JS mapping to not use global types in NodeJS
Diffstat (limited to 'config/makeprops.py')
-rwxr-xr-xconfig/makeprops.py51
1 files changed, 24 insertions, 27 deletions
diff --git a/config/makeprops.py b/config/makeprops.py
index 7ed4fb68e94..5ccc81399e8 100755
--- a/config/makeprops.py
+++ b/config/makeprops.py
@@ -53,9 +53,9 @@ struct Property
const char* deprecatedBy;
Property(const char* n, bool d, const char* b) :
- pattern(n),
- deprecated(d),
- deprecatedBy(b)
+ pattern(n),
+ deprecated(d),
+ deprecatedBy(b)
{
}
@@ -116,18 +116,15 @@ namespace IceInternal
"""
jsPreamble = commonPreamble + """
-(function(global){
- var Ice = global.Ice || Ice;
- require("Ice/Property");
- var %(classname)s = {};
- var Property = Ice.Property;
+var Ice = require("../Ice/Property").Ice;
+var %(classname)s = {};
+var Property = Ice.Property;
"""
jsEpilogue = \
"""
- Ice.%(classname)s = %(classname)s;
- global.Ice = Ice;
-}(typeof (global) === "undefined" ? window : global));
+Ice.%(classname)s = %(classname)s;
+module.exports.Ice = Ice;
"""
def usage():
@@ -544,23 +541,23 @@ class JSPropertyHandler(PropertyHandler):
def startFiles(self):
self.srcFile = file(self.className + ".js", "wb")
self.srcFile.write(jsPreamble % {'inputfile' : self.inputfile, 'classname' : self.className})
- self.srcFile.write(" /* jshint -W044*/\n\n");
+ self.srcFile.write("/* jshint -W044*/\n\n");
def closeFiles(self):
- self.srcFile.write(" /* jshint +W044*/\n\n");
- self.srcFile.write(" %s.validProps =\n" % (self.className))
- self.srcFile.write(" [\n")
+ self.srcFile.write("/* jshint +W044*/\n\n");
+ self.srcFile.write("%s.validProps =\n" % (self.className))
+ self.srcFile.write("[\n")
for s in self.sections:
if s in self.validSections:
- self.srcFile.write(" %s.%sProps,\n" % (self.className, s))
- self.srcFile.write(" ];\n\n")
+ self.srcFile.write(" %s.%sProps,\n" % (self.className, s))
+ self.srcFile.write("];\n\n")
- self.srcFile.write(" %s.clPropNames =\n" % (self.className))
- self.srcFile.write(" [\n")
+ self.srcFile.write("%s.clPropNames =\n" % (self.className))
+ self.srcFile.write("[\n")
for s in self.cmdLineOptions:
if s in self.validSections:
- self.srcFile.write(" \"%s\",\n" % s)
- self.srcFile.write(" ];\n")
+ self.srcFile.write(" \"%s\",\n" % s)
+ self.srcFile.write("];\n")
self.srcFile.write(jsEpilogue % {'classname' : self.className});
self.srcFile.close()
@@ -571,28 +568,28 @@ class JSPropertyHandler(PropertyHandler):
def deprecatedImpl(self, propertyName):
if self.currentSection in self.validSections:
- self.srcFile.write(" new Property(\"/^%s\.%s/\", true, null),\n" % (self.currentSection, \
+ self.srcFile.write(" new Property(\"/^%s\.%s/\", true, null),\n" % (self.currentSection, \
self.fix(propertyName)))
def deprecatedImplWithReplacementImpl(self, propertyName, deprecatedBy):
if self.currentSection in self.validSections:
- self.srcFile.write(" new Property(\"/^%s\.%s/\", true, \"%s\"),\n" % \
+ self.srcFile.write(" new Property(\"/^%s\.%s/\", true, \"%s\"),\n" % \
(self.currentSection, self.fix(propertyName), deprecatedBy))
def propertyImpl(self, propertyName):
if self.currentSection in self.validSections:
- self.srcFile.write(" new Property(\"/^%s\.%s/\", false, null),\n" % (self.currentSection, \
+ self.srcFile.write(" new Property(\"/^%s\.%s/\", false, null),\n" % (self.currentSection, \
self.fix(propertyName)))
def newSection(self):
if self.currentSection in self.validSections:
self.skipSection = False
- self.srcFile.write(" %s.%sProps =\n" % (self.className, self.currentSection));
- self.srcFile.write(" [\n")
+ self.srcFile.write("%s.%sProps =\n" % (self.className, self.currentSection));
+ self.srcFile.write("[\n")
def closeSection(self):
if self.currentSection in self.validSections:
- self.srcFile.write(" ];\n")
+ self.srcFile.write("];\n")
self.srcFile.write("\n")
def moveFiles(self, location):