# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# File : IDLparser.py
-# Module : SALOME
-
-import string, sys, fpformat, re, os
+import os
+import os.path as osp
+import re
import xml.sax
-import pdb
from xml.sax.handler import *
from omniidl import idlast, idltype, idlvisitor, idlutil, output
"COMP_TYPE" : "",
"COMP_NAME" : "",
"COMP_UNAME" : "",
- "COMP_MULT" : "",
"COMP_IMPL" : ""
}
def output_xml(self, f, depth=0):
d = depth
if self.name != '':
- s = string.ljust('', 4*depth)
+ s = ''.ljust(4*depth)
s += '<' + self.name
for k,v in list(self.attrs.items()):
s += ' ' + k + '="' + v + '"'
if self.name != '':
s = '</' + self.name + '>\n'
if len(self.childs) > 0 :
- s = string.ljust('', 4*depth) + s
+ s = ''.ljust(4*depth) + s
f.write(s)
def Dump(self, levels=-1, depth=0):
if levels == 0: return
- s = string.ljust('', 4*depth)
+ s = ''.ljust(4*depth)
print(s, self, self.content)
for i in self.childs:
i.Dump(levels-1, depth+1)
self.addNamedChild('component-author', common_data["AUTHOR"])
self.addNamedChild('component-version', common_data["VERSION"])
self.addNamedChild('component-comment', 'unknown')
- self.addNamedChild('component-multistudy', common_data["COMP_MULT"])
self.addNamedChild('component-impltype', common_data["COMP_IMPL"])
self.addNamedChild('component-icone', common_data["ICON"])
self.addNamedChild('constraint')
for i in ['component-username', 'component-author',
'component-type', 'component-icone', 'component-version',
- 'component-multistudy', 'component-impltype', 'constraint']:
+ 'component-impltype', 'constraint']:
ext = C.getChild(i)
int = self.getChild(i)
if int is None:
self.buffer = ''
def endElement(self, name):
- self.buffer = string.join(string.split(self.buffer), ' ')
+ self.buffer = ' '.join(self.buffer.split())
p = self.list[len(self.list)-1]
p.content = self.buffer
if name == 'component':
def visitStringType(self, type):
self.currentType = "string"
+ def visitWStringType(self, type):
+ self.currentType = "wstring"
+
def visitParameter(self, node):
node.paramType().accept(self)
if node.is_in():
common_data["COMP_NAME"] = getParamValue("name", "", args)
common_data["COMP_UNAME"] = getParamValue("username", "", args)
common_data["COMP_TYPE"] = getParamValue("type", "OTHER", args)
- common_data["COMP_MULT"] = getParamValue("multistudy", "1", args)
common_data["COMP_IMPL"] = getParamValue("impltype", "1", args)
print(common_data)
#==================================================
- if (os.path.exists(CatalogFileName)):
+ if (osp.exists(CatalogFileName)):
print("Importing", CatalogFileName)
C = Catalog(CatalogFileName)
else:
if remove_comp :
C.removeComponent(remove_comp)
- if (os.path.exists(CatalogFileName)):
+ if (osp.exists(CatalogFileName)):
print("Updating", CatalogFileName)
CatalogFileName_old = CatalogFileName + '_old'
os.rename(CatalogFileName, CatalogFileName_old)
f.close()
os.rename(CatalogFileName_new, CatalogFileName)
- if ((CatalogFileName_old != "") & os.path.exists(CatalogFileName_old)):
+ if ((CatalogFileName_old != "") & osp.exists(CatalogFileName_old)):
os.unlink(CatalogFileName_old)
print()
if __name__ == "__main__":
print()
- print("Usage : omniidl -bIDLparser [-I<catalog files directory>]* -Wbcatalog=<my_catalog.xml>[,icon=<pngfile>][,version=<num>][,author=<name>][,name=<component_name>][,username=<component_username>][,multistudy=<component_multistudy>][,impltype=<implementation type : 0 (python), 1 (C++)>] <file.idl>")
+ print("Usage : omniidl -bIDLparser [-I<catalog files directory>]* -Wbcatalog=<my_catalog.xml>[,icon=<pngfile>][,version=<num>][,author=<name>][,name=<component_name>][,username=<component_username>][,impltype=<implementation type : 0 (python), 1 (C++)>] <file.idl>")
print()