From: Christian Van Wambeke Date: Wed, 25 Apr 2018 10:59:45 +0000 (+0200) Subject: fix contents pdf maxdepth and use sphinx 1.7.3 on is231761 X-Git-Tag: 5.1.0~30 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e6944fefa9328b002cf2b9792bf4c1780916ec55;p=tools%2Fsat.git fix contents pdf maxdepth and use sphinx 1.7.3 on is231761 --- diff --git a/doc/build/doctrees/commands/apidoc/modules.doctree b/doc/build/doctrees/commands/apidoc/modules.doctree index 253388e..7d6f90e 100644 Binary files a/doc/build/doctrees/commands/apidoc/modules.doctree and b/doc/build/doctrees/commands/apidoc/modules.doctree differ diff --git a/doc/build/doctrees/commands/apidoc/src.colorama.doctree b/doc/build/doctrees/commands/apidoc/src.colorama.doctree index 43692a1..1e7d19c 100644 Binary files a/doc/build/doctrees/commands/apidoc/src.colorama.doctree and b/doc/build/doctrees/commands/apidoc/src.colorama.doctree differ diff --git a/doc/build/doctrees/commands/apidoc/src.doctree b/doc/build/doctrees/commands/apidoc/src.doctree index be6c6d4..4ef126d 100644 Binary files a/doc/build/doctrees/commands/apidoc/src.doctree and b/doc/build/doctrees/commands/apidoc/src.doctree differ diff --git a/doc/build/doctrees/commands/application.doctree b/doc/build/doctrees/commands/application.doctree index 6f20fd4..bade1c3 100644 Binary files a/doc/build/doctrees/commands/application.doctree and b/doc/build/doctrees/commands/application.doctree differ diff --git a/doc/build/doctrees/commands/clean.doctree b/doc/build/doctrees/commands/clean.doctree index 4f064c1..3c4dcad 100644 Binary files a/doc/build/doctrees/commands/clean.doctree and b/doc/build/doctrees/commands/clean.doctree differ diff --git a/doc/build/doctrees/commands/compile.doctree b/doc/build/doctrees/commands/compile.doctree index d8fce14..4dddde6 100644 Binary files a/doc/build/doctrees/commands/compile.doctree and b/doc/build/doctrees/commands/compile.doctree differ diff --git a/doc/build/doctrees/commands/config.doctree b/doc/build/doctrees/commands/config.doctree index 114cea1..7266a1f 100644 Binary files a/doc/build/doctrees/commands/config.doctree and b/doc/build/doctrees/commands/config.doctree differ diff --git a/doc/build/doctrees/commands/environ.doctree b/doc/build/doctrees/commands/environ.doctree index da4b855..c88330f 100644 Binary files a/doc/build/doctrees/commands/environ.doctree and b/doc/build/doctrees/commands/environ.doctree differ diff --git a/doc/build/doctrees/commands/generate.doctree b/doc/build/doctrees/commands/generate.doctree index 5568c6c..284094e 100644 Binary files a/doc/build/doctrees/commands/generate.doctree and b/doc/build/doctrees/commands/generate.doctree differ diff --git a/doc/build/doctrees/commands/launcher.doctree b/doc/build/doctrees/commands/launcher.doctree index ba254b0..9f32b81 100644 Binary files a/doc/build/doctrees/commands/launcher.doctree and b/doc/build/doctrees/commands/launcher.doctree differ diff --git a/doc/build/doctrees/commands/log.doctree b/doc/build/doctrees/commands/log.doctree index 7467096..5cad307 100644 Binary files a/doc/build/doctrees/commands/log.doctree and b/doc/build/doctrees/commands/log.doctree differ diff --git a/doc/build/doctrees/commands/package.doctree b/doc/build/doctrees/commands/package.doctree index 447bcbf..d311772 100644 Binary files a/doc/build/doctrees/commands/package.doctree and b/doc/build/doctrees/commands/package.doctree differ diff --git a/doc/build/doctrees/commands/prepare.doctree b/doc/build/doctrees/commands/prepare.doctree index 381dba1..8dbe702 100644 Binary files a/doc/build/doctrees/commands/prepare.doctree and b/doc/build/doctrees/commands/prepare.doctree differ diff --git a/doc/build/doctrees/configuration.doctree b/doc/build/doctrees/configuration.doctree index c6d9f05..9d39c88 100644 Binary files a/doc/build/doctrees/configuration.doctree and b/doc/build/doctrees/configuration.doctree differ diff --git a/doc/build/doctrees/environment.pickle b/doc/build/doctrees/environment.pickle index 29a2a92..073ae4e 100644 Binary files a/doc/build/doctrees/environment.pickle and b/doc/build/doctrees/environment.pickle differ diff --git a/doc/build/doctrees/index.doctree b/doc/build/doctrees/index.doctree index 499f4c5..06e4560 100644 Binary files a/doc/build/doctrees/index.doctree and b/doc/build/doctrees/index.doctree differ diff --git a/doc/build/doctrees/installation_of_sat.doctree b/doc/build/doctrees/installation_of_sat.doctree index 62e5233..29be655 100644 Binary files a/doc/build/doctrees/installation_of_sat.doctree and b/doc/build/doctrees/installation_of_sat.doctree differ diff --git a/doc/build/doctrees/release_notes/release_notes_5.0.0.doctree b/doc/build/doctrees/release_notes/release_notes_5.0.0.doctree index 109e83a..f562e29 100644 Binary files a/doc/build/doctrees/release_notes/release_notes_5.0.0.doctree and b/doc/build/doctrees/release_notes/release_notes_5.0.0.doctree differ diff --git a/doc/build/doctrees/usage_of_sat.doctree b/doc/build/doctrees/usage_of_sat.doctree index 3256626..2a6501d 100644 Binary files a/doc/build/doctrees/usage_of_sat.doctree and b/doc/build/doctrees/usage_of_sat.doctree differ diff --git a/doc/build/doctrees/write_command.doctree b/doc/build/doctrees/write_command.doctree index 6581639..f4e01f0 100644 Binary files a/doc/build/doctrees/write_command.doctree and b/doc/build/doctrees/write_command.doctree differ diff --git a/doc/build/html/.buildinfo b/doc/build/html/.buildinfo index 1d98c1d..83f65b3 100644 --- a/doc/build/html/.buildinfo +++ b/doc/build/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 2c4d344051e59f2c4840e68130e38438 -tags: fbb0d17656682115ca4d033fb2f83ba1 +config: d7bdbf2f29518819f629c0dfc8f7331a +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/doc/build/html/_modules/index.html b/doc/build/html/_modules/index.html index 4018e6d..1f4ee4a 100644 --- a/doc/build/html/_modules/index.html +++ b/doc/build/html/_modules/index.html @@ -2,38 +2,27 @@ - + - - Overview: module code — salomeTools 5.0.0dev documentation - + Overview: module code — salomeTools 5.0.0dev documentation - - + - - + + + - - +
@@ -69,7 +58,7 @@
-
+ diff --git a/doc/build/html/_modules/src/ElementTree.html b/doc/build/html/_modules/src/ElementTree.html index 9428f9f..c03cb3d 100644 --- a/doc/build/html/_modules/src/ElementTree.html +++ b/doc/build/html/_modules/src/ElementTree.html @@ -2,39 +2,27 @@ - + - - src.ElementTree — salomeTools 5.0.0dev documentation - + src.ElementTree — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,130 +31,130 @@

Source code for src.ElementTree

-#
-# ElementTree
-# $Id: ElementTree.py 2326 2005-03-17 07:45:21Z fredrik $
-#
-# light-weight XML support for Python 1.5.2 and later.
-#
-# history:
-# 2001-10-20 fl   created (from various sources)
-# 2001-11-01 fl   return root from parse method
-# 2002-02-16 fl   sort attributes in lexical order
-# 2002-04-06 fl   TreeBuilder refactoring, added PythonDoc markup
-# 2002-05-01 fl   finished TreeBuilder refactoring
-# 2002-07-14 fl   added basic namespace support to ElementTree.write
-# 2002-07-25 fl   added QName attribute support
-# 2002-10-20 fl   fixed encoding in write
-# 2002-11-24 fl   changed default encoding to ascii; fixed attribute encoding
-# 2002-11-27 fl   accept file objects or file names for parse/write
-# 2002-12-04 fl   moved XMLTreeBuilder back to this module
-# 2003-01-11 fl   fixed entity encoding glitch for us-ascii
-# 2003-02-13 fl   added XML literal factory
-# 2003-02-21 fl   added ProcessingInstruction/PI factory
-# 2003-05-11 fl   added tostring/fromstring helpers
-# 2003-05-26 fl   added ElementPath support
-# 2003-07-05 fl   added makeelement factory method
-# 2003-07-28 fl   added more well-known namespace prefixes
-# 2003-08-15 fl   fixed typo in ElementTree.findtext (Thomas Dartsch)
-# 2003-09-04 fl   fall back on emulator if ElementPath is not installed
-# 2003-10-31 fl   markup updates
-# 2003-11-15 fl   fixed nested namespace bug
-# 2004-03-28 fl   added XMLID helper
-# 2004-06-02 fl   added default support to findtext
-# 2004-06-08 fl   fixed encoding of non-ascii element/attribute names
-# 2004-08-23 fl   take advantage of post-2.1 expat features
-# 2005-02-01 fl   added iterparse implementation
-# 2005-03-02 fl   fixed iterparse support for pre-2.2 versions
-#
-# Copyright (c) 1999-2005 by Fredrik Lundh.  All rights reserved.
-#
-# fredrik@pythonware.com
-# http://www.pythonware.com
-#
-# --------------------------------------------------------------------
-# The ElementTree toolkit is
-#
-# Copyright (c) 1999-2005 by Fredrik Lundh
-#
-# By obtaining, using, and/or copying this software and/or its
-# associated documentation, you agree that you have read, understood,
-# and will comply with the following terms and conditions:
-#
-# Permission to use, copy, modify, and distribute this software and
-# its associated documentation for any purpose and without fee is
-# hereby granted, provided that the above copyright notice appears in
-# all copies, and that both that copyright notice and this permission
-# notice appear in supporting documentation, and that the name of
-# Secret Labs AB or the author not be used in advertising or publicity
-# pertaining to distribution of the software without specific, written
-# prior permission.
-#
-# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
-# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
-# ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
-# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
-# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
-# OF THIS SOFTWARE.
-# --------------------------------------------------------------------
+#
+# ElementTree
+# $Id: ElementTree.py 2326 2005-03-17 07:45:21Z fredrik $
+#
+# light-weight XML support for Python 1.5.2 and later.
+#
+# history:
+# 2001-10-20 fl   created (from various sources)
+# 2001-11-01 fl   return root from parse method
+# 2002-02-16 fl   sort attributes in lexical order
+# 2002-04-06 fl   TreeBuilder refactoring, added PythonDoc markup
+# 2002-05-01 fl   finished TreeBuilder refactoring
+# 2002-07-14 fl   added basic namespace support to ElementTree.write
+# 2002-07-25 fl   added QName attribute support
+# 2002-10-20 fl   fixed encoding in write
+# 2002-11-24 fl   changed default encoding to ascii; fixed attribute encoding
+# 2002-11-27 fl   accept file objects or file names for parse/write
+# 2002-12-04 fl   moved XMLTreeBuilder back to this module
+# 2003-01-11 fl   fixed entity encoding glitch for us-ascii
+# 2003-02-13 fl   added XML literal factory
+# 2003-02-21 fl   added ProcessingInstruction/PI factory
+# 2003-05-11 fl   added tostring/fromstring helpers
+# 2003-05-26 fl   added ElementPath support
+# 2003-07-05 fl   added makeelement factory method
+# 2003-07-28 fl   added more well-known namespace prefixes
+# 2003-08-15 fl   fixed typo in ElementTree.findtext (Thomas Dartsch)
+# 2003-09-04 fl   fall back on emulator if ElementPath is not installed
+# 2003-10-31 fl   markup updates
+# 2003-11-15 fl   fixed nested namespace bug
+# 2004-03-28 fl   added XMLID helper
+# 2004-06-02 fl   added default support to findtext
+# 2004-06-08 fl   fixed encoding of non-ascii element/attribute names
+# 2004-08-23 fl   take advantage of post-2.1 expat features
+# 2005-02-01 fl   added iterparse implementation
+# 2005-03-02 fl   fixed iterparse support for pre-2.2 versions
+#
+# Copyright (c) 1999-2005 by Fredrik Lundh.  All rights reserved.
+#
+# fredrik@pythonware.com
+# http://www.pythonware.com
+#
+# --------------------------------------------------------------------
+# The ElementTree toolkit is
+#
+# Copyright (c) 1999-2005 by Fredrik Lundh
+#
+# By obtaining, using, and/or copying this software and/or its
+# associated documentation, you agree that you have read, understood,
+# and will comply with the following terms and conditions:
+#
+# Permission to use, copy, modify, and distribute this software and
+# its associated documentation for any purpose and without fee is
+# hereby granted, provided that the above copyright notice appears in
+# all copies, and that both that copyright notice and this permission
+# notice appear in supporting documentation, and that the name of
+# Secret Labs AB or the author not be used in advertising or publicity
+# pertaining to distribution of the software without specific, written
+# prior permission.
+#
+# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
+# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
+# ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
+# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+# --------------------------------------------------------------------
 
 __all__ = [
-    # public symbols
-    "Comment",
-    "dump",
-    "Element", "ElementTree",
-    "fromstring",
-    "iselement", "iterparse",
-    "parse",
-    "PI", "ProcessingInstruction",
-    "QName",
-    "SubElement",
-    "tostring",
-    "TreeBuilder",
-    "VERSION", "XML",
-    "XMLTreeBuilder",
+    # public symbols
+    "Comment",
+    "dump",
+    "Element", "ElementTree",
+    "fromstring",
+    "iselement", "iterparse",
+    "parse",
+    "PI", "ProcessingInstruction",
+    "QName",
+    "SubElement",
+    "tostring",
+    "TreeBuilder",
+    "VERSION", "XML",
+    "XMLTreeBuilder",
     ]
 
-##
-# The <b>Element</b> type is a flexible container object, designed to
-# store hierarchical data structures in memory. The type can be
-# described as a cross between a list and a dictionary.
-# <p>
-# Each element has a number of properties associated with it:
-# <ul>
-# <li>a <i>tag</i>. This is a string identifying what kind of data
-# this element represents (the element type, in other words).</li>
-# <li>a number of <i>attributes</i>, stored in a Python dictionary.</li>
-# <li>a <i>text</i> string.</li>
-# <li>an optional <i>tail</i> string.</li>
-# <li>a number of <i>child elements</i>, stored in a Python sequence</li>
-# </ul>
-#
-# To create an element instance, use the {@link #Element} or {@link
-# #SubElement} factory functions.
-# <p>
-# The {@link #ElementTree} class can be used to wrap an element
-# structure, and convert it from and to XML.
-##
+##
+# The <b>Element</b> type is a flexible container object, designed to
+# store hierarchical data structures in memory. The type can be
+# described as a cross between a list and a dictionary.
+# <p>
+# Each element has a number of properties associated with it:
+# <ul>
+# <li>a <i>tag</i>. This is a string identifying what kind of data
+# this element represents (the element type, in other words).</li>
+# <li>a number of <i>attributes</i>, stored in a Python dictionary.</li>
+# <li>a <i>text</i> string.</li>
+# <li>an optional <i>tail</i> string.</li>
+# <li>a number of <i>child elements</i>, stored in a Python sequence</li>
+# </ul>
+#
+# To create an element instance, use the {@link #Element} or {@link
+# #SubElement} factory functions.
+# <p>
+# The {@link #ElementTree} class can be used to wrap an element
+# structure, and convert it from and to XML.
+##
 
 import string, sys, re, platform
 
 class _SimpleElementPath:
-    # emulate pre-1.2 find/findtext/findall behaviour
+    # emulate pre-1.2 find/findtext/findall behaviour
     def find(self, element, tag):
         for elem in element:
             if elem.tag == tag:
                 return elem
-        return None
-    def findtext(self, element, tag, default=None):
+        return None
+    def findtext(self, element, tag, default=None):
         for elem in element:
             if elem.tag == tag:
-                return elem.text or ""
+                return elem.text or ""
         return default
     def findall(self, element, tag):
-        if tag[:3] == ".//":
+        if tag[:3] == ".//":
             return element.getiterator(tag[3:])
         result = []
         for elem in element:
@@ -177,57 +165,57 @@
 try:
     import ElementPath
 except ImportError:
-    # FIXME: issue warning in this case?
+    # FIXME: issue warning in this case?
     ElementPath = _SimpleElementPath()
 
-# TODO: add support for custom namespace resolvers/default namespaces
-# TODO: add improved support for incremental parsing
+# TODO: add support for custom namespace resolvers/default namespaces
+# TODO: add improved support for incremental parsing
 
-VERSION = "1.2.6"
+VERSION = "1.2.6"
 
-##
-# Internal element class.  This class defines the Element interface,
-# and provides a reference implementation of this interface.
-# <p>
-# You should not create instances of this class directly.  Use the
-# appropriate factory functions instead, such as {@link #Element}
-# and {@link #SubElement}.
-#
-# @see Element
-# @see SubElement
-# @see Comment
-# @see ProcessingInstruction
+##
+# Internal element class.  This class defines the Element interface,
+# and provides a reference implementation of this interface.
+# <p>
+# You should not create instances of this class directly.  Use the
+# appropriate factory functions instead, such as {@link #Element}
+# and {@link #SubElement}.
+#
+# @see Element
+# @see SubElement
+# @see Comment
+# @see ProcessingInstruction
 
 class _ElementInterface:
-    # <tag attrib>text<child/>...</tag>tail
+    # <tag attrib>text<child/>...</tag>tail
 
-    ##
-    # (Attribute) Element tag.
+    ##
+    # (Attribute) Element tag.
 
-    tag = None
+    tag = None
 
-    ##
-    # (Attribute) Element attribute dictionary.  Where possible, use
-    # {@link #_ElementInterface.get},
-    # {@link #_ElementInterface.set},
-    # {@link #_ElementInterface.keys}, and
-    # {@link #_ElementInterface.items} to access
-    # element attributes.
+    ##
+    # (Attribute) Element attribute dictionary.  Where possible, use
+    # {@link #_ElementInterface.get},
+    # {@link #_ElementInterface.set},
+    # {@link #_ElementInterface.keys}, and
+    # {@link #_ElementInterface.items} to access
+    # element attributes.
 
-    attrib = None
+    attrib = None
 
-    ##
-    # (Attribute) Text before first subelement.  This is either a
-    # string or the value None, if there was no text.
+    ##
+    # (Attribute) Text before first subelement.  This is either a
+    # string or the value None, if there was no text.
 
-    text = None
+    text = None
 
-    ##
-    # (Attribute) Text after this element's end tag, but before the
-    # next sibling element's start tag.  This is either a string or
-    # the value None, if there was no text.
+    ##
+    # (Attribute) Text after this element's end tag, but before the
+    # next sibling element's start tag.  This is either a string or
+    # the value None, if there was no text.
 
-    tail = None # text after end tag, if any
+    tail = None # text after end tag, if any
 
     def __init__(self, tag, attrib):
         self.tag = tag
@@ -235,188 +223,188 @@
         self._children = []
 
     def __repr__(self):
-        return "<Element %s at %x>" % (self.tag, id(self))
+        return "<Element %s at %x>" % (self.tag, id(self))
 
-    ##
-    # Creates a new element object of the same type as this element.
-    #
-    # @param tag Element tag.
-    # @param attrib Element attributes, given as a dictionary.
-    # @return A new element instance.
+    ##
+    # Creates a new element object of the same type as this element.
+    #
+    # @param tag Element tag.
+    # @param attrib Element attributes, given as a dictionary.
+    # @return A new element instance.
 
     def makeelement(self, tag, attrib):
         return Element(tag, attrib)
 
-    ##
-    # Returns the number of subelements.
-    #
-    # @return The number of subelements.
+    ##
+    # Returns the number of subelements.
+    #
+    # @return The number of subelements.
 
     def __len__(self):
         return len(self._children)
 
-    ##
-    # Returns the given subelement.
-    #
-    # @param index What subelement to return.
-    # @return The given subelement.
-    # @exception IndexError If the given element does not exist.
+    ##
+    # Returns the given subelement.
+    #
+    # @param index What subelement to return.
+    # @return The given subelement.
+    # @exception IndexError If the given element does not exist.
 
     def __getitem__(self, index):
         return self._children[index]
 
-    ##
-    # Replaces the given subelement.
-    #
-    # @param index What subelement to replace.
-    # @param element The new element value.
-    # @exception IndexError If the given element does not exist.
-    # @exception AssertionError If element is not a valid object.
+    ##
+    # Replaces the given subelement.
+    #
+    # @param index What subelement to replace.
+    # @param element The new element value.
+    # @exception IndexError If the given element does not exist.
+    # @exception AssertionError If element is not a valid object.
 
     def __setitem__(self, index, element):
         assert iselement(element)
         self._children[index] = element
 
-    ##
-    # Deletes the given subelement.
-    #
-    # @param index What subelement to delete.
-    # @exception IndexError If the given element does not exist.
+    ##
+    # Deletes the given subelement.
+    #
+    # @param index What subelement to delete.
+    # @exception IndexError If the given element does not exist.
 
     def __delitem__(self, index):
         del self._children[index]
 
-    ##
-    # Returns a list containing subelements in the given range.
-    #
-    # @param start The first subelement to return.
-    # @param stop The first subelement that shouldn't be returned.
-    # @return A sequence object containing subelements.
+    ##
+    # Returns a list containing subelements in the given range.
+    #
+    # @param start The first subelement to return.
+    # @param stop The first subelement that shouldn't be returned.
+    # @return A sequence object containing subelements.
 
     def __getslice__(self, start, stop):
         return self._children[start:stop]
 
-    ##
-    # Replaces a number of subelements with elements from a sequence.
-    #
-    # @param start The first subelement to replace.
-    # @param stop The first subelement that shouldn't be replaced.
-    # @param elements A sequence object with zero or more elements.
-    # @exception AssertionError If a sequence member is not a valid object.
+    ##
+    # Replaces a number of subelements with elements from a sequence.
+    #
+    # @param start The first subelement to replace.
+    # @param stop The first subelement that shouldn't be replaced.
+    # @param elements A sequence object with zero or more elements.
+    # @exception AssertionError If a sequence member is not a valid object.
 
     def __setslice__(self, start, stop, elements):
         for element in elements:
             assert iselement(element)
         self._children[start:stop] = list(elements)
 
-    ##
-    # Deletes a number of subelements.
-    #
-    # @param start The first subelement to delete.
-    # @param stop The first subelement to leave in there.
+    ##
+    # Deletes a number of subelements.
+    #
+    # @param start The first subelement to delete.
+    # @param stop The first subelement to leave in there.
 
     def __delslice__(self, start, stop):
         del self._children[start:stop]
 
-    ##
-    # Adds a subelement to the end of this element.
-    #
-    # @param element The element to add.
-    # @exception AssertionError If a sequence member is not a valid object.
+    ##
+    # Adds a subelement to the end of this element.
+    #
+    # @param element The element to add.
+    # @exception AssertionError If a sequence member is not a valid object.
 
     def append(self, element):
         assert iselement(element)
         self._children.append(element)
 
-    ##
-    # Inserts a subelement at the given position in this element.
-    #
-    # @param index Where to insert the new subelement.
-    # @exception AssertionError If the element is not a valid object.
+    ##
+    # Inserts a subelement at the given position in this element.
+    #
+    # @param index Where to insert the new subelement.
+    # @exception AssertionError If the element is not a valid object.
 
     def insert(self, index, element):
         assert iselement(element)
         self._children.insert(index, element)
 
-    ##
-    # Removes a matching subelement.  Unlike the <b>find</b> methods,
-    # this method compares elements based on identity, not on tag
-    # value or contents.
-    #
-    # @param element What element to remove.
-    # @exception ValueError If a matching element could not be found.
-    # @exception AssertionError If the element is not a valid object.
+    ##
+    # Removes a matching subelement.  Unlike the <b>find</b> methods,
+    # this method compares elements based on identity, not on tag
+    # value or contents.
+    #
+    # @param element What element to remove.
+    # @exception ValueError If a matching element could not be found.
+    # @exception AssertionError If the element is not a valid object.
 
     def remove(self, element):
         assert iselement(element)
         self._children.remove(element)
 
-    ##
-    # Returns all subelements.  The elements are returned in document
-    # order.
-    #
-    # @return A list of subelements.
-    # @defreturn list of Element instances
+    ##
+    # Returns all subelements.  The elements are returned in document
+    # order.
+    #
+    # @return A list of subelements.
+    # @defreturn list of Element instances
 
     def getchildren(self):
         return self._children
 
-    ##
-    # Finds the first matching subelement, by tag name or path.
-    #
-    # @param path What element to look for.
-    # @return The first matching element, or None if no element was found.
-    # @defreturn Element or None
+    ##
+    # Finds the first matching subelement, by tag name or path.
+    #
+    # @param path What element to look for.
+    # @return The first matching element, or None if no element was found.
+    # @defreturn Element or None
 
     def find(self, path):
-        if ElementPath.find(self, path) == None:
+        if ElementPath.find(self, path) == None:
             return ElementPath.find(self, path.encode())
         return ElementPath.find(self, path)
 
-    ##
-    # Finds text for the first matching subelement, by tag name or path.
-    #
-    # @param path What element to look for.
-    # @param default What to return if the element was not found.
-    # @return The text content of the first matching element, or the
-    #     default value no element was found.  Note that if the element
-    #     has is found, but has no text content, this method returns an
-    #     empty string.
-    # @defreturn string
-
-    def findtext(self, path, default=None):
+    ##
+    # Finds text for the first matching subelement, by tag name or path.
+    #
+    # @param path What element to look for.
+    # @param default What to return if the element was not found.
+    # @return The text content of the first matching element, or the
+    #     default value no element was found.  Note that if the element
+    #     has is found, but has no text content, this method returns an
+    #     empty string.
+    # @defreturn string
+
+    def findtext(self, path, default=None):
         return ElementPath.findtext(self, path, default)
 
-    ##
-    # Finds all matching subelements, by tag name or path.
-    #
-    # @param path What element to look for.
-    # @return A list or iterator containing all matching elements,
-    #    in document order.
-    # @defreturn list of Element instances
+    ##
+    # Finds all matching subelements, by tag name or path.
+    #
+    # @param path What element to look for.
+    # @return A list or iterator containing all matching elements,
+    #    in document order.
+    # @defreturn list of Element instances
 
     def findall(self, path):
         return ElementPath.findall(self, path)
 
-    ##
-    # Resets an element.  This function removes all subelements, clears
-    # all attributes, and sets the text and tail attributes to None.
+    ##
+    # Resets an element.  This function removes all subelements, clears
+    # all attributes, and sets the text and tail attributes to None.
 
     def clear(self):
         self.attrib.clear()
         self._children = []
-        self.text = self.tail = None
-
-    ##
-    # Gets an element attribute.
-    #
-    # @param key What attribute to look for.
-    # @param default What to return if the attribute was not found.
-    # @return The attribute value, or the default value, if the
-    #     attribute was not found.
-    # @defreturn string or None
-
-    def get(self, key, default=None):
+        self.text = self.tail = None
+
+    ##
+    # Gets an element attribute.
+    #
+    # @param key What attribute to look for.
+    # @param default What to return if the attribute was not found.
+    # @return The attribute value, or the default value, if the
+    #     attribute was not found.
+    # @defreturn string or None
+
+    def get(self, key, default=None):
         res = self.attrib.get(key, default)
         if not res:
             res = self.attrib.get(key.encode(), default)
@@ -425,21 +413,21 @@
         else:
             return res
 
-    ##
-    # Sets an element attribute.
-    #
-    # @param key What attribute to set.
-    # @param value The attribute value.
+    ##
+    # Sets an element attribute.
+    #
+    # @param key What attribute to set.
+    # @param value The attribute value.
 
     def set(self, key, value):
         self.attrib[key] = value
 
-    ##
-    # Gets a list of attribute names.  The names are returned in an
-    # arbitrary order (just like for an ordinary Python dictionary).
-    #
-    # @return A list of element attribute names.
-    # @defreturn list of strings
+    ##
+    # Gets a list of attribute names.  The names are returned in an
+    # arbitrary order (just like for an ordinary Python dictionary).
+    #
+    # @return A list of element attribute names.
+    # @defreturn list of strings
 
     def keys(self):
         res = []
@@ -450,130 +438,130 @@
                 res.append(key)
         return res
                 
-    ##
-    # Gets element attributes, as a sequence.  The attributes are
-    # returned in an arbitrary order.
-    #
-    # @return A list of (name, value) tuples for all attributes.
-    # @defreturn list of (string, string) tuples
+    ##
+    # Gets element attributes, as a sequence.  The attributes are
+    # returned in an arbitrary order.
+    #
+    # @return A list of (name, value) tuples for all attributes.
+    # @defreturn list of (string, string) tuples
 
     def items(self):
         return self.attrib.items()
 
-    ##
-    # Creates a tree iterator.  The iterator loops over this element
-    # and all subelements, in document order, and returns all elements
-    # with a matching tag.
-    # <p>
-    # If the tree structure is modified during iteration, the result
-    # is undefined.
-    #
-    # @param tag What tags to look for (default is to return all elements).
-    # @return A list or iterator containing all the matching elements.
-    # @defreturn list or iterator
-
-    def getiterator(self, tag=None):
+    ##
+    # Creates a tree iterator.  The iterator loops over this element
+    # and all subelements, in document order, and returns all elements
+    # with a matching tag.
+    # <p>
+    # If the tree structure is modified during iteration, the result
+    # is undefined.
+    #
+    # @param tag What tags to look for (default is to return all elements).
+    # @return A list or iterator containing all the matching elements.
+    # @defreturn list or iterator
+
+    def getiterator(self, tag=None):
         nodes = []
-        if tag == "*":
-            tag = None
-        if tag is None or self.tag == tag:
+        if tag == "*":
+            tag = None
+        if tag is None or self.tag == tag:
             nodes.append(self)
         for node in self._children:
             nodes.extend(node.getiterator(tag))
         return nodes
 
-# compatibility
+# compatibility
 _Element = _ElementInterface
 
-##
-# Element factory.  This function returns an object implementing the
-# standard Element interface.  The exact class or type of that object
-# is implementation dependent, but it will always be compatible with
-# the {@link #_ElementInterface} class in this module.
-# <p>
-# The element name, attribute names, and attribute values can be
-# either 8-bit ASCII strings or Unicode strings.
-#
-# @param tag The element name.
-# @param attrib An optional dictionary, containing element attributes.
-# @param **extra Additional attributes, given as keyword arguments.
-# @return An element instance.
-# @defreturn Element
+##
+# Element factory.  This function returns an object implementing the
+# standard Element interface.  The exact class or type of that object
+# is implementation dependent, but it will always be compatible with
+# the {@link #_ElementInterface} class in this module.
+# <p>
+# The element name, attribute names, and attribute values can be
+# either 8-bit ASCII strings or Unicode strings.
+#
+# @param tag The element name.
+# @param attrib An optional dictionary, containing element attributes.
+# @param **extra Additional attributes, given as keyword arguments.
+# @return An element instance.
+# @defreturn Element
 
 
[docs]def Element(tag, attrib={}, **extra): attrib = attrib.copy() attrib.update(extra) - return _ElementInterface(tag, attrib) - -## -# Subelement factory. This function creates an element instance, and -# appends it to an existing element. -# <p> -# The element name, attribute names, and attribute values can be -# either 8-bit ASCII strings or Unicode strings. -# -# @param parent The parent element. -# @param tag The subelement name. -# @param attrib An optional dictionary, containing element attributes. -# @param **extra Additional attributes, given as keyword arguments. -# @return An element instance. -# @defreturn Element -
+ return _ElementInterface(tag, attrib)
+ +## +# Subelement factory. This function creates an element instance, and +# appends it to an existing element. +# <p> +# The element name, attribute names, and attribute values can be +# either 8-bit ASCII strings or Unicode strings. +# +# @param parent The parent element. +# @param tag The subelement name. +# @param attrib An optional dictionary, containing element attributes. +# @param **extra Additional attributes, given as keyword arguments. +# @return An element instance. +# @defreturn Element +
[docs]def SubElement(parent, tag, attrib={}, **extra): attrib = attrib.copy() attrib.update(extra) element = parent.makeelement(tag, attrib) parent.append(element) - return element - -## -# Comment element factory. This factory function creates a special -# element that will be serialized as an XML comment. -# <p> -# The comment string can be either an 8-bit ASCII string or a Unicode -# string. -# -# @param text A string containing the comment string. -# @return An element instance, representing a comment. -# @defreturn Element -
-
[docs]def Comment(text=None): + return element
+ +## +# Comment element factory. This factory function creates a special +# element that will be serialized as an XML comment. +# <p> +# The comment string can be either an 8-bit ASCII string or a Unicode +# string. +# +# @param text A string containing the comment string. +# @return An element instance, representing a comment. +# @defreturn Element + +
[docs]def Comment(text=None): element = Element(Comment) element.text = text - return element - -## -# PI element factory. This factory function creates a special element -# that will be serialized as an XML processing instruction. -# -# @param target A string containing the PI target. -# @param text A string containing the PI contents, if any. -# @return An element instance, representing a PI. -# @defreturn Element -
-
[docs]def ProcessingInstruction(target, text=None): + return element
+ +## +# PI element factory. This factory function creates a special element +# that will be serialized as an XML processing instruction. +# +# @param target A string containing the PI target. +# @param text A string containing the PI contents, if any. +# @return An element instance, representing a PI. +# @defreturn Element + +
[docs]def ProcessingInstruction(target, text=None): element = Element(ProcessingInstruction) element.text = target if text: - element.text = element.text + " " + text - return element -
+ element.text = element.text + " " + text + return element
+ PI = ProcessingInstruction -## -# QName wrapper. This can be used to wrap a QName attribute value, in -# order to get proper namespace handling on output. -# -# @param text A string containing the QName value, in the form {uri}local, -# or, if the tag argument is given, the URI part of a QName. -# @param tag Optional tag. If given, the first argument is interpreted as -# an URI, and this argument is interpreted as a local name. -# @return An opaque object, representing the QName. +## +# QName wrapper. This can be used to wrap a QName attribute value, in +# order to get proper namespace handling on output. +# +# @param text A string containing the QName value, in the form {uri}local, +# or, if the tag argument is given, the URI part of a QName. +# @param tag Optional tag. If given, the first argument is interpreted as +# an URI, and this argument is interpreted as a local name. +# @return An opaque object, representing the QName.
[docs]class QName: - def __init__(self, text_or_uri, tag=None): + def __init__(self, text_or_uri, tag=None): if tag: - text_or_uri = "{%s}%s" % (text_or_uri, tag) + text_or_uri = "{%s}%s" % (text_or_uri, tag) self.text = text_or_uri def __str__(self): return self.text @@ -582,60 +570,60 @@ def __cmp__(self, other): if isinstance(other, QName): return cmp(self.text, other.text) - return cmp(self.text, other) - -## -# ElementTree wrapper class. This class represents an entire element -# hierarchy, and adds some extra support for serialization to and from -# standard XML. -# -# @param element Optional root element. -# @keyparam file Optional file handle or name. If given, the -# tree is initialized with the contents of this XML file. -
+ return cmp(self.text, other)
+ +## +# ElementTree wrapper class. This class represents an entire element +# hierarchy, and adds some extra support for serialization to and from +# standard XML. +# +# @param element Optional root element. +# @keyparam file Optional file handle or name. If given, the +# tree is initialized with the contents of this XML file. +
[docs]class ElementTree: - def __init__(self, element=None, file=None): - assert element is None or iselement(element) - self._root = element # first node - if file: - self.parse(file) + def __init__(self, element=None, file=None): + assert element is None or iselement(element) + self._root = element # first node + if file: + self.parse(file) - ## - # Gets the root element for this tree. - # - # @return An element instance. - # @defreturn Element + ## + # Gets the root element for this tree. + # + # @return An element instance. + # @defreturn Element
[docs] def getroot(self): - return self._root - - ## - # Replaces the root element for this tree. This discards the - # current contents of the tree, and replaces it with the given - # element. Use with care. - # - # @param element An element instance. -
+ return self._root
+ + ## + # Replaces the root element for this tree. This discards the + # current contents of the tree, and replaces it with the given + # element. Use with care. + # + # @param element An element instance. + def _setroot(self, element): assert iselement(element) self._root = element - ## - # Loads an external XML document into this element tree. - # - # @param source A file name or file object. - # @param parser An optional parser instance. If not given, the - # standard {@link XMLTreeBuilder} parser is used. - # @return The document root element. - # @defreturn Element - -
[docs] def parse(self, source, parser=None): - if not hasattr(source, "read"): - # OP 14/11/2017 Ajout de traces pour essayer de decouvrir le pb - # de remontee de log des tests - #print "TRACES OP - ElementTree.py/ElementTree.parse() source = '#%s#'" %source - source = open(source, "rb") + ## + # Loads an external XML document into this element tree. + # + # @param source A file name or file object. + # @param parser An optional parser instance. If not given, the + # standard {@link XMLTreeBuilder} parser is used. + # @return The document root element. + # @defreturn Element + +
[docs] def parse(self, source, parser=None): + if not hasattr(source, "read"): + # OP 14/11/2017 Ajout de traces pour essayer de decouvrir le pb + # de remontee de log des tests + #print "TRACES OP - ElementTree.py/ElementTree.parse() source = '#%s#'" %source + source = open(source, "rb") if not parser: parser = XMLTreeBuilder() while 1: @@ -644,106 +632,106 @@ break parser.feed(data) self._root = parser.close() - return self._root - - ## - # Creates a tree iterator for the root element. The iterator loops - # over all elements in this tree, in document order. - # - # @param tag What tags to look for (default is to return all elements) - # @return An iterator. - # @defreturn iterator -
-
[docs] def getiterator(self, tag=None): - assert self._root is not None - return self._root.getiterator(tag) - - ## - # Finds the first toplevel element with given tag. - # Same as getroot().find(path). - # - # @param path What element to look for. - # @return The first matching element, or None if no element was found. - # @defreturn Element or None -
+ return self._root
+ + ## + # Creates a tree iterator for the root element. The iterator loops + # over all elements in this tree, in document order. + # + # @param tag What tags to look for (default is to return all elements) + # @return An iterator. + # @defreturn iterator + +
[docs] def getiterator(self, tag=None): + assert self._root is not None + return self._root.getiterator(tag)
+ + ## + # Finds the first toplevel element with given tag. + # Same as getroot().find(path). + # + # @param path What element to look for. + # @return The first matching element, or None if no element was found. + # @defreturn Element or None +
[docs] def find(self, path): - assert self._root is not None - if path[:1] == "/": - path = "." + path - return self._root.find(path) - - ## - # Finds the element text for the first toplevel element with given - # tag. Same as getroot().findtext(path). - # - # @param path What toplevel element to look for. - # @param default What to return if the element was not found. - # @return The text content of the first matching element, or the - # default value no element was found. Note that if the element - # has is found, but has no text content, this method returns an - # empty string. - # @defreturn string -
-
[docs] def findtext(self, path, default=None): - assert self._root is not None - if path[:1] == "/": - path = "." + path - return self._root.findtext(path, default) - - ## - # Finds all toplevel elements with the given tag. - # Same as getroot().findall(path). - # - # @param path What element to look for. - # @return A list or iterator containing all matching elements, - # in document order. - # @defreturn list of Element instances -
+ assert self._root is not None + if path[:1] == "/": + path = "." + path + return self._root.find(path)
+ + ## + # Finds the element text for the first toplevel element with given + # tag. Same as getroot().findtext(path). + # + # @param path What toplevel element to look for. + # @param default What to return if the element was not found. + # @return The text content of the first matching element, or the + # default value no element was found. Note that if the element + # has is found, but has no text content, this method returns an + # empty string. + # @defreturn string + +
[docs] def findtext(self, path, default=None): + assert self._root is not None + if path[:1] == "/": + path = "." + path + return self._root.findtext(path, default)
+ + ## + # Finds all toplevel elements with the given tag. + # Same as getroot().findall(path). + # + # @param path What element to look for. + # @return A list or iterator containing all matching elements, + # in document order. + # @defreturn list of Element instances +
[docs] def findall(self, path): - assert self._root is not None - if path[:1] == "/": - path = "." + path - return self._root.findall(path) - - ## - # Writes the element tree to a file, as XML. - # - # @param file A file name, or a file object opened for writing. - # @param encoding Optional output encoding (default is US-ASCII). -
-
[docs] def write(self, file, encoding="us-ascii"): - assert self._root is not None - if not hasattr(file, "write"): - file = open(file, "wb") + assert self._root is not None + if path[:1] == "/": + path = "." + path + return self._root.findall(path)
+ + ## + # Writes the element tree to a file, as XML. + # + # @param file A file name, or a file object opened for writing. + # @param encoding Optional output encoding (default is US-ASCII). + +
[docs] def write(self, file, encoding="us-ascii"): + assert self._root is not None + if not hasattr(file, "write"): + file = open(file, "wb") if not encoding: - encoding = "us-ascii" - elif encoding != "utf-8" and encoding != "us-ascii": - file.write("<?xml version='1.0' encoding='%s'?>\n" % encoding) - self._write(file, self._root, encoding, {}) -
- def _write(self, file, node, encoding, namespaces, margin=0): - # write XML to file + encoding = "us-ascii" + elif encoding != "utf-8" and encoding != "us-ascii": + file.write("<?xml version='1.0' encoding='%s'?>\n" % encoding) + self._write(file, self._root, encoding, {}) + + def _write(self, file, node, encoding, namespaces, margin=0): + # write XML to file tag = node.tag if tag is Comment: - file.write("<!-- %s -->\n" % _escape_cdata(node.text, encoding)) + file.write("<!-- %s -->\n" % _escape_cdata(node.text, encoding)) elif tag is ProcessingInstruction: - file.write("<?%s?>\n" % _escape_cdata(node.text, encoding)) + file.write("<?%s?>\n" % _escape_cdata(node.text, encoding)) else: items = node.items() - xmlns_items = [] # new namespaces in this scope + xmlns_items = [] # new namespaces in this scope try: - if isinstance(tag, QName) or tag[:1] == "{": + if isinstance(tag, QName) or tag[:1] == "{": tag, xmlns = fixtag(tag, namespaces) if xmlns: xmlns_items.append(xmlns) except TypeError: _raise_serialization_error(tag) - file.write(' ' * margin) - file.write(_encode("<", encoding) + _encode(tag, encoding)) + file.write(' ' * margin) + file.write(_encode("<", encoding) + _encode(tag, encoding)) if items or xmlns_items: - items = sorted(items) # lexical order + items = sorted(items) # lexical order for k, v in items: try: - if isinstance(k, QName) or k[:1] == "{": + if isinstance(k, QName) or k[:1] == "{": k, xmlns = fixtag(k, namespaces) if xmlns: xmlns_items.append(xmlns) except TypeError: @@ -754,123 +742,123 @@ if xmlns: xmlns_items.append(xmlns) except TypeError: _raise_serialization_error(v) - file.write(" %s=\"%s\"" % (k,v)) + file.write(" %s=\"%s\"" % (k,v)) for k, v in xmlns_items: - file.write(" %s=\"%s\"" % (k,v)) + file.write(" %s=\"%s\"" % (k,v)) if node.text or len(node): - file.write(">") + file.write(">") if node.text: - file.write(_escape_cdata(node.text, encoding)) - if len(node) > 0: file.write("\n") + file.write(_escape_cdata(node.text, encoding)) + if len(node) > 0: file.write("\n") for n in node: - self._write(file, n, encoding, namespaces, margin + 2) - if len(node) > 0: file.write(' ' * margin) - file.write(_encode("</", encoding) + _encode(tag, encoding) + _encode(">\n", encoding)) + self._write(file, n, encoding, namespaces, margin + 2) + if len(node) > 0: file.write(' ' * margin) + file.write(_encode("</", encoding) + _encode(tag, encoding) + _encode(">\n", encoding)) else: - file.write("/>\n") + file.write("/>\n") for k, v in xmlns_items: del namespaces[v] if node.tail: - file.write(_escape_cdata(node.tail, encoding)) + file.write(_escape_cdata(node.tail, encoding)) -# -------------------------------------------------------------------- -# helpers +# -------------------------------------------------------------------- +# helpers + +## +# Checks if an object appears to be a valid element object. +# +# @param An element instance. +# @return A true value if this is an element object. +# @defreturn flag -## -# Checks if an object appears to be a valid element object. -# -# @param An element instance. -# @return A true value if this is an element object. -# @defreturn flag -
[docs]def iselement(element): - # FIXME: not sure about this; might be a better idea to look - # for tag/attrib/text attributes - return isinstance(element, _ElementInterface) or hasattr(element, "tag") - -## -# Writes an element tree or element structure to sys.stdout. This -# function should be used for debugging only. -# <p> -# The exact output format is implementation dependent. In this -# version, it's written as an ordinary XML file. -# -# @param elem An element tree or an individual element. -
+ # FIXME: not sure about this; might be a better idea to look + # for tag/attrib/text attributes + return isinstance(element, _ElementInterface) or hasattr(element, "tag") + +## +# Writes an element tree or element structure to sys.stdout. This +# function should be used for debugging only. +# <p> +# The exact output format is implementation dependent. In this +# version, it's written as an ordinary XML file. +# +# @param elem An element tree or an individual element. +
[docs]def dump(elem): - # debugging + # debugging if not isinstance(elem, ElementTree): elem = ElementTree(elem) elem.write(sys.stdout) tail = elem.getroot().tail - if not tail or tail[-1] != "\n": - sys.stdout.write("\n") -
+ if not tail or tail[-1] != "\n": + sys.stdout.write("\n") + def _encode(s, encoding): try: return s.encode(encoding) except AttributeError: - return s # 1.5.2: assume the string uses the right encoding + return s # 1.5.2: assume the string uses the right encoding -if sys.version[:3] == "1.5": - _escape = re.compile(r"[&<>\"\x80-\xff]+") # 1.5.2 +if sys.version[:3] == "1.5": + _escape = re.compile(r"[&<>\"\x80-\xff]+") # 1.5.2 else: - _escape = re.compile(eval(r'u"[&<>\"\u0080-\uffff]+"')) + _escape = re.compile(eval(r'u"[&<>\"\u0080-\uffff]+"')) _escape_map = { - "&": "&amp;", - "<": "&lt;", - ">": "&gt;", - '"': "&quot;", + "&": "&amp;", + "<": "&lt;", + ">": "&gt;", + '"': "&quot;", } _namespace_map = { - # "well-known" namespace prefixes - "http://www.w3.org/XML/1998/namespace": "xml", - "http://www.w3.org/1999/xhtml": "html", - "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf", - "http://schemas.xmlsoap.org/wsdl/": "wsdl", + # "well-known" namespace prefixes + "http://www.w3.org/XML/1998/namespace": "xml", + "http://www.w3.org/1999/xhtml": "html", + "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf", + "http://schemas.xmlsoap.org/wsdl/": "wsdl", } def _raise_serialization_error(text): raise TypeError( - "cannot serialize %r (type %s)" % (text, type(text).__name__) + "cannot serialize %r (type %s)" % (text, type(text).__name__) ) def _encode_entity(text, pattern=_escape): - # map reserved and non-ascii characters to numerical entities + # map reserved and non-ascii characters to numerical entities def escape_entities(m, map=_escape_map): out = [] append = out.append for char in m.group(): text = map.get(char) - if text is None: - text = "&#%d;" % ord(char) + if text is None: + text = "&#%d;" % ord(char) append(text) - return string.join(out, "") + return string.join(out, "") try: - return _encode(pattern.sub(escape_entities, text), "ascii") + return _encode(pattern.sub(escape_entities, text), "ascii") except TypeError: _raise_serialization_error(text) -# -# the following functions assume an ascii-compatible encoding -# (or "utf-16") +# +# the following functions assume an ascii-compatible encoding +# (or "utf-16") -def _escape_cdata(text, encoding=None, replace=str.replace): - # escape character data +def _escape_cdata(text, encoding=None, replace=str.replace): + # escape character data try: - if platform.python_version()[0] == '2': # python 2.x.y + if platform.python_version()[0] == '2': # python 2.x.y if encoding: try: text = _encode(text, encoding) except UnicodeError: return _encode_entity(text) - text = replace(text, "&", "&amp;") - text = replace(text, "<", "&lt;") - text = replace(text, ">", "&gt;") - text = replace(text, "####newLine####", "<br \>") + text = replace(text, "&", "&amp;") + text = replace(text, "<", "&lt;") + text = replace(text, ">", "&gt;") + text = replace(text, "####newLine####", "<br \>") if encoding: try: text = _encode(text, encoding) @@ -880,14 +868,14 @@ except (TypeError, AttributeError): _raise_serialization_error(text) -def _escape_attrib(text, encoding=None, replace=str.replace): - # escape attribute value +def _escape_attrib(text, encoding=None, replace=str.replace): + # escape attribute value try: - text = replace(text, "&", "&amp;") - text = replace(text, "'", "&apos;") # FIXME: overkill - text = replace(text, "\"", "&quot;") - text = replace(text, "<", "&lt;") - text = replace(text, ">", "&gt;") + text = replace(text, "&", "&amp;") + text = replace(text, "'", "&apos;") # FIXME: overkill + text = replace(text, "\"", "&quot;") + text = replace(text, "<", "&lt;") + text = replace(text, ">", "&gt;") if encoding: try: text = _encode(text, encoding) @@ -898,69 +886,69 @@ _raise_serialization_error(text) def fixtag(tag, namespaces): - # given a decorated tag (of the form {uri}tag), return prefixed - # tag and namespace declaration, if any + # given a decorated tag (of the form {uri}tag), return prefixed + # tag and namespace declaration, if any if isinstance(tag, QName): tag = tag.text - namespace_uri, tag = string.split(tag[1:], "}", 1) + namespace_uri, tag = string.split(tag[1:], "}", 1) prefix = namespaces.get(namespace_uri) - if prefix is None: + if prefix is None: prefix = _namespace_map.get(namespace_uri) - if prefix is None: - prefix = "ns%d" % len(namespaces) + if prefix is None: + prefix = "ns%d" % len(namespaces) namespaces[namespace_uri] = prefix - if prefix == "xml": - xmlns = None + if prefix == "xml": + xmlns = None else: - xmlns = ("xmlns:%s" % prefix, namespace_uri) + xmlns = ("xmlns:%s" % prefix, namespace_uri) else: - xmlns = None - return "%s:%s" % (prefix, tag), xmlns - -## -# Parses an XML document into an element tree. -# -# @param source A filename or file object containing XML data. -# @param parser An optional parser instance. If not given, the -# standard {@link XMLTreeBuilder} parser is used. -# @return An ElementTree instance - -
[docs]def parse(source, parser=None): - # OP 14/11/2017 Ajout de traces pour essayer de decouvrir le pb - # de remontee de log des tests - #print "TRACES OP - ElementTree.py/parse() source = '#%s#'" %source + xmlns = None + return "%s:%s" % (prefix, tag), xmlns + +## +# Parses an XML document into an element tree. +# +# @param source A filename or file object containing XML data. +# @param parser An optional parser instance. If not given, the +# standard {@link XMLTreeBuilder} parser is used. +# @return An ElementTree instance + +
[docs]def parse(source, parser=None): + # OP 14/11/2017 Ajout de traces pour essayer de decouvrir le pb + # de remontee de log des tests + #print "TRACES OP - ElementTree.py/parse() source = '#%s#'" %source tree = ElementTree() tree.parse(source, parser) - return tree - -## -# Parses an XML document into an element tree incrementally, and reports -# what's going on to the user. -# -# @param source A filename or file object containing XML data. -# @param events A list of events to report back. If omitted, only "end" -# events are reported. -# @return A (event, elem) iterator. -
+ return tree
+ +## +# Parses an XML document into an element tree incrementally, and reports +# what's going on to the user. +# +# @param source A filename or file object containing XML data. +# @param events A list of events to report back. If omitted, only "end" +# events are reported. +# @return A (event, elem) iterator. +
[docs]class iterparse: - def __init__(self, source, events=None): - if not hasattr(source, "read"): - # OP TEST - print "iterparse.__init__ source = %s" %source - source = open(source, "rb") + def __init__(self, source, events=None): + if not hasattr(source, "read"): + # OP TEST + print "iterparse.__init__ source = %s" %source + source = open(source, "rb") self._file = source self._events = [] self._index = 0 - self.root = self._root = None + self.root = self._root = None self._parser = XMLTreeBuilder() - # wire up the parser for event reporting + # wire up the parser for event reporting parser = self._parser._parser append = self._events.append - if events is None: - events = ["end"] + if events is None: + events = ["end"] for event in events: - if event == "start": + if event == "start": try: parser.ordered_attributes = 1 parser.specified_attributes = 1 @@ -973,22 +961,22 @@ start=self._parser._start): append((event, start(tag, attrib_in))) parser.StartElementHandler = handler - elif event == "end": + elif event == "end": def handler(tag, event=event, append=append, end=self._parser._end): append((event, end(tag))) parser.EndElementHandler = handler - elif event == "start-ns": + elif event == "start-ns": def handler(prefix, uri, event=event, append=append): try: - uri = _encode(uri, "ascii") + uri = _encode(uri, "ascii") except UnicodeError: pass - append((event, (prefix or "", uri))) + append((event, (prefix or "", uri))) parser.StartNamespaceDeclHandler = handler - elif event == "end-ns": + elif event == "end-ns": def handler(prefix, event=event, append=append): - append((event, None)) + append((event, None)) parser.EndNamespaceDeclHandler = handler
[docs] def next(self): @@ -996,13 +984,13 @@ try: item = self._events[self._index] except IndexError: - if self._parser is None: + if self._parser is None: self.root = self._root try: raise StopIteration except NameError: raise IndexError - # load event buffer + # load event buffer del self._events[:] self._index = 0 data = self._file.read(16384) @@ -1010,151 +998,151 @@ self._parser.feed(data) else: self._root = self._parser.close() - self._parser = None + self._parser = None else: self._index = self._index + 1 - return item -
+ return item
+ try: iter def __iter__(self): return self except NameError: def __getitem__(self, index): - return self.next() - -## -# Parses an XML document from a string constant. This function can -# be used to embed "XML literals" in Python code. -# -# @param source A string containing XML data. -# @return An Element instance. -# @defreturn Element - + return self.next() + +## +# Parses an XML document from a string constant. This function can +# be used to embed "XML literals" in Python code. +# +# @param source A string containing XML data. +# @return An Element instance. +# @defreturn Element +
[docs]def XML(text): parser = XMLTreeBuilder() parser.feed(text) - return parser.close() - -## -# Parses an XML document from a string constant, and also returns -# a dictionary which maps from element id:s to elements. -# -# @param source A string containing XML data. -# @return A tuple containing an Element instance and a dictionary. -# @defreturn (Element, dictionary) -
+ return parser.close() + +## +# Parses an XML document from a string constant, and also returns +# a dictionary which maps from element id:s to elements. +# +# @param source A string containing XML data. +# @return A tuple containing an Element instance and a dictionary. +# @defreturn (Element, dictionary) + def XMLID(text): parser = XMLTreeBuilder() parser.feed(text) tree = parser.close() ids = {} for elem in tree.getiterator(): - id = elem.get("id") + id = elem.get("id") if id: ids[id] = elem return tree, ids -## -# Parses an XML document from a string constant. Same as {@link #XML}. -# -# @def fromstring(text) -# @param source A string containing XML data. -# @return An Element instance. -# @defreturn Element +## +# Parses an XML document from a string constant. Same as {@link #XML}. +# +# @def fromstring(text) +# @param source A string containing XML data. +# @return An Element instance. +# @defreturn Element fromstring = XML -## -# Generates a string representation of an XML element, including all -# subelements. -# -# @param element An Element instance. -# @return An encoded string containing the XML data. -# @defreturn string +## +# Generates a string representation of an XML element, including all +# subelements. +# +# @param element An Element instance. +# @return An encoded string containing the XML data. +# @defreturn string -
[docs]def tostring(element, encoding=None): +
[docs]def tostring(element, encoding=None): class dummy: pass data = [] - file = dummy() - file.write = data.append - ElementTree(element).write(file, encoding) + file = dummy() + file.write = data.append + ElementTree(element).write(file, encoding) data2 = [] for item in data: if isinstance(item, bytes): item = item.decode() data2.append(item) - return "".join(data2) - -## -# Generic element structure builder. This builder converts a sequence -# of {@link #TreeBuilder.start}, {@link #TreeBuilder.data}, and {@link -# #TreeBuilder.end} method calls to a well-formed element structure. -# <p> -# You can use this class to build an element structure using a custom XML -# parser, or a parser for some other XML-like format. -# -# @param element_factory Optional element factory. This factory -# is called to create new Element instances, as necessary. -
+ return "".join(data2)
+ +## +# Generic element structure builder. This builder converts a sequence +# of {@link #TreeBuilder.start}, {@link #TreeBuilder.data}, and {@link +# #TreeBuilder.end} method calls to a well-formed element structure. +# <p> +# You can use this class to build an element structure using a custom XML +# parser, or a parser for some other XML-like format. +# +# @param element_factory Optional element factory. This factory +# is called to create new Element instances, as necessary. +
[docs]class TreeBuilder: - def __init__(self, element_factory=None): - self._data = [] # data collector - self._elem = [] # element stack - self._last = None # last element - self._tail = None # true if we're after an end tag - if element_factory is None: + def __init__(self, element_factory=None): + self._data = [] # data collector + self._elem = [] # element stack + self._last = None # last element + self._tail = None # true if we're after an end tag + if element_factory is None: element_factory = _ElementInterface self._factory = element_factory - ## - # Flushes the parser buffers, and returns the toplevel documen - # element. - # - # @return An Element instance. - # @defreturn Element + ## + # Flushes the parser buffers, and returns the toplevel documen + # element. + # + # @return An Element instance. + # @defreturn Element
[docs] def close(self): - assert len(self._elem) == 0, "missing end tags" - assert self._last != None, "missing toplevel element" - return self._last -
+ assert len(self._elem) == 0, "missing end tags" + assert self._last != None, "missing toplevel element" + return self._last
+ def _flush(self): if self._data: - if self._last is not None: - text = "" + if self._last is not None: + text = "" for item in self._data: try: text += item except: text += item.decode() if self._tail: - assert self._last.tail is None, "internal error (tail)" + assert self._last.tail is None, "internal error (tail)" self._last.tail = text else: - assert self._last.text is None, "internal error (text)" + assert self._last.text is None, "internal error (text)" self._last.text = text self._data = [] - ## - # Adds text to the current element. - # - # @param data A string. This should be either an 8-bit string - # containing ASCII text, or a Unicode string. + ## + # Adds text to the current element. + # + # @param data A string. This should be either an 8-bit string + # containing ASCII text, or a Unicode string.
[docs] def data(self, data): - self._data.append(data) - - ## - # Opens a new element. - # - # @param tag The element name. - # @param attrib A dictionary containing element attributes. - # @return The opened element. - # @defreturn Element -
+ self._data.append(data) + + ## + # Opens a new element. + # + # @param tag The element name. + # @param attrib A dictionary containing element attributes. + # @return The opened element. + # @defreturn Element +
[docs] def start(self, tag, attrs): self._flush() self._last = elem = self._factory(tag, attrs) @@ -1162,88 +1150,88 @@ self._elem[-1].append(elem) self._elem.append(elem) self._tail = 0 - return elem - - ## - # Closes the current element. - # - # @param tag The element name. - # @return The closed element. - # @defreturn Element -
+ return elem + + ## + # Closes the current element. + # + # @param tag The element name. + # @return The closed element. + # @defreturn Element +
[docs] def end(self, tag): self._flush() self._last = self._elem.pop() assert self._last.tag == tag,\ - "end tag mismatch (expected %s, got %s)" % ( + "end tag mismatch (expected %s, got %s)" % ( self._last.tag, tag) self._tail = 1 - return self._last - -## -# Element structure builder for XML source data, based on the -# <b>expat</b> parser. -# -# @keyparam target Target object. If omitted, the builder uses an -# instance of the standard {@link #TreeBuilder} class. -# @keyparam html Predefine HTML entities. This flag is not supported -# by the current implementation. -# @see #ElementTree -# @see #TreeBuilder -
+ return self._last + +## +# Element structure builder for XML source data, based on the +# <b>expat</b> parser. +# +# @keyparam target Target object. If omitted, the builder uses an +# instance of the standard {@link #TreeBuilder} class. +# @keyparam html Predefine HTML entities. This flag is not supported +# by the current implementation. +# @see #ElementTree +# @see #TreeBuilder +
[docs]class XMLTreeBuilder: - def __init__(self, html=0, target=None): + def __init__(self, html=0, target=None): try: - from xml.parsers import expat + from xml.parsers import expat except ImportError: raise ImportError( - "No module named expat; use SimpleXMLTreeBuilder instead" + "No module named expat; use SimpleXMLTreeBuilder instead" ) - self._parser = parser = expat.ParserCreate(None, "}") - if target is None: + self._parser = parser = expat.ParserCreate(None, "}") + if target is None: target = TreeBuilder() self._target = target - self._names = {} # name memo cache - # callbacks + self._names = {} # name memo cache + # callbacks parser.DefaultHandlerExpand = self._default parser.StartElementHandler = self._start parser.EndElementHandler = self._end parser.CharacterDataHandler = self._data - # let expat do the buffering, if supported + # let expat do the buffering, if supported try: self._parser.buffer_text = 1 except AttributeError: pass - # use new-style attribute handling, if supported + # use new-style attribute handling, if supported try: self._parser.ordered_attributes = 1 self._parser.specified_attributes = 1 parser.StartElementHandler = self._start_list except AttributeError: pass - #encoding = None - #if not parser.returns_unicode: - # encoding = "utf-8" - # target.xml(encoding, None) - self._doctype = None + #encoding = None + #if not parser.returns_unicode: + # encoding = "utf-8" + # target.xml(encoding, None) + self._doctype = None self.entity = {} def _fixtext(self, text): - # convert text string to ascii, if possible + # convert text string to ascii, if possible try: - return _encode(text, "ascii") + return _encode(text, "ascii") except UnicodeError: return text def _fixname(self, key): - # expand qname, and convert name string to ascii, if possible + # expand qname, and convert name string to ascii, if possible try: name = self._names[key] except KeyError: name = key - if "}" in name: - name = "{" + name + if "}" in name: + name = "{" + name self._names[key] = name = self._fixtext(name) return name @@ -1272,23 +1260,23 @@ def _default(self, text): prefix = text[:1] - if prefix == "&": - # deal with undefined entities + if prefix == "&": + # deal with undefined entities try: self._target.data(self.entity[text[1:-1]]) except KeyError: - from xml.parsers import expat + from xml.parsers import expat raise expat.error( - "undefined entity %s: line %d, column %d" % + "undefined entity %s: line %d, column %d" % (text, self._parser.ErrorLineNumber, self._parser.ErrorColumnNumber) ) - elif prefix == "<" and text[:9] == "<!DOCTYPE": - self._doctype = [] # inside a doctype declaration - elif self._doctype is not None: - # parse doctype contents - if prefix == ">": - self._doctype = None + elif prefix == "<" and text[:9] == "<!DOCTYPE": + self._doctype = [] # inside a doctype declaration + elif self._doctype is not None: + # parse doctype contents + if prefix == ">": + self._doctype = None return text = string.strip(text) if not text: @@ -1297,56 +1285,56 @@ n = len(self._doctype) if n > 2: type = self._doctype[1] - if type == "PUBLIC" and n == 4: + if type == "PUBLIC" and n == 4: name, type, pubid, system = self._doctype - elif type == "SYSTEM" and n == 3: + elif type == "SYSTEM" and n == 3: name, type, system = self._doctype - pubid = None + pubid = None else: return if pubid: pubid = pubid[1:-1] self.doctype(name, pubid, system[1:-1]) - self._doctype = None + self._doctype = None - ## - # Handles a doctype declaration. - # - # @param name Doctype name. - # @param pubid Public identifier. - # @param system System identifier. + ## + # Handles a doctype declaration. + # + # @param name Doctype name. + # @param pubid Public identifier. + # @param system System identifier.
[docs] def doctype(self, name, pubid, system): - pass + pass
+ + ## + # Feeds data to the parser. + # + # @param data Encoded data. - ## - # Feeds data to the parser. - # - # @param data Encoded data. -
[docs] def feed(self, data): - # OP 14/11/2017 Ajout de traces pour essayer de decouvrir le pb - # de remontee de log des tests - #print "TRACES OP - ElementTree.py/XMLTreeBuilder.feed() data = '#%s#'" %data - self._parser.Parse(data, 0) - - ## - # Finishes feeding data to the parser. - # - # @return An element structure. - # @defreturn Element -
+ # OP 14/11/2017 Ajout de traces pour essayer de decouvrir le pb + # de remontee de log des tests + #print "TRACES OP - ElementTree.py/XMLTreeBuilder.feed() data = '#%s#'" %data + self._parser.Parse(data, 0) + + ## + # Finishes feeding data to the parser. + # + # @return An element structure. + # @defreturn Element +
[docs] def close(self): - self._parser.Parse("", 1) # end of data + self._parser.Parse("", 1) # end of data tree = self._target.close() - del self._target, self._parser # get rid of circular references + del self._target, self._parser # get rid of circular references return tree
-
+ diff --git a/doc/build/html/_modules/src/__init__.html b/doc/build/html/_modules/src/__init__.html index 0b990c7..b32dd4c 100644 --- a/doc/build/html/_modules/src/__init__.html +++ b/doc/build/html/_modules/src/__init__.html @@ -2,39 +2,27 @@ - + - - src.__init__ — salomeTools 5.0.0dev documentation - + src.__init__ — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,23 +31,23 @@

Source code for src.__init__

-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-#  Copyright (C) 2010-2013  CEA/DEN
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library 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
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+#  Copyright (C) 2010-2013  CEA/DEN
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library 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
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 
 
 """\
@@ -71,58 +59,58 @@
 import errno
 import stat
 
-from . import pyconf
-from . import architecture
-from . import printcolors
-from . import options
-from . import system
-from . import ElementTree
-from . import logger
-from . import product
-from . import environment
-from . import fileEnviron
-from . import compilation
-from . import test_module
-from . import template
+from . import pyconf
+from . import architecture
+from . import printcolors
+from . import options
+from . import system
+from . import ElementTree
+from . import logger
+from . import product
+from . import environment
+from . import fileEnviron
+from . import compilation
+from . import test_module
+from . import template
 
 import platform
-if platform.system() == "Windows" :
+if platform.system() == "Windows" :
     import colorama
     colorama.init()
 
-OK_STATUS = "OK"
-KO_STATUS = "KO"
-NA_STATUS = "NA"
-KNOWNFAILURE_STATUS = "KF"
-TIMEOUT_STATUS = "TIMEOUT"
+OK_STATUS = "OK"
+KO_STATUS = "KO"
+NA_STATUS = "NA"
+KNOWNFAILURE_STATUS = "KF"
+TIMEOUT_STATUS = "TIMEOUT"
 
-CONFIG_FILENAME = "sat-config.pyconf"
+CONFIG_FILENAME = "sat-config.pyconf"
 
 
[docs]class SatException(Exception): """rename Exception Class""" - pass -
+ pass
+
[docs]def ensure_path_exists(p): """Create a path if not existing :param p str: The path. """ if not os.path.exists(p): - os.makedirs(p) -
-
[docs]def check_config_has_application( config, details = None ): + os.makedirs(p)
+ +
[docs]def check_config_has_application( config, details = None ): """check that the config has the key APPLICATION. Else raise an exception. :param config class 'common.pyconf.Config': The config. """ - if 'APPLICATION' not in config: - message = _("An APPLICATION is required. Use 'config --list' to get" - " the list of available applications.\n") + if 'APPLICATION' not in config: + message = _("An APPLICATION is required. Use 'config --list' to get" + " the list of available applications.\n") if details : details.append(message) - raise SatException( message ) -
-
[docs]def check_config_has_profile( config, details = None ): + raise SatException( message )
+ +
[docs]def check_config_has_profile( config, details = None ): """\ check that the config has the key APPLICATION.profile. else, raise an exception. @@ -130,15 +118,15 @@ :param config class 'common.pyconf.Config': The config. """ check_config_has_application(config) - if 'profile' not in config.APPLICATION: - message = _("A profile section is required in your application.\n") + if 'profile' not in config.APPLICATION: + message = _("A profile section is required in your application.\n") if details : details.append(message) - raise SatException( message ) -
+ raise SatException( message )
+
[docs]def config_has_application( config ): - return 'APPLICATION' in config -
+ return 'APPLICATION' in config
+
[docs]def get_cfg_param(config, param_name, default): """\ eearch for param_name value in config. @@ -154,8 +142,8 @@ """ if param_name in config: return config[param_name] - return default -
+ return default
+ + logger.write("\n", 2) +
[docs]def get_base_path(config): """\ Returns the path of the products base. @@ -179,17 +167,17 @@ :return: The path of the products base. :rtype: str """ - if "base" not in config.LOCAL: + if "base" not in config.LOCAL: local_file_path = os.path.join(config.VARS.salometoolsway, - "data", - "local.pyconf") - msg = _("Please define a base path in the file %s" % local_file_path) + "data", + "local.pyconf") + msg = _("Please define a base path in the file %s" % local_file_path) raise SatException(msg) base_path = os.path.abspath(config.LOCAL.base) - return base_path -
+ return base_path +
[docs]def get_launcher_name(config): """\ Returns the name of salome launcher. @@ -199,13 +187,13 @@ :rtype: str """ check_config_has_application(config) - if 'profile' in config.APPLICATION and 'launcher_name' in config.APPLICATION.profile: + if 'profile' in config.APPLICATION and 'launcher_name' in config.APPLICATION.profile: launcher_name = config.APPLICATION.profile.launcher_name else: - launcher_name = 'salome' + launcher_name = 'salome' + + return launcher_name
- return launcher_name -
[docs]def get_log_path(config): """\ Returns the path of the logs. @@ -214,56 +202,56 @@ :return: The path of the logs. :rtype: str """ - if "log_dir" not in config.LOCAL: + if "log_dir" not in config.LOCAL: local_file_path = os.path.join(config.VARS.salometoolsway, - "data", - "local.pyconf") - msg = _("Please define a log_dir in the file %s" % local_file_path) + "data", + "local.pyconf") + msg = _("Please define a log_dir in the file %s" % local_file_path) raise SatException(msg) log_dir_path = os.path.abspath(config.LOCAL.log_dir) - return log_dir_path -
+ return log_dir_path +
[docs]def get_salome_version(config): - if hasattr(config.APPLICATION, 'version_salome'): + if hasattr(config.APPLICATION, 'version_salome'): Version = config.APPLICATION.version_salome else: - KERNEL_info = product.get_product_config(config, "KERNEL") + KERNEL_info = product.get_product_config(config, "KERNEL") VERSION = os.path.join( KERNEL_info.install_dir, - "bin", - "salome", - "VERSION") + "bin", + "salome", + "VERSION") if not os.path.isfile(VERSION): - return None + return None fVERSION = open(VERSION) Version = fVERSION.readline() fVERSION.close() VersionSalome = int(only_numbers(Version)) - return VersionSalome -
+ return VersionSalome +
[docs]def only_numbers(str_num): - return ''.join([nb for nb in str_num if nb in '0123456789'] or '0') -
+ return ''.join([nb for nb in str_num if nb in '0123456789'] or '0') +
[docs]def read_config_from_a_file(filePath): try: cfg_file = pyconf.Config(filePath) except pyconf.ConfigError as e: - raise SatException(_("Error in configuration file: %(file)s\n %(error)s") % \ - { 'file': filePath, 'error': str(e) }) - return cfg_file -
+ raise SatException(_("Error in configuration file: %(file)s\n %(error)s") % \ + { 'file': filePath, 'error': str(e) }) + return cfg_file +
[docs]def get_tmp_filename(cfg, name): if not os.path.exists(cfg.VARS.tmp_root): os.makedirs(cfg.VARS.tmp_root) - return os.path.join(cfg.VARS.tmp_root, name) + return os.path.join(cfg.VARS.tmp_root, name)
-## -# Utils class to simplify path manipulations. +## +# Utils class to simplify path manipulations.
[docs]class Path: def __init__(self, path): self.path = str(path) @@ -281,41 +269,41 @@ return self.path == other.path
[docs] def exists(self): - return self.islink() or os.path.exists(self.path) -
+ return self.islink() or os.path.exists(self.path)
+ + return os.path.islink(self.path) +
[docs] def isdir(self): - return os.path.isdir(self.path) -
+ return os.path.isdir(self.path) +
[docs] def isfile(self): - return os.path.isfile(self.path) -
+ return os.path.isfile(self.path) +
[docs] def list(self): - return [Path(p) for p in os.listdir(self.path)] -
+ return [Path(p) for p in os.listdir(self.path)] +
[docs] def dir(self): - return Path(os.path.dirname(self.path)) -
+ return Path(os.path.dirname(self.path)) +
[docs] def base(self): - return Path(os.path.basename(self.path)) -
-
[docs] def make(self, mode=None): + return Path(os.path.basename(self.path))
+ +
[docs] def make(self, mode=None): os.makedirs(self.path) if mode: - os.chmod(self.path, mode) -
+ os.chmod(self.path, mode) +
[docs] def chmod(self, mode): - os.chmod(self.path, mode) -
+ os.chmod(self.path, mode) +
[docs] def rm(self): if self.islink(): os.remove(self.path) else: - shutil.rmtree( self.path, onerror = handleRemoveReadonly ) -
-
[docs] def copy(self, path, smart=False): + shutil.rmtree( self.path, onerror = handleRemoveReadonly )
+ +
[docs] def copy(self, path, smart=False): if not isinstance(path, Path): path = Path(path) @@ -324,32 +312,32 @@ elif os.path.isdir(self.path): return self.copydir(path, smart) else: - return self.copyfile(path) -
+ return self.copyfile(path) +
[docs] def smartcopy(self, path): - return self.copy(path, True) -
+ return self.copy(path, True) + + return False + + return False + -
[docs] def copydir(self, dst, smart=False): + return False
+ +
[docs] def copydir(self, dst, smart=False): try: names = self.list() @@ -359,23 +347,23 @@ for name in names: if name == dst: continue - if smart and (str(name) in [".git", "CVS", ".svn"]): + if smart and (str(name) in [".git", "CVS", ".svn"]): continue srcname = self + name dstname = dst + name srcname.copy(dstname, smart) - return True + return True except: - return False -
+ return False +
[docs] def copyfile(self, path): try: shutil.copy2(self.path, str(path)) - return True + return True except: - return False -
-
[docs]def find_file_in_lpath(file_name, lpath, additional_dir = ""): + return False
+ +
[docs]def find_file_in_lpath(file_name, lpath, additional_dir = ""): """\ Find in all the directories in lpath list the file that has the same name as file_name. @@ -400,16 +388,16 @@ for file_n in l_files: if file_n == file_name: return os.path.join(dir_complete, file_name) - return False -
+ return False +
[docs]def handleRemoveReadonly(func, path, exc): excvalue = exc[1] if func in (os.rmdir, os.remove) and excvalue.errno == errno.EACCES: - os.chmod(path, stat.S_IRWXU| stat.S_IRWXG| stat.S_IRWXO) # 0777 + os.chmod(path, stat.S_IRWXU| stat.S_IRWXG| stat.S_IRWXO) # 0777 func(path) else: - raise -
+ raise +
[docs]def deepcopy_list(input_list): """\ Do a deep copy of a list @@ -421,8 +409,8 @@ res = [] for elem in input_list: res.append(elem) - return res -
+ return res +
[docs]def remove_item_from_list(input_list, item): """\ Remove all occurences of item from input_list @@ -436,8 +424,8 @@ if elem == item: continue res.append(elem) - return res -
+ return res +
[docs]def parse_date(date): """\ Transform YYYYMMDD_hhmmss into YYYY-MM-DD hh:mm:ss. @@ -448,14 +436,14 @@ """ if len(date) != 15: return date - res = "%s-%s-%s %s:%s:%s" % (date[0:4], + res = "%s-%s-%s %s:%s:%s" % (date[0:4], date[4:6], date[6:8], date[9:11], date[11:13], date[13:]) - return res -
+ return res +
[docs]def merge_dicts(*dict_args): """\ Given any number of dicts, shallow copy and merge into a new dict, @@ -464,40 +452,41 @@ result = {} for dictionary in dict_args: result.update(dictionary) - return result -
+ return result +
[docs]def replace_in_file(filein, strin, strout): """Replace <strin> by <strout> in file <filein>""" - shutil.move(filein, filein + "_old") + shutil.move(filein, filein + "_old") fileout= filein - filein = filein + "_old" - fin = open(filein, "r") - fout = open(fileout, "w") + filein = filein + "_old" + fin = open(filein, "r") + fout = open(fileout, "w") for line in fin: - fout.write(line.replace(strin, strout)) -
+ fout.write(line.replace(strin, strout)) +
[docs]def get_property_in_product_cfg(product_cfg, pprty): - if not "properties" in product_cfg: - return None + if not "properties" in product_cfg: + return None if not pprty in product_cfg.properties: - return None - return product_cfg.properties[pprty] -
+ return None + return product_cfg.properties[pprty] +
[docs]def activate_mesa_property(config): """Add mesa property into application properties :param config Config: The global configuration. It must have an application! """ - # Verify the existence of the file - if not 'properties' in config.APPLICATION: - config.APPLICATION.addMapping( 'properties', src.pyconf.Mapping(), None ) - config.APPLICATION.properties.use_mesa="yes" -
+ # Verify the existence of the file + if not 'properties' in config.APPLICATION: + config.APPLICATION.addMapping( 'properties', src.pyconf.Mapping(), None ) + config.APPLICATION.properties.use_mesa="yes" + + -
+ diff --git a/doc/build/html/_modules/src/architecture.html b/doc/build/html/_modules/src/architecture.html index 5fd13c4..34f1184 100644 --- a/doc/build/html/_modules/src/architecture.html +++ b/doc/build/html/_modules/src/architecture.html @@ -2,39 +2,27 @@ - + - - src.architecture — salomeTools 5.0.0dev documentation - + src.architecture — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,23 +31,23 @@

Source code for src.architecture

-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-#  Copyright (C) 2010-2013  CEA/DEN
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library 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
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+#  Copyright (C) 2010-2013  CEA/DEN
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library 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
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 
 '''
 In this file : all the stuff that can change with the architecture 
@@ -73,22 +61,22 @@
       
     :rtype: boolean
     '''
-    return platform.system() == 'Windows'
-
+ return platform.system() == 'Windows'
+
[docs]def get_user(): '''method that gets the username that launched sat :rtype: str ''' - # In windows case, the USERNAME environment variable has to be set + # In windows case, the USERNAME environment variable has to be set if is_windows(): - if not os.environ.has_key('USERNAME'): - raise Exception('USERNAME environment variable not set') - return os.environ['USERNAME'] - else: # linux + if not os.environ.has_key('USERNAME'): + raise Exception('USERNAME environment variable not set') + return os.environ['USERNAME'] + else: # linux import pwd - return pwd.getpwuid(os.getuid())[0] -
+ return pwd.getpwuid(os.getuid())[0]
+ def _lsb_release(args): '''Get system information with lsb_release. @@ -97,22 +85,22 @@ :rtype: str ''' try: - path = '/usr/local/bin:/usr/bin:/bin' - lsb_path = os.getenv("LSB_PATH") - if lsb_path is not None: - path = lsb_path + ":" + path + path = '/usr/local/bin:/usr/bin:/bin' + lsb_path = os.getenv("LSB_PATH") + if lsb_path is not None: + path = lsb_path + ":" + path - from subprocess import Popen, PIPE - res = Popen(['lsb_release', args], env={'PATH': path}, + from subprocess import Popen, PIPE + res = Popen(['lsb_release', args], env={'PATH': path}, stdout=PIPE).communicate()[0][:-1] - # in case of python3, convert byte to str + # in case of python3, convert byte to str if isinstance(res, bytes): res = res.decode() return res except OSError: - sys.stderr.write(_(u"lsb_release not installed\n")) - sys.stderr.write(_(u"You can define $LSB_PATH to give" - " the path to lsb_release\n")) + sys.stderr.write(_(u"lsb_release not installed\n")) + sys.stderr.write(_(u"You can define $LSB_PATH to give" + " the path to lsb_release\n")) sys.exit(-1)
[docs]def get_distribution(codes): @@ -124,21 +112,21 @@ :rtype: str ''' if is_windows(): - return "Win" + return "Win" - # Call to lsb_release - distrib = _lsb_release('-si') - if codes is not None and distrib in codes: + # Call to lsb_release + distrib = _lsb_release('-si') + if codes is not None and distrib in codes: distrib = codes[distrib] else: - sys.stderr.write(_(u"Unknown distribution: '%s'\n") % distrib) - sys.stderr.write(_(u"Please add your distribution to" - " src/internal_config/distrib.pyconf\n")) + sys.stderr.write(_(u"Unknown distribution: '%s'\n") % distrib) + sys.stderr.write(_(u"Please add your distribution to" + " src/internal_config/distrib.pyconf\n")) sys.exit(-1) - return distrib + return distrib
+ -
[docs]def get_distrib_version(distrib, codes): '''Gets the version of the distribution @@ -153,16 +141,16 @@ if is_windows(): return platform.release() - # Call to lsb_release - version = _lsb_release('-sr') + # Call to lsb_release + version = _lsb_release('-sr') if distrib in codes: if version in codes[distrib]: version = codes[distrib][version] - if distrib == "CO": - version=version[0] #for centos, we only care for major version - return version -
+ if distrib == "CO": + version=version[0] #for centos, we only care for major version + return version +
[docs]def get_python_version(): '''Gets the version of the running python. @@ -170,9 +158,9 @@ :rtype: str ''' - # The platform python module gives the answer - return platform.python_version() -
+ # The platform python module gives the answer + return platform.python_version() +
[docs]def get_nb_proc(): '''Gets the number of processors of the machine on which salomeTools is running. @@ -185,14 +173,14 @@ import multiprocessing nb_proc=multiprocessing.cpu_count() except : - nb_proc=int(os.sysconf('SC_NPROCESSORS_ONLN')) + nb_proc=int(os.sysconf('SC_NPROCESSORS_ONLN')) return nb_proc
-
+ diff --git a/doc/build/html/_modules/src/colorama/ansi.html b/doc/build/html/_modules/src/colorama/ansi.html index 00f0bf8..a28a4c7 100644 --- a/doc/build/html/_modules/src/colorama/ansi.html +++ b/doc/build/html/_modules/src/colorama/ansi.html @@ -2,39 +2,27 @@ - + - - src.colorama.ansi — salomeTools 5.0.0dev documentation - + src.colorama.ansi — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,54 +31,54 @@

Source code for src.colorama.ansi

-# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
+# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
 '''
 This module generates ANSI character codes to printing colors to terminals.
 See: http://en.wikipedia.org/wiki/ANSI_escape_code
 '''
 
-CSI = '\033['
-OSC = '\033]'
-BEL = '\007'
+CSI = '\033['
+OSC = '\033]'
+BEL = '\007'
 
 
 
[docs]def code_to_chars(code): - return CSI + str(code) + 'm' -
+ return CSI + str(code) + 'm'
+
[docs]def set_title(title): - return OSC + '2;' + title + BEL -
+ return OSC + '2;' + title + BEL
+
[docs]def clear_screen(mode=2): - return CSI + str(mode) + 'J' -
+ return CSI + str(mode) + 'J'
+
[docs]def clear_line(mode=2): - return CSI + str(mode) + 'K' + return CSI + str(mode) + 'K'
+ -
[docs]class AnsiCodes(object): def __init__(self): - # the subclasses declare class attributes which are numbers. - # Upon instantiation we define instance attributes, which are the same - # as the class attributes but wrapped with the ANSI escape sequence + # the subclasses declare class attributes which are numbers. + # Upon instantiation we define instance attributes, which are the same + # as the class attributes but wrapped with the ANSI escape sequence for name in dir(self): - if not name.startswith('_'): + if not name.startswith('_'): value = getattr(self, name) - setattr(self, name, code_to_chars(value)) + setattr(self, name, code_to_chars(value))
+ -
[docs]class AnsiCursor(object):
[docs] def UP(self, n=1): - return CSI + str(n) + 'A'
+ return CSI + str(n) + 'A'
[docs] def DOWN(self, n=1): - return CSI + str(n) + 'B'
+ return CSI + str(n) + 'B'
[docs] def FORWARD(self, n=1): - return CSI + str(n) + 'C'
+ return CSI + str(n) + 'C'
[docs] def BACK(self, n=1): - return CSI + str(n) + 'D'
+ return CSI + str(n) + 'D'
[docs] def POS(self, x=1, y=1): - return CSI + str(y) + ';' + str(x) + 'H' + return CSI + str(y) + ';' + str(x) + 'H'
+ -
[docs]class AnsiFore(AnsiCodes): BLACK = 30 RED = 31 @@ -102,7 +90,7 @@ WHITE = 37 RESET = 39 - # These are fairly well supported, but not part of the standard. + # These are fairly well supported, but not part of the standard. LIGHTBLACK_EX = 90 LIGHTRED_EX = 91 LIGHTGREEN_EX = 92 @@ -110,9 +98,9 @@ LIGHTBLUE_EX = 94 LIGHTMAGENTA_EX = 95 LIGHTCYAN_EX = 96 - LIGHTWHITE_EX = 97 + LIGHTWHITE_EX = 97
+ -
[docs]class AnsiBack(AnsiCodes): BLACK = 40 RED = 41 @@ -124,7 +112,7 @@ WHITE = 47 RESET = 49 - # These are fairly well supported, but not part of the standard. + # These are fairly well supported, but not part of the standard. LIGHTBLACK_EX = 100 LIGHTRED_EX = 101 LIGHTGREEN_EX = 102 @@ -132,15 +120,15 @@ LIGHTBLUE_EX = 104 LIGHTMAGENTA_EX = 105 LIGHTCYAN_EX = 106 - LIGHTWHITE_EX = 107 + LIGHTWHITE_EX = 107
+ -
[docs]class AnsiStyle(AnsiCodes): BRIGHT = 1 DIM = 2 NORMAL = 22 - RESET_ALL = 0 -
+ RESET_ALL = 0 + Fore = AnsiFore() Back = AnsiBack() Style = AnsiStyle() @@ -150,7 +138,7 @@ -
+ diff --git a/doc/build/html/_modules/src/colorama/ansitowin32.html b/doc/build/html/_modules/src/colorama/ansitowin32.html index 0a71e27..e619a62 100644 --- a/doc/build/html/_modules/src/colorama/ansitowin32.html +++ b/doc/build/html/_modules/src/colorama/ansitowin32.html @@ -2,39 +2,27 @@ - + - - src.colorama.ansitowin32 — salomeTools 5.0.0dev documentation - + src.colorama.ansitowin32 — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,29 +31,29 @@

Source code for src.colorama.ansitowin32

-# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
+# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
 import re
 import sys
 import os
 
-from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style
-from .winterm import WinTerm, WinColor, WinStyle
-from .win32 import windll, winapi_test
+from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style
+from .winterm import WinTerm, WinColor, WinStyle
+from .win32 import windll, winapi_test
 
 
-winterm = None
-if windll is not None:
+winterm = None
+if windll is not None:
     winterm = WinTerm()
 
 
 
[docs]def is_stream_closed(stream): - return not hasattr(stream, 'closed') or stream.closed + return not hasattr(stream, 'closed') or stream.closed
+ -
[docs]def is_a_tty(stream): - return hasattr(stream, 'isatty') and stream.isatty() + return hasattr(stream, 'isatty') and stream.isatty()
+ -
[docs]class StreamWrapper(object): ''' Wraps a stream (such as stdout), acting as a transparent proxy for all @@ -73,8 +61,8 @@ Converter instance. ''' def __init__(self, wrapped, converter): - # double-underscore everything to prevent clashes with names of - # attributes on the wrapped stream object. + # double-underscore everything to prevent clashes with names of + # attributes on the wrapped stream object. self.__wrapped = wrapped self.__convertor = converter @@ -82,49 +70,49 @@ return getattr(self.__wrapped, name)
[docs] def write(self, text): - self.__convertor.write(text) + self.__convertor.write(text)
+ -
[docs]class AnsiToWin32(object): ''' Implements a 'write()' method which, on Windows, will strip ANSI character sequences from the text, and if outputting to a tty, will convert them into win32 function calls. ''' - ANSI_CSI_RE = re.compile('\001?\033\[((?:\d|;)*)([a-zA-Z])\002?') # Control Sequence Introducer - ANSI_OSC_RE = re.compile('\001?\033\]((?:.|;)*?)(\x07)\002?') # Operating System Command + ANSI_CSI_RE = re.compile('\001?\033\[((?:\d|;)*)([a-zA-Z])\002?') # Control Sequence Introducer + ANSI_OSC_RE = re.compile('\001?\033\]((?:.|;)*?)(\x07)\002?') # Operating System Command - def __init__(self, wrapped, convert=None, strip=None, autoreset=False): - # The wrapped stream (normally sys.stdout or sys.stderr) + def __init__(self, wrapped, convert=None, strip=None, autoreset=False): + # The wrapped stream (normally sys.stdout or sys.stderr) self.wrapped = wrapped - # should we reset colors to defaults after every .write() + # should we reset colors to defaults after every .write() self.autoreset = autoreset - # create the proxy wrapping our output stream + # create the proxy wrapping our output stream self.stream = StreamWrapper(wrapped, self) - on_windows = os.name == 'nt' - # We test if the WinAPI works, because even if we are on Windows - # we may be using a terminal that doesn't support the WinAPI - # (e.g. Cygwin Terminal). In this case it's up to the terminal - # to support the ANSI codes. + on_windows = os.name == 'nt' + # We test if the WinAPI works, because even if we are on Windows + # we may be using a terminal that doesn't support the WinAPI + # (e.g. Cygwin Terminal). In this case it's up to the terminal + # to support the ANSI codes. conversion_supported = on_windows and winapi_test() - # should we strip ANSI sequences from our output? - if strip is None: + # should we strip ANSI sequences from our output? + if strip is None: strip = conversion_supported or (not is_stream_closed(wrapped) and not is_a_tty(wrapped)) self.strip = strip - # should we should convert ANSI sequences into win32 calls? - if convert is None: + # should we should convert ANSI sequences into win32 calls? + if convert is None: convert = conversion_supported and not is_stream_closed(wrapped) and is_a_tty(wrapped) self.convert = convert - # dict of ansi codes to win32 functions and parameters + # dict of ansi codes to win32 functions and parameters self.win32_calls = self.get_win32_calls() - # are we wrapping stderr? + # are we wrapping stderr? self.on_stderr = self.wrapped is sys.stderr
[docs] def should_wrap(self): @@ -135,8 +123,8 @@ False on non-Windows platforms, unless optional functionality like autoreset has been requested using kwargs to init() ''' - return self.convert or self.strip or self.autoreset -
+ return self.convert or self.strip or self.autoreset
+
[docs] def get_win32_calls(self): if self.convert and winterm: return { @@ -153,14 +141,14 @@ AnsiFore.CYAN: (winterm.fore, WinColor.CYAN), AnsiFore.WHITE: (winterm.fore, WinColor.GREY), AnsiFore.RESET: (winterm.fore, ), - AnsiFore.LIGHTBLACK_EX: (winterm.fore, WinColor.BLACK, True), - AnsiFore.LIGHTRED_EX: (winterm.fore, WinColor.RED, True), - AnsiFore.LIGHTGREEN_EX: (winterm.fore, WinColor.GREEN, True), - AnsiFore.LIGHTYELLOW_EX: (winterm.fore, WinColor.YELLOW, True), - AnsiFore.LIGHTBLUE_EX: (winterm.fore, WinColor.BLUE, True), - AnsiFore.LIGHTMAGENTA_EX: (winterm.fore, WinColor.MAGENTA, True), - AnsiFore.LIGHTCYAN_EX: (winterm.fore, WinColor.CYAN, True), - AnsiFore.LIGHTWHITE_EX: (winterm.fore, WinColor.GREY, True), + AnsiFore.LIGHTBLACK_EX: (winterm.fore, WinColor.BLACK, True), + AnsiFore.LIGHTRED_EX: (winterm.fore, WinColor.RED, True), + AnsiFore.LIGHTGREEN_EX: (winterm.fore, WinColor.GREEN, True), + AnsiFore.LIGHTYELLOW_EX: (winterm.fore, WinColor.YELLOW, True), + AnsiFore.LIGHTBLUE_EX: (winterm.fore, WinColor.BLUE, True), + AnsiFore.LIGHTMAGENTA_EX: (winterm.fore, WinColor.MAGENTA, True), + AnsiFore.LIGHTCYAN_EX: (winterm.fore, WinColor.CYAN, True), + AnsiFore.LIGHTWHITE_EX: (winterm.fore, WinColor.GREY, True), AnsiBack.BLACK: (winterm.back, WinColor.BLACK), AnsiBack.RED: (winterm.back, WinColor.RED), AnsiBack.GREEN: (winterm.back, WinColor.GREEN), @@ -170,17 +158,17 @@ AnsiBack.CYAN: (winterm.back, WinColor.CYAN), AnsiBack.WHITE: (winterm.back, WinColor.GREY), AnsiBack.RESET: (winterm.back, ), - AnsiBack.LIGHTBLACK_EX: (winterm.back, WinColor.BLACK, True), - AnsiBack.LIGHTRED_EX: (winterm.back, WinColor.RED, True), - AnsiBack.LIGHTGREEN_EX: (winterm.back, WinColor.GREEN, True), - AnsiBack.LIGHTYELLOW_EX: (winterm.back, WinColor.YELLOW, True), - AnsiBack.LIGHTBLUE_EX: (winterm.back, WinColor.BLUE, True), - AnsiBack.LIGHTMAGENTA_EX: (winterm.back, WinColor.MAGENTA, True), - AnsiBack.LIGHTCYAN_EX: (winterm.back, WinColor.CYAN, True), - AnsiBack.LIGHTWHITE_EX: (winterm.back, WinColor.GREY, True), + AnsiBack.LIGHTBLACK_EX: (winterm.back, WinColor.BLACK, True), + AnsiBack.LIGHTRED_EX: (winterm.back, WinColor.RED, True), + AnsiBack.LIGHTGREEN_EX: (winterm.back, WinColor.GREEN, True), + AnsiBack.LIGHTYELLOW_EX: (winterm.back, WinColor.YELLOW, True), + AnsiBack.LIGHTBLUE_EX: (winterm.back, WinColor.BLUE, True), + AnsiBack.LIGHTMAGENTA_EX: (winterm.back, WinColor.MAGENTA, True), + AnsiBack.LIGHTCYAN_EX: (winterm.back, WinColor.CYAN, True), + AnsiBack.LIGHTWHITE_EX: (winterm.back, WinColor.GREY, True), } - return dict() -
+ return dict() +
[docs] def write(self, text): if self.strip or self.convert: self.write_and_convert(text) @@ -188,16 +176,16 @@ self.wrapped.write(text) self.wrapped.flush() if self.autoreset: - self.reset_all() + self.reset_all()
+ -
[docs] def reset_all(self): if self.convert: - self.call_win32('m', (0,)) + self.call_win32('m', (0,)) elif not self.strip and not is_stream_closed(self.wrapped): - self.wrapped.write(Style.RESET_ALL) + self.wrapped.write(Style.RESET_ALL)
+ -
[docs] def write_and_convert(self, text): ''' Write the given text to our wrapped stream, stripping any ANSI @@ -211,41 +199,41 @@ self.write_plain_text(text, cursor, start) self.convert_ansi(*match.groups()) cursor = end - self.write_plain_text(text, cursor, len(text)) + self.write_plain_text(text, cursor, len(text))
+ -
[docs] def write_plain_text(self, text, start, end): if start < end: self.wrapped.write(text[start:end]) - self.wrapped.flush() + self.wrapped.flush()
+ -
[docs] def convert_ansi(self, paramstring, command): if self.convert: params = self.extract_params(command, paramstring) - self.call_win32(command, params) + self.call_win32(command, params)
+ -
[docs] def extract_params(self, command, paramstring): - if command in 'Hf': - params = tuple(int(p) if len(p) != 0 else 1 for p in paramstring.split(';')) + if command in 'Hf': + params = tuple(int(p) if len(p) != 0 else 1 for p in paramstring.split(';')) while len(params) < 2: - # defaults: + # defaults: params = params + (1,) else: - params = tuple(int(p) for p in paramstring.split(';') if len(p) != 0) + params = tuple(int(p) for p in paramstring.split(';') if len(p) != 0) if len(params) == 0: - # defaults: - if command in 'JKm': + # defaults: + if command in 'JKm': params = (0,) - elif command in 'ABCD': + elif command in 'ABCD': params = (1,) - return params + return params
+ -
[docs] def call_win32(self, command, params): - if command == 'm': + if command == 'm': for param in params: if param in self.win32_calls: func_args = self.win32_calls[param] @@ -253,30 +241,30 @@ args = func_args[1:] kwargs = dict(on_stderr=self.on_stderr) func(*args, **kwargs) - elif command in 'J': + elif command in 'J': winterm.erase_screen(params[0], on_stderr=self.on_stderr) - elif command in 'K': + elif command in 'K': winterm.erase_line(params[0], on_stderr=self.on_stderr) - elif command in 'Hf': # cursor position - absolute + elif command in 'Hf': # cursor position - absolute winterm.set_cursor_position(params, on_stderr=self.on_stderr) - elif command in 'ABCD': # cursor position - relative + elif command in 'ABCD': # cursor position - relative n = params[0] - # A - up, B - down, C - forward, D - back - x, y = {'A': (0, -n), 'B': (0, n), 'C': (n, 0), 'D': (-n, 0)}[command] - winterm.cursor_adjust(x, y, on_stderr=self.on_stderr) + # A - up, B - down, C - forward, D - back + x, y = {'A': (0, -n), 'B': (0, n), 'C': (n, 0), 'D': (-n, 0)}[command] + winterm.cursor_adjust(x, y, on_stderr=self.on_stderr)
+ -
[docs] def convert_osc(self, text): for match in self.ANSI_OSC_RE.finditer(text): start, end = match.span() text = text[:start] + text[end:] paramstring, command = match.groups() - if command in '\x07': # \x07 = BEL - params = paramstring.split(";") - # 0 - change title and icon (we will only change title) - # 1 - change icon (we don't support this) - # 2 - change title - if params[0] in '02': + if command in '\x07': # \x07 = BEL + params = paramstring.split(";") + # 0 - change title and icon (we will only change title) + # 1 - change icon (we don't support this) + # 2 - change title + if params[0] in '02': winterm.set_title(params[1]) return text
@@ -284,7 +272,7 @@ -
+ diff --git a/doc/build/html/_modules/src/colorama/initialise.html b/doc/build/html/_modules/src/colorama/initialise.html index 1b9c23b..d26d883 100644 --- a/doc/build/html/_modules/src/colorama/initialise.html +++ b/doc/build/html/_modules/src/colorama/initialise.html @@ -2,39 +2,27 @@ - + - - src.colorama.initialise — salomeTools 5.0.0dev documentation - + src.colorama.initialise — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,32 +31,32 @@

Source code for src.colorama.initialise

-# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
+# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
 import atexit
 import contextlib
 import sys
 
-from .ansitowin32 import AnsiToWin32
+from .ansitowin32 import AnsiToWin32
 
 
-orig_stdout = None
-orig_stderr = None
+orig_stdout = None
+orig_stderr = None
 
-wrapped_stdout = None
-wrapped_stderr = None
+wrapped_stdout = None
+wrapped_stderr = None
 
-atexit_done = False
+atexit_done = False
 
 
 
[docs]def reset_all(): - if AnsiToWin32 is not None: # Issue #74: objects might become None at exit - AnsiToWin32(orig_stdout).reset_all() + if AnsiToWin32 is not None: # Issue #74: objects might become None at exit + AnsiToWin32(orig_stdout).reset_all()
-
-
[docs]def init(autoreset=False, convert=None, strip=None, wrap=True): + +
[docs]def init(autoreset=False, convert=None, strip=None, wrap=True): if not wrap and any([autoreset, convert, strip]): - raise ValueError('wrap=False conflicts with any other arg=True') + raise ValueError('wrap=False conflicts with any other arg=True') global wrapped_stdout, wrapped_stderr global orig_stdout, orig_stderr @@ -76,13 +64,13 @@ orig_stdout = sys.stdout orig_stderr = sys.stderr - if sys.stdout is None: - wrapped_stdout = None + if sys.stdout is None: + wrapped_stdout = None else: sys.stdout = wrapped_stdout = \ wrap_stream(orig_stdout, convert, strip, autoreset, wrap) - if sys.stderr is None: - wrapped_stderr = None + if sys.stderr is None: + wrapped_stderr = None else: sys.stderr = wrapped_stderr = \ wrap_stream(orig_stderr, convert, strip, autoreset, wrap) @@ -90,45 +78,47 @@ global atexit_done if not atexit_done: atexit.register(reset_all) - atexit_done = True + atexit_done = True
+ -
[docs]def deinit(): - if orig_stdout is not None: + if orig_stdout is not None: sys.stdout = orig_stdout - if orig_stderr is not None: - sys.stderr = orig_stderr + if orig_stderr is not None: + sys.stderr = orig_stderr
-
-@contextlib.contextmanager -
[docs]def colorama_text(*args, **kwargs): + +
[docs]@contextlib.contextmanager +def colorama_text(*args, **kwargs): init(*args, **kwargs) try: yield finally: - deinit() + deinit()
+ -
[docs]def reinit(): - if wrapped_stdout is not None: + if wrapped_stdout is not None: sys.stdout = wrapped_stdout - if wrapped_stderr is not None: - sys.stderr = wrapped_stderr + if wrapped_stderr is not None: + sys.stderr = wrapped_stderr
+ -
[docs]def wrap_stream(stream, convert, strip, autoreset, wrap): if wrap: wrapper = AnsiToWin32(stream, convert=convert, strip=strip, autoreset=autoreset) if wrapper.should_wrap(): stream = wrapper.stream - return stream -
+ return stream + + + -
+ diff --git a/doc/build/html/_modules/src/colorama/win32.html b/doc/build/html/_modules/src/colorama/win32.html index 1b0b429..9f4e534 100644 --- a/doc/build/html/_modules/src/colorama/win32.html +++ b/doc/build/html/_modules/src/colorama/win32.html @@ -2,39 +2,27 @@ - + - - src.colorama.win32 — salomeTools 5.0.0dev documentation - + src.colorama.win32 — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,37 +31,37 @@

Source code for src.colorama.win32

-# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
+# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
 
-# from winbase.h
+# from winbase.h
 STDOUT = -11
 STDERR = -12
 
 try:
     import ctypes
-    from ctypes import LibraryLoader
+    from ctypes import LibraryLoader
     windll = LibraryLoader(ctypes.WinDLL)
-    from ctypes import wintypes
+    from ctypes import wintypes
 except (AttributeError, ImportError):
-    windll = None
-    SetConsoleTextAttribute = lambda *_: None
-    winapi_test = lambda *_: None
+    windll = None
+    SetConsoleTextAttribute = lambda *_: None
+    winapi_test = lambda *_: None
 else:
-    from ctypes import byref, Structure, c_char, POINTER
+    from ctypes import byref, Structure, c_char, POINTER
 
     COORD = wintypes._COORD
 
     class CONSOLE_SCREEN_BUFFER_INFO(Structure):
         """struct in wincon.h."""
         _fields_ = [
-            ("dwSize", COORD),
-            ("dwCursorPosition", COORD),
-            ("wAttributes", wintypes.WORD),
-            ("srWindow", wintypes.SMALL_RECT),
-            ("dwMaximumWindowSize", COORD),
+            ("dwSize", COORD),
+            ("dwCursorPosition", COORD),
+            ("wAttributes", wintypes.WORD),
+            ("srWindow", wintypes.SMALL_RECT),
+            ("dwMaximumWindowSize", COORD),
         ]
         def __str__(self):
-            return '(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)' % (
+            return '(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)' % (
                 self.dwSize.Y, self.dwSize.X
                 , self.dwCursorPosition.Y, self.dwCursorPosition.X
                 , self.wAttributes
@@ -144,8 +132,8 @@
         csbi = CONSOLE_SCREEN_BUFFER_INFO()
         success = _GetConsoleScreenBufferInfo(
             handle, byref(csbi))
-        return bool(success)
-
+ return bool(success)
+ def GetConsoleScreenBufferInfo(stream_id=STDOUT): handle = handles[stream_id] csbi = CONSOLE_SCREEN_BUFFER_INFO() @@ -155,23 +143,23 @@
[docs] def SetConsoleTextAttribute(stream_id, attrs): handle = handles[stream_id] - return _SetConsoleTextAttribute(handle, attrs) -
- def SetConsoleCursorPosition(stream_id, position, adjust=True): + return _SetConsoleTextAttribute(handle, attrs)
+ + def SetConsoleCursorPosition(stream_id, position, adjust=True): position = COORD(*position) - # If the position is out of range, do nothing. + # If the position is out of range, do nothing. if position.Y <= 0 or position.X <= 0: return - # Adjust for Windows' SetConsoleCursorPosition: - # 1. being 0-based, while ANSI is 1-based. - # 2. expecting (x,y), while ANSI uses (y,x). + # Adjust for Windows' SetConsoleCursorPosition: + # 1. being 0-based, while ANSI is 1-based. + # 2. expecting (x,y), while ANSI uses (y,x). adjusted_position = COORD(position.Y - 1, position.X - 1) if adjust: - # Adjust for viewport's scroll position + # Adjust for viewport's scroll position sr = GetConsoleScreenBufferInfo(STDOUT).srWindow adjusted_position.Y += sr.Top adjusted_position.X += sr.Left - # Resume normal processing + # Resume normal processing handle = handles[stream_id] return _SetConsoleCursorPosition(handle, adjusted_position) @@ -180,7 +168,7 @@ char = c_char(char.encode()) length = wintypes.DWORD(length) num_written = wintypes.DWORD(0) - # Note that this is hard-coded for ANSI (vs wide) bytes. + # Note that this is hard-coded for ANSI (vs wide) bytes. success = _FillConsoleOutputCharacterA( handle, char, length, start, byref(num_written)) return num_written.value @@ -191,7 +179,7 @@ attribute = wintypes.WORD(attr) length = wintypes.DWORD(length) num_written = wintypes.DWORD(0) - # Note that this is hard-coded for ANSI (vs wide) bytes. + # Note that this is hard-coded for ANSI (vs wide) bytes. return _FillConsoleOutputAttribute( handle, attribute, length, start, byref(num_written)) @@ -202,7 +190,7 @@
-
+ diff --git a/doc/build/html/_modules/src/colorama/winterm.html b/doc/build/html/_modules/src/colorama/winterm.html index ce36f21..777fcfd 100644 --- a/doc/build/html/_modules/src/colorama/winterm.html +++ b/doc/build/html/_modules/src/colorama/winterm.html @@ -2,39 +2,27 @@ - + - - src.colorama.winterm — salomeTools 5.0.0dev documentation - + src.colorama.winterm — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,11 +31,11 @@

Source code for src.colorama.winterm

-# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
-from . import win32
+# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
+from . import win32
 
 
-# from wincon.h
+# from wincon.h
 
[docs]class WinColor(object): BLACK = 0 BLUE = 1 @@ -56,14 +44,14 @@ RED = 4 MAGENTA = 5 YELLOW = 6 - GREY = 7 + GREY = 7
-# from wincon.h
+# from wincon.h
[docs]class WinStyle(object): - NORMAL = 0x00 # dim text, dim background - BRIGHT = 0x08 # bright text, dim background - BRIGHT_BACKGROUND = 0x80 # dim text, bright background -
+ NORMAL = 0x00 # dim text, dim background + BRIGHT = 0x08 # bright text, dim background + BRIGHT_BACKGROUND = 0x80 # dim text, bright background
+
[docs]class WinTerm(object): def __init__(self): @@ -72,97 +60,97 @@ self._default_fore = self._fore self._default_back = self._back self._default_style = self._style - # In order to emulate LIGHT_EX in windows, we borrow the BRIGHT style. - # So that LIGHT_EX colors and BRIGHT style do not clobber each other, - # we track them separately, since LIGHT_EX is overwritten by Fore/Back - # and BRIGHT is overwritten by Style codes. + # In order to emulate LIGHT_EX in windows, we borrow the BRIGHT style. + # So that LIGHT_EX colors and BRIGHT style do not clobber each other, + # we track them separately, since LIGHT_EX is overwritten by Fore/Back + # and BRIGHT is overwritten by Style codes. self._light = 0
[docs] def get_attrs(self): - return self._fore + self._back * 16 + (self._style | self._light) -
+ return self._fore + self._back * 16 + (self._style | self._light)
+
[docs] def set_attrs(self, value): self._fore = value & 7 self._back = (value >> 4) & 7 - self._style = value & (WinStyle.BRIGHT | WinStyle.BRIGHT_BACKGROUND) -
-
[docs] def reset_all(self, on_stderr=None): + self._style = value & (WinStyle.BRIGHT | WinStyle.BRIGHT_BACKGROUND)
+ +
[docs] def reset_all(self, on_stderr=None): self.set_attrs(self._default) - self.set_console(attrs=self._default) -
-
[docs] def fore(self, fore=None, light=False, on_stderr=False): - if fore is None: + self.set_console(attrs=self._default)
+ +
[docs] def fore(self, fore=None, light=False, on_stderr=False): + if fore is None: fore = self._default_fore self._fore = fore - # Emulate LIGHT_EX with BRIGHT Style + # Emulate LIGHT_EX with BRIGHT Style if light: self._light |= WinStyle.BRIGHT else: self._light &= ~WinStyle.BRIGHT - self.set_console(on_stderr=on_stderr) -
-
[docs] def back(self, back=None, light=False, on_stderr=False): - if back is None: + self.set_console(on_stderr=on_stderr)
+ +
[docs] def back(self, back=None, light=False, on_stderr=False): + if back is None: back = self._default_back self._back = back - # Emulate LIGHT_EX with BRIGHT_BACKGROUND Style + # Emulate LIGHT_EX with BRIGHT_BACKGROUND Style if light: self._light |= WinStyle.BRIGHT_BACKGROUND else: self._light &= ~WinStyle.BRIGHT_BACKGROUND - self.set_console(on_stderr=on_stderr) -
-
[docs] def style(self, style=None, on_stderr=False): - if style is None: + self.set_console(on_stderr=on_stderr)
+ +
[docs] def style(self, style=None, on_stderr=False): + if style is None: style = self._default_style self._style = style - self.set_console(on_stderr=on_stderr) -
-
[docs] def set_console(self, attrs=None, on_stderr=False): - if attrs is None: + self.set_console(on_stderr=on_stderr)
+ +
[docs] def set_console(self, attrs=None, on_stderr=False): + if attrs is None: attrs = self.get_attrs() handle = win32.STDOUT if on_stderr: handle = win32.STDERR - win32.SetConsoleTextAttribute(handle, attrs) -
+ win32.SetConsoleTextAttribute(handle, attrs)
+
[docs] def get_position(self, handle): position = win32.GetConsoleScreenBufferInfo(handle).dwCursorPosition - # Because Windows coordinates are 0-based, - # and win32.SetConsoleCursorPosition expects 1-based. + # Because Windows coordinates are 0-based, + # and win32.SetConsoleCursorPosition expects 1-based. position.X += 1 position.Y += 1 - return position -
-
[docs] def set_cursor_position(self, position=None, on_stderr=False): - if position is None: - # I'm not currently tracking the position, so there is no default. - # position = self.get_position() + return position
+ +
[docs] def set_cursor_position(self, position=None, on_stderr=False): + if position is None: + # I'm not currently tracking the position, so there is no default. + # position = self.get_position() return handle = win32.STDOUT if on_stderr: handle = win32.STDERR - win32.SetConsoleCursorPosition(handle, position) -
-
[docs] def cursor_adjust(self, x, y, on_stderr=False): + win32.SetConsoleCursorPosition(handle, position)
+ +
[docs] def cursor_adjust(self, x, y, on_stderr=False): handle = win32.STDOUT if on_stderr: handle = win32.STDERR position = self.get_position(handle) adjusted_position = (position.Y + y, position.X + x) - win32.SetConsoleCursorPosition(handle, adjusted_position, adjust=False) -
-
[docs] def erase_screen(self, mode=0, on_stderr=False): - # 0 should clear from the cursor to the end of the screen. - # 1 should clear from the cursor to the beginning of the screen. - # 2 should clear the entire screen, and move cursor to (1,1) + win32.SetConsoleCursorPosition(handle, adjusted_position, adjust=False)
+ +
[docs] def erase_screen(self, mode=0, on_stderr=False): + # 0 should clear from the cursor to the end of the screen. + # 1 should clear from the cursor to the beginning of the screen. + # 2 should clear the entire screen, and move cursor to (1,1) handle = win32.STDOUT if on_stderr: handle = win32.STDERR csbi = win32.GetConsoleScreenBufferInfo(handle) - # get the number of character cells in the current buffer + # get the number of character cells in the current buffer cells_in_screen = csbi.dwSize.X * csbi.dwSize.Y - # get number of character cells before current cursor position + # get number of character cells before current cursor position cells_before_cursor = csbi.dwSize.X * csbi.dwCursorPosition.Y + csbi.dwCursorPosition.X if mode == 0: from_coord = csbi.dwCursorPosition @@ -173,18 +161,18 @@ elif mode == 2: from_coord = win32.COORD(0, 0) cells_to_erase = cells_in_screen - # fill the entire screen with blanks - win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord) - # now set the buffer's attributes accordingly + # fill the entire screen with blanks + win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord) + # now set the buffer's attributes accordingly win32.FillConsoleOutputAttribute(handle, self.get_attrs(), cells_to_erase, from_coord) if mode == 2: - # put the cursor where needed - win32.SetConsoleCursorPosition(handle, (1, 1)) -
-
[docs] def erase_line(self, mode=0, on_stderr=False): - # 0 should clear from the cursor to the end of the line. - # 1 should clear from the cursor to the beginning of the line. - # 2 should clear the entire line. + # put the cursor where needed + win32.SetConsoleCursorPosition(handle, (1, 1))
+ +
[docs] def erase_line(self, mode=0, on_stderr=False): + # 0 should clear from the cursor to the end of the line. + # 1 should clear from the cursor to the beginning of the line. + # 2 should clear the entire line. handle = win32.STDOUT if on_stderr: handle = win32.STDERR @@ -198,11 +186,11 @@ elif mode == 2: from_coord = win32.COORD(0, csbi.dwCursorPosition.Y) cells_to_erase = csbi.dwSize.X - # fill the entire screen with blanks - win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord) - # now set the buffer's attributes accordingly - win32.FillConsoleOutputAttribute(handle, self.get_attrs(), cells_to_erase, from_coord) -
+ # fill the entire screen with blanks + win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord) + # now set the buffer's attributes accordingly + win32.FillConsoleOutputAttribute(handle, self.get_attrs(), cells_to_erase, from_coord)
+
[docs] def set_title(self, title): win32.SetConsoleTitle(title)
@@ -210,7 +198,7 @@ -
+ diff --git a/doc/build/html/_modules/src/compilation.html b/doc/build/html/_modules/src/compilation.html index bbbfbdc..533a60a 100644 --- a/doc/build/html/_modules/src/compilation.html +++ b/doc/build/html/_modules/src/compilation.html @@ -2,39 +2,27 @@ - + - - src.compilation — salomeTools 5.0.0dev documentation - + src.compilation — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,23 +31,23 @@

Source code for src.compilation

-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-#  Copyright (C) 2010-2013  CEA/DEN
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library 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
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+#  Copyright (C) 2010-2013  CEA/DEN
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library 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
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 
 import os
 import subprocess
@@ -68,13 +56,13 @@
 
 import src
 
-C_COMPILE_ENV_LIST = ["CC",
-                      "CXX",
-                      "F77",
-                      "CFLAGS",
-                      "CXXFLAGS",
-                      "LIBS",
-                      "LDFLAGS"]
+C_COMPILE_ENV_LIST = ["CC",
+                      "CXX",
+                      "F77",
+                      "CFLAGS",
+                      "CXXFLAGS",
+                      "LIBS",
+                      "LDFLAGS"]
 
 
[docs]class Builder: """Class to handle all construction steps, like cmake, configure, make, ... @@ -84,7 +72,7 @@ logger, product_info, options = src.options.OptResult(), - check_src=True): + check_src=True): self.config = config self.logger = logger self.options = options @@ -92,270 +80,270 @@ self.build_dir = src.Path(self.product_info.build_dir) self.source_dir = src.Path(self.product_info.source_dir) self.install_dir = src.Path(self.product_info.install_dir) - self.header = "" - self.debug_mode = False - if "debug" in self.product_info and self.product_info.debug == "yes": - self.debug_mode = True - - ## - # Shortcut method to log in log file. -
[docs] def log(self, text, level, showInfo=True): + self.header = "" + self.debug_mode = False + if "debug" in self.product_info and self.product_info.debug == "yes": + self.debug_mode = True + + ## + # Shortcut method to log in log file. +
[docs] def log(self, text, level, showInfo=True): self.logger.write(text, level, showInfo) self.logger.logTxtFile.write(src.printcolors.cleancolor(text)) - self.logger.flush() + self.logger.flush()
- ## - # Shortcut method to log a command.
+ ## + # Shortcut method to log a command.
[docs] def log_command(self, command): - self.log("> %s\n" % command, 5) + self.log("> %s\n" % command, 5)
- ## - # Prepares the environment. - # Build two environment: one for building and one for testing (launch).
+ ## + # Prepares the environment. + # Build two environment: one for building and one for testing (launch).
[docs] def prepare(self): if not self.build_dir.exists(): - # create build dir + # create build dir self.build_dir.make() - self.log(' build_dir = %s\n' % str(self.build_dir), 4) - self.log(' install_dir = %s\n' % str(self.install_dir), 4) - self.log('\n', 4) + self.log(' build_dir = %s\n' % str(self.build_dir), 4) + self.log(' install_dir = %s\n' % str(self.install_dir), 4) + self.log('\n', 4) - # add products in depend and opt_depend list recursively + # add products in depend and opt_depend list recursively environ_info = src.product.get_product_dependencies(self.config, self.product_info) - #environ_info.append(self.product_info.name) + #environ_info.append(self.product_info.name) - # create build environment + # create build environment self.build_environ = src.environment.SalomeEnviron(self.config, src.environment.Environ(dict(os.environ)), - True) + True) self.build_environ.silent = (self.config.USER.output_verbose_level < 5) self.build_environ.set_full_environ(self.logger, environ_info) - # create runtime environment + # create runtime environment self.launch_environ = src.environment.SalomeEnviron(self.config, src.environment.Environ(dict(os.environ)), - False) - self.launch_environ.silent = True # no need to show here + False) + self.launch_environ.silent = True # no need to show here self.launch_environ.set_full_environ(self.logger, environ_info) for ee in C_COMPILE_ENV_LIST: vv = self.build_environ.get(ee) if len(vv) > 0: - self.log(" %s = %s\n" % (ee, vv), 4, False) + self.log(" %s = %s\n" % (ee, vv), 4, False) - return 0 + return 0
- ## - # Runs cmake with the given options.
-
[docs] def cmake(self, options=""): + ## + # Runs cmake with the given options. +
[docs] def cmake(self, options=""): cmake_option = options - # cmake_option +=' -DCMAKE_VERBOSE_MAKEFILE=ON -DSALOME_CMAKE_DEBUG=ON' - if 'cmake_options' in self.product_info: - cmake_option += " %s " % " ".join( + # cmake_option +=' -DCMAKE_VERBOSE_MAKEFILE=ON -DSALOME_CMAKE_DEBUG=ON' + if 'cmake_options' in self.product_info: + cmake_option += " %s " % " ".join( self.product_info.cmake_options.split()) - # add debug option + # add debug option if self.debug_mode: - cmake_option += " -DCMAKE_BUILD_TYPE=Debug" + cmake_option += " -DCMAKE_BUILD_TYPE=Debug" else : - cmake_option += " -DCMAKE_BUILD_TYPE=Release" + cmake_option += " -DCMAKE_BUILD_TYPE=Release" - # In case CMAKE_GENERATOR is defined in environment, - # use it in spite of automatically detect it - if 'cmake_generator' in self.config.APPLICATION: - cmake_option += " -DCMAKE_GENERATOR=%s" \ + # In case CMAKE_GENERATOR is defined in environment, + # use it in spite of automatically detect it + if 'cmake_generator' in self.config.APPLICATION: + cmake_option += " -DCMAKE_GENERATOR=%s" \ % self.config.APPLICATION.cmake_generator - command = ("cmake %s -DCMAKE_INSTALL_PREFIX=%s %s" % + command = ("cmake %s -DCMAKE_INSTALL_PREFIX=%s %s" % (cmake_option, self.install_dir, self.source_dir)) self.log_command(command) - # for key in sorted(self.build_environ.environ.environ.keys()): - # print key, " ", self.build_environ.environ.environ[key] + # for key in sorted(self.build_environ.environ.environ.keys()): + # print key, " ", self.build_environ.environ.environ[key] res = subprocess.call(command, - shell=True, + shell=True, cwd=str(self.build_dir), env=self.build_environ.environ.environ, stdout=self.logger.logTxtFile, stderr=subprocess.STDOUT) - self.put_txt_log_in_appli_log_dir("cmake") + self.put_txt_log_in_appli_log_dir("cmake") if res == 0: return res else: - return 1 + return 1
- ## - # Runs build_configure with the given options.
-
[docs] def build_configure(self, options=""): + ## + # Runs build_configure with the given options. +
[docs] def build_configure(self, options=""): - if 'buildconfigure_options' in self.product_info: - options += " %s " % self.product_info.buildconfigure_options + if 'buildconfigure_options' in self.product_info: + options += " %s " % self.product_info.buildconfigure_options - command = str('%s/build_configure') % (self.source_dir) - command = command + " " + options + command = str('%s/build_configure') % (self.source_dir) + command = command + " " + options self.log_command(command) res = subprocess.call(command, - shell=True, + shell=True, cwd=str(self.build_dir), env=self.build_environ.environ.environ, stdout=self.logger.logTxtFile, stderr=subprocess.STDOUT) - self.put_txt_log_in_appli_log_dir("build_configure") + self.put_txt_log_in_appli_log_dir("build_configure") if res == 0: return res else: - return 1 + return 1
- ## - # Runs configure with the given options.
-
[docs] def configure(self, options=""): + ## + # Runs configure with the given options. +
[docs] def configure(self, options=""): - if 'configure_options' in self.product_info: - options += " %s " % self.product_info.configure_options + if 'configure_options' in self.product_info: + options += " %s " % self.product_info.configure_options - command = "%s/configure --prefix=%s" % (self.source_dir, + command = "%s/configure --prefix=%s" % (self.source_dir, str(self.install_dir)) - command = command + " " + options + command = command + " " + options self.log_command(command) res = subprocess.call(command, - shell=True, + shell=True, cwd=str(self.build_dir), env=self.build_environ.environ.environ, stdout=self.logger.logTxtFile, stderr=subprocess.STDOUT) - self.put_txt_log_in_appli_log_dir("configure") + self.put_txt_log_in_appli_log_dir("configure") if res == 0: return res else: - return 1 -
+ return 1
+
[docs] def hack_libtool(self): - if not os.path.exists(str(self.build_dir + 'libtool')): + if not os.path.exists(str(self.build_dir + 'libtool')): return - lf = open(os.path.join(str(self.build_dir), "libtool"), 'r') + lf = open(os.path.join(str(self.build_dir), "libtool"), 'r') for line in lf.readlines(): - if 'hack_libtool' in line: + if 'hack_libtool' in line: return - # fix libtool by replacing CC="<compil>" with hack_libtool function - hack_command='''sed -i "s%^CC=\\"\(.*\)\\"%hack_libtool() { \\n\\ -if test \\"\$(echo \$@ | grep -E '\\\\\\-L/usr/lib(/../lib)?(64)? ')\\" == \\\"\\\" \\n\\ - then\\n\\ - cmd=\\"\\1 \$@\\"\\n\\ - else\\n\\ - cmd=\\"\\1 \\"\`echo \$@ | sed -r -e 's|(.*)-L/usr/lib(/../lib)?(64)? (.*)|\\\\\\1\\\\\\4 -L/usr/lib\\\\\\3|g'\`\\n\\ - fi\\n\\ - \$cmd\\n\\ -}\\n\\ -CC=\\"hack_libtool\\"%g" libtool''' + # fix libtool by replacing CC="<compil>" with hack_libtool function + hack_command='''sed -i "s%^CC=\\"\(.*\)\\"%hack_libtool() { \\n\\ +if test \\"\$(echo \$@ | grep -E '\\\\\\-L/usr/lib(/../lib)?(64)? ')\\" == \\\"\\\" \\n\\ + then\\n\\ + cmd=\\"\\1 \$@\\"\\n\\ + else\\n\\ + cmd=\\"\\1 \\"\`echo \$@ | sed -r -e 's|(.*)-L/usr/lib(/../lib)?(64)? (.*)|\\\\\\1\\\\\\4 -L/usr/lib\\\\\\3|g'\`\\n\\ + fi\\n\\ + \$cmd\\n\\ +}\\n\\ +CC=\\"hack_libtool\\"%g" libtool''' self.log_command(hack_command) subprocess.call(hack_command, - shell=True, + shell=True, cwd=str(self.build_dir), env=self.build_environ.environ.environ, stdout=self.logger.logTxtFile, - stderr=subprocess.STDOUT) + stderr=subprocess.STDOUT)
- ## - # Runs make to build the module.
-
[docs] def make(self, nb_proc, make_opt=""): + ## + # Runs make to build the module. +
[docs] def make(self, nb_proc, make_opt=""): - # make - command = 'make' - command = command + " -j" + str(nb_proc) - command = command + " " + make_opt + # make + command = 'make' + command = command + " -j" + str(nb_proc) + command = command + " " + make_opt self.log_command(command) res = subprocess.call(command, - shell=True, + shell=True, cwd=str(self.build_dir), env=self.build_environ.environ.environ, stdout=self.logger.logTxtFile, stderr=subprocess.STDOUT) - self.put_txt_log_in_appli_log_dir("make") + self.put_txt_log_in_appli_log_dir("make") if res == 0: return res else: - return 1 + return 1
- ## - # Runs msbuild to build the module.
-
[docs] def wmake(self,nb_proc, opt_nb_proc = None): + ## + # Runs msbuild to build the module. +
[docs] def wmake(self,nb_proc, opt_nb_proc = None): - hh = 'MSBUILD /m:%s' % str(nb_proc) + hh = 'MSBUILD /m:%s' % str(nb_proc) if self.debug_mode: - hh += " " + src.printcolors.printcWarning("DEBUG") - # make - command = 'msbuild' - command = command + " /maxcpucount:" + str(nb_proc) + hh += " " + src.printcolors.printcWarning("DEBUG") + # make + command = 'msbuild' + command = command + " /maxcpucount:" + str(nb_proc) if self.debug_mode: - command = command + " /p:Configuration=Debug" + command = command + " /p:Configuration=Debug" else: - command = command + " /p:Configuration=Release" - command = command + " ALL_BUILD.vcxproj" + command = command + " /p:Configuration=Release" + command = command + " ALL_BUILD.vcxproj" self.log_command(command) res = subprocess.call(command, - shell=True, + shell=True, cwd=str(self.build_dir), env=self.build_environ.environ.environ, stdout=self.logger.logTxtFile, stderr=subprocess.STDOUT) - self.put_txt_log_in_appli_log_dir("make") + self.put_txt_log_in_appli_log_dir("make") if res == 0: return res else: - return 1 + return 1
- ## - # Runs 'make install'.
+ ## + # Runs 'make install'.
[docs] def install(self): - if self.config.VARS.dist_name=="Win": - command = 'msbuild INSTALL.vcxproj' + if self.config.VARS.dist_name=="Win": + command = 'msbuild INSTALL.vcxproj' if self.debug_mode: - command = command + " /p:Configuration=Debug" + command = command + " /p:Configuration=Debug" else: - command = command + " /p:Configuration=Release" + command = command + " /p:Configuration=Release" else : - command = 'make install' + command = 'make install' self.log_command(command) res = subprocess.call(command, - shell=True, + shell=True, cwd=str(self.build_dir), env=self.build_environ.environ.environ, stdout=self.logger.logTxtFile, stderr=subprocess.STDOUT) - self.put_txt_log_in_appli_log_dir("makeinstall") + self.put_txt_log_in_appli_log_dir("makeinstall") if res == 0: return res else: - return 1 + return 1
- ## - # Runs 'make_check'.
-
[docs] def check(self, command=""): + ## + # Runs 'make_check'. +
[docs] def check(self, command=""): if src.architecture.is_windows(): - cmd = 'msbuild RUN_TESTS.vcxproj' + cmd = 'msbuild RUN_TESTS.vcxproj' else : - if self.product_info.build_source=="autotools" : - cmd = 'make check' + if self.product_info.build_source=="autotools" : + cmd = 'make check' else: - cmd = 'make test' + cmd = 'make test' if command: cmd = command @@ -363,7 +351,7 @@ self.log_command(cmd) res = subprocess.call(cmd, - shell=True, + shell=True, cwd=str(self.build_dir), env=self.launch_environ.environ.environ, stdout=self.logger.logTxtFile, @@ -372,43 +360,43 @@ if res == 0: return res else: - return 1 + return 1
- ## - # Performs a default build for this module.
+ ## + # Performs a default build for this module.
[docs] def do_default_build(self, - build_conf_options="", - configure_options="", - show_warning=True): - use_autotools = False - if 'use_autotools' in self.product_info: + build_conf_options="", + configure_options="", + show_warning=True): + use_autotools = False + if 'use_autotools' in self.product_info: uc = self.product_info.use_autotools - if uc in ['always', 'yes']: - use_autotools = True - elif uc == 'option': + if uc in ['always', 'yes']: + use_autotools = True + elif uc == 'option': use_autotools = self.options.autotools self.use_autotools = use_autotools - use_ctest = False - if 'use_ctest' in self.product_info: + use_ctest = False + if 'use_ctest' in self.product_info: uc = self.product_info.use_ctest - if uc in ['always', 'yes']: - use_ctest = True - elif uc == 'option': + if uc in ['always', 'yes']: + use_ctest = True + elif uc == 'option': use_ctest = self.options.ctest self.use_ctest = use_ctest if show_warning: - cmd = "" - if use_autotools: cmd = "(autotools)" - if use_ctest: cmd = "(ctest)" + cmd = "" + if use_autotools: cmd = "(autotools)" + if use_ctest: cmd = "(ctest)" - self.log("\n", 4, False) - self.log("%(module)s: Run default compilation method %(cmd)s\n" % \ - { "module": self.module, "cmd": cmd }, 4) + self.log("\n", 4, False) + self.log("%(module)s: Run default compilation method %(cmd)s\n" % \ + { "module": self.module, "cmd": cmd }, 4) if use_autotools: if not self.prepare(): return self.get_result() @@ -419,8 +407,8 @@ if not self.install(): return self.get_result() if not self.clean(): return self.get_result() - else: # CMake - if self.config.VARS.dist_name=='Win': + else: # CMake + if self.config.VARS.dist_name=='Win': if not self.wprepare(): return self.get_result() if not self.cmake(): return self.get_result() if not self.wmake(): return self.get_result() @@ -433,19 +421,19 @@ if not self.install(): return self.get_result() if not self.clean(): return self.get_result() - return self.get_result() + return self.get_result()
- ## - # Performs a build with a script.
+ ## + # Performs a build with a script.
[docs] def do_python_script_build(self, script, nb_proc): - # script found - self.logger.write(_("Compile %(product)s using script %(script)s\n") % \ - { 'product': self.product_info.name, - 'script': src.printcolors.printcLabel(script) }, 4) + # script found + self.logger.write(_("Compile %(product)s using script %(script)s\n") % \ + { 'product': self.product_info.name, + 'script': src.printcolors.printcLabel(script) }, 4) try: import imp product = self.product_info.name - pymodule = imp.load_source(product + "_compile_script", script) + pymodule = imp.load_source(product + "_compile_script", script) self.nb_proc = nb_proc retcode = pymodule.compil(self.config, self, self.logger) except: @@ -456,66 +444,66 @@ traceback.print_exc() retcode = 1 finally: - self.put_txt_log_in_appli_log_dir("script") + self.put_txt_log_in_appli_log_dir("script") + + return retcode
- return retcode -
[docs] def complete_environment(self, make_options): - assert self.build_environ is not None - # pass additional variables to environment - # (may be used by the build script) - self.build_environ.set("SOURCE_DIR", str(self.source_dir)) - self.build_environ.set("INSTALL_DIR", str(self.install_dir)) - self.build_environ.set("PRODUCT_INSTALL", str(self.install_dir)) - self.build_environ.set("BUILD_DIR", str(self.build_dir)) - self.build_environ.set("PRODUCT_BUILD", str(self.build_dir)) - self.build_environ.set("MAKE_OPTIONS", make_options) - self.build_environ.set("DIST_NAME", self.config.VARS.dist_name) - self.build_environ.set("DIST_VERSION", self.config.VARS.dist_version) - self.build_environ.set("DIST", self.config.VARS.dist) - self.build_environ.set("VERSION", self.product_info.version) -
+ assert self.build_environ is not None + # pass additional variables to environment + # (may be used by the build script) + self.build_environ.set("SOURCE_DIR", str(self.source_dir)) + self.build_environ.set("INSTALL_DIR", str(self.install_dir)) + self.build_environ.set("PRODUCT_INSTALL", str(self.install_dir)) + self.build_environ.set("BUILD_DIR", str(self.build_dir)) + self.build_environ.set("PRODUCT_BUILD", str(self.build_dir)) + self.build_environ.set("MAKE_OPTIONS", make_options) + self.build_environ.set("DIST_NAME", self.config.VARS.dist_name) + self.build_environ.set("DIST_VERSION", self.config.VARS.dist_version) + self.build_environ.set("DIST", self.config.VARS.dist) + self.build_environ.set("VERSION", self.product_info.version) +
[docs] def do_batch_script_build(self, script, nb_proc): if src.architecture.is_windows(): - make_options = "/maxcpucount:%s" % nb_proc + make_options = "/maxcpucount:%s" % nb_proc else : - make_options = "-j%s" % nb_proc + make_options = "-j%s" % nb_proc - self.log_command(" " + _("Run build script %s\n") % script) + self.log_command(" " + _("Run build script %s\n") % script) self.complete_environment(make_options) res = subprocess.call(script, - shell=True, + shell=True, stdout=self.logger.logTxtFile, stderr=subprocess.STDOUT, cwd=str(self.build_dir), env=self.build_environ.environ.environ) - self.put_txt_log_in_appli_log_dir("script") + self.put_txt_log_in_appli_log_dir("script") if res == 0: return res else: - return 1 -
+ return 1 +
[docs] def do_script_build(self, script, number_of_proc=0): - # define make options (may not be used by the script) + # define make options (may not be used by the script) if number_of_proc==0: - nb_proc = src.get_cfg_param(self.product_info,"nb_proc", 0) + nb_proc = src.get_cfg_param(self.product_info,"nb_proc", 0) if nb_proc == 0: nb_proc = self.config.VARS.nb_proc else: nb_proc = min(number_of_proc, self.config.VARS.nb_proc) - extension = script.split('.')[-1] - if extension in ["bat","sh"]: + extension = script.split('.')[-1] + if extension in ["bat","sh"]: return self.do_batch_script_build(script, nb_proc) - if extension == "py": + if extension == "py": return self.do_python_script_build(script, nb_proc) - msg = _("The script %s must have .sh, .bat or .py extension." % script) - raise src.SatException(msg) -
+ msg = _("The script %s must have .sh, .bat or .py extension." % script) + raise src.SatException(msg) +
[docs] def put_txt_log_in_appli_log_dir(self, file_name): '''Put the txt log (that contain the system logs, like make command output) in the directory <APPLICATION DIR>/LOGS/<product_name>/ @@ -525,23 +513,23 @@ if self.logger.logTxtFile == sys.__stdout__: return dir_where_to_put = os.path.join(self.config.APPLICATION.workdir, - "LOGS", + "LOGS", self.product_info.name) file_path = os.path.join(dir_where_to_put, file_name) src.ensure_path_exists(dir_where_to_put) - # write the logTxtFile copy it to the destination, and then recreate - # it as it was + # write the logTxtFile copy it to the destination, and then recreate + # it as it was self.logger.logTxtFile.close() shutil.move(self.logger.txtFilePath, file_path) - self.logger.logTxtFile = open(str(self.logger.txtFilePath), 'w') - self.logger.logTxtFile.write(open(file_path, "r").read()) -
+ self.logger.logTxtFile = open(str(self.logger.txtFilePath), 'w') + self.logger.logTxtFile.write(open(file_path, "r").read()) + -
+ diff --git a/doc/build/html/_modules/src/debug.html b/doc/build/html/_modules/src/debug.html index 06ad3bc..227c71f 100644 --- a/doc/build/html/_modules/src/debug.html +++ b/doc/build/html/_modules/src/debug.html @@ -2,39 +2,27 @@ - + - - src.debug — salomeTools 5.0.0dev documentation - + src.debug — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,24 +31,24 @@

Source code for src.debug

-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-
-#  Copyright (C) 2010-2018  CEA/DEN
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library 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
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+
+#  Copyright (C) 2010-2018  CEA/DEN
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library 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
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 
 """\
 This file assume DEBUG functionalities use
@@ -99,52 +87,52 @@
 
 import os
 import sys
-import StringIO as SIO
-import pprint as PP
+import StringIO as SIO
+import pprint as PP
 
-_debug = [False] #support push/pop for temporary activate debug outputs
+_debug = [False] #support push/pop for temporary activate debug outputs
 
-
[docs]def indent(text, amount=2, ch=' '): +
[docs]def indent(text, amount=2, ch=' '): """indent multi lines message""" padding = amount * ch - return ''.join(padding + line for line in text.splitlines(True)) -
-
[docs]def write(title, var="", force=None, fmt="\n#### DEBUG: %s:\n%s\n"): + return ''.join(padding + line for line in text.splitlines(True))
+ +
[docs]def write(title, var="", force=None, fmt="\n#### DEBUG: %s:\n%s\n"): """write sys.stderr a message if _debug[-1]==True or optionaly force=True""" if _debug[-1] or force: - if 'src.pyconf.' in str(type(var)): + if 'src.pyconf.' in str(type(var)): sys.stderr.write(fmt % (title, indent(getStrConfigDbg(var)))) elif type(var) is not str: sys.stderr.write(fmt % (title, indent(PP.pformat(var)))) else: sys.stderr.write(fmt % (title, indent(var))) - return -
-
[docs]def tofix(title, var="", force=None): + return
+ +
[docs]def tofix(title, var="", force=None): """\ write sys.stderr a message if _debug[-1]==True or optionaly force=True use this only if no logger accessible for classic logger.warning(message) or logger.debug(message) """ - fmt = "\n#### TOFIX: %s:\n%s\n" - write(title, var, force, fmt) -
+ fmt = "\n#### TOFIX: %s:\n%s\n" + write(title, var, force, fmt)
+
[docs]def push_debug(aBool): """set debug outputs activated, or not""" - _debug.append(aBool) -
+ _debug.append(aBool)
+
[docs]def pop_debug(): """restore previous debug outputs status""" if len(_debug) > 1: return _debug.pop() else: - sys.stderr.write("\nERROR: pop_debug: too much pop.") - return None + sys.stderr.write("\nERROR: pop_debug: too much pop.") + return None
+ +############################################### +# utilitaires divers pour debug +############################################### -############################################### -# utilitaires divers pour debug -############################################### -
[docs]class OutStream(SIO.StringIO): """utility class for pyconf.Config output iostream"""
[docs] def close(self): @@ -152,31 +140,31 @@ keep value before lost as self.value """ self.value = self.getvalue() - SIO.StringIO.close(self) -
+ SIO.StringIO.close(self)
+
[docs]class InStream(SIO.StringIO): """utility class for pyconf.Config input iostream""" - pass -
+ pass +
[docs]def getLocalEnv(): """get string for environment variables representation""" - res = "" + res = "" for i in sorted(os.environ): - res += "%s : %s\n" % (i, os.environ[i]) - return res + res += "%s : %s\n" % (i, os.environ[i]) + return res
-# save as initial Config.save() moved as Config.__save__() +# save as initial Config.save() moved as Config.__save__()
[docs]def saveConfigStd(config, aStream): """returns as file .pyconf""" indent = 0 - config.__save__(aStream, indent) -
+ config.__save__(aStream, indent) +
[docs]def getStrConfigStd(config): """set string as saveConfigStd, as file .pyconf""" outStream = OutStream() saveConfigStd(config, outStream) - return outStream.value -
+ return outStream.value +
[docs]def getStrConfigDbg(config): """\ set string as saveConfigDbg, @@ -184,73 +172,73 @@ """ outStream = OutStream() saveConfigDbg(config, outStream) - return outStream.value -
-
[docs]def saveConfigDbg(config, aStream, indent=0, path=""): + return outStream.value
+ +
[docs]def saveConfigDbg(config, aStream, indent=0, path=""): """pyconf returns multilines (path expression evaluation) for debug""" _saveConfigRecursiveDbg(config, aStream, indent, path) - aStream.close() # as config.__save__() -
+ aStream.close() # as config.__save__() + def _saveConfigRecursiveDbg(config, aStream, indent, path): """pyconf inspired from Mapping.__save__""" - debug = False + debug = False if indent <= 0: indentp = 0 else: indentp = indentp + 2 - indstr = indent * ' ' # '':no indent, ' ':indent + indstr = indent * ' ' # '':no indent, ' ':indent strType = str(type(config)) - if "Sequence" in strType: + if "Sequence" in strType: for i in range(len(config)): - _saveConfigRecursiveDbg(config[i], aStream, indentp, path+"[%i]" % i) + _saveConfigRecursiveDbg(config[i], aStream, indentp, path+"[%i]" % i) return try: - order = object.__getattribute__(config, 'order') - data = object.__getattribute__(config, 'data') + order = object.__getattribute__(config, 'order') + data = object.__getattribute__(config, 'data') except: - aStream.write("%s%s : '%s'\n" % (indstr, path, str(config))) + aStream.write("%s%s : '%s'\n" % (indstr, path, str(config))) return for key in sorted(order): value = data[key] strType = str(type(value)) - if debug: print indstr + 'strType = %s' % strType, key - if "Config" in strType: - _saveConfigRecursiveDbg(value, aStream, indentp, path+"."+key) + if debug: print indstr + 'strType = %s' % strType, key + if "Config" in strType: + _saveConfigRecursiveDbg(value, aStream, indentp, path+"."+key) continue - if "Mapping" in strType: - _saveConfigRecursiveDbg(value, aStream, indentp, path+"."+key) + if "Mapping" in strType: + _saveConfigRecursiveDbg(value, aStream, indentp, path+"."+key) continue - if "Sequence" in strType: + if "Sequence" in strType: for i in range(len(value)): - _saveConfigRecursiveDbg(value[i], aStream, indentp, path+"."+key+"[%i]" % i) + _saveConfigRecursiveDbg(value[i], aStream, indentp, path+"."+key+"[%i]" % i) continue - if "Expression" in strType: + if "Expression" in strType: try: evaluate = value.evaluate(config) - aStream.write("%s%s.%s : %s --> '%s'\n" % (indstr, path, key, str(value), evaluate)) + aStream.write("%s%s.%s : %s --> '%s'\n" % (indstr, path, key, str(value), evaluate)) except Exception as e: - aStream.write("%s%s.%s : !!! ERROR: %s !!!\n" % (indstr, path, key, e.message)) + aStream.write("%s%s.%s : !!! ERROR: %s !!!\n" % (indstr, path, key, e.message)) continue - if "Reference" in strType: + if "Reference" in strType: try: evaluate = value.resolve(config) - aStream.write("%s%s.%s : %s --> '%s'\n" % (indstr, path, key, str(value), evaluate)) + aStream.write("%s%s.%s : %s --> '%s'\n" % (indstr, path, key, str(value), evaluate)) except Exception as e: - aStream.write("%s%s.%s : !!! ERROR: %s !!!\n" % (indstr, path, key, e.message)) + aStream.write("%s%s.%s : !!! ERROR: %s !!!\n" % (indstr, path, key, e.message)) continue - if type(value) in [str, bool, int, type(None), unicode]: - aStream.write("%s%s.%s : '%s'\n" % (indstr, path, key, str(value))) + if type(value) in [str, bool, int, type(None), unicode]: + aStream.write("%s%s.%s : '%s'\n" % (indstr, path, key, str(value))) continue try: - aStream.write("!!! TODO fix that %s %s%s.%s : %s\n" % (type(value), indstr, path, key, str(value))) + aStream.write("!!! TODO fix that %s %s%s.%s : %s\n" % (type(value), indstr, path, key, str(value))) except Exception as e: - aStream.write("%s%s.%s : !!! %s\n" % (indstr, path, key, e.message)) + aStream.write("%s%s.%s : !!! %s\n" % (indstr, path, key, e.message)) -
+ diff --git a/doc/build/html/_modules/src/environment.html b/doc/build/html/_modules/src/environment.html index 5e044b4..fb9c49d 100644 --- a/doc/build/html/_modules/src/environment.html +++ b/doc/build/html/_modules/src/environment.html @@ -2,39 +2,27 @@ - + - - src.environment — salomeTools 5.0.0dev documentation - + src.environment — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,23 +31,23 @@

Source code for src.environment

-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-#  Copyright (C) 2010-2013  CEA/DEN
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library 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
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+#  Copyright (C) 2010-2013  CEA/DEN
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library 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
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 
 import os
 import subprocess
@@ -67,27 +55,27 @@
 import sys
 
 import src
-import src.debug as DBG
-import pprint as PP
+import src.debug as DBG
+import pprint as PP
 
 
[docs]class Environ: """\ Class to manage the environment context """ - def __init__(self, environ=None): + def __init__(self, environ=None): """Initialization. If the environ argument is passed, the environment will be add to it, else it is the external environment. :param environ dict: """ - if environ is not None: + if environ is not None: self.environ = environ else: self.environ = os.environ def __repr__(self): """easy non exhaustive quick resume for debug print""" - return "%s(\n%s\n)" % (self.__class__.__name__, PP.pformat(self.environ)) + return "%s(\n%s\n)" % (self.__class__.__name__, PP.pformat(self.environ)) def _expandvars(self, value): """\ @@ -97,15 +85,15 @@ :return: the replaced variable :rtype: str """ - if "$" in value: - # The string.Template class is a string class - # for supporting $-substitutions + if "$" in value: + # The string.Template class is a string class + # for supporting $-substitutions zt = string.Template(value) try: value = zt.substitute(self.environ) except KeyError as exc: - raise src.SatException(_("Missing definition " - "in environment: %s") % str(exc)) + raise src.SatException(_("Missing definition " + "in environment: %s") % str(exc)) return value
[docs] def append_value(self, key, value, sep=os.pathsep): @@ -116,18 +104,18 @@ :param value str: the value to append to key :param sep str: the separator string """ - # check if the key is already in the environment + # check if the key is already in the environment if key in self.environ: value_list = self.environ[key].split(sep) - # Check if the value is already in the key value or not + # Check if the value is already in the key value or not if not value in value_list: value_list.append(value) else: value_list.append(value_list.pop(value_list.index(value))) self.set(key, sep.join(value_list)) else: - self.set(key, value) -
+ self.set(key, value)
+
[docs] def append(self, key, value, sep=os.pathsep): """\ Same as append_value but the value argument can be a list @@ -140,8 +128,8 @@ for v in value: self.append_value(key, v, sep) else: - self.append_value(key, value, sep) -
+ self.append_value(key, value, sep)
+
[docs] def prepend_value(self, key, value, sep=os.pathsep): """\ prepend value to key using sep @@ -158,8 +146,8 @@ value_list.insert(0, value_list.pop(value_list.index(value))) self.set(key, sep.join(value_list)) else: - self.set(key, value) -
+ self.set(key, value)
+
[docs] def prepend(self, key, value, sep=os.pathsep): """\ Same as prepend_value but the value argument can be a list @@ -172,16 +160,16 @@ for v in value: self.prepend_value(key, v, sep) else: - self.prepend_value(key, value, sep) -
+ self.prepend_value(key, value, sep)
+
[docs] def is_defined(self, key): """\ Check if the key exists in the environment :param key str: the environment variable to check """ - return key in self.environ.keys() -
+ return key in self.environ.keys()
+
[docs] def set(self, key, value): """\ Set the environment variable "key" to value "value" @@ -189,8 +177,8 @@ :param key str: the environment variable to set :param value str: the value """ - self.environ[key] = self._expandvars(value) -
+ self.environ[key] = self._expandvars(value) +
[docs] def get(self, key): """\ Get the value of the environment variable "key" @@ -200,8 +188,8 @@ if key in self.environ: return self.environ[key] else: - return "" -
+ return "" +
[docs] def command_value(self, key, command): """\ Get the value given by the system command "command" @@ -211,12 +199,12 @@ :param command str: the command to execute """ value = subprocess.Popen(command, - shell=True, + shell=True, stdout=subprocess.PIPE, env=self.environ).communicate()[0] - self.environ[key] = value + self.environ[key] = value
+ -
[docs]class SalomeEnviron: """\ Class to manage the environment of SALOME. @@ -224,9 +212,9 @@ def __init__(self, cfg, environ, - forBuild=False, - for_package=None, - enable_simple_env_script = True): + forBuild=False, + for_package=None, + enable_simple_env_script = True): """\ Initialization. @@ -243,16 +231,16 @@ self.forBuild = forBuild self.for_package = for_package self.enable_simple_env_script = enable_simple_env_script - self.silent = False + self.silent = False def __repr__(self): """easy almost exhaustive quick resume for debug print""" res = { - "environ" : self.environ, - "forBuild" : self.forBuild, - "for_package" : self.for_package, + "environ" : self.environ, + "forBuild" : self.forBuild, + "for_package" : self.for_package, } - return "%s(\n%s\n)" % (self.__class__.__name__, PP.pformat(res)) + return "%s(\n%s\n)" % (self.__class__.__name__, PP.pformat(res))
[docs] def append(self, key, value, sep=os.pathsep): """\ @@ -262,8 +250,8 @@ :param value str: the value to append to key :param sep str: the separator string """ - return self.environ.append(key, value, sep) -
+ return self.environ.append(key, value, sep)
+
[docs] def prepend(self, key, value, sep=os.pathsep): """\ prepend value to key using sep @@ -272,24 +260,24 @@ :param value str: the value to prepend to key :param sep str: the separator string """ - return self.environ.prepend(key, value, sep) -
+ return self.environ.prepend(key, value, sep) +
[docs] def is_defined(self, key): """\ Check if the key exists in the environment :param key str: the environment variable to check """ - return self.environ.is_defined(key) -
+ return self.environ.is_defined(key) +
[docs] def get(self, key): """\ Get the value of the environment variable "key" :param key str: the environment variable """ - return self.environ.get(key) -
+ return self.environ.get(key) +
[docs] def set(self, key, value): """\ Set the environment variable "key" to value "value" @@ -297,15 +285,15 @@ :param key str: the environment variable to set :param value str: the value """ - # check if value needs to be evaluated - if value is not None and value.startswith("`") and value.endswith("`"): - res = subprocess.Popen("echo %s" % value, - shell=True, + # check if value needs to be evaluated + if value is not None and value.startswith("`") and value.endswith("`"): + res = subprocess.Popen("echo %s" % value, + shell=True, stdout=subprocess.PIPE).communicate() value = res[0].strip() - return self.environ.set(key, value) -
+ return self.environ.set(key, value) +
[docs] def dump(self, out): """\ Write the environment to out @@ -316,60 +304,60 @@ try: value = self.get(k) except: - value = "?" - out.write("%s=%s\n" % (k, value)) -
+ value = "?" + out.write("%s=%s\n" % (k, value)) +
[docs] def add_line(self, nb_line): """\ Add empty lines to the out stream (in case of file generation) :param nb_line int: the number of empty lines to add """ - if 'add_line' in dir(self.environ): - self.environ.add_line(nb_line) -
+ if 'add_line' in dir(self.environ): + self.environ.add_line(nb_line) +
[docs] def add_comment(self, comment): """\ Add a commentary to the out stream (in case of file generation) :param comment str: the commentary to add """ - if 'add_comment' in dir(self.environ): - self.environ.add_comment(comment) -
+ if 'add_comment' in dir(self.environ): + self.environ.add_comment(comment) +
[docs] def add_warning(self, warning): """\ Add a warning to the out stream (in case of file generation) :param warning str: the warning to add """ - if 'add_warning' in dir(self.environ): - self.environ.add_warning(warning) -
+ if 'add_warning' in dir(self.environ): + self.environ.add_warning(warning) +
[docs] def finish(self, required): """\ Add a final instruction in the out file (in case of file generation) :param required bool: Do nothing if required is False """ - if 'finish' in dir(self.environ): + if 'finish' in dir(self.environ): self.environ.add_line(1) - self.environ.add_comment("clean all the path") - self.environ.finish(required) -
+ self.environ.add_comment("clean all the path") + self.environ.finish(required) +
[docs] def set_python_libdirs(self): """Set some generic variables for python library paths""" - ver = self.get('PYTHON_VERSION') - self.set('PYTHON_LIBDIR0', os.path.join('lib', - 'python' + ver, - 'site-packages')) - self.set('PYTHON_LIBDIR1', os.path.join('lib64', - 'python' + ver, - 'site-packages')) + ver = self.get('PYTHON_VERSION') + self.set('PYTHON_LIBDIR0', os.path.join('lib', + 'python' + ver, + 'site-packages')) + self.set('PYTHON_LIBDIR1', os.path.join('lib64', + 'python' + ver, + 'site-packages')) - self.python_lib0 = self.get('PYTHON_LIBDIR0') - self.python_lib1 = self.get('PYTHON_LIBDIR1') -
+ self.python_lib0 = self.get('PYTHON_LIBDIR0') + self.python_lib1 = self.get('PYTHON_LIBDIR1') +
[docs] def get_names(self, lProducts): """\ Get the products name to add in SALOME_MODULES environment variable @@ -379,21 +367,21 @@ :param lProducts list: List of products to potentially add """ - lProdHasGui = [p for p in lProducts if 'properties' in + lProdHasGui = [p for p in lProducts if 'properties' in src.product.get_product_config(self.cfg, p) and - 'has_salome_gui' in + 'has_salome_gui' in src.product.get_product_config(self.cfg, p).properties and src.product.get_product_config(self.cfg, - p).properties.has_salome_gui=='yes'] + p).properties.has_salome_gui=='yes'] lProdName = [] for ProdName in lProdHasGui: pi = src.product.get_product_config(self.cfg, ProdName) - if 'component_name' in pi: + if 'component_name' in pi: lProdName.append(pi.component_name) else: lProdName.append(ProdName) - return lProdName -
+ return lProdName +
[docs] def set_application_env(self, logger): """\ Sets the environment defined in the APPLICATION file. @@ -401,35 +389,35 @@ :param logger Logger: The logger instance to display messages """ - # add variable PRODUCT_ROOT_DIR as $workdir in APPLICATION.environ section if not present + # add variable PRODUCT_ROOT_DIR as $workdir in APPLICATION.environ section if not present try: tmp = self.cfg.APPLICATION.environ.PRODUCT_ROOT_DIR except: - self.cfg.APPLICATION.environ.PRODUCT_ROOT_DIR = src.pyconf.Reference(self.cfg, src.pyconf.DOLLAR, "workdir") - DBG.write("set_application_env add default Config.APPLICATION.environ.PRODUCT_ROOT_DIR", self.cfg.APPLICATION.environ) + self.cfg.APPLICATION.environ.PRODUCT_ROOT_DIR = src.pyconf.Reference(self.cfg, src.pyconf.DOLLAR, "workdir") + DBG.write("set_application_env add default Config.APPLICATION.environ.PRODUCT_ROOT_DIR", self.cfg.APPLICATION.environ) - # Set the variables defined in the "environ" section - if 'environ' in self.cfg.APPLICATION: - # we write PRODUCT environment it in order to conform to - # parseConfigFile.py - self.add_comment("PRODUCT environment") + # Set the variables defined in the "environ" section + if 'environ' in self.cfg.APPLICATION: + # we write PRODUCT environment it in order to conform to + # parseConfigFile.py + self.add_comment("PRODUCT environment") self.load_cfg_environment(self.cfg.APPLICATION.environ) - if self.forBuild and "build" in self.cfg.APPLICATION.environ: + if self.forBuild and "build" in self.cfg.APPLICATION.environ: self.load_cfg_environment(self.cfg.APPLICATION.environ.build) - if not self.forBuild and "launch" in self.cfg.APPLICATION.environ: + if not self.forBuild and "launch" in self.cfg.APPLICATION.environ: self.load_cfg_environment(self.cfg.APPLICATION.environ.launch) self.add_line(1) - # If there is an "environ_script" section, load the scripts - if 'environ_script' in self.cfg.APPLICATION: + # If there is an "environ_script" section, load the scripts + if 'environ_script' in self.cfg.APPLICATION: for pscript in self.cfg.APPLICATION.environ_script: - self.add_comment("script %s" % pscript) - sname = pscript.replace(" ", "_") - self.run_env_script("APPLICATION_%s" % sname, + self.add_comment("script %s" % pscript) + sname = pscript.replace(" ", "_") + self.run_env_script("APPLICATION_%s" % sname, self.cfg.APPLICATION.environ_script[pscript], logger) - self.add_line(1) -
+ self.add_line(1) +
[docs] def set_salome_minimal_product_env(self, product_info, logger): """\ Sets the minimal environment for a SALOME product. @@ -438,150 +426,150 @@ :param product_info Config: The product description :param logger Logger: The logger instance to display messages """ - # set root dir - DBG.write("set_salome_minimal_product_env", product_info) - root_dir = product_info.name + "_ROOT_DIR" + # set root dir + DBG.write("set_salome_minimal_product_env", product_info) + root_dir = product_info.name + "_ROOT_DIR" if not self.is_defined(root_dir): - if 'install_dir' in product_info and product_info.install_dir: + if 'install_dir' in product_info and product_info.install_dir: self.set(root_dir, product_info.install_dir) elif not self.silent: - logger.write(" " + _("No install_dir for product %s\n") % + logger.write(" " + _("No install_dir for product %s\n") % product_info.name, 5) source_in_package = src.get_property_in_product_cfg(product_info, - "sources_in_package") - if not self.for_package or source_in_package == "yes": - # set source dir, unless no source dir + "sources_in_package") + if not self.for_package or source_in_package == "yes": + # set source dir, unless no source dir if not src.product.product_is_fixed(product_info): - src_dir = product_info.name + "_SRC_DIR" + src_dir = product_info.name + "_SRC_DIR" if not self.is_defined(src_dir): if not self.for_package: self.set(src_dir, product_info.source_dir) else: - self.set(src_dir, os.path.join("out_dir_Path", - "SOURCES", - product_info.name)) -
+ self.set(src_dir, os.path.join("out_dir_Path", + "SOURCES", + product_info.name)) +
[docs] def set_salome_generic_product_env(self, pi): """\ Sets the generic environment for a SALOME product. :param pi Config: The product description """ - # Construct XXX_ROOT_DIR - env_root_dir = self.get(pi.name + "_ROOT_DIR") + # Construct XXX_ROOT_DIR + env_root_dir = self.get(pi.name + "_ROOT_DIR") l_binpath_libpath = [] - # create additional ROOT_DIR for CPP components - if 'component_name' in pi: + # create additional ROOT_DIR for CPP components + if 'component_name' in pi: compo_name = pi.component_name - if compo_name + "CPP" == pi.name: - compo_root_dir = compo_name + "_ROOT_DIR" + if compo_name + "CPP" == pi.name: + compo_root_dir = compo_name + "_ROOT_DIR" envcompo_root_dir = os.path.join( self.cfg.TOOLS.common.install_root, compo_name ) self.set(compo_root_dir , envcompo_root_dir) - bin_path = os.path.join(envcompo_root_dir, 'bin', 'salome') - lib_path = os.path.join(envcompo_root_dir, 'lib', 'salome') + bin_path = os.path.join(envcompo_root_dir, 'bin', 'salome') + lib_path = os.path.join(envcompo_root_dir, 'lib', 'salome') l_binpath_libpath.append( (bin_path, lib_path) ) - if src.get_property_in_product_cfg(pi, "fhs"): - lib_path = os.path.join(env_root_dir, 'lib') + if src.get_property_in_product_cfg(pi, "fhs"): + lib_path = os.path.join(env_root_dir, 'lib') pylib1_path = os.path.join(env_root_dir, self.python_lib0) pylib2_path = os.path.join(env_root_dir, self.python_lib1) - bin_path = os.path.join(env_root_dir, 'bin') + bin_path = os.path.join(env_root_dir, 'bin') else: - lib_path = os.path.join(env_root_dir, 'lib', 'salome') - pylib1_path = os.path.join(env_root_dir, self.python_lib0, 'salome') - pylib2_path = os.path.join(env_root_dir, self.python_lib1, 'salome') - bin_path = os.path.join(env_root_dir, 'bin', 'salome') + lib_path = os.path.join(env_root_dir, 'lib', 'salome') + pylib1_path = os.path.join(env_root_dir, self.python_lib0, 'salome') + pylib2_path = os.path.join(env_root_dir, self.python_lib1, 'salome') + bin_path = os.path.join(env_root_dir, 'bin', 'salome') - # Construct the paths to prepend to PATH and LD_LIBRARY_PATH and - # PYTHONPATH + # Construct the paths to prepend to PATH and LD_LIBRARY_PATH and + # PYTHONPATH l_binpath_libpath.append( (bin_path, lib_path) ) for bin_path, lib_path in l_binpath_libpath: if not self.forBuild: - self.prepend('PATH', bin_path) + self.prepend('PATH', bin_path) if src.architecture.is_windows(): - self.prepend('PATH', lib_path) + self.prepend('PATH', lib_path) else : - self.prepend('LD_LIBRARY_PATH', lib_path) + self.prepend('LD_LIBRARY_PATH', lib_path) l = [ bin_path, lib_path, pylib1_path, pylib2_path ] - self.prepend('PYTHONPATH', l) -
+ self.prepend('PYTHONPATH', l) +
[docs] def set_cpp_env(self, product_info): """\ Sets the generic environment for a SALOME cpp product. :param product_info Config: The product description """ - # Construct XXX_ROOT_DIR - env_root_dir = self.get(product_info.name + "_ROOT_DIR") + # Construct XXX_ROOT_DIR + env_root_dir = self.get(product_info.name + "_ROOT_DIR") l_binpath_libpath = [] - # Construct the paths to prepend to PATH and LD_LIBRARY_PATH and - # PYTHONPATH - bin_path = os.path.join(env_root_dir, 'bin') - lib_path = os.path.join(env_root_dir, 'lib') + # Construct the paths to prepend to PATH and LD_LIBRARY_PATH and + # PYTHONPATH + bin_path = os.path.join(env_root_dir, 'bin') + lib_path = os.path.join(env_root_dir, 'lib') l_binpath_libpath.append( (bin_path, lib_path) ) for bin_path, lib_path in l_binpath_libpath: if not self.forBuild: - self.prepend('PATH', bin_path) + self.prepend('PATH', bin_path) if src.architecture.is_windows(): - self.prepend('PATH', lib_path) + self.prepend('PATH', lib_path) else : - self.prepend('LD_LIBRARY_PATH', lib_path) + self.prepend('LD_LIBRARY_PATH', lib_path) l = [ bin_path, lib_path, os.path.join(env_root_dir, self.python_lib0), os.path.join(env_root_dir, self.python_lib1) ] - self.prepend('PYTHONPATH', l) -
+ self.prepend('PYTHONPATH', l) +
[docs] def load_cfg_environment(self, cfg_env): """\ Loads environment defined in cfg_env :param cfg_env Config: A config containing an environment """ - # Loop on cfg_env values + # Loop on cfg_env values for env_def in cfg_env: val = cfg_env[env_def] - # if it is env_script, do not do anything (reserved keyword) - if env_def == "env_script": + # if it is env_script, do not do anything (reserved keyword) + if env_def == "env_script": continue - # if it is a dict, do not do anything + # if it is a dict, do not do anything if isinstance(val, src.pyconf.Mapping): continue - # if it is a list, loop on its values + # if it is a list, loop on its values if isinstance(val, src.pyconf.Sequence): - # transform into list of strings + # transform into list of strings l_val = [] for item in val: l_val.append(item) val = l_val - # "_" means that the value must be prepended - if env_def.startswith("_"): - # separator exception for PV_PLUGIN_PATH - if env_def[1:] == 'PV_PLUGIN_PATH': - self.prepend(env_def[1:], val, ';') + # "_" means that the value must be prepended + if env_def.startswith("_"): + # separator exception for PV_PLUGIN_PATH + if env_def[1:] == 'PV_PLUGIN_PATH': + self.prepend(env_def[1:], val, ';') else: self.prepend(env_def[1:], val) - elif env_def.endswith("_"): - # separator exception for PV_PLUGIN_PATH - if env_def[:-1] == 'PV_PLUGIN_PATH': - self.append(env_def[:-1], val, ';') + elif env_def.endswith("_"): + # separator exception for PV_PLUGIN_PATH + if env_def[:-1] == 'PV_PLUGIN_PATH': + self.append(env_def[:-1], val, ';') else: self.append(env_def[:-1], val) else: - self.set(env_def, val) -
+ self.set(env_def, val) +
[docs] def set_a_product(self, product, logger): """\ Sets the environment of a product. @@ -590,92 +578,92 @@ :param logger Logger: The logger instance to display messages """ - # Get the informations corresponding to the product + # Get the informations corresponding to the product pi = src.product.get_product_config(self.cfg, product) - # skip mesa products (if any) at run time, - # unless use_mesa property was activated + # skip mesa products (if any) at run time, + # unless use_mesa property was activated if not self.forBuild: - if not ("APPLICATION" in self.cfg and - "properties" in self.cfg.APPLICATION and - "use_mesa" in self.cfg.APPLICATION.properties and - self.cfg.APPLICATION.properties.use_mesa == "yes") : - if ("properties" in pi and - "is_mesa" in pi.properties and - pi.properties.is_mesa == "yes") : - logger.write(_("Skip mesa product %s\n") % pi.name, 4) + if not ("APPLICATION" in self.cfg and + "properties" in self.cfg.APPLICATION and + "use_mesa" in self.cfg.APPLICATION.properties and + self.cfg.APPLICATION.properties.use_mesa == "yes") : + if ("properties" in pi and + "is_mesa" in pi.properties and + pi.properties.is_mesa == "yes") : + logger.write(_("Skip mesa product %s\n") % pi.name, 4) return if self.for_package: - pi.install_dir = os.path.join("out_dir_Path", + pi.install_dir = os.path.join("out_dir_Path", self.for_package, pi.name) if not self.silent: - logger.write(_("Setting environment for %s\n") % product, 4) + logger.write(_("Setting environment for %s\n") % product, 4) self.add_line(1) - self.add_comment('setting environ for ' + product) + self.add_comment('setting environ for ' + product) - # Do not define environment if the product is native + # Do not define environment if the product is native if src.product.product_is_native(pi): if src.product.product_has_env_script(pi): - self.run_env_script(pi, native=True) + self.run_env_script(pi, native=True) return - # Set an additional environment for SALOME products + # Set an additional environment for SALOME products if src.product.product_is_salome(pi): - # set environment using definition of the product + # set environment using definition of the product self.set_salome_minimal_product_env(pi, logger) self.set_salome_generic_product_env(pi) if src.product.product_is_cpp(pi): - # set a specific environment for cpp modules + # set a specific environment for cpp modules self.set_salome_minimal_product_env(pi, logger) self.set_cpp_env(pi) if src.product.product_is_generated(pi): - if "component_name" in pi: - # hack the source and install directories in order to point - # on the generated product source install directories + if "component_name" in pi: + # hack the source and install directories in order to point + # on the generated product source install directories install_dir_save = pi.install_dir source_dir_save = pi.source_dir name_save = pi.name pi.install_dir = os.path.join(self.cfg.APPLICATION.workdir, - "INSTALL", + "INSTALL", pi.component_name) if self.for_package: - pi.install_dir = os.path.join("out_dir_Path", + pi.install_dir = os.path.join("out_dir_Path", self.for_package, pi.component_name) pi.source_dir = os.path.join(self.cfg.APPLICATION.workdir, - "GENERATED", + "GENERATED", pi.component_name) pi.name = pi.component_name self.set_salome_minimal_product_env(pi, logger) self.set_salome_generic_product_env(pi) - # Put original values + # Put original values pi.install_dir = install_dir_save pi.source_dir = source_dir_save pi.name = name_save - # Put the environment define in the configuration of the product - if "environ" in pi: + # Put the environment define in the configuration of the product + if "environ" in pi: self.load_cfg_environment(pi.environ) - if self.forBuild and "build" in pi.environ: + if self.forBuild and "build" in pi.environ: self.load_cfg_environment(pi.environ.build) - if not self.forBuild and "launch" in pi.environ: + if not self.forBuild and "launch" in pi.environ: self.load_cfg_environment(pi.environ.launch) - # if product_info defines a env_scripts, load it - if 'env_script' in pi.environ: - self.run_env_script(pi, logger) + # if product_info defines a env_scripts, load it + if 'env_script' in pi.environ: + self.run_env_script(pi, logger)
- -
[docs] def run_env_script(self, product_info, logger=None, native=False): + +
[docs] def run_env_script(self, product_info, logger=None, native=False): """\ Runs an environment script. @@ -684,34 +672,34 @@ :param native Boolean: if True load set_native_env instead of set_env """ env_script = product_info.environ.env_script - # Check that the script exists + # Check that the script exists if not os.path.exists(env_script): - raise src.SatException(_("Environment script not found: %s") % + raise src.SatException(_("Environment script not found: %s") % env_script) - if not self.silent and logger is not None: - logger.write(" ** load %s\n" % env_script, 4) + if not self.silent and logger is not None: + logger.write(" ** load %s\n" % env_script, 4) - # import the script and run the set_env function + # import the script and run the set_env function try: import imp - pyproduct = imp.load_source(product_info.name + "_env_script", + pyproduct = imp.load_source(product_info.name + "_env_script", env_script) if not native: pyproduct.set_env(self, product_info.install_dir, product_info.version) else: - if "set_nativ_env" in dir(pyproduct): + if "set_nativ_env" in dir(pyproduct): pyproduct.set_nativ_env(self) except: __, exceptionValue, exceptionTraceback = sys.exc_info() - print(exceptionValue) + print(exceptionValue) import traceback traceback.print_tb(exceptionTraceback) - traceback.print_exc() -
-
[docs] def run_simple_env_script(self, script_path, logger=None): + traceback.print_exc()
+ +
[docs] def run_simple_env_script(self, script_path, logger=None): """\ Runs an environment script. Same as run_env_script, but with a script path as parameter. @@ -721,32 +709,32 @@ """ if not self.enable_simple_env_script: return - # Check that the script exists + # Check that the script exists if not os.path.exists(script_path): - raise src.SatException(_("Environment script not found: %s") % + raise src.SatException(_("Environment script not found: %s") % script_path) - if not self.silent and logger is not None: - logger.write(" ** load %s\n" % script_path, 4) + if not self.silent and logger is not None: + logger.write(" ** load %s\n" % script_path, 4) script_basename = os.path.basename(script_path) - if script_basename.endswith(".py"): - script_basename = script_basename[:-len(".py")] + if script_basename.endswith(".py"): + script_basename = script_basename[:-len(".py")] - # import the script and run the set_env function + # import the script and run the set_env function try: import imp - pyproduct = imp.load_source(script_basename + "_env_script", + pyproduct = imp.load_source(script_basename + "_env_script", script_path) pyproduct.load_env(self) except: __, exceptionValue, exceptionTraceback = sys.exc_info() - print(exceptionValue) + print(exceptionValue) import traceback traceback.print_tb(exceptionTraceback) - traceback.print_exc() -
-
[docs] def set_products(self, logger, src_root=None): + traceback.print_exc()
+ +
[docs] def set_products(self, logger, src_root=None): """\ Sets the environment for all the products. @@ -754,20 +742,20 @@ :param src_root src: the application working directory """ self.add_line(1) - self.add_comment('setting environ for all products') + self.add_comment('setting environ for all products') - # Make sure that the python lib dirs are set after python - if "Python" in self.cfg.APPLICATION.products: - self.set_a_product("Python", logger) + # Make sure that the python lib dirs are set after python + if "Python" in self.cfg.APPLICATION.products: + self.set_a_product("Python", logger) self.set_python_libdirs() - # The loop on the products + # The loop on the products for product in self.cfg.APPLICATION.products.keys(): - if product == "Python": + if product == "Python": continue self.set_a_product(product, logger) - self.finish(False) -
+ self.finish(False)
+
[docs] def set_full_environ(self, logger, env_info): """\ Sets the full environment for products @@ -776,22 +764,22 @@ :param logger Logger: The logger instance to display messages :param env_info list: the list of products """ - DBG.write("set_full_environ for", env_info) - # DBG.write("set_full_environ config", self.cfg.APPLICATION.environ, True) - # set product environ + DBG.write("set_full_environ for", env_info) + # DBG.write("set_full_environ config", self.cfg.APPLICATION.environ, True) + # set product environ self.set_application_env(logger) self.set_python_libdirs() - # set products + # set products for product in env_info: - self.set_a_product(product, logger) -
+ self.set_a_product(product, logger) +
[docs]class FileEnvWriter: """\ Class to dump the environment to a file. """ - def __init__(self, config, logger, out_dir, src_root, env_info=None): + def __init__(self, config, logger, out_dir, src_root, env_info=None): """\ Initialization. @@ -805,10 +793,10 @@ self.logger = logger self.out_dir = out_dir self.src_root= src_root - self.silent = True + self.silent = True self.env_info = env_info -
[docs] def write_env_file(self, filename, forBuild, shell, for_package = None): +
[docs] def write_env_file(self, filename, forBuild, shell, for_package = None): """\ Create an environment file. @@ -819,43 +807,43 @@ :rtype: str """ if not self.silent: - self.logger.write(_("Create environment file %s\n") % + self.logger.write(_("Create environment file %s\n") % src.printcolors.printcLabel(filename), 3) - # create then env object - env_file = open(os.path.join(self.out_dir, filename), "w") + # create then env object + env_file = open(os.path.join(self.out_dir, filename), "w") tmp = src.fileEnviron.get_file_environ(env_file, shell, {}) env = SalomeEnviron(self.config, tmp, forBuild, for_package=for_package) env.silent = self.silent - # Set the environment - if self.env_info is not None: + # Set the environment + if self.env_info is not None: env.set_full_environ(self.logger, self.env_info) else: - # set env from the APPLICATION + # set env from the APPLICATION env.set_application_env(self.logger) - # The list of products to launch + # The list of products to launch lProductsName = env.get_names(self.config.APPLICATION.products.keys()) - env.set( "SALOME_MODULES", ','.join(lProductsName)) + env.set( "SALOME_MODULES", ','.join(lProductsName)) - # set the products + # set the products env.set_products(self.logger, src_root=self.src_root) - # add cleanup and close - env.finish(True) + # add cleanup and close + env.finish(True) env_file.close() - return env_file.name -
+ return env_file.name
+
[docs] def write_cfgForPy_file(self, filename, additional_env = {}, - for_package = None, - with_commercial = True): + for_package = None, + with_commercial = True): """\ Append to current opened aFile a cfgForPy environment (SALOME python launcher). @@ -867,43 +855,43 @@ designed for a package. """ if not self.silent: - self.logger.write(_("Create configuration file %s\n") % + self.logger.write(_("Create configuration file %s\n") % src.printcolors.printcLabel(filename.name), 3) - # create then env object + # create then env object tmp = src.fileEnviron.get_file_environ(filename, - "cfgForPy", + "cfgForPy", {}) - # environment for launch + # environment for launch env = SalomeEnviron(self.config, tmp, - forBuild=False, + forBuild=False, for_package=for_package, enable_simple_env_script = with_commercial) env.silent = self.silent - if self.env_info is not None: + if self.env_info is not None: env.set_full_environ(self.logger, self.env_info) else: - # set env from PRODUCT + # set env from PRODUCT env.set_application_env(self.logger) - # The list of products to launch + # The list of products to launch lProductsName = env.get_names(self.config.APPLICATION.products.keys()) - env.set( "SALOME_MODULES", ','.join(lProductsName)) + env.set( "SALOME_MODULES", ','.join(lProductsName)) - # set the products + # set the products env.set_products(self.logger, src_root=self.src_root) - # Add the additional environment if it is not empty + # Add the additional environment if it is not empty if len(additional_env) != 0: for variable in additional_env: env.set(variable, additional_env[variable]) - # add cleanup and close - env.finish(True) -
+ # add cleanup and close + env.finish(True) +
[docs]class Shell: """\ Definition of a Shell. @@ -916,8 +904,8 @@ :param extension str: the shell extension """ self.name = name - self.extension = extension -
+ self.extension = extension +
[docs]def load_environment(config, build, logger): """\ Loads the environment (used to run the tests, for example). @@ -929,13 +917,13 @@ environ = SalomeEnviron(config, Environ(os.environ), build) environ.set_application_env(logger) environ.set_products(logger) - environ.finish(True)
+ environ.finish(True) -
+ diff --git a/doc/build/html/_modules/src/fileEnviron.html b/doc/build/html/_modules/src/fileEnviron.html index ad71a9c..098a7eb 100644 --- a/doc/build/html/_modules/src/fileEnviron.html +++ b/doc/build/html/_modules/src/fileEnviron.html @@ -2,39 +2,27 @@ - + - - src.fileEnviron — salomeTools 5.0.0dev documentation - + src.fileEnviron — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,116 +31,116 @@

Source code for src.fileEnviron

-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-#  Copyright (C) 2010-2013  CEA/DEN
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library 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
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+#  Copyright (C) 2010-2013  CEA/DEN
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library 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
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 
 import os
-import pprint as PP
-import src.debug as DBG
-
-bat_header="""\
-@echo off
-
-rem The following variables are used only in case of a sat package
-set out_dir_Path=%~dp0
-set PRODUCT_OUT_DIR=%out_dir_Path%
-set prereq_install_Path=%out_dir_Path%\PREREQUISITES\INSTALL
-set prereq_build_Path=%out_dir_Path%\PREREQUISITES\BUILD
-"""
-
-
-bash_header="""\
-#!/bin/bash
-##########################################################################
-#
-#### cleandup ###
-# cleanup a path (first parameter) from duplicated entries;
-# second parameter is the separator
-cleandup() {
-out_var=`echo $1 | awk -v sep=$2 '{                      \\
-     na = split($1,a,sep);                               \\
-     k=0;                                                \\
-     for(i=0;i<=na;i++) {                                \\
-       found=0;                                          \\
-       for(j=0;j<k;j++) {                                \\
-         if(a[i]==aa[j])                                 \\
-         {                                               \\
-           found=1;                                      \\
-           break;                                        \\
-         };                                              \\
-       };                                                \\
-       if(found==0) {                                    \\
-         aa[k++]=a[i];                                   \\
-       };                                                \\
-     };                                                  \\
-     ORS=sep;                                            \\
-     for(i=0;i<k;i++) {                                  \\
-       print aa[i];                                      \\
-     }                                                   \\
-   }' | sed -e 's|\\(.*\\)$1|\\1|g' -e 's|^[:;]||' -e 's|[:;]$||'`
-echo $out_var
-}
-### clean ###
-clean ()
-{
-xenv=`printenv $1`
-out_var=`cleandup $xenv $2`
-export $1=$out_var
-}
-
-# The 3 following variables are used only in case of a sat package
-export out_dir_Path=$(cd $(dirname ${BASH_SOURCE[0]});pwd)
-export PRODUCT_OUT_DIR=${out_dir_Path}
-export PRODUCT_ROOT_DIR=${PRODUCT_OUT_DIR}
-
-###########################################################################
-"""
-
-cfg_header="""\
-[SALOME Configuration]
-"""
-
-Launcher_header="""\
-# a generated SALOME Configuration file using python syntax
-"""
-
-
[docs]def get_file_environ(output, shell, environ=None): +import pprint as PP +import src.debug as DBG + +bat_header="""\ +@echo off + +rem The following variables are used only in case of a sat package +set out_dir_Path=%~dp0 +set PRODUCT_OUT_DIR=%out_dir_Path% +set prereq_install_Path=%out_dir_Path%\PREREQUISITES\INSTALL +set prereq_build_Path=%out_dir_Path%\PREREQUISITES\BUILD +""" + + +bash_header="""\ +#!/bin/bash +########################################################################## +# +#### cleandup ### +# cleanup a path (first parameter) from duplicated entries; +# second parameter is the separator +cleandup() { +out_var=`echo $1 | awk -v sep=$2 '{ \\ + na = split($1,a,sep); \\ + k=0; \\ + for(i=0;i<=na;i++) { \\ + found=0; \\ + for(j=0;j<k;j++) { \\ + if(a[i]==aa[j]) \\ + { \\ + found=1; \\ + break; \\ + }; \\ + }; \\ + if(found==0) { \\ + aa[k++]=a[i]; \\ + }; \\ + }; \\ + ORS=sep; \\ + for(i=0;i<k;i++) { \\ + print aa[i]; \\ + } \\ + }' | sed -e 's|\\(.*\\)$1|\\1|g' -e 's|^[:;]||' -e 's|[:;]$||'` +echo $out_var +} +### clean ### +clean () +{ +xenv=`printenv $1` +out_var=`cleandup $xenv $2` +export $1=$out_var +} + +# The 3 following variables are used only in case of a sat package +export out_dir_Path=$(cd $(dirname ${BASH_SOURCE[0]});pwd) +export PRODUCT_OUT_DIR=${out_dir_Path} +export PRODUCT_ROOT_DIR=${PRODUCT_OUT_DIR} + +########################################################################### +""" + +cfg_header="""\ +[SALOME Configuration] +""" + +Launcher_header="""\ +# a generated SALOME Configuration file using python syntax +""" + +
[docs]def get_file_environ(output, shell, environ=None): """Instantiate correct FileEnvironment sub-class. :param output file: the output file stream. :param shell str: the type of shell syntax to use. :param environ dict: a potential additional environment. """ - if shell == "bash": + if shell == "bash": return BashFileEnviron(output, environ) - if shell == "bat": + if shell == "bat": return BatFileEnviron(output, environ) - if shell == "cfgForPy": + if shell == "cfgForPy": return LauncherFileEnviron(output, environ) - if shell == "cfg": + if shell == "cfg": return ContextFileEnviron(output, environ) - raise Exception("FileEnviron: Unknown shell = %s" % shell) -
+ raise Exception("FileEnviron: Unknown shell = %s" % shell)
+
[docs]class FileEnviron(object): """\ Base class for shell environment """ - def __init__(self, output, environ=None): + def __init__(self, output, environ=None): """\ Initialization @@ -165,13 +153,13 @@ """\ easy non exhaustive quick resume for debug print""" res = { - "output" : self.output, - "environ" : self.environ, + "output" : self.output, + "environ" : self.environ, } - return "%s(\n%s\n)" % (self.__class__.__name__, PP.pformat(res)) + return "%s(\n%s\n)" % (self.__class__.__name__, PP.pformat(res)) - def _do_init(self, output, environ=None): + def _do_init(self, output, environ=None): """\ Initialization @@ -180,14 +168,14 @@ """ self.output = output self.toclean = [] - if environ is not None: - #if str(type(environ)) == "<type 'instance'>": + if environ is not None: + #if str(type(environ)) == "<type 'instance'>": if id(environ) == id(os.environ): - DBG.tofix("set %s environ as python os.environ, are you sure it is safe ?" % self.__class__.__name__, True) + DBG.tofix("set %s environ as python os.environ, are you sure it is safe ?" % self.__class__.__name__, True) self.environ = environ else: - DBG.tofix("set %s environ as COPY of python os.environ, are you sure it is safe ?" % self.__class__.__name__, True) - self.environ = dict(os.environ) #make a copy cvw 180320 + DBG.tofix("set %s environ as COPY of python os.environ, are you sure it is safe ?" % self.__class__.__name__, True) + self.environ = dict(os.environ) #make a copy cvw 180320
[docs] def add_line(self, number): """\ @@ -195,32 +183,32 @@ :param number int: the number of lines to add """ - self.output.write("\n" * number) -
+ self.output.write("\n" * number)
+
[docs] def add_comment(self, comment): """\ Add a comment in the shell file :param comment str: the comment to add """ - self.output.write("# %s\n" % comment) -
+ self.output.write("# %s\n" % comment)
+
[docs] def add_echo(self, text): """\ Add a "echo" in the shell file :param text str: the text to echo """ - self.output.write('echo %s"\n' % text) -
+ self.output.write('echo %s"\n' % text)
+
[docs] def add_warning(self, warning): """\ Add a warning "echo" in the shell file :param warning str: the text to echo """ - self.output.write('echo "WARNING %s"\n' % warning) -
+ self.output.write('echo "WARNING %s"\n' % warning)
+
[docs] def append_value(self, key, value, sep=os.pathsep): """\ append value to key using sep @@ -231,8 +219,8 @@ """ self.set(key, self.get(key) + sep + value) if (key, sep) not in self.toclean: - self.toclean.append((key, sep)) -
+ self.toclean.append((key, sep))
+
[docs] def append(self, key, value, sep=os.pathsep): """\ Same as append_value but the value argument can be a list @@ -244,8 +232,8 @@ if isinstance(value, list): self.append_value(key, sep.join(value), sep) else: - self.append_value(key, value, sep) -
+ self.append_value(key, value, sep) +
[docs] def prepend_value(self, key, value, sep=os.pathsep): """\ prepend value to key using sep @@ -256,8 +244,8 @@ """ self.set(key, value + sep + self.get(key)) if (key, sep) not in self.toclean: - self.toclean.append((key, sep)) -
+ self.toclean.append((key, sep)) +
[docs] def prepend(self, key, value, sep=os.pathsep): """\ Same as prepend_value but the value argument can be a list @@ -269,16 +257,16 @@ if isinstance(value, list): self.prepend_value(key, sep.join(value), sep) else: - self.prepend_value(key, value, sep) -
+ self.prepend_value(key, value, sep) +
[docs] def is_defined(self, key): """\ Check if the key exists in the environment :param key str: the environment variable to check """ - return (key in self.environ) -
+ return (key in self.environ) +
[docs] def set(self, key, value): """\ Set the environment variable 'key' to value 'value' @@ -286,16 +274,16 @@ :param key str: the environment variable to set :param value str: the value """ - raise NotImplementedError("set is not implement for this shell!") -
+ raise NotImplementedError("set is not implement for this shell!") +
[docs] def get(self, key): """\ Get the value of the environment variable "key" :param key str: the environment variable """ - return '${%s}' % key -
+ return '${%s}' % key +
[docs] def command_value(self, key, command): """\ Get the value given by the system command "command" @@ -306,23 +294,23 @@ :param key str: the environment variable :param command str: the command to execute """ - raise NotImplementedError("command_value is not implement " - "for this shell!") -
-
[docs] def finish(self, required=True): + raise NotImplementedError("command_value is not implement " + "for this shell!")
+ +
[docs] def finish(self, required=True): """Add a final instruction in the out file (in case of file generation) :param required bool: Do nothing if required is False """ for (key, sep) in self.toclean: - if sep != ' ': - self.output.write('clean %s "%s"\n' % (key, sep)) -
+ if sep != ' ': + self.output.write('clean %s "%s"\n' % (key, sep)) +
[docs]class BashFileEnviron(FileEnviron): """\ Class for bash shell. """ - def __init__(self, output, environ=None): + def __init__(self, output, environ=None): """Initialization :param output file: the output file stream. @@ -337,9 +325,9 @@ :param key str: the environment variable to set :param value str: the value """ - self.output.write('export %s="%s"\n' % (key, value)) - self.environ[key] = value -
+ self.output.write('export %s="%s"\n' % (key, value)) + self.environ[key] = value +
[docs] def command_value(self, key, command): """\ Get the value given by the system command "command" @@ -350,22 +338,22 @@ :param key str: the environment variable :param command str: the command to execute """ - self.output.write('export %s=$(%s)\n' % (key, command)) -
-
[docs] def finish(self, required=True): + self.output.write('export %s=$(%s)\n' % (key, command))
+ +
[docs] def finish(self, required=True): """Add a final instruction in the out file (in case of file generation) :param required bool: Do nothing if required is False """ if not required: return - FileEnviron.finish(self, required) -
+ FileEnviron.finish(self, required) +
[docs]class BatFileEnviron(FileEnviron): """\ for Windows batch shell. """ - def __init__(self, output, environ=None): + def __init__(self, output, environ=None): """Initialization :param output file: the output file stream. @@ -379,24 +367,24 @@ :param comment str: the comment to add """ - self.output.write("rem %s\n" % comment) -
+ self.output.write("rem %s\n" % comment) +
[docs] def get(self, key): """Get the value of the environment variable "key" :param key str: the environment variable """ - return '%%%s%%' % key -
+ return '%%%s%%' % key +
[docs] def set(self, key, value): """Set the environment variable "key" to value "value" :param key str: the environment variable to set :param value str: the value """ - self.output.write('set %s=%s\n' % (key, value)) - self.environ[key] = value -
+ self.output.write('set %s=%s\n' % (key, value)) + self.environ[key] = value +
[docs] def command_value(self, key, command): """\ Get the value given by the system command "command" @@ -407,22 +395,22 @@ :param key str: the environment variable :param command str: the command to execute """ - self.output.write('%s > tmp.txt\n' % (command)) - self.output.write('set /p %s =< tmp.txt\n' % (key)) -
-
[docs] def finish(self, required=True): + self.output.write('%s > tmp.txt\n' % (command)) + self.output.write('set /p %s =< tmp.txt\n' % (key))
+ +
[docs] def finish(self, required=True): """\ Add a final instruction in the out file (in case of file generation) In the particular windows case, do nothing :param required bool: Do nothing if required is False """ - return -
+ return +
[docs]class ContextFileEnviron(FileEnviron): """Class for a salome context configuration file. """ - def __init__(self, output, environ=None): + def __init__(self, output, environ=None): """Initialization :param output file: the output file stream. @@ -437,16 +425,16 @@ :param key str: the environment variable to set :param value str: the value """ - self.output.write('%s="%s"\n' % (key, value)) - self.environ[key] = value -
+ self.output.write('%s="%s"\n' % (key, value)) + self.environ[key] = value +
[docs] def get(self, key): """Get the value of the environment variable "key" :param key str: the environment variable """ - return '%({0})s'.format(key) -
+ return '%({0})s'.format(key) +
[docs] def command_value(self, key, command): """\ Get the value given by the system command "command" @@ -457,23 +445,23 @@ :param key str: the environment variable :param command str: the command to execute """ - raise NotImplementedError("command_value is not implement " - "for salome context files!") -
+ raise NotImplementedError("command_value is not implement " + "for salome context files!") +
[docs] def add_echo(self, text): """Add a comment :param text str: the comment to add """ - self.add_comment(text) -
+ self.add_comment(text) +
[docs] def add_warning(self, warning): """Add a warning :param text str: the warning to add """ - self.add_comment("WARNING %s" % warning) -
+ self.add_comment("WARNING %s" % warning) +
[docs] def prepend_value(self, key, value, sep=os.pathsep): """prepend value to key using sep @@ -481,8 +469,8 @@ :param value str: the value to prepend to key :param sep str: the separator string """ - self.output.write('ADD_TO_%s: %s\n' % (key, value)) -
+ self.output.write('ADD_TO_%s: %s\n' % (key, value)) +
[docs] def append_value(self, key, value, sep=os.pathsep): """append value to key using sep @@ -490,15 +478,15 @@ :param value str: the value to append to key :param sep str: the separator string """ - self.prepend_value(key, value) -
-
[docs] def finish(self, required=True): + self.prepend_value(key, value)
+ +
[docs] def finish(self, required=True): """Add a final instruction in the out file (in case of file generation) :param required bool: Do nothing if required is False """ - return -
+ return +
[docs]def special_path_separator(name): """\ TCLLIBPATH, TKLIBPATH, PV_PLUGIN_PATH environments variables need @@ -508,19 +496,19 @@ :param name str: The name of the variable to find the separator """ - special_blanks_keys=["TCLLIBPATH", "TKLIBPATH"] - special_semicolon_keys=["PV_PLUGIN_PATH"] + special_blanks_keys=["TCLLIBPATH", "TKLIBPATH"] + special_semicolon_keys=["PV_PLUGIN_PATH"] res=os.pathsep - if name in special_blanks_keys: res=" " - if name in special_semicolon_keys: res=";" - return res -
+ if name in special_blanks_keys: res=" " + if name in special_semicolon_keys: res=";" + return res +
[docs]class LauncherFileEnviron: """\ Class to generate a launcher file script (in python syntax) SalomeContext API """ - def __init__(self, output, environ=None): + def __init__(self, output, environ=None): """Initialization :param output file: the output file stream. @@ -528,59 +516,59 @@ """ self.output = output self.toclean = [] - if environ is not None: + if environ is not None: self.environ = environ else: self.environ = os.environ - # Initialize some variables - if not "PATH" in self.environ.keys(): - self.environ["PATH"]="" - if not "LD_LIBRARY_PATH" in self.environ.keys(): - self.environ["LD_LIBRARY_PATH"]="" - if not "PYTHONPATH" in self.environ.keys(): - self.environ["PYTHONPATH"]="" - if not "TCLLIBPATH" in self.environ.keys(): - self.environ["TCLLIBPATH"]="" - if not "TKLIBPATH" in self.environ.keys(): - self.environ["TKLIBPATH"]="" - - # four whitespaces for first indentation in a python script - self.indent=" " - self.prefix="context." - self.setVarEnv="setVariable" + # Initialize some variables + if not "PATH" in self.environ.keys(): + self.environ["PATH"]="" + if not "LD_LIBRARY_PATH" in self.environ.keys(): + self.environ["LD_LIBRARY_PATH"]="" + if not "PYTHONPATH" in self.environ.keys(): + self.environ["PYTHONPATH"]="" + if not "TCLLIBPATH" in self.environ.keys(): + self.environ["TCLLIBPATH"]="" + if not "TKLIBPATH" in self.environ.keys(): + self.environ["TKLIBPATH"]="" + + # four whitespaces for first indentation in a python script + self.indent=" " + self.prefix="context." + self.setVarEnv="setVariable" self.begin=self.indent+self.prefix self.output.write(Launcher_header) - self.specialKeys={"PATH": "Path", - "LD_LIBRARY_PATH": "LdLibraryPath", - "PYTHONPATH": "PythonPath"} + self.specialKeys={"PATH": "Path", + "LD_LIBRARY_PATH": "LdLibraryPath", + "PYTHONPATH": "PythonPath"}
[docs] def change_to_launcher(self, value): res=value - return res -
+ return res
+
[docs] def add_line(self, number): """Add some empty lines in the launcher file :param number int: the number of lines to add """ - self.output.write("\n" * number) -
+ self.output.write("\n" * number) +
[docs] def add_echo(self, text): """Add a comment :param text str: the comment to add """ - self.output.write('# %s"\n' % text) -
+ self.output.write('# %s"\n' % text) +
[docs] def add_warning(self, warning): """Add a warning :param text str: the warning to add """ - self.output.write('# "WARNING %s"\n' % warning) -
-
[docs] def append_value(self, key, value, sep=":"): + self.output.write('# "WARNING %s"\n' % warning)
+ +
[docs] def append_value(self, key, value, sep=":"): """append value to key using sep :param key str: the environment variable to append @@ -590,9 +578,9 @@ if self.is_defined(key) : self.add(key, value) else : - self.set(key, value) -
-
[docs] def append(self, key, value, sep=":"): + self.set(key, value)
+ +
[docs] def append(self, key, value, sep=":"): """Same as append_value but the value argument can be a list :param key str: the environment variable to append @@ -602,9 +590,9 @@ if isinstance(value, list): self.append_value(key, sep.join(value), sep) else: - self.append_value(key, value, sep) -
-
[docs] def prepend_value(self, key, value, sep=":"): + self.append_value(key, value, sep)
+ +
[docs] def prepend_value(self, key, value, sep=":"): """prepend value to key using sep :param key str: the environment variable to prepend @@ -614,9 +602,9 @@ if self.is_defined(key) : self.add(key, value) else : - self.set(key, value) -
-
[docs] def prepend(self, key, value, sep=":"): + self.set(key, value)
+ +
[docs] def prepend(self, key, value, sep=":"): """Same as prepend_value but the value argument can be a list :param key str: the environment variable to prepend @@ -626,22 +614,22 @@ if isinstance(value, list): self.prepend_value(key, sep.join(value), sep) else: - self.prepend_value(key, value, sep) -
+ self.prepend_value(key, value, sep) +
[docs] def is_defined(self, key): """Check if the key exists in the environment :param key str: the environment variable to check """ - return key in self.environ.keys() -
+ return key in self.environ.keys() +
[docs] def get(self, key): """Get the value of the environment variable "key" :param key str: the environment variable """ - return '${%s}' % key -
+ return '${%s}' % key +
[docs] def set(self, key, value): """Set the environment variable "key" to value "value" @@ -649,10 +637,10 @@ :param value str: the value """ self.output.write(self.begin+self.setVarEnv+ - '(r"%s", r"%s", overwrite=True)\n' % + '(r"%s", r"%s", overwrite=True)\n' % (key, self.change_to_launcher(value))) - self.environ[key] = value -
+ self.environ[key] = value +
[docs] def add(self, key, value): """prepend value to key using sep @@ -660,21 +648,21 @@ :param value str: the value to prepend to key """ if key in self.specialKeys.keys(): - self.output.write(self.begin+'addTo%s(r"%s")\n' % + self.output.write(self.begin+'addTo%s(r"%s")\n' % (self.specialKeys[key], self.change_to_launcher(value))) - self.environ[key]+=":"+value + self.environ[key]+=":"+value return sep=special_path_separator(key) self.output.write(self.indent+ - '#temporary solution!!! have to be defined in API a ' - '?dangerous? addToSpecial(r"%s", r"%s")\n' % + '#temporary solution!!! have to be defined in API a ' + '?dangerous? addToSpecial(r"%s", r"%s")\n' % (key, value)) - #pathsep not precised because do not know future os launch? - self.output.write(self.begin+'addToSpecial(r"%s", r"%s")\n' + #pathsep not precised because do not know future os launch? + self.output.write(self.begin+'addToSpecial(r"%s", r"%s")\n' % (key, self.change_to_launcher(value))) - self.environ[key]+=sep+value #here yes we know os for current execution -
+ self.environ[key]+=sep+value #here yes we know os for current execution +
[docs] def command_value(self, key, command): """\ Get the value given by the system command "command" @@ -683,7 +671,7 @@ :param key str: the environment variable :param command str: the command to execute """ - self.output.write(self.indent+'#`%s`\n' % command) + self.output.write(self.indent+'#`%s`\n' % command) import shlex, subprocess args = shlex.split(command) @@ -691,233 +679,233 @@ out, __ = res.communicate() self.output.write(self.begin+ self.setVarEnv+ - '(r"%s", r"%s", overwrite=True)\n' % (key, out)) -
+ '(r"%s", r"%s", overwrite=True)\n' % (key, out)) +
[docs] def add_comment(self, comment): - # Special comment in case of the distène licence - if comment=="DISTENE license": + # Special comment in case of the distène licence + if comment=="DISTENE license": self.output.write(self.indent+ - "#"+ + "#"+ self.prefix+ self.setVarEnv+ - '(r"%s", r"%s", overwrite=True)\n' % - ('DISTENE_LICENSE_FILE', + '(r"%s", r"%s", overwrite=True)\n' % + ('DISTENE_LICENSE_FILE', self.change_to_launcher( - 'Use global envvar: DLIM8VAR'))) + 'Use global envvar: DLIM8VAR'))) self.output.write(self.indent+ - "#"+ + "#"+ self.prefix+ self.setVarEnv+ - '(r"%s", r"%s", overwrite=True)\n' % - ('DLIM8VAR', + '(r"%s", r"%s", overwrite=True)\n' % + ('DLIM8VAR', self.change_to_launcher( - '<your licence>'))) + '<your licence>'))) return - if "setting environ for" in comment: - self.output.write(self.indent+"#[%s]\n" % - comment.split("setting environ for ")[1]) + if "setting environ for" in comment: + self.output.write(self.indent+"#[%s]\n" % + comment.split("setting environ for ")[1]) return - self.output.write(self.indent+"# %s\n" % comment) -
-
[docs] def finish(self, required=True): + self.output.write(self.indent+"# %s\n" % comment)
+ +
[docs] def finish(self, required=True): """\ Add a final instruction in the out file (in case of file generation) In the particular launcher case, do nothing :param required bool: Do nothing if required is False """ - return -
+ return +
[docs]class ScreenEnviron(FileEnviron): - def __init__(self, output, environ=None): + def __init__(self, output, environ=None): self._do_init(output, environ) self.defined = {}
[docs] def add_line(self, number): - pass -
+ pass
+
[docs] def add_comment(self, comment): - pass -
+ pass +
[docs] def add_echo(self, text): - pass -
+ pass +
[docs] def add_warning(self, warning): - pass -
-
[docs] def write(self, command, name, value, sign="="): + pass
+ +
[docs] def write(self, command, name, value, sign="="): import src - self.output.write(" %s%s %s %s %s\n" % \ + self.output.write(" %s%s %s %s %s\n" % \ (src.printcolors.printcLabel(command), - " " * (12 - len(command)), - src.printcolors.printcInfo(name), sign, value)) -
+ " " * (12 - len(command)), + src.printcolors.printcInfo(name), sign, value)) +
[docs] def is_defined(self, name): - return self.defined.has_key(name) -
+ return self.defined.has_key(name) +
[docs] def get(self, name): - return "${%s}" % name -
+ return "${%s}" % name +
[docs] def set(self, name, value): - self.write("set", name, value) - self.defined[name] = value -
-
[docs] def prepend(self, name, value, sep=":"): + self.write("set", name, value) + self.defined[name] = value
+ +
[docs] def prepend(self, name, value, sep=":"): if isinstance(value, list): value = sep.join(value) value = value + sep + self.get(name) - self.write("prepend", name, value) -
-
[docs] def append(self, name, value, sep=":"): + self.write("prepend", name, value)
+ +
[docs] def append(self, name, value, sep=":"): if isinstance(value, list): value = sep.join(value) value = self.get(name) + sep + value - self.write("append", name, value) -
+ self.write("append", name, value) +
[docs] def command_value(self, key, command): - pass -
+ pass +
[docs] def run_env_script(self, module, script): - self.write("load", script, "", sign="") - -# The SALOME launcher template
-withProfile = """\ -#! /usr/bin/env python - -################################################################ -# WARNING: this file is automatically generated by SalomeTools # -# WARNING: and so could be overwritten at any time. # -################################################################ - -import os -import sys -import subprocess - - -# Add the pwdPath to able to run the launcher after unpacking a package -# Used only in case of a salomeTools package -out_dir_Path=os.path.abspath(os.path.dirname(__file__)) - -# Preliminary work to initialize path to SALOME Python modules -def __initialize(): - - sys.path[:0] = [ 'BIN_KERNEL_INSTALL_DIR' ] - os.environ['ABSOLUTE_APPLI_PATH'] = 'KERNEL_INSTALL_DIR' - - # define folder to store omniorb config (initially in virtual application folder) - try: - from salomeContextUtils import setOmniOrbUserPath - setOmniOrbUserPath() - except Exception, e: - print e - sys.exit(1) -# End of preliminary work - -# salome doc only works for virtual applications. Therefore we overwrite it with this function -def _showDoc(modules): - for module in modules: - modulePath = os.getenv(module+"_ROOT_DIR") - if modulePath != None: - baseDir = os.path.join(modulePath, "share", "doc", "salome") - docfile = os.path.join(baseDir, "gui", module.upper(), "index.html") - if not os.path.isfile(docfile): - docfile = os.path.join(baseDir, "tui", module.upper(), "index.html") - if not os.path.isfile(docfile): - docfile = os.path.join(baseDir, "dev", module.upper(), "index.html") - if os.path.isfile(docfile): - out, err = subprocess.Popen(["xdg-open", docfile]).communicate() - else: - print "Online documentation is not accessible for module:", module - else: - print module+"_ROOT_DIR not found!" - -def main(args): - # Identify application path then locate configuration files - __initialize() - - if args == ['--help']: - from salomeContext import usage - usage() - sys.exit(0) - - #from salomeContextUtils import getConfigFileNames - #configFileNames, args, unexisting = getConfigFileNames( args, checkExistence=True ) - #if len(unexisting) > 0: - # print "ERROR: unexisting configuration file(s): " + ', '.join(unexisting) - # sys.exit(1) - - # Create a SalomeContext which parses configFileNames to initialize environment - try: - from salomeContext import SalomeContext, SalomeContextException - SalomeContext.addToSpecial=addToSpecial - context = SalomeContext(None) - - # Here set specific variables, if needed - # context.addToPath('mypath') - # context.addToLdLibraryPath('myldlibrarypath') - # context.addToPythonPath('mypythonpath') - # context.setVariable('myvarname', 'value') - - # Logger level error - context.getLogger().setLevel(40) - - context.setVariable(r"PRODUCT_ROOT_DIR", out_dir_Path, overwrite=True) - # here your local standalone environment - - if len(args) >1 and args[0]=='doc': - _showDoc(args[1:]) - return - - # Start SALOME, parsing command line arguments - context.runSalome(args) - #print 'Thank you for using SALOME!' - - # Logger level info - context.getLogger().setLevel(20) - - except SalomeContextException, e: - import logging - logging.getLogger("salome").error(e) - sys.exit(1) -# -def addToSpecial(self, name, value, pathSep=None): - # add special dangerous cases: TCLLIBPATH PV_PLUGIN_PATH etc... - # http://computer-programming-forum.com/57-tcl/1dfddc136afccb94.htm - # TCLLIBPATH: Tcl treats the contents of that variable as a list. Be happy, for you can now use drive letters on windows. - if value == '': - return - - specialBlanksKeys=["TCLLIBPATH", "TKLIBPATH"] - specialSemicolonKeys=["PV_PLUGIN_PATH"] - res=os.pathsep - if name in specialBlanksKeys: res=" " - if name in specialSemicolonKeys: res=";" - - if pathSep==None: - sep=res - else: - sep=pathSep - value = os.path.expandvars(value) # expand environment variables - self.getLogger().debug("Add to %s: %s", name, value) - env = os.getenv(name, None) - if env is None: - os.environ[name] = value - else: - os.environ[name] = value + sep + env #explicitely or not special path separator ?whitespace, semicolon? - -if __name__ == "__main__": - args = sys.argv[1:] - main(args) -# -""" + self.write("load", script, "", sign="") + +# The SALOME launcher template +withProfile = """\ +#! /usr/bin/env python + +################################################################ +# WARNING: this file is automatically generated by SalomeTools # +# WARNING: and so could be overwritten at any time. # +################################################################ + +import os +import sys +import subprocess + + +# Add the pwdPath to able to run the launcher after unpacking a package +# Used only in case of a salomeTools package +out_dir_Path=os.path.abspath(os.path.dirname(__file__)) + +# Preliminary work to initialize path to SALOME Python modules +def __initialize(): + + sys.path[:0] = [ 'BIN_KERNEL_INSTALL_DIR' ] + os.environ['ABSOLUTE_APPLI_PATH'] = 'KERNEL_INSTALL_DIR' + + # define folder to store omniorb config (initially in virtual application folder) + try: + from salomeContextUtils import setOmniOrbUserPath + setOmniOrbUserPath() + except Exception, e: + print e + sys.exit(1) +# End of preliminary work + +# salome doc only works for virtual applications. Therefore we overwrite it with this function +def _showDoc(modules): + for module in modules: + modulePath = os.getenv(module+"_ROOT_DIR") + if modulePath != None: + baseDir = os.path.join(modulePath, "share", "doc", "salome") + docfile = os.path.join(baseDir, "gui", module.upper(), "index.html") + if not os.path.isfile(docfile): + docfile = os.path.join(baseDir, "tui", module.upper(), "index.html") + if not os.path.isfile(docfile): + docfile = os.path.join(baseDir, "dev", module.upper(), "index.html") + if os.path.isfile(docfile): + out, err = subprocess.Popen(["xdg-open", docfile]).communicate() + else: + print "Online documentation is not accessible for module:", module + else: + print module+"_ROOT_DIR not found!" + +def main(args): + # Identify application path then locate configuration files + __initialize() + + if args == ['--help']: + from salomeContext import usage + usage() + sys.exit(0) + + #from salomeContextUtils import getConfigFileNames + #configFileNames, args, unexisting = getConfigFileNames( args, checkExistence=True ) + #if len(unexisting) > 0: + # print "ERROR: unexisting configuration file(s): " + ', '.join(unexisting) + # sys.exit(1) + + # Create a SalomeContext which parses configFileNames to initialize environment + try: + from salomeContext import SalomeContext, SalomeContextException + SalomeContext.addToSpecial=addToSpecial + context = SalomeContext(None) + + # Here set specific variables, if needed + # context.addToPath('mypath') + # context.addToLdLibraryPath('myldlibrarypath') + # context.addToPythonPath('mypythonpath') + # context.setVariable('myvarname', 'value') + + # Logger level error + context.getLogger().setLevel(40) + + context.setVariable(r"PRODUCT_ROOT_DIR", out_dir_Path, overwrite=True) + # here your local standalone environment + + if len(args) >1 and args[0]=='doc': + _showDoc(args[1:]) + return + + # Start SALOME, parsing command line arguments + context.runSalome(args) + #print 'Thank you for using SALOME!' + + # Logger level info + context.getLogger().setLevel(20) + + except SalomeContextException, e: + import logging + logging.getLogger("salome").error(e) + sys.exit(1) +# +def addToSpecial(self, name, value, pathSep=None): + # add special dangerous cases: TCLLIBPATH PV_PLUGIN_PATH etc... + # http://computer-programming-forum.com/57-tcl/1dfddc136afccb94.htm + # TCLLIBPATH: Tcl treats the contents of that variable as a list. Be happy, for you can now use drive letters on windows. + if value == '': + return + + specialBlanksKeys=["TCLLIBPATH", "TKLIBPATH"] + specialSemicolonKeys=["PV_PLUGIN_PATH"] + res=os.pathsep + if name in specialBlanksKeys: res=" " + if name in specialSemicolonKeys: res=";" + + if pathSep==None: + sep=res + else: + sep=pathSep + value = os.path.expandvars(value) # expand environment variables + self.getLogger().debug("Add to %s: %s", name, value) + env = os.getenv(name, None) + if env is None: + os.environ[name] = value + else: + os.environ[name] = value + sep + env #explicitely or not special path separator ?whitespace, semicolon? + +if __name__ == "__main__": + args = sys.argv[1:] + main(args) +# +""" -
+ diff --git a/doc/build/html/_modules/src/fork.html b/doc/build/html/_modules/src/fork.html index 8bc3898..c7b2490 100644 --- a/doc/build/html/_modules/src/fork.html +++ b/doc/build/html/_modules/src/fork.html @@ -2,39 +2,27 @@ - + - - src.fork — salomeTools 5.0.0dev documentation - + src.fork — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,23 +31,23 @@

Source code for src.fork

-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-#  Copyright (C) 2010-2013  CEA/DEN
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library 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
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+#  Copyright (C) 2010-2013  CEA/DEN
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library 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
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 
 import os
 import sys
@@ -67,7 +55,7 @@
 import pickle
 import subprocess
 
-
[docs]def show_progress(logger, top, delai, ss=""): +
[docs]def show_progress(logger, top, delai, ss=""): """shortcut function to display the progression :param logger Logger: The logging instance @@ -75,10 +63,10 @@ :param delai int: the number max :param ss str: the string to display """ - logger.write("\r%s\r%s %s / %s " % ((" " * 30), ss, top, (delai - top)), 4, - False) - logger.flush() -
+ logger.write("\r%s\r%s %s / %s " % ((" " * 30), ss, top, (delai - top)), 4, + False) + logger.flush()
+
[docs]def write_back(logger, message, level): """shortcut function to write at the begin of the line @@ -86,36 +74,36 @@ :param message str: the text to display :param level int: the level of verbosity """ - logger.write("\r%s\r%s" % ((" " * 40), message), level) + logger.write("\r%s\r%s" % ((" " * 40), message), level)
-# Launch command -# --------------
-
[docs]def launch_command(cmd, logger, cwd, args=[], log=None): +# Launch command +# -------------- +
[docs]def launch_command(cmd, logger, cwd, args=[], log=None): if log: - log = file(log, "a") - logger.write("launch: %s\n" % cmd, 5, screenOnly=True) + log = file(log, "a") + logger.write("launch: %s\n" % cmd, 5, screenOnly=True) for arg in args: - cmd += " " + arg + cmd += " " + arg prs = subprocess.Popen(cmd, - shell=True, + shell=True, stdout=log, stderr=subprocess.STDOUT, cwd=cwd, - executable='/bin/bash') - return prs + executable='/bin/bash') + return prs
-# Launch a batch -# --------------
-
[docs]def batch(cmd, logger, cwd, args=[], log=None, delai=20, sommeil=1): +# Launch a batch +# -------------- +
[docs]def batch(cmd, logger, cwd, args=[], log=None, delai=20, sommeil=1): proc = launch_command(cmd, logger, cwd, args, log) top = 0 - sys.stdout.softspace = True + sys.stdout.softspace = True begin = time.time() - while proc.poll() is None: + while proc.poll() is None: if time.time() - begin >= 1: - show_progress(logger, top, delai, "batch:") + show_progress(logger, top, delai, "batch:") if top == delai: - logger.write("batch: time out KILL\n", 3) + logger.write("batch: time out KILL\n", 3) import signal os.kill(proc.pid, signal.SIGTERM) break @@ -125,14 +113,14 @@ top += 1 sys.stdout.flush() else: - write_back(logger, "batch: exit (%s)\n" % str(proc.returncode), 5) - return (proc.returncode == 0), top + write_back(logger, "batch: exit (%s)\n" % str(proc.returncode), 5) + return (proc.returncode == 0), top
-# Launch a salome process -# -----------------------
+# Launch a salome process +# -----------------------
[docs]def batch_salome(cmd, logger, cwd, args, getTmpDir, - pendant="SALOME_Session_Server", fin="killSalome.py", - log=None, delai=20, sommeil=1, delaiapp=0): + pendant="SALOME_Session_Server", fin="killSalome.py", + log=None, delai=20, sommeil=1, delaiapp=0): beginTime = time.time() launch_command(cmd, logger, cwd, args, log) @@ -140,9 +128,9 @@ if delaiapp == 0: delaiapp = delai - # first launch salome (looking for .pidict file) + # first launch salome (looking for .pidict file) top = 0 - found = False + found = False tmp_dir = getTmpDir() while (not found and top < delaiapp): if os.path.exists(tmp_dir): @@ -151,10 +139,10 @@ listFile = [] for file_name in listFile: - if file_name.endswith("pidict"): - # sometime we get a old file that will be removed by runSalome. - # So we test that we can read it. - currentTime = None + if file_name.endswith("pidict"): + # sometime we get a old file that will be removed by runSalome. + # So we test that we can read it. + currentTime = None try: statinfo = os.stat(os.path.join(tmp_dir, file_name)) currentTime = statinfo.st_mtime @@ -162,44 +150,44 @@ if currentTime and currentTime > beginTime: try: - file_ = open(os.path.join(tmp_dir, file_name), "r") + file_ = open(os.path.join(tmp_dir, file_name), "r") process_ids = pickle.load(file_) file_.close() for process_id in process_ids: for __, cmd in process_id.items(): if cmd == [pendant]: - found = True + found = True pidictFile = file_name except: file_.close() time.sleep(sommeil) top += 1 - show_progress(logger, top, delaiapp, "launching salome or appli:") + show_progress(logger, top, delaiapp, "launching salome or appli:") - # continue or not + # continue or not if found: - write_back(logger, "batch_salome: started\n", 5) + write_back(logger, "batch_salome: started\n", 5) else: - logger.write("batch_salome: FAILED to launch salome or appli\n", 3) - return False, -1 + logger.write("batch_salome: FAILED to launch salome or appli\n", 3) + return False, -1 - # salome launched run the script + # salome launched run the script top = 0 - code = None - while code is None: - show_progress(logger, top, delai, "running salome or appli:") + code = None + while code is None: + show_progress(logger, top, delai, "running salome or appli:") if not os.access(os.path.join(tmp_dir, pidictFile), os.F_OK): - write_back(logger, "batch_salome: exit\n", 5) - code = True + write_back(logger, "batch_salome: exit\n", 5) + code = True elif top >= delai: - # timeout kill the test + # timeout kill the test os.system(fin) - logger.write("batch_salome: time out KILL\n", 3) - code = False + logger.write("batch_salome: time out KILL\n", 3) + code = False else: - # still waiting + # still waiting time.sleep(sommeil) top = top + 1 @@ -209,7 +197,7 @@
-
+ diff --git a/doc/build/html/_modules/src/logger.html b/doc/build/html/_modules/src/logger.html index 7391cab..1757670 100644 --- a/doc/build/html/_modules/src/logger.html +++ b/doc/build/html/_modules/src/logger.html @@ -2,39 +2,27 @@ - + - - src.logger — salomeTools 5.0.0dev documentation - + src.logger — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,23 +31,23 @@

Source code for src.logger

-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-#  Copyright (C) 2010-2012  CEA/DEN
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library 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
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+#  Copyright (C) 2010-2012  CEA/DEN
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library 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
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 
 """\
 Implements the classes and method relative to the logging
@@ -72,11 +60,11 @@
 import tempfile
 
 import src
-from . import printcolors
-from . import xmlManager
+from . import printcolors
+from . import xmlManager
 
-log_macro_command_file_expression = "^[0-9]{8}_+[0-9]{6}_+.*\.xml$"
-log_all_command_file_expression = "^.*[0-9]{8}_+[0-9]{6}_+.*\.xml$"
+log_macro_command_file_expression = "^[0-9]{8}_+[0-9]{6}_+.*\.xml$"
+log_all_command_file_expression = "^.*[0-9]{8}_+[0-9]{6}_+.*\.xml$"
 
 
[docs]class Logger(object): """\ @@ -84,9 +72,9 @@ """ def __init__(self, config, - silent_sysstd=False, - all_in_terminal=False, - micro_command = False): + silent_sysstd=False, + all_in_terminal=False, + micro_command = False): """Initialization :param config pyconf.Config: The global configuration. @@ -97,54 +85,54 @@ self.default_level = 3 self.silentSysStd = silent_sysstd - # Construct xml log file location for sat prints. - prefix = "" + # Construct xml log file location for sat prints. + prefix = "" if micro_command: - prefix = "micro_" - hour_command_host = (config.VARS.datehour + "_" + - config.VARS.command + "_" + + prefix = "micro_" + hour_command_host = (config.VARS.datehour + "_" + + config.VARS.command + "_" + config.VARS.hostname) - logFileName = prefix + hour_command_host + ".xml" + logFileName = prefix + hour_command_host + ".xml" log_dir = src.get_log_path(config) logFilePath = os.path.join(log_dir, logFileName) - # Construct txt file location in order to log - # the external commands calls (cmake, make, git clone, etc...) - txtFileName = prefix + hour_command_host + ".txt" - txtFilePath = os.path.join(log_dir, "OUT", txtFileName) + # Construct txt file location in order to log + # the external commands calls (cmake, make, git clone, etc...) + txtFileName = prefix + hour_command_host + ".txt" + txtFilePath = os.path.join(log_dir, "OUT", txtFileName) src.ensure_path_exists(os.path.dirname(logFilePath)) src.ensure_path_exists(os.path.dirname(txtFilePath)) - # The path of the log files (one for sat traces, and the other for - # the system commands traces) + # The path of the log files (one for sat traces, and the other for + # the system commands traces) self.logFileName = logFileName self.logFilePath = logFilePath self.txtFileName = txtFileName self.txtFilePath = txtFilePath - # The list of all log files corresponding to the current command and - # the commands called by the current command + # The list of all log files corresponding to the current command and + # the commands called by the current command self.l_logFiles = [logFilePath, txtFilePath] - # Initialize xml instance and put first fields - # like beginTime, user, command, etc... - self.xmlFile = xmlManager.XmlLogFile(logFilePath, "SATcommand", - attrib = {"application" : config.VARS.application}) + # Initialize xml instance and put first fields + # like beginTime, user, command, etc... + self.xmlFile = xmlManager.XmlLogFile(logFilePath, "SATcommand", + attrib = {"application" : config.VARS.application}) self.put_initial_xml_fields() - # Initialize the txt file for reading + # Initialize the txt file for reading try: - self.logTxtFile = open(str(self.txtFilePath), 'w') + self.logTxtFile = open(str(self.txtFilePath), 'w') except IOError: - #msg1 = _("WARNING! Trying to write to a file that" - # " is not accessible:") - #msg2 = _("The logs won't be written.") - #print("%s\n%s\n%s\n" % (src.printcolors.printcWarning(msg1), - # src.printcolors.printcLabel(str(self.txtFilePath)), - # src.printcolors.printcWarning(msg2) )) + #msg1 = _("WARNING! Trying to write to a file that" + # " is not accessible:") + #msg2 = _("The logs won't be written.") + #print("%s\n%s\n%s\n" % (src.printcolors.printcWarning(msg1), + # src.printcolors.printcLabel(str(self.txtFilePath)), + # src.printcolors.printcWarning(msg2) )) self.logTxtFile = tempfile.TemporaryFile() - # If the option all_in_terminal was called, all the system commands - # are redirected to the terminal + # If the option all_in_terminal was called, all the system commands + # are redirected to the terminal if all_in_terminal: self.logTxtFile = sys.__stdout__ @@ -153,40 +141,40 @@ Called at class initialization: Put all fields corresponding to the command context (user, time, ...) """ - # command name - self.xmlFile.add_simple_node("Site", attrib={"command" : + # command name + self.xmlFile.add_simple_node("Site", attrib={"command" : self.config.VARS.command}) - # version of salomeTools - self.xmlFile.append_node_attrib("Site", attrib={"satversion" : + # version of salomeTools + self.xmlFile.append_node_attrib("Site", attrib={"satversion" : self.config.INTERNAL.sat_version}) - # machine name on which the command has been launched - self.xmlFile.append_node_attrib("Site", attrib={"hostname" : + # machine name on which the command has been launched + self.xmlFile.append_node_attrib("Site", attrib={"hostname" : self.config.VARS.hostname}) - # Distribution of the machine - self.xmlFile.append_node_attrib("Site", attrib={"OS" : + # Distribution of the machine + self.xmlFile.append_node_attrib("Site", attrib={"OS" : self.config.VARS.dist}) - # The user that have launched the command - self.xmlFile.append_node_attrib("Site", attrib={"user" : + # The user that have launched the command + self.xmlFile.append_node_attrib("Site", attrib={"user" : self.config.VARS.user}) - # The time when command was launched + # The time when command was launched Y, m, dd, H, M, S = date_to_datetime(self.config.VARS.datehour) - date_hour = "%2s/%2s/%4s %2sh%2sm%2ss" % (dd, m, Y, H, M, S) - self.xmlFile.append_node_attrib("Site", attrib={"beginTime" : + date_hour = "%2s/%2s/%4s %2sh%2sm%2ss" % (dd, m, Y, H, M, S) + self.xmlFile.append_node_attrib("Site", attrib={"beginTime" : date_hour}) - # The application if any - if "APPLICATION" in self.config: - self.xmlFile.append_node_attrib("Site", - attrib={"application" : self.config.VARS.application}) - # The initialization of the trace node - self.xmlFile.add_simple_node("Log",text="") - # The system commands logs - self.xmlFile.add_simple_node("OutLog", - text=os.path.join("OUT", self.txtFileName)) - # The initialization of the node where - # to put the links to the other sat commands that can be called by any - # command - self.xmlFile.add_simple_node("Links") -
+ # The application if any + if "APPLICATION" in self.config: + self.xmlFile.append_node_attrib("Site", + attrib={"application" : self.config.VARS.application}) + # The initialization of the trace node + self.xmlFile.add_simple_node("Log",text="") + # The system commands logs + self.xmlFile.add_simple_node("OutLog", + text=os.path.join("OUT", self.txtFileName)) + # The initialization of the node where + # to put the links to the other sat commands that can be called by any + # command + self.xmlFile.add_simple_node("Links")
+ -
[docs] def write(self, message, level=None, screenOnly=False): + attrib = {"command" : command_name, + "passed" : command_res, + "launchedCommand" : full_launched_command})
+ +
[docs] def write(self, message, level=None, screenOnly=False): """\ function used in the commands to print in the terminal and the log file. @@ -218,47 +206,47 @@ to the message 0 < level < 6. :param screenOnly boolean: if True, do not write in log file. """ - # do not write message starting with \r to log file - if not message.startswith("\r") and not screenOnly: - self.xmlFile.append_node_text("Log", + # do not write message starting with \r to log file + if not message.startswith("\r") and not screenOnly: + self.xmlFile.append_node_text("Log", printcolors.cleancolor(message)) - # get user or option output level + # get user or option output level current_output_verbose_level = self.config.USER.output_verbose_level - if not ('isatty' in dir(sys.stdout) and sys.stdout.isatty()): - # clean the message color if the terminal is redirected by user - # ex: sat compile appli > log.txt + if not ('isatty' in dir(sys.stdout) and sys.stdout.isatty()): + # clean the message color if the terminal is redirected by user + # ex: sat compile appli > log.txt message = printcolors.cleancolor(message) - # Print message regarding the output level value + # Print message regarding the output level value if level: if level <= current_output_verbose_level and not self.silentSysStd: sys.stdout.write(message) else: if self.default_level <= current_output_verbose_level and not self.silentSysStd: sys.stdout.write(message) - self.flush() -
+ self.flush()
+
[docs] def error(self, message): """Print an error. :param message str: The message to print. """ - # Print in the log file - self.xmlFile.append_node_text("traces", _('ERROR:') + message) + # Print in the log file + self.xmlFile.append_node_text("traces", _('ERROR:') + message) - # Print in the terminal and clean colors if the terminal - # is redirected by user - if not ('isatty' in dir(sys.stderr) and sys.stderr.isatty()): - sys.stderr.write(printcolors.printcError(_('ERROR:') + message)) + # Print in the terminal and clean colors if the terminal + # is redirected by user + if not ('isatty' in dir(sys.stderr) and sys.stderr.isatty()): + sys.stderr.write(printcolors.printcError(_('ERROR:') + message)) else: - sys.stderr.write(_('ERROR:') + message) -
+ sys.stderr.write(_('ERROR:') + message)
+
[docs] def flush(self): """Flush terminal""" sys.stdout.flush() - self.logTxtFile.flush() -
+ self.logTxtFile.flush()
+
[docs] def end_write(self, attribute): """\ Called just after command end: Put all fields @@ -268,7 +256,7 @@ :param attribute dict: the attribute to add to the node "Site". """ - # Get current time (end of command) and format it + # Get current time (end of command) and format it dt = datetime.datetime.now() Y, m, dd, H, M, S = date_to_datetime(self.config.VARS.datehour) t0 = datetime.datetime(int(Y), int(m), int(dd), int(H), int(M), int(S)) @@ -278,33 +266,33 @@ hours = int(total_time / 3600) minutes = int((total_time - hours*3600) / 60) seconds = total_time - hours*3600 - minutes*60 - # Add the fields corresponding to the end time - # and the total time of command - endtime = dt.strftime('%Y/%m/%d %Hh%Mm%Ss') - self.xmlFile.append_node_attrib("Site", attrib={"endTime" : endtime}) - self.xmlFile.append_node_attrib("Site", - attrib={"TotalTime" : "%ih%im%is" % (hours, minutes, seconds)}) + # Add the fields corresponding to the end time + # and the total time of command + endtime = dt.strftime('%Y/%m/%d %Hh%Mm%Ss') + self.xmlFile.append_node_attrib("Site", attrib={"endTime" : endtime}) + self.xmlFile.append_node_attrib("Site", + attrib={"TotalTime" : "%ih%im%is" % (hours, minutes, seconds)}) - # Add the attribute passed to the method - self.xmlFile.append_node_attrib("Site", attrib=attribute) + # Add the attribute passed to the method + self.xmlFile.append_node_attrib("Site", attrib=attribute) - # Call the method to write the xml file on the hard drive - self.xmlFile.write_tree(stylesheet = "command.xsl") + # Call the method to write the xml file on the hard drive + self.xmlFile.write_tree(stylesheet = "command.xsl") - # Dump the config in a pyconf file in the log directory + # Dump the config in a pyconf file in the log directory logDir = src.get_log_path(self.config) dumpedPyconfFileName = (self.config.VARS.datehour - + "_" + + "_" + self.config.VARS.command - + ".pyconf") - dumpedPyconfFilePath = os.path.join(logDir, 'OUT', dumpedPyconfFileName) + + ".pyconf") + dumpedPyconfFilePath = os.path.join(logDir, 'OUT', dumpedPyconfFileName) try: - f = open(dumpedPyconfFilePath, 'w') + f = open(dumpedPyconfFilePath, 'w') self.config.__save__(f) f.close() except IOError: - pass -
+ pass +
[docs]def date_to_datetime(date): """\ From a string date in format YYYYMMDD_HHMMSS @@ -320,8 +308,8 @@ H = date[9:11] M = date[11:13] S = date[13:15] - return Y, m, dd, H, M, S -
+ return Y, m, dd, H, M, S +
[docs]def timedelta_total_seconds(timedelta): """\ Replace total_seconds from datetime module @@ -333,8 +321,8 @@ """ return ( timedelta.microseconds + 0.0 + - (timedelta.seconds + timedelta.days * 24 * 3600) * 10 ** 6) / 10 ** 6 -
+ (timedelta.seconds + timedelta.days * 24 * 3600) * 10 ** 6) / 10 ** 6 +
[docs]def show_command_log(logFilePath, cmd, application, notShownCommands): """\ Used in updateHatXml. @@ -352,35 +340,35 @@ in the log file corresponds to application :rtype: boolean """ - # When the command is not in notShownCommands, no need to go further : - # Do not show + # When the command is not in notShownCommands, no need to go further : + # Do not show if cmd in notShownCommands: - return False, None, None + return False, None, None - # Get the application of the log file + # Get the application of the log file try: logFileXml = src.xmlManager.ReadXmlFile(logFilePath) except Exception as e: - msg = _("WARNING: the log file %s cannot be read:" % logFilePath) - sys.stdout.write(printcolors.printcWarning("%s\n%s\n" % (msg, e))) - return False, None, None + msg = _("WARNING: the log file %s cannot be read:" % logFilePath) + sys.stdout.write(printcolors.printcWarning("%s\n%s\n" % (msg, e))) + return False, None, None - if 'application' in logFileXml.xmlroot.keys(): - appliLog = logFileXml.xmlroot.get('application') - launched_cmd = logFileXml.xmlroot.find('Site').attrib['launchedCommand'] - # if it corresponds, then the log has to be shown + if 'application' in logFileXml.xmlroot.keys(): + appliLog = logFileXml.xmlroot.get('application') + launched_cmd = logFileXml.xmlroot.find('Site').attrib['launchedCommand'] + # if it corresponds, then the log has to be shown if appliLog == application: - return True, appliLog, launched_cmd - elif application != 'None': - return False, appliLog, launched_cmd + return True, appliLog, launched_cmd + elif application != 'None': + return False, appliLog, launched_cmd - return True, appliLog, launched_cmd + return True, appliLog, launched_cmd - if application == 'None': - return True, None, None + if application == 'None': + return True, None, None - return False, None, None -
+ return False, None, None +
[docs]def list_log_file(dirPath, expression): """Find all files corresponding to expression in dirPath @@ -391,29 +379,29 @@ """ lRes = [] for fileName in os.listdir(dirPath): - # YYYYMMDD_HHMMSS_namecmd.xml + # YYYYMMDD_HHMMSS_namecmd.xml sExpr = expression oExpr = re.compile(sExpr) if oExpr.search(fileName): file_name = fileName - if fileName.startswith("micro_"): - file_name = fileName[len("micro_"):] - # get date and hour and format it - date_hour_cmd_host = file_name.split('_') + if fileName.startswith("micro_"): + file_name = fileName[len("micro_"):] + # get date and hour and format it + date_hour_cmd_host = file_name.split('_') date_not_formated = date_hour_cmd_host[0] - date = "%s/%s/%s" % (date_not_formated[6:8], + date = "%s/%s/%s" % (date_not_formated[6:8], date_not_formated[4:6], date_not_formated[0:4]) hour_not_formated = date_hour_cmd_host[1] - hour = "%s:%s:%s" % (hour_not_formated[0:2], + hour = "%s:%s:%s" % (hour_not_formated[0:2], hour_not_formated[2:4], hour_not_formated[4:6]) if len(date_hour_cmd_host) < 4: - cmd = date_hour_cmd_host[2][:-len('.xml')] - host = "" + cmd = date_hour_cmd_host[2][:-len('.xml')] + host = "" else: cmd = date_hour_cmd_host[2] - host = date_hour_cmd_host[3][:-len('.xml')] + host = date_hour_cmd_host[3][:-len('.xml')] lRes.append((os.path.join(dirPath, fileName), date_not_formated, date, @@ -421,9 +409,9 @@ hour, cmd, host)) - return lRes -
-
[docs]def update_hat_xml(logDir, application=None, notShownCommands = []): + return lRes
+ +
[docs]def update_hat_xml(logDir, application=None, notShownCommands = []): """\ Create the xml file in logDir that contain all the xml file and have a name like YYYYMMDD_HHMMSS_namecmd.xml @@ -431,35 +419,35 @@ :param logDir str: the directory to parse :param application str: the name of the application if there is any """ - # Create an instance of XmlLogFile class to create hat.xml file - xmlHatFilePath = os.path.join(logDir, 'hat.xml') + # Create an instance of XmlLogFile class to create hat.xml file + xmlHatFilePath = os.path.join(logDir, 'hat.xml') xmlHat = src.xmlManager.XmlLogFile(xmlHatFilePath, - "LOGlist", {"application" : application}) - # parse the log directory to find all the command logs, - # then add it to the xml file + "LOGlist", {"application" : application}) + # parse the log directory to find all the command logs, + # then add it to the xml file lLogFile = list_log_file(logDir, log_macro_command_file_expression) for filePath, __, date, __, hour, cmd, __ in lLogFile: showLog, cmdAppli, full_cmd = show_command_log(filePath, cmd, application, notShownCommands) - #if cmd not in notShownCommands: + #if cmd not in notShownCommands: if showLog: - # add a node to the hat.xml file - xmlHat.add_simple_node("LogCommand", + # add a node to the hat.xml file + xmlHat.add_simple_node("LogCommand", text=os.path.basename(filePath), - attrib = {"date" : date, - "hour" : hour, - "cmd" : cmd, - "application" : cmdAppli, - "full_command" : full_cmd}) + attrib = {"date" : date, + "hour" : hour, + "cmd" : cmd, + "application" : cmdAppli, + "full_command" : full_cmd}) - # Write the file on the hard drive - xmlHat.write_tree('hat.xsl')
+ # Write the file on the hard drive + xmlHat.write_tree('hat.xsl') -
+ diff --git a/doc/build/html/_modules/src/options.html b/doc/build/html/_modules/src/options.html index 413314e..b27df28 100644 --- a/doc/build/html/_modules/src/options.html +++ b/doc/build/html/_modules/src/options.html @@ -2,39 +2,27 @@ - + - - src.options — salomeTools 5.0.0dev documentation - + src.options — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,29 +31,29 @@

Source code for src.options

-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-#  Copyright (C) 2010-2013  CEA/DEN
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library 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
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+#  Copyright (C) 2010-2013  CEA/DEN
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library 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
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 '''The Options class that manages the access to all options passed as 
    parameters in salomeTools command lines
 '''
 import getopt
 import sys
-from . import printcolors
+from . import printcolors
 
 
[docs]class OptResult(object): '''An instance of this class will be the object manipulated @@ -79,7 +67,7 @@ def __init__(self): '''Initialization ''' - self.__dict__ = dict() + self.__dict__ = dict() def __getattr__(self, name): '''Overwrite of the __getattr__ function @@ -89,10 +77,10 @@ :return: the value corresponding to the attribute. :rtype: str,int,list,boolean ''' - if name in self.__dict__: - return self.__dict__[name] + if name in self.__dict__: + return self.__dict__[name] else: - raise AttributeError(name + _(u" is not a valid option")) + raise AttributeError(name + _(u" is not a valid option")) def __setattr__(self, name, value): '''Overwrite of the __setattr__ function @@ -103,24 +91,24 @@ :return: Nothing. :rtype: N\A ''' - object.__setattr__(self,name,value) -
+ object.__setattr__(self,name,value)
+
[docs]class Options: '''Class to manage all salomeTools options ''' def __init__(self): '''Initialization ''' - # The options field stocks all options of a command - # in a list that contains dicts + # The options field stocks all options of a command + # in a list that contains dicts self.options = [] - # The list of available option type - self.availableOptions = ["boolean", "string", "int", "float", - "long", "list", "list2"] - self.default = None + # The list of available option type + self.availableOptions = ["boolean", "string", "int", "float", + "long", "list", "list2"] + self.default = None
[docs] def add_option(self, shortName, longName, - optionType, destName, helpString="", default = None): + optionType, destName, helpString="", default = None): '''Method to add an option to a command. It gets all attributes of an option and append it in the options field @@ -136,41 +124,41 @@ :rtype: N\A ''' option = dict() - option['shortName'] = shortName - option['longName'] = longName + option['shortName'] = shortName + option['longName'] = longName if optionType not in self.availableOptions: - print("error optionType", optionType, "not available.") + print("error optionType", optionType, "not available.") sys.exit(-1) - option['optionType'] = optionType - option['destName'] = destName - option['helpString'] = helpString - option['result'] = default - self.options.append(option) -
+ option['optionType'] = optionType + option['destName'] = destName + option['helpString'] = helpString + option['result'] = default + self.options.append(option)
+
[docs] def print_help(self): '''Method that display all options stored in self.options and there help :return: Nothing. :rtype: N\A ''' - # Do nothing if there are no options + # Do nothing if there are no options if len(self.options) == 0: return - # for all options, print its values. - # "shortname" is an optional field of the options - print(printcolors.printcHeader(_("Available options are:"))) + # for all options, print its values. + # "shortname" is an optional field of the options + print(printcolors.printcHeader(_("Available options are:"))) for option in self.options: - if 'shortName' in option and len(option['shortName']) > 0: - print(" -%(shortName)1s, --%(longName)s" - " (%(optionType)s)\n\t%(helpString)s\n" % option) + if 'shortName' in option and len(option['shortName']) > 0: + print(" -%(shortName)1s, --%(longName)s" + " (%(optionType)s)\n\t%(helpString)s\n" % option) else: - print(" --%(longName)s (%(optionType)s)\n\t%(helpString)s\n" - % option) -
-
[docs] def parse_args(self, argList=None): + print(" --%(longName)s (%(optionType)s)\n\t%(helpString)s\n" + % option)
+ +
[docs] def parse_args(self, argList=None): '''Method that instantiates the class OptResult that gives access to all options in the code @@ -180,70 +168,71 @@ is the full raw list of passed options :rtype: (class 'common.options.OptResult',list) ''' - if argList is None: + if argList is None: argList = sys.argv[1:] - # format shortNameOption and longNameOption - # to make right arguments to getopt.getopt function - shortNameOption = "" + # format shortNameOption and longNameOption + # to make right arguments to getopt.getopt function + shortNameOption = "" longNameOption = [] for option in self.options: - shortNameOption = shortNameOption + option['shortName'] - if option['shortName'] != "" and option['optionType'] != "boolean": - shortNameOption = shortNameOption + ":" + shortNameOption = shortNameOption + option['shortName'] + if option['shortName'] != "" and option['optionType'] != "boolean": + shortNameOption = shortNameOption + ":" - if option['longName'] != "": - if option['optionType'] != "boolean": - longNameOption.append(option['longName'] + "=") + if option['longName'] != "": + if option['optionType'] != "boolean": + longNameOption.append(option['longName'] + "=") else: - longNameOption.append(option['longName']) + longNameOption.append(option['longName']) - # call to getopt.getopt function to get the option - # passed in the command regarding the available options + # call to getopt.getopt function to get the option + # passed in the command regarding the available options optlist, args = getopt.getopt(argList, shortNameOption, longNameOption) - # instantiate and completing the optResult that will be returned + # instantiate and completing the optResult that will be returned optResult = OptResult() for option in self.options: - shortOption = "-" + option['shortName'] - longOption = "--" + option['longName'] - optionType = option['optionType'] + shortOption = "-" + option['shortName'] + longOption = "--" + option['longName'] + optionType = option['optionType'] for opt in optlist: if opt[0] in [shortOption, longOption]: - if optionType == "string": - option['result'] = opt[1] - elif optionType == "boolean": - option['result'] = True - elif optionType == "int": - option['result'] = int(opt[1]) - elif optionType == "float": - option['result'] = float(opt[1]) - elif optionType == "long": - option['result'] = long(opt[1]) - elif optionType == "list": - if option['result'] is None: - option['result'] = list() - option['result'].append(opt[1]) - elif optionType == "list2": - if option['result'] is None: - option['result'] = list() - if opt[1].find(",") == -1: - option['result'].append(opt[1]) + if optionType == "string": + option['result'] = opt[1] + elif optionType == "boolean": + option['result'] = True + elif optionType == "int": + option['result'] = int(opt[1]) + elif optionType == "float": + option['result'] = float(opt[1]) + elif optionType == "long": + option['result'] = long(opt[1]) + elif optionType == "list": + if option['result'] is None: + option['result'] = list() + option['result'].append(opt[1]) + elif optionType == "list2": + if option['result'] is None: + option['result'] = list() + if opt[1].find(",") == -1: + option['result'].append(opt[1]) else: - elts = filter(lambda l: len(l) > 0, opt[1].split(",")) - option['result'].extend(elts) + elts = filter(lambda l: len(l) > 0, opt[1].split(",")) + option['result'].extend(elts) + + optResult.__setattr__(option['destName'], option['result']) + # free the option in order to be able to make + # a new free call of options (API case) + option['result'] = None + return optResult, args
- optResult.__setattr__(option['destName'], option['result']) - # free the option in order to be able to make - # a new free call of options (API case) - option['result'] = None - return optResult, args -
+ -
+ diff --git a/doc/build/html/_modules/src/printcolors.html b/doc/build/html/_modules/src/printcolors.html index c9da0a6..bba9968 100644 --- a/doc/build/html/_modules/src/printcolors.html +++ b/doc/build/html/_modules/src/printcolors.html @@ -2,39 +2,27 @@ - + - - src.printcolors — salomeTools 5.0.0dev documentation - + src.printcolors — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,51 +31,51 @@

Source code for src.printcolors

-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-#  Copyright (C) 2010-2013  CEA/DEN
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library 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
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+#  Copyright (C) 2010-2013  CEA/DEN
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library 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
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 '''In this file is stored the mechanism that manage color prints in the terminal
 '''
 
-# define constant to use in scripts
-COLOR_ERROR = 'ERROR'
-COLOR_WARNING = 'WARNING'
-COLOR_SUCCESS = 'SUCCESS'
-COLOR_LABEL = 'LABEL'
-COLOR_HEADER = 'HEADER'
-COLOR_INFO = 'INFO'
-COLOR_HIGLIGHT = 'HIGHLIGHT'
+# define constant to use in scripts
+COLOR_ERROR = 'ERROR'
+COLOR_WARNING = 'WARNING'
+COLOR_SUCCESS = 'SUCCESS'
+COLOR_LABEL = 'LABEL'
+COLOR_HEADER = 'HEADER'
+COLOR_INFO = 'INFO'
+COLOR_HIGLIGHT = 'HIGHLIGHT'
 
-# the color map to use to print the colors
+# the color map to use to print the colors
 __colormap__ = {
-    COLOR_ERROR: '\033[1m\033[31m',
-    COLOR_SUCCESS: '\033[1m\033[32m',
-    COLOR_WARNING: '\033[33m',
-    COLOR_HEADER: '\033[34m',
-    COLOR_INFO: '\033[35m',
-    COLOR_LABEL: '\033[36m',
-    COLOR_HIGLIGHT: '\033[97m\033[43m'
+    COLOR_ERROR: '\033[1m\033[31m',
+    COLOR_SUCCESS: '\033[1m\033[32m',
+    COLOR_WARNING: '\033[33m',
+    COLOR_HEADER: '\033[34m',
+    COLOR_INFO: '\033[35m',
+    COLOR_LABEL: '\033[36m',
+    COLOR_HIGLIGHT: '\033[97m\033[43m'
 }
 
-# list of available codes
+# list of available codes
 __code_range__ = ([1, 4] + list(range(30, 38)) + list(range(40, 48))
                 + list(range(90, 98)) + list(range(100, 108)))
 
-
[docs]def printc(txt, code=''): +
[docs]def printc(txt, code=''): '''print a text with colors :param txt str: The text to be printed. @@ -95,22 +83,22 @@ :return: The colored text. :rtype: str ''' - # no code means 'auto mode' (works only for OK, KO, NO and ERR*) - if code == '': + # no code means 'auto mode' (works only for OK, KO, NO and ERR*) + if code == '': striptxt = txt.strip().upper() - if striptxt == "OK": + if striptxt == "OK": code = COLOR_SUCCESS - elif striptxt in ["KO", "NO"] or striptxt.startswith("ERR"): + elif striptxt in ["KO", "NO"] or striptxt.startswith("ERR"): code = COLOR_ERROR else: return txt - # no code => output the originial text - if code not in __colormap__.keys() or __colormap__[code] == '': + # no code => output the originial text + if code not in __colormap__.keys() or __colormap__[code] == '': return txt - return __colormap__[code] + txt + '\033[0m' -
+ return __colormap__[code] + txt + '\033[0m'
+
[docs]def printcInfo(txt): '''print a text info color @@ -118,8 +106,8 @@ :return: The colored text. :rtype: str ''' - return printc(txt, COLOR_INFO) -
+ return printc(txt, COLOR_INFO)
+
[docs]def printcError(txt): '''print a text error color @@ -127,8 +115,8 @@ :return: The colored text. :rtype: str ''' - return printc(txt, COLOR_ERROR) -
+ return printc(txt, COLOR_ERROR)
+
[docs]def printcWarning(txt): '''print a text warning color @@ -136,8 +124,8 @@ :return: The colored text. :rtype: str ''' - return printc(txt, COLOR_WARNING) -
+ return printc(txt, COLOR_WARNING)
+
[docs]def printcHeader(txt): '''print a text header color @@ -145,8 +133,8 @@ :return: The colored text. :rtype: str ''' - return printc(txt, COLOR_HEADER) -
+ return printc(txt, COLOR_HEADER)
+
[docs]def printcLabel(txt): '''print a text label color @@ -154,8 +142,8 @@ :return: The colored text. :rtype: str ''' - return printc(txt, COLOR_LABEL) -
+ return printc(txt, COLOR_LABEL) +
[docs]def printcSuccess(txt): '''print a text success color @@ -163,8 +151,8 @@ :return: The colored text. :rtype: str ''' - return printc(txt, COLOR_SUCCESS) -
+ return printc(txt, COLOR_SUCCESS) +
[docs]def printcHighlight(txt): '''print a text highlight color @@ -172,8 +160,8 @@ :return: The colored text. :rtype: str ''' - return printc(txt, COLOR_HIGLIGHT) -
+ return printc(txt, COLOR_HIGLIGHT) +
[docs]def cleancolor(message): '''remove color from a colored text. @@ -181,15 +169,15 @@ :return: The cleaned text. :rtype: str ''' - if message == None: + if message == None: return message - message = message.replace('\033[0m', '') + message = message.replace('\033[0m', '') for i in __code_range__: - message = message.replace('\033[%dm' % i, '') - return message -
- + + + logger.write(" %s = %s %s\n" % (label, printcInfo(str(value)), + suffix), level) + -# This method prints the color map +# This method prints the color map + print(printc(" %s: '%s', " % (k, ';'.join(codes)), k)) + print("}") + + + -
+ diff --git a/doc/build/html/_modules/src/product.html b/doc/build/html/_modules/src/product.html index 07de867..14c4799 100644 --- a/doc/build/html/_modules/src/product.html +++ b/doc/build/html/_modules/src/product.html @@ -2,39 +2,27 @@ - + - - src.product — salomeTools 5.0.0dev documentation - + src.product — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,23 +31,23 @@

Source code for src.product

-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-#  Copyright (C) 2010-2012  CEA/DEN
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library 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
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+#  Copyright (C) 2010-2012  CEA/DEN
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library 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
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 
 """\
 In this file are implemented the methods 
@@ -70,13 +58,13 @@
 import re
 
 import src
-import src.debug as DBG
+import src.debug as DBG
 
-AVAILABLE_VCS = ['git', 'svn', 'cvs']
-config_expression = "^config-\d+$"
-VERSION_DELIMITER = "_to_"
+AVAILABLE_VCS = ['git', 'svn', 'cvs']
+config_expression = "^config-\d+$"
+VERSION_DELIMITER = "_to_"
 
-
[docs]def get_product_config(config, product_name, with_install_dir=True): +
[docs]def get_product_config(config, product_name, with_install_dir=True): """Get the specific configuration of a product from the global configuration :param config Config: The global configuration @@ -88,146 +76,146 @@ :rtype: Config """ - # Get the version of the product from the application definition + # Get the version of the product from the application definition version = config.APPLICATION.products[product_name] - # if no version, then take the default one defined in the application + # if no version, then take the default one defined in the application if isinstance(version, bool): version = config.APPLICATION.tag - # Define debug and dev modes - # Get the tag if a dictionary is given in APPLICATION.products for the - # current product - debug = 'no' - dev = 'no' - base = 'maybe' - section = None + # Define debug and dev modes + # Get the tag if a dictionary is given in APPLICATION.products for the + # current product + debug = 'no' + dev = 'no' + base = 'maybe' + section = None if isinstance(version, src.pyconf.Mapping): dic_version = version - # Get the version/tag - if not 'tag' in dic_version: + # Get the version/tag + if not 'tag' in dic_version: version = config.APPLICATION.tag else: version = dic_version.tag - # Get the debug if any - if 'debug' in dic_version: + # Get the debug if any + if 'debug' in dic_version: debug = dic_version.debug - # Get the dev if any - if 'dev' in dic_version: + # Get the dev if any + if 'dev' in dic_version: dev = dic_version.dev - # Get the base if any - if 'base' in dic_version: + # Get the base if any + if 'base' in dic_version: base = dic_version.base - # Get the section if any - if 'section' in dic_version: + # Get the section if any + if 'section' in dic_version: section = dic_version.section vv = version - # substitute some character with _ in order to get the correct definition - # in config.PRODUCTS. This is done because the pyconf tool does not handle - # the . and - characters - for c in ".-": vv = vv.replace(c, "_") + # substitute some character with _ in order to get the correct definition + # in config.PRODUCTS. This is done because the pyconf tool does not handle + # the . and - characters + for c in ".-": vv = vv.replace(c, "_") - prod_info = None + prod_info = None if product_name in config.PRODUCTS: - # Search for the product description in the configuration + # Search for the product description in the configuration prod_info = get_product_section(config, product_name, vv, section) - # merge opt_depend in depend - if prod_info is not None and 'opt_depend' in prod_info: + # merge opt_depend in depend + if prod_info is not None and 'opt_depend' in prod_info: for depend in prod_info.opt_depend: if depend in config.APPLICATION.products: - prod_info.depend.append(depend,'') + prod_info.depend.append(depend,'') - # In case of a product get with a vcs, - # put the tag (equal to the version) - if prod_info is not None and prod_info.get_source in AVAILABLE_VCS: + # In case of a product get with a vcs, + # put the tag (equal to the version) + if prod_info is not None and prod_info.get_source in AVAILABLE_VCS: - if prod_info.get_source == 'git': + if prod_info.get_source == 'git': prod_info.git_info.tag = version - if prod_info.get_source == 'svn': + if prod_info.get_source == 'svn': prod_info.svn_info.tag = version - if prod_info.get_source == 'cvs': + if prod_info.get_source == 'cvs': prod_info.cvs_info.tag = version - # In case of a fixed product, - # define the install_dir (equal to the version) - if prod_info is not None and os.path.isdir(version): + # In case of a fixed product, + # define the install_dir (equal to the version) + if prod_info is not None and os.path.isdir(version): prod_info.install_dir = version - prod_info.get_source = "fixed" + prod_info.get_source = "fixed" - # Check if the product is defined as native in the application - if prod_info is not None: - if version == "native": - prod_info.get_source = "native" - elif prod_info.get_source == "native": - msg = _("The product %(prod)s has version %(ver)s but is " - "declared as native in its definition" % - { 'prod': prod_info.name, 'ver': version}) + # Check if the product is defined as native in the application + if prod_info is not None: + if version == "native": + prod_info.get_source = "native" + elif prod_info.get_source == "native": + msg = _("The product %(prod)s has version %(ver)s but is " + "declared as native in its definition" % + { 'prod': prod_info.name, 'ver': version}) raise src.SatException(msg) - # If there is no definition but the product is declared as native, - # construct a new definition containing only the get_source key - if prod_info is None and version == "native": + # If there is no definition but the product is declared as native, + # construct a new definition containing only the get_source key + if prod_info is None and version == "native": prod_info = src.pyconf.Config() prod_info.name = product_name - prod_info.get_source = "native" + prod_info.get_source = "native" - # If there is no definition but the product is fixed, - # construct a new definition containing only the product name - if prod_info is None and os.path.isdir(version): + # If there is no definition but the product is fixed, + # construct a new definition containing only the product name + if prod_info is None and os.path.isdir(version): prod_info = src.pyconf.Config() prod_info.name = product_name - prod_info.get_source = "fixed" - prod_info.addMapping("environ", src.pyconf.Mapping(prod_info), "") + prod_info.get_source = "fixed" + prod_info.addMapping("environ", src.pyconf.Mapping(prod_info), "") - # If prod_info is still None, it means that there is no product definition - # in the config. The user has to provide it. - if prod_info is None: - prod_pyconf_path = src.find_file_in_lpath(product_name + ".pyconf", + # If prod_info is still None, it means that there is no product definition + # in the config. The user has to provide it. + if prod_info is None: + prod_pyconf_path = src.find_file_in_lpath(product_name + ".pyconf", config.PATHS.PRODUCTPATH) if not prod_pyconf_path: - msg = _("""\ -No definition found for the product %(1)s. -Please create a %(2)s.pyconf file somewhere in: -%(3)s""") % { - "1": product_name, - "2": product_name, - "3": config.PATHS.PRODUCTPATH } + msg = _("""\ +No definition found for the product %(1)s. +Please create a %(2)s.pyconf file somewhere in: +%(3)s""") % { + "1": product_name, + "2": product_name, + "3": config.PATHS.PRODUCTPATH } else: - msg = _("""\ -No definition corresponding to the version %(1)s was found in the file: - %(2)s. -Please add a section in it.""") % {"1" : vv, "2" : prod_pyconf_path} + msg = _("""\ +No definition corresponding to the version %(1)s was found in the file: + %(2)s. +Please add a section in it.""") % {"1" : vv, "2" : prod_pyconf_path} raise src.SatException(msg) - # Set the debug, dev and version keys + # Set the debug, dev and version keys prod_info.debug = debug prod_info.dev = dev prod_info.version = version - # Set the archive_info if the product is get in archive mode - if prod_info.get_source == "archive": - if not "archive_info" in prod_info: - prod_info.addMapping("archive_info", + # Set the archive_info if the product is get in archive mode + if prod_info.get_source == "archive": + if not "archive_info" in prod_info: + prod_info.addMapping("archive_info", src.pyconf.Mapping(prod_info), - "") - if "archive_name" not in prod_info.archive_info: - arch_name = product_name + "-" + version + ".tar.gz" + "") + if "archive_name" not in prod_info.archive_info: + arch_name = product_name + "-" + version + ".tar.gz" arch_path = src.find_file_in_lpath(arch_name, config.PATHS.ARCHIVEPATH) if not arch_path: - msg = _("Archive %(1)s for %(2)s not found in config.PATHS.ARCHIVEPATH") % \ - {"1" : arch_name, "2" : prod_info.name} + msg = _("Archive %(1)s for %(2)s not found in config.PATHS.ARCHIVEPATH") % \ + {"1" : arch_name, "2" : prod_info.name} DBG.tofix(msg, config.PATHS.ARCHIVEPATH) - prod_info.archive_info.archive_name = arch_name #without path - # raise src.SatException(msg) #may be a warning, continue #8646 + prod_info.archive_info.archive_name = arch_name #without path + # raise src.SatException(msg) #may be a warning, continue #8646 else: prod_info.archive_info.archive_name = arch_path else: @@ -238,105 +226,105 @@ arch_name, config.PATHS.ARCHIVEPATH) if not arch_path: - msg = _("Archive %(1)s for %(2)s not found in config.PATHS.ARCHIVEPATH") % \ - {"1" : arch_name, "2" : prod_info.name} - DBG.tofix(msg, config.PATHS.ARCHIVEPATH) #avoid 2 messages in compile - prod_info.archive_info.archive_name = arch_name #without path - # raise src.SatException(msg) #may be a warning, continue #8646 + msg = _("Archive %(1)s for %(2)s not found in config.PATHS.ARCHIVEPATH") % \ + {"1" : arch_name, "2" : prod_info.name} + DBG.tofix(msg, config.PATHS.ARCHIVEPATH) #avoid 2 messages in compile + prod_info.archive_info.archive_name = arch_name #without path + # raise src.SatException(msg) #may be a warning, continue #8646 prod_info.archive_info.archive_name = arch_path - # If the product compiles with a script, check the script existence - # and if it is executable + # If the product compiles with a script, check the script existence + # and if it is executable if product_has_script(prod_info): - # Check the compil_script key existence - if "compil_script" not in prod_info: - msg = _("""\ -No compilation script found for the product %s. -Please provide a 'compil_script' key in its definition.""") % product_name + # Check the compil_script key existence + if "compil_script" not in prod_info: + msg = _("""\ +No compilation script found for the product %s. +Please provide a 'compil_script' key in its definition.""") % product_name raise src.SatException(msg) - # Get the path of the script + # Get the path of the script script = prod_info.compil_script script_name = os.path.basename(script) if script == script_name: - # Only a name is given. Search in the default directory + # Only a name is given. Search in the default directory script_path = src.find_file_in_lpath(script_name, config.PATHS.PRODUCTPATH, - "compil_scripts") + "compil_scripts") if not script_path: raise src.SatException( - _("Compilation script not found: %s") % script_name) + _("Compilation script not found: %s") % script_name) prod_info.compil_script = script_path if src.architecture.is_windows(): - prod_info.compil_script = prod_info.compil_script[:-len(".sh")] + ".bat" + prod_info.compil_script = prod_info.compil_script[:-len(".sh")] + ".bat" - # Check that the script is executable + # Check that the script is executable if not os.access(prod_info.compil_script, os.X_OK): - #raise src.SatException( - # _("Compilation script cannot be executed: %s") % - # prod_info.compil_script) - DBG.tofix("Compilation script cannot be executed:", prod_info.compil_script) + #raise src.SatException( + # _("Compilation script cannot be executed: %s") % + # prod_info.compil_script) + DBG.tofix("Compilation script cannot be executed:", prod_info.compil_script) - # Get the full paths of all the patches + # Get the full paths of all the patches if product_has_patches(prod_info): patches = [] try: for patch in prod_info.patches: patch_path = patch - # If only a filename, then search for the patch in the PRODUCTPATH + # If only a filename, then search for the patch in the PRODUCTPATH if os.path.basename(patch_path) == patch_path: - # Search in the PRODUCTPATH/patches + # Search in the PRODUCTPATH/patches patch_path = src.find_file_in_lpath(patch, config.PATHS.PRODUCTPATH, - "patches") + "patches") if not patch_path: - msg = _("Patch %(patch_name)s for %(prod_name)s not found:" - "\n" % {"patch_name" : patch, - "prod_name" : prod_info.name}) + msg = _("Patch %(patch_name)s for %(prod_name)s not found:" + "\n" % {"patch_name" : patch, + "prod_name" : prod_info.name}) raise src.SatException(msg) patches.append(patch_path) except: - DBG.tofix("problem in prod_info.patches", prod_info) + DBG.tofix("problem in prod_info.patches", prod_info) prod_info.patches = patches - # Get the full paths of the environment scripts + # Get the full paths of the environment scripts if product_has_env_script(prod_info): env_script_path = prod_info.environ.env_script - # If only a filename, then search for the environment script - # in the PRODUCTPATH/env_scripts + # If only a filename, then search for the environment script + # in the PRODUCTPATH/env_scripts if os.path.basename(env_script_path) == env_script_path: - # Search in the PRODUCTPATH/env_scripts + # Search in the PRODUCTPATH/env_scripts env_script_path = src.find_file_in_lpath( prod_info.environ.env_script, config.PATHS.PRODUCTPATH, - "env_scripts") + "env_scripts") if not env_script_path: - msg = _("Environment script %(env_name)s for %(prod_name)s not " - "found.\n" % {"env_name" : env_script_path, - "prod_name" : prod_info.name}) + msg = _("Environment script %(env_name)s for %(prod_name)s not " + "found.\n" % {"env_name" : env_script_path, + "prod_name" : prod_info.name}) raise src.SatException(msg) prod_info.environ.env_script = env_script_path if with_install_dir: - # The variable with_install_dir is at false only for internal use - # of the function get_install_dir + # The variable with_install_dir is at false only for internal use + # of the function get_install_dir - # Save the install_dir key if there is any - if "install_dir" in prod_info and not "install_dir_save" in prod_info: + # Save the install_dir key if there is any + if "install_dir" in prod_info and not "install_dir_save" in prod_info: prod_info.install_dir_save = prod_info.install_dir - # if it is not the first time the install_dir is computed, it means - # that install_dir_save exists and it has to be taken into account. - if "install_dir_save" in prod_info: + # if it is not the first time the install_dir is computed, it means + # that install_dir_save exists and it has to be taken into account. + if "install_dir_save" in prod_info: prod_info.install_dir = prod_info.install_dir_save - # Set the install_dir key + # Set the install_dir key prod_info.install_dir = get_install_dir(config, base, version, prod_info) - return prod_info -
-
[docs]def get_product_section(config, product_name, version, section=None): + return prod_info
+ +
[docs]def get_product_section(config, product_name, version, section=None): """Get the product description from the configuration :param config Config: The global configuration @@ -348,25 +336,25 @@ :rtype: Config """ - # if section is not None, try to get the corresponding section + # if section is not None, try to get the corresponding section if section: if section not in config.PRODUCTS[product_name]: - return None - # returns specific information for the given version + return None + # returns specific information for the given version prod_info = config.PRODUCTS[product_name][section] prod_info.section = section prod_info.from_file = config.PRODUCTS[product_name].from_file return prod_info - # If it exists, get the information of the product_version - if "version_" + version in config.PRODUCTS[product_name]: - # returns specific information for the given version - prod_info = config.PRODUCTS[product_name]["version_" + version] - prod_info.section = "version_" + version + # If it exists, get the information of the product_version + if "version_" + version in config.PRODUCTS[product_name]: + # returns specific information for the given version + prod_info = config.PRODUCTS[product_name]["version_" + version] + prod_info.section = "version_" + version prod_info.from_file = config.PRODUCTS[product_name].from_file return prod_info - # Else, check if there is a description for multiple versions + # Else, check if there is a description for multiple versions l_section_name = config.PRODUCTS[product_name].keys() l_section_ranges = [section_name for section_name in l_section_name if VERSION_DELIMITER in section_name] @@ -374,23 +362,23 @@ minimum, maximum = section_range.split(VERSION_DELIMITER) if (src.only_numbers(version) >= src.only_numbers(minimum) and src.only_numbers(version) <= src.only_numbers(maximum)): - # returns specific information for the versions + # returns specific information for the versions prod_info = config.PRODUCTS[product_name][section_range] prod_info.section = section_range prod_info.from_file = config.PRODUCTS[product_name].from_file return prod_info - # Else, get the standard informations - if "default" in config.PRODUCTS[product_name]: - # returns the generic information (given version not found) + # Else, get the standard informations + if "default" in config.PRODUCTS[product_name]: + # returns the generic information (given version not found) prod_info = config.PRODUCTS[product_name].default - prod_info.section = "default" + prod_info.section = "default" prod_info.from_file = config.PRODUCTS[product_name].from_file return prod_info - # if noting was found, return None - return None -
+ # if noting was found, return None + return None
+
[docs]def get_install_dir(config, base, version, prod_info): """Compute the installation directory of a given product @@ -406,28 +394,28 @@ :return: The path of the product installation :rtype: str """ - install_dir = "" - in_base = False - if (("install_dir" in prod_info and prod_info.install_dir == "base") - or base == "yes"): - in_base = True - if (base == "no" or ("no_base" in config.APPLICATION - and config.APPLICATION.no_base == "yes")): - in_base = False + install_dir = "" + in_base = False + if (("install_dir" in prod_info and prod_info.install_dir == "base") + or base == "yes"): + in_base = True + if (base == "no" or ("no_base" in config.APPLICATION + and config.APPLICATION.no_base == "yes")): + in_base = False if in_base: install_dir = get_base_install_dir(config, prod_info, version) else: - if "install_dir" not in prod_info or prod_info.install_dir == "base": - # Set it to the default value (in application directory) + if "install_dir" not in prod_info or prod_info.install_dir == "base": + # Set it to the default value (in application directory) install_dir = os.path.join(config.APPLICATION.workdir, - "INSTALL", + "INSTALL", prod_info.name) else: install_dir = prod_info.install_dir - return install_dir -
+ return install_dir
+
[docs]def get_base_install_dir(config, prod_info, version): """Compute the installation directory of a product in base @@ -439,27 +427,27 @@ :rtype: str """ base_path = src.get_base_path(config) - prod_dir = os.path.join(base_path, prod_info.name + "-" + version) + prod_dir = os.path.join(base_path, prod_info.name + "-" + version) if not os.path.exists(prod_dir): - return os.path.join(prod_dir, "config-1") + return os.path.join(prod_dir, "config-1") exists, install_dir = check_config_exists(config, prod_dir, prod_info) if exists: return install_dir - # Find the first config-<i> directory that is available in the product - # directory - found = False + # Find the first config-<i> directory that is available in the product + # directory + found = False label = 1 while not found: - install_dir = os.path.join(prod_dir, "config-%i" % label) + install_dir = os.path.join(prod_dir, "config-%i" % label) if os.path.exists(install_dir): label+=1 else: - found = True + found = True - return install_dir -
+ return install_dir
+
[docs]def check_config_exists(config, prod_dir, prod_info): """\ Verify that the installation directory of a product in a base exists @@ -475,57 +463,57 @@ and if it is found, the path of the found installation :rtype: (boolean, str) """ - # check if the directories or files of the directory corresponds to the - # directory installation of the product + # check if the directories or files of the directory corresponds to the + # directory installation of the product l_dir_and_files = os.listdir(prod_dir) for dir_or_file in l_dir_and_files: oExpr = re.compile(config_expression) if not(oExpr.search(dir_or_file)): - # not config-<i>, not interesting + # not config-<i>, not interesting continue - # check if there is the file sat-config.pyconf file in the installation - # directory + # check if there is the file sat-config.pyconf file in the installation + # directory config_file = os.path.join(prod_dir, dir_or_file, src.CONFIG_FILENAME) if not os.path.exists(config_file): continue - # If there is no dependency, it is the right path + # If there is no dependency, it is the right path if len(prod_info.depend)==0: compile_cfg = src.pyconf.Config(config_file) if len(compile_cfg) == 0: - return True, os.path.join(prod_dir, dir_or_file) + return True, os.path.join(prod_dir, dir_or_file) continue - # check if there is the config described in the file corresponds the - # dependencies of the product - config_corresponds = True + # check if there is the config described in the file corresponds the + # dependencies of the product + config_corresponds = True compile_cfg = src.pyconf.Config(config_file) for prod_dep in prod_info.depend: - # if the dependency is not in the config, - # the config does not correspond + # if the dependency is not in the config, + # the config does not correspond if prod_dep not in compile_cfg: - config_corresponds = False + config_corresponds = False break else: - prod_dep_info = get_product_config(config, prod_dep, False) - # If the version of the dependency does not correspond, - # the config does not correspond + prod_dep_info = get_product_config(config, prod_dep, False) + # If the version of the dependency does not correspond, + # the config does not correspond if prod_dep_info.version != compile_cfg[prod_dep]: - config_corresponds = False + config_corresponds = False break for prod_name in compile_cfg: if prod_name not in prod_info.depend: - config_corresponds = False + config_corresponds = False break if config_corresponds: - return True, os.path.join(prod_dir, dir_or_file) + return True, os.path.join(prod_dir, dir_or_file) - return False, None + return False, None
-
+
[docs]def get_products_infos(lproducts, config): """Get the specific configuration of a list of products @@ -536,18 +524,18 @@ :rtype: [(str, Config)] """ products_infos = [] - # Loop on product names + # Loop on product names for prod in lproducts: - # Get the specific configuration of the product + # Get the specific configuration of the product prod_info = get_product_config(config, prod) - if prod_info is not None: + if prod_info is not None: products_infos.append((prod, prod_info)) else: - msg = _("The %s product has no definition " - "in the configuration.") % prod + msg = _("The %s product has no definition " + "in the configuration.") % prod raise src.SatException(msg) - return products_infos -
+ return products_infos
+
[docs]def get_product_dependencies(config, product_info): """\ Get recursively the list of products that are @@ -559,7 +547,7 @@ :return: the list of products in dependence :rtype: list """ - if "depend" not in product_info or product_info.depend == []: + if "depend" not in product_info or product_info.depend == []: return [] res = [] for prod in product_info.depend: @@ -572,8 +560,8 @@ for prod_in_dep in dep_prod: if prod_in_dep not in res: res.append(prod_in_dep) - return res -
+ return res +
[docs]def check_installation(product_info): """\ Verify if a product is well installed. Checks install directory presence @@ -585,18 +573,18 @@ :rtype: boolean """ if not product_compiles(product_info): - return True + return True install_dir = product_info.install_dir if not os.path.exists(install_dir): - return False - if ("present_files" in product_info and - "install" in product_info.present_files): + return False + if ("present_files" in product_info and + "install" in product_info.present_files): for file_relative_path in product_info.present_files.install: file_path = os.path.join(install_dir, file_relative_path) if not os.path.exists(file_path): - return False - return True -
+ return False + return True +
[docs]def check_source(product_info): """Verify if a sources of product is preset. Checks source directory presence @@ -605,18 +593,18 @@ :return: True if it is well installed :rtype: boolean """ - DBG.write("check_source product_info", product_info) + DBG.write("check_source product_info", product_info) source_dir = product_info.source_dir if not os.path.exists(source_dir): - return False - if ("present_files" in product_info and - "source" in product_info.present_files): + return False + if ("present_files" in product_info and + "source" in product_info.present_files): for file_relative_path in product_info.present_files.source: file_path = os.path.join(source_dir, file_relative_path) if not os.path.exists(file_path): - return False - return True -
+ return False + return True +
[docs]def product_is_sample(product_info): """Know if a product has the sample type @@ -625,12 +613,12 @@ :return: True if the product has the sample type, else False :rtype: boolean """ - if 'type' in product_info: + if 'type' in product_info: ptype = product_info.type - return ptype.lower() == 'sample' + return ptype.lower() == 'sample' else: - return False -
+ return False +
[docs]def product_is_salome(product_info): """Know if a product is a SALOME module @@ -639,10 +627,10 @@ :return: True if the product is a SALOME module, else False :rtype: boolean """ - return ("properties" in product_info and - "is_SALOME_module" in product_info.properties and - product_info.properties.is_SALOME_module == "yes") -
+ return ("properties" in product_info and + "is_SALOME_module" in product_info.properties and + product_info.properties.is_SALOME_module == "yes") +
[docs]def product_is_fixed(product_info): """Know if a product is fixed @@ -652,8 +640,8 @@ :rtype: boolean """ get_src = product_info.get_source - return get_src.lower() == 'fixed' -
+ return get_src.lower() == 'fixed' +
[docs]def product_is_native(product_info): """Know if a product is native @@ -663,8 +651,8 @@ :rtype: boolean """ get_src = product_info.get_source - return get_src.lower() == 'native' -
+ return get_src.lower() == 'native' +
[docs]def product_is_dev(product_info): """Know if a product is in dev mode @@ -674,11 +662,11 @@ :rtype: boolean """ dev = product_info.dev - res = (dev.lower() == 'yes') - DBG.write('product_is_dev %s' % product_info.name, res) - # if product_info.name == "XDATA": return True #test #10569 - return res -
+ res = (dev.lower() == 'yes') + DBG.write('product_is_dev %s' % product_info.name, res) + # if product_info.name == "XDATA": return True #test #10569 + return res +
[docs]def product_is_debug(product_info): """Know if a product is in debug mode @@ -688,8 +676,8 @@ :rtype: boolean """ debug = product_info.debug - return debug.lower() == 'yes' -
+ return debug.lower() == 'yes' +
[docs]def product_is_autotools(product_info): """Know if a product is compiled using the autotools @@ -699,8 +687,8 @@ :rtype: boolean """ build_src = product_info.build_source - return build_src.lower() == 'autotools' -
+ return build_src.lower() == 'autotools' +
[docs]def product_is_cmake(product_info): """Know if a product is compiled using the cmake @@ -710,8 +698,8 @@ :rtype: boolean """ build_src = product_info.build_source - return build_src.lower() == 'cmake' -
+ return build_src.lower() == 'cmake' +
[docs]def product_is_vcs(product_info): """Know if a product is download using git, svn or cvs (not archive) @@ -720,8 +708,8 @@ :return: True if the product is vcs, else False :rtype: boolean """ - return product_info.get_source in AVAILABLE_VCS -
+ return product_info.get_source in AVAILABLE_VCS +
[docs]def product_is_smesh_plugin(product_info): """Know if a product is a SMESH plugin @@ -730,10 +718,10 @@ :return: True if the product is a SMESH plugin, else False :rtype: boolean """ - return ("properties" in product_info and - "smesh_plugin" in product_info.properties and - product_info.properties.smesh_plugin == "yes") -
+ return ("properties" in product_info and + "smesh_plugin" in product_info.properties and + product_info.properties.smesh_plugin == "yes") +
[docs]def product_is_cpp(product_info): """Know if a product is cpp @@ -742,10 +730,10 @@ :return: True if the product is a cpp, else False :rtype: boolean """ - return ("properties" in product_info and - "cpp" in product_info.properties and - product_info.properties.cpp == "yes") -
+ return ("properties" in product_info and + "cpp" in product_info.properties and + product_info.properties.cpp == "yes") +
[docs]def product_compiles(product_info): """\ Know if a product compiles or not @@ -756,10 +744,10 @@ :return: True if the product compiles, else False :rtype: boolean """ - return not("properties" in product_info and - "compilation" in product_info.properties and - product_info.properties.compilation == "no") -
+ return not("properties" in product_info and + "compilation" in product_info.properties and + product_info.properties.compilation == "no") +
[docs]def product_has_script(product_info): """Know if a product has a compilation script @@ -768,12 +756,12 @@ :return: True if the product it has a compilation script, else False :rtype: boolean """ - if "build_source" not in product_info: - # Native case - return False + if "build_source" not in product_info: + # Native case + return False build_src = product_info.build_source - return build_src.lower() == 'script' -
+ return build_src.lower() == 'script' +
[docs]def product_has_env_script(product_info): """Know if a product has an environment script @@ -782,8 +770,8 @@ :return: True if the product it has an environment script, else False :rtype: boolean """ - return "environ" in product_info and "env_script" in product_info.environ -
+ return "environ" in product_info and "env_script" in product_info.environ +
[docs]def product_has_patches(product_info): """Know if a product has one or more patches @@ -792,11 +780,11 @@ :return: True if the product has one or more patches :rtype: boolean """ - res = ( "patches" in product_info and len(product_info.patches) > 0 ) - DBG.write('product_has_patches %s' % product_info.name, res) - # if product_info.name == "XDATA": return True #test #10569 - return res -
+ res = ( "patches" in product_info and len(product_info.patches) > 0 ) + DBG.write('product_has_patches %s' % product_info.name, res) + # if product_info.name == "XDATA": return True #test #10569 + return res + + return False +
[docs]def product_has_salome_gui(product_info): """Know if a product has a SALOME gui @@ -819,10 +807,10 @@ :return: True if the product has a SALOME gui, else False :rtype: Boolean """ - return ("properties" in product_info and - "has_salome_gui" in product_info.properties and - product_info.properties.has_salome_gui == "yes") -
+ return ("properties" in product_info and + "has_salome_gui" in product_info.properties and + product_info.properties.has_salome_gui == "yes") +
[docs]def product_is_mpi(product_info): """Know if a product has openmpi in its dependencies @@ -831,8 +819,8 @@ :return: True if the product has openmpi inits dependencies :rtype: boolean """ - return "openmpi" in product_info.depend -
+ return "openmpi" in product_info.depend +
[docs]def product_is_generated(product_info): """Know if a product is generated (YACSGEN) @@ -841,10 +829,10 @@ :return: True if the product is generated :rtype: boolean """ - return ("properties" in product_info and - "generate" in product_info.properties and - product_info.properties.generate == "yes") -
+ return ("properties" in product_info and + "generate" in product_info.properties and + product_info.properties.generate == "yes") +
[docs]def get_product_components(product_info): """Get the component list to generate with the product @@ -858,7 +846,7 @@ return [] compo_list = [] - if "component_name" in product_info: + if "component_name" in product_info: compo_list = product_info.component_name if isinstance(compo_list, str): @@ -870,7 +858,7 @@
-
+ diff --git a/doc/build/html/_modules/src/pyconf.html b/doc/build/html/_modules/src/pyconf.html index a0cbe7b..f58827c 100644 --- a/doc/build/html/_modules/src/pyconf.html +++ b/doc/build/html/_modules/src/pyconf.html @@ -2,39 +2,27 @@ - + - - src.pyconf — salomeTools 5.0.0dev documentation - + src.pyconf — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,44 +31,44 @@

Source code for src.pyconf

-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-
-# Copyright 2004-2007 by Vinay Sajip. All Rights Reserved.
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of Vinay Sajip
-# not be used in advertising or publicity pertaining to distribution
-# of the software without specific, written prior permission.
-# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
-# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
-# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
-# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-#  Copyright (C) 2010-2013  CEA/DEN
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library 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
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-
-# CEA adds : 
-# Possibility to overwrites value in a pyconf file
-# Python 3 porting
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+
+# Copyright 2004-2007 by Vinay Sajip. All Rights Reserved.
+#
+# Permission to use, copy, modify, and distribute this software and its
+# documentation for any purpose and without fee is hereby granted,
+# provided that the above copyright notice appear in all copies and that
+# both that copyright notice and this permission notice appear in
+# supporting documentation, and that the name of Vinay Sajip
+# not be used in advertising or publicity pertaining to distribution
+# of the software without specific, written prior permission.
+# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+#  Copyright (C) 2010-2013  CEA/DEN
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library 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
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+
+# CEA adds : 
+# Possibility to overwrites value in a pyconf file
+# Python 3 porting
 
 
 """
@@ -153,55 +141,55 @@
 of how it's used, see test_config.py (search for streamOpener).
 """
 
-__author__  = "Vinay Sajip <vinay_sajip@red-dove.com>"
-__status__  = "alpha"
-__version__ = "0.3.7.1" #modified for salomeTools
-__date__    = "05 October 2007"
+__author__  = "Vinay Sajip <vinay_sajip@red-dove.com>"
+__status__  = "alpha"
+__version__ = "0.3.7.1" #modified for salomeTools
+__date__    = "05 October 2007"
 
 import codecs
 import os
 import sys
 
-WORD = 'a'
-NUMBER = '9'
-STRING = '"'
-EOF = ''
-LCURLY = '{'
-RCURLY = '}'
-LBRACK = '['
-LBRACK2 = 'a['
-RBRACK = ']'
-LPAREN = '('
-LPAREN2 = '(('
-RPAREN = ')'
-DOT = '.'
-COMMA = ','
-COLON = ':'
-AT = '@'
-PLUS = '+'
-MINUS = '-'
-STAR = '*'
-SLASH = '/'
-MOD = '%'
-BACKTICK = '`'
-DOLLAR = '$'
-TRUE = 'True'
-FALSE = 'False'
-NONE = 'None'
-
-WORDCHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_"
-
-if sys.platform == 'win32':
-    NEWLINE = '\r\n'
-elif os.name == 'mac':
-    NEWLINE = '\r'
+WORD = 'a'
+NUMBER = '9'
+STRING = '"'
+EOF = ''
+LCURLY = '{'
+RCURLY = '}'
+LBRACK = '['
+LBRACK2 = 'a['
+RBRACK = ']'
+LPAREN = '('
+LPAREN2 = '(('
+RPAREN = ')'
+DOT = '.'
+COMMA = ','
+COLON = ':'
+AT = '@'
+PLUS = '+'
+MINUS = '-'
+STAR = '*'
+SLASH = '/'
+MOD = '%'
+BACKTICK = '`'
+DOLLAR = '$'
+TRUE = 'True'
+FALSE = 'False'
+NONE = 'None'
+
+WORDCHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_"
+
+if sys.platform == 'win32':
+    NEWLINE = '\r\n'
+elif os.name == 'mac':
+    NEWLINE = '\r'
 else:
-    NEWLINE = '\n'
+    NEWLINE = '\n'
 
 try:
-    has_utf32 = True
+    has_utf32 = True
 except:
-    has_utf32 = False
+    has_utf32 = False
 
 
[docs]class ConfigInputStream(object): """ @@ -218,24 +206,24 @@ @param stream: The underlying stream to be read. Should be seekable. @type stream: A stream (file-like object). """ - encoding = None + encoding = None signature = stream.read(4) used = -1 if has_utf32: if signature == codecs.BOM_UTF32_LE: - encoding = 'utf-32le' + encoding = 'utf-32le' elif signature == codecs.BOM_UTF32_BE: - encoding = 'utf-32be' - if encoding is None: + encoding = 'utf-32be' + if encoding is None: if signature[:3] == codecs.BOM_UTF8: used = 3 - encoding = 'utf-8' + encoding = 'utf-8' elif signature[:2] == codecs.BOM_UTF16_LE: used = 2 - encoding = 'utf-16le' + encoding = 'utf-16le' elif signature[:2] == codecs.BOM_UTF16_BE: used = 2 - encoding = 'utf-16be' + encoding = 'utf-16be' else: used = 0 if used >= 0: @@ -247,33 +235,33 @@ self.encoding = encoding
[docs] def read(self, size): - if (size == 0) or (self.encoding is None): + if (size == 0) or (self.encoding is None): rv = self.stream.read(size) else: - rv = u'' + rv = u'' while size > 0: rv += self.stream.read(1) size -= 1 - return rv -
+ return rv
+
[docs] def close(self): - self.stream.close() -
+ self.stream.close()
+
[docs] def readline(self): - if self.encoding is None: - line = '' + if self.encoding is None: + line = '' else: - line = u'' - while True: + line = u'' + while True: c = self.stream.read(1) if isinstance(c, bytes): c = c.decode() if c: line += c - if c == '\n': + if c == '\n': break - return line -
+ return line
+
[docs]class ConfigOutputStream(object): """ An output stream which can write either ANSI files with default encoding @@ -283,7 +271,7 @@ built-in support. """ - def __init__(self, stream, encoding=None): + def __init__(self, stream, encoding=None): """ Initialize an instance. @@ -292,34 +280,34 @@ @param encoding: The desired encoding. @type encoding: str """ - if encoding is not None: + if encoding is not None: encoding = str(encoding).lower() self.encoding = encoding - if encoding == "utf-8": + if encoding == "utf-8": stream.write(codecs.BOM_UTF8) - elif encoding == "utf-16be": + elif encoding == "utf-16be": stream.write(codecs.BOM_UTF16_BE) - elif encoding == "utf-16le": + elif encoding == "utf-16le": stream.write(codecs.BOM_UTF16_LE) - elif encoding == "utf-32be": + elif encoding == "utf-32be": stream.write(codecs.BOM_UTF32_BE) - elif encoding == "utf-32le": + elif encoding == "utf-32le": stream.write(codecs.BOM_UTF32_LE) - if encoding is not None: + if encoding is not None: writer = codecs.getwriter(encoding) stream = writer(stream) self.stream = stream
[docs] def write(self, data): - self.stream.write(data) -
+ self.stream.write(data)
+
[docs] def flush(self): - self.stream.flush() -
+ self.stream.flush() +
[docs] def close(self): - self.stream.close() -
+ self.stream.close() +
[docs]def defaultStreamOpener(name): """\ This function returns a read-only stream, given its name. The name passed @@ -335,32 +323,32 @@ @return: A stream with the specified name. @rtype: A read-only stream (file-like object) """ - return ConfigInputStream(open(name, 'rb')) -
-streamOpener = None + return ConfigInputStream(open(name, 'rb')) + +streamOpener = None -__resolveOverwrite__ = True +__resolveOverwrite__ = True
[docs]class ConfigError(Exception): """ This is the base class of exceptions raised by this module. """ - pass -
+ pass +
[docs]class ConfigFormatError(ConfigError): """ This is the base class of exceptions raised due to syntax errors in configurations. """ - pass -
+ pass +
[docs]class ConfigResolutionError(ConfigError): """ This is the base class of exceptions raised due to semantic errors in configurations. """ - pass -
+ pass +
[docs]def isWord(s): """ See if a passed-in value is an identifier. If the value passed in is not a @@ -382,11 +370,11 @@ @return: True if a word, else False @rtype: bool """ - if type(s) != type(''): - return False - s = s.replace('_', '') - return s.isalnum() -
+ if type(s) != type(''): + return False + s = s.replace('_', '') + return s.isalnum() +
[docs]def makePath(prefix, suffix): """\ Make a path from a prefix and suffix. @@ -405,13 +393,13 @@ """ if not prefix: rv = suffix - elif suffix[0] == '[': + elif suffix[0] == '[': rv = prefix + suffix else: - rv = prefix + '.' + suffix - return rv + rv = prefix + '.' + suffix + return rv
+ -
[docs]class Container(object): """ This internal class is the base class for mappings and sequences. @@ -430,7 +418,7 @@ @param parent: The parent of this instance in the hierarchy. @type parent: A L{Container} instance. """ - object.__setattr__(self, 'parent', parent) + object.__setattr__(self, 'parent', parent)
[docs] def setPath(self, path): """ @@ -439,8 +427,8 @@ to this instance from the root of the hierarchy. @type path: str """ - object.__setattr__(self, 'path', path) -
+ object.__setattr__(self, 'path', path)
+
[docs] def evaluate(self, item): """ Evaluate items which are instances of L{Reference} or L{Expression}. @@ -459,8 +447,8 @@ item = item.resolve(self) elif isinstance(item, Expression): item = item.evaluate(self) - return item -
+ return item +
[docs] def writeToStream(self, stream, indent, container): """ Write this instance to a stream at the specified indentation level. @@ -475,59 +463,59 @@ @type container: L{Container} @raise NotImplementedError: If a subclass does not override this """ - raise NotImplementedError -
+ raise NotImplementedError +
[docs] def writeValue(self, value, stream, indent): if isinstance(self, Mapping): - indstr = ' ' + indstr = ' ' else: - indstr = indent * ' ' + indstr = indent * ' ' if isinstance(value, Reference) or isinstance(value, Expression): - stream.write('%s%r%s' % (indstr, value, NEWLINE)) + stream.write('%s%r%s' % (indstr, value, NEWLINE)) else: - if isinstance(value, str): # and not isWord(value): + if isinstance(value, str): # and not isWord(value): value = repr(value) - stream.write('%s%s%s' % (indstr, value, NEWLINE)) -
+ stream.write('%s%s%s' % (indstr, value, NEWLINE)) +
[docs]class Mapping(Container): """ This internal class implements key-value mappings in configurations. """ - def __init__(self, parent=None): + def __init__(self, parent=None): """ Initialize an instance. @param parent: The parent of this instance in the hierarchy. @type parent: A L{Container} instance. """ - Container.__init__(self, parent) - object.__setattr__(self, 'path', '') - object.__setattr__(self, 'data', {}) - object.__setattr__(self, 'order', []) # to preserve ordering - object.__setattr__(self, 'comments', {}) + Container.__init__(self, parent) + object.__setattr__(self, 'path', '') + object.__setattr__(self, 'data', {}) + object.__setattr__(self, 'order', []) # to preserve ordering + object.__setattr__(self, 'comments', {}) def __delitem__(self, key): """ Remove an item """ - data = object.__getattribute__(self, 'data') + data = object.__getattribute__(self, 'data') if key not in data: raise AttributeError(key) - order = object.__getattribute__(self, 'order') - comments = object.__getattribute__(self, 'comments') + order = object.__getattribute__(self, 'order') + comments = object.__getattribute__(self, 'comments') del data[key] order.remove(key) del comments[key] def __getitem__(self, key): - data = object.__getattribute__(self, 'data') + data = object.__getattribute__(self, 'data') if key not in data: raise AttributeError(key) rv = data[key] return self.evaluate(rv) - __getattr__ = __getitem__ + __getattr__ = __getitem__ ''' def __getattribute__(self, name): @@ -551,13 +539,13 @@
[docs] def iteritems(self): for key in self.keys(): yield(key, self[key]) - raise StopIteration -
+ raise StopIteration
+ def __contains__(self, item): - order = object.__getattribute__(self, 'order') + order = object.__getattribute__(self, 'order') return item in order -
[docs] def addMapping(self, key, value, comment, setting=False): +
[docs] def addMapping(self, key, value, comment, setting=False): """ Add a key-value mapping with a comment. @@ -572,52 +560,52 @@ @raise ConfigFormatError: If an existing key is seen again and setting is False. """ - data = object.__getattribute__(self, 'data') - order = object.__getattribute__(self, 'order') - comments = object.__getattribute__(self, 'comments') + data = object.__getattribute__(self, 'data') + order = object.__getattribute__(self, 'order') + comments = object.__getattribute__(self, 'comments') data[key] = value if key not in order: order.append(key) elif not setting: - raise ConfigFormatError("repeated key: %s" % key) - comments[key] = comment -
+ raise ConfigFormatError("repeated key: %s" % key) + comments[key] = comment
+ def __setattr__(self, name, value): - self.addMapping(name, value, None, True) + self.addMapping(name, value, None, True) - __setitem__ = __setattr__ + __setitem__ = __setattr__
[docs] def keys(self): """ Return the keys in a similar way to a dictionary. """ - return object.__getattribute__(self, 'order') -
-
[docs] def get(self, key, default=None): + return object.__getattribute__(self, 'order')
+ +
[docs] def get(self, key, default=None): """ Allows a dictionary-style get operation. """ if key in self: return self[key] - return default -
+ return default + def __str__(self): - return str(object.__getattribute__(self, 'data')) + return str(object.__getattribute__(self, 'data')) def __repr__(self): - return repr(object.__getattribute__(self, 'data')) + return repr(object.__getattribute__(self, 'data')) def __len__(self): - return len(object.__getattribute__(self, 'order')) + return len(object.__getattribute__(self, 'order')) def __iter__(self): return self.iterkeys()
[docs] def iterkeys(self): - order = object.__getattribute__(self, 'order') - return order.__iter__() -
+ order = object.__getattribute__(self, 'order') + return order.__iter__() +
[docs] def writeToStream(self, stream, indent, container): """ Write this instance to a stream at the specified indentation level. @@ -631,16 +619,16 @@ @param container: The container of this instance @type container: L{Container} """ - indstr = indent * ' ' + indstr = indent * ' ' if len(self) == 0: - stream.write(' { }%s' % NEWLINE) + stream.write(' { }%s' % NEWLINE) else: if isinstance(container, Mapping): stream.write(NEWLINE) - stream.write('%s{%s' % (indstr, NEWLINE)) + stream.write('%s{%s' % (indstr, NEWLINE)) self.__save__(stream, indent + 1) - stream.write('%s}%s' % (indstr, NEWLINE)) -
+ stream.write('%s}%s' % (indstr, NEWLINE)) + def __save__(self, stream, indent=0): """ Save this configuration to the specified stream. @@ -649,10 +637,10 @@ @param indent: The indentation level for the output. @type indent: int """ - indstr = indent * ' ' - order = object.__getattribute__(self, 'order') - data = object.__getattribute__(self, 'data') - maxlen = 0 # max(map(lambda x: len(x), order)) + indstr = indent * ' ' + order = object.__getattribute__(self, 'order') + data = object.__getattribute__(self, 'data') + maxlen = 0 # max(map(lambda x: len(x), order)) for key in order: comment = self.comments[key] if isWord(key): @@ -660,16 +648,16 @@ else: skey = repr(key) if comment: - stream.write('%s#%s' % (indstr, comment)) - if skey.startswith("u'"): + stream.write('%s#%s' % (indstr, comment)) + if skey.startswith("u'"): skey = skey[1:] - stream.write('%s%-*s :' % (indstr, maxlen, skey)) + stream.write('%s%-*s :' % (indstr, maxlen, skey)) value = data[key] if isinstance(value, Container): value.writeToStream(stream, indent, self) else: - self.writeValue(value, stream, indent) - + self.writeValue(value, stream, indent) +
[docs]class Config(Mapping): """ This class represents a configuration, and is the only one which clients @@ -684,9 +672,9 @@ """ def __init__(self): self.sys = sys - self.os = os -
- def __init__(self, streamOrFile=None, parent=None, PWD = None): + self.os = os + + def __init__(self, streamOrFile=None, parent=None, PWD = None): """ Initializes an instance. @@ -699,26 +687,26 @@ in the configuration hierarchy. @type parent: a L{Container} instance. """ - try: # Python 3 compatibility - if isinstance(streamOrFile, unicode): + try: # Python 3 compatibility + if isinstance(streamOrFile, unicode): streamOrFile = streamOrFile.encode() except NameError: pass - Mapping.__init__(self, parent) - object.__setattr__(self, 'reader', ConfigReader(self)) - object.__setattr__(self, 'namespaces', [Config.Namespace()]) - if streamOrFile is not None: + Mapping.__init__(self, parent) + object.__setattr__(self, 'reader', ConfigReader(self)) + object.__setattr__(self, 'namespaces', [Config.Namespace()]) + if streamOrFile is not None: if isinstance(streamOrFile, str) or isinstance(streamOrFile, bytes): global streamOpener - if streamOpener is None: + if streamOpener is None: streamOpener = defaultStreamOpener streamOrFile = streamOpener(streamOrFile) - load = object.__getattribute__(self, "load") + load = object.__getattribute__(self, "load") load(streamOrFile) - # Specific add for salomeTools : PWD + # Specific add for salomeTools : PWD if PWD: key, pwd = PWD - if key == "": + if key == "": self.PWD = pwd else: self[key].PWD = pwd @@ -734,11 +722,11 @@ existing keys. @raise ConfigFormatError: if there is a syntax error in the stream. """ - reader = object.__getattribute__(self, 'reader') + reader = object.__getattribute__(self, 'reader') reader.load(stream) - stream.close() - -
[docs] def addNamespace(self, ns, name=None): + stream.close()
+ +
[docs] def addNamespace(self, ns, name=None): """ Add a namespace to this configuration which can be used to evaluate (resolve) dotted-identifier expressions. @@ -749,13 +737,13 @@ an additional level of indirection. @type name: str """ - namespaces = object.__getattribute__(self, 'namespaces') - if name is None: + namespaces = object.__getattribute__(self, 'namespaces') + if name is None: namespaces.append(ns) else: - setattr(namespaces[0], name, ns) -
-
[docs] def removeNamespace(self, ns, name=None): + setattr(namespaces[0], name, ns)
+ +
[docs] def removeNamespace(self, ns, name=None): """ Remove a namespace added with L{addNamespace}. @param ns: The namespace to be removed. @@ -763,13 +751,13 @@ called. @type name: str """ - namespaces = object.__getattribute__(self, 'namespaces') - if name is None: + namespaces = object.__getattribute__(self, 'namespaces') + if name is None: namespaces.remove(ns) else: - delattr(namespaces[0], name) -
- def __save__(self, stream, indent=0, no_close=False): + delattr(namespaces[0], name) + + def __save__(self, stream, indent=0, no_close=False): """ Save this configuration to the specified stream. The stream is closed if this is the top-level configuration in the hierarchy. @@ -792,12 +780,12 @@ @rtype: any @raise ConfigError: If the path is invalid """ - s = 'self.' + path + s = 'self.' + path try: return eval(s) except Exception as e: - raise ConfigError(str(e)) - + raise ConfigError(str(e)) +
[docs]class Sequence(Container): """ This internal class implements a value which is a sequence of other values. @@ -808,7 +796,7 @@ """ def __init__(self, seq): self.seq = seq - self.limit = len(object.__getattribute__(seq, 'data')) + self.limit = len(object.__getattribute__(seq, 'data')) self.index = 0 def __iter__(self): @@ -819,26 +807,26 @@ raise StopIteration rv = self.seq[self.index] self.index += 1 - return rv + return rv
- # This method is for python3 compatibility + # This method is for python3 compatibility def __next__(self): if self.index >= self.limit: raise StopIteration rv = self.seq[self.index] self.index += 1 - return rv - - def __init__(self, parent=None): + return rv + + def __init__(self, parent=None): """ Initialize an instance. @param parent: The parent of this instance in the hierarchy. @type parent: A L{Container} instance. """ - Container.__init__(self, parent) - object.__setattr__(self, 'data', []) - object.__setattr__(self, 'comments', []) + Container.__init__(self, parent) + object.__setattr__(self, 'data', []) + object.__setattr__(self, 'comments', [])
[docs] def append(self, item, comment): """ @@ -849,21 +837,21 @@ @param comment: A comment for the item. @type comment: str """ - data = object.__getattribute__(self, 'data') - comments = object.__getattribute__(self, 'comments') + data = object.__getattribute__(self, 'data') + comments = object.__getattribute__(self, 'comments') data.append(item) - comments.append(comment) -
+ comments.append(comment) + def __getitem__(self, index): - data = object.__getattribute__(self, 'data') + data = object.__getattribute__(self, 'data') try: rv = data[index] except (IndexError, KeyError, TypeError): - raise ConfigResolutionError('%r is not a valid index for %r' % (index, object.__getattribute__(self, 'path'))) + raise ConfigResolutionError('%r is not a valid index for %r' % (index, object.__getattribute__(self, 'path'))) if not isinstance(rv, list): rv = self.evaluate(rv) else: - # deal with a slice + # deal with a slice result = [] for a in rv: result.append(self.evaluate(a)) @@ -874,13 +862,13 @@ return Sequence.SeqIter(self) def __repr__(self): - return repr(object.__getattribute__(self, 'data')) + return repr(object.__getattribute__(self, 'data')) def __str__(self): - return str(self[:]) # using the slice evaluates the contents + return str(self[:]) # using the slice evaluates the contents def __len__(self): - return len(object.__getattribute__(self, 'data')) + return len(object.__getattribute__(self, 'data'))
[docs] def writeToStream(self, stream, indent, container): """ @@ -895,16 +883,16 @@ @param container: The container of this instance @type container: L{Container} """ - indstr = indent * ' ' + indstr = indent * ' ' if len(self) == 0: - stream.write(' [ ]%s' % NEWLINE) + stream.write(' [ ]%s' % NEWLINE) else: if isinstance(container, Mapping): stream.write(NEWLINE) - stream.write('%s[%s' % (indstr, NEWLINE)) + stream.write('%s[%s' % (indstr, NEWLINE)) self.__save__(stream, indent + 1) - stream.write('%s]%s' % (indstr, NEWLINE)) -
+ stream.write('%s]%s' % (indstr, NEWLINE)) + def __save__(self, stream, indent): """ Save this instance to the specified stream. @@ -914,20 +902,20 @@ @type indent: int """ if indent == 0: - raise ConfigError("sequence cannot be saved as a top-level item") - data = object.__getattribute__(self, 'data') - comments = object.__getattribute__(self, 'comments') - indstr = indent * ' ' + raise ConfigError("sequence cannot be saved as a top-level item") + data = object.__getattribute__(self, 'data') + comments = object.__getattribute__(self, 'comments') + indstr = indent * ' ' for i in range(0, len(data)): value = data[i] comment = comments[i] if comment: - stream.write('%s#%s' % (indstr, comment)) + stream.write('%s#%s' % (indstr, comment)) if isinstance(value, Container): value.writeToStream(stream, indent, self) else: - self.writeValue(value, stream, indent) - + self.writeValue(value, stream, indent) +
[docs]class Reference(object): """ This internal class implements a value which is a reference to another value. @@ -956,8 +944,8 @@ @param ident: The identifier which continues the reference. @type ident: str """ - self.elements.append((type, ident)) -
+ self.elements.append((type, ident)) +
[docs] def findConfig(self, container): """ Find the closest enclosing configuration to the specified container. @@ -967,10 +955,10 @@ @return: The closest enclosing configuration, or None. @rtype: L{Config} """ - while (container is not None) and not isinstance(container, Config): - container = object.__getattribute__(container, 'parent') - return container -
+ while (container is not None) and not isinstance(container, Config): + container = object.__getattribute__(container, 'parent') + return container +
[docs] def resolve(self, container): """ Resolve this instance in the context of a container. @@ -981,17 +969,17 @@ @rtype: any @raise ConfigResolutionError: If resolution fails. """ - rv = None - path = object.__getattribute__(container, 'path') + rv = None + path = object.__getattribute__(container, 'path') current = container - while current is not None: + while current is not None: if self.type == BACKTICK: - namespaces = object.__getattribute__(current, 'namespaces') - found = False + namespaces = object.__getattribute__(current, 'namespaces') + found = False for ns in namespaces: try: rv = eval(str(self)[1:-1], vars(ns)) - found = True + found = True break except: pass @@ -1006,28 +994,28 @@ rv = rv[key] break except: - rv = None + rv = None pass - current = object.__getattribute__(current, 'parent') - if current is None: - raise ConfigResolutionError("unable to evaluate %r in the configuration %s" % (self, path)) - return rv -
+ current = object.__getattribute__(current, 'parent') + if current is None: + raise ConfigResolutionError("unable to evaluate %r in the configuration %s" % (self, path)) + return rv + def __str__(self): s = self.elements[0] for tt, tv in self.elements[1:]: if tt == DOT: - s += '.%s' % tv + s += '.%s' % tv else: - s += '[%r]' % tv + s += '[%r]' % tv if self.type == BACKTICK: return BACKTICK + s + BACKTICK else: return DOLLAR + s def __repr__(self): - return self.__str__() - + return self.__str__() +
[docs]class Expression(object): """ This internal class implements a value which is obtained by evaluating an expression. @@ -1048,10 +1036,10 @@ self.rhs = rhs def __str__(self): - return '%r %s %r' % (self.lhs, self.op, self.rhs) + return '%r %s %r' % (self.lhs, self.op, self.rhs) def __repr__(self): - return self.__str__() + return self.__str__()
[docs] def evaluate(self, container): """ @@ -1087,30 +1075,30 @@ rv = lhs / rhs else: rv = lhs % rhs - return rv -
+ return rv +
[docs]class ConfigReader(object): """ This internal class implements a parser for configurations. """ def __init__(self, config): - self.filename = None + self.filename = None self.config = config self.lineno = 0 self.colno = 0 - self.lastc = None - self.last_token = None - self.commentchars = '#' - self.whitespace = ' \t\r\n' - self.quotes = '\'"' - self.punct = ':-+*/%,.{}[]()@`$' - self.digits = '0123456789' - self.wordchars = '%s' % WORDCHARS # make a copy + self.lastc = None + self.last_token = None + self.commentchars = '#' + self.whitespace = ' \t\r\n' + self.quotes = '\'"' + self.punct = ':-+*/%,.{}[]()@`$' + self.digits = '0123456789' + self.wordchars = '%s' % WORDCHARS # make a copy self.identchars = self.wordchars + self.digits self.pbchars = [] self.pbtokens = [] - self.comment = None + self.comment = None
[docs] def location(self): """ @@ -1122,8 +1110,8 @@ @return: A string representing a location in the stream being read. @rtype: str """ - return "%s(%d,%d)" % (self.filename, self.lineno, self.colno) -
+ return "%s(%d,%d)" % (self.filename, self.lineno, self.colno)
+
[docs] def getChar(self): """ Get the next char from the stream. Update line and column numbers @@ -1141,15 +1129,15 @@ if isinstance(c,bytes): c = c.decode() self.colno += 1 - if c == '\n': + if c == '\n': self.lineno += 1 self.colno = 1 - return c -
+ return c + def __repr__(self): - return "<ConfigReader at 0x%08x>" % id(self) + return "<ConfigReader at 0x%08x>" % id(self) - __str__ = __repr__ + __str__ = __repr__
[docs] def getToken(self): """ @@ -1165,16 +1153,16 @@ if self.pbtokens: return self.pbtokens.pop() stream = self.stream - self.comment = None - token = '' + self.comment = None + token = '' tt = EOF - while True: + while True: c = self.getChar() if not c: break - elif c == '#': + elif c == '#': if self.comment : - self.comment += '#' + stream.readline() + self.comment += '#' + stream.readline() else : self.comment = stream.readline() self.lineno += 1 @@ -1183,13 +1171,13 @@ token = c quote = c tt = STRING - escaped = False - multiline = False + escaped = False + multiline = False c1 = self.getChar() if c1 == quote: c2 = self.getChar() if c2 == quote: - multiline = True + multiline = True token += quote token += quote else: @@ -1197,20 +1185,20 @@ self.pbchars.append(c1) else: self.pbchars.append(c1) - while True: + while True: c = self.getChar() if not c: break token += c if (c == quote) and not escaped: - if not multiline or (len(token) >= 6 and token.endswith(token[:3]) and token[-4] != '\\'): + if not multiline or (len(token) >= 6 and token.endswith(token[:3]) and token[-4] != '\\'): break - if c == '\\': + if c == '\\': escaped = not escaped else: - escaped = False + escaped = False if not c: - raise ConfigFormatError('%s: Unterminated quoted string: %r, %r' % (self.location(), token, c)) + raise ConfigFormatError('%s: Unterminated quoted string: %r, %r' % (self.location(), token, c)) break if c in self.whitespace: self.lastc = c @@ -1218,22 +1206,22 @@ elif c in self.punct: token = c tt = c - if (self.lastc == ']') or (self.lastc in self.identchars): - if c == '[': + if (self.lastc == ']') or (self.lastc in self.identchars): + if c == '[': tt = LBRACK2 - elif c == '(': + elif c == '(': tt = LPAREN2 break elif c in self.digits: token = c tt = NUMBER - while True: + while True: c = self.getChar() if not c: break if c in self.digits: token += c - elif (c == '.') and token.find('.') < 0: + elif (c == '.') and token.find('.') < 0: token += c else: if c and (c not in self.whitespace): @@ -1247,29 +1235,29 @@ while c and (c in self.identchars): token += c c = self.getChar() - if c: # and c not in self.whitespace: + if c: # and c not in self.whitespace: self.pbchars.append(c) - if token == "True": + if token == "True": tt = TRUE - elif token == "False": + elif token == "False": tt = FALSE - elif token == "None": + elif token == "None": tt = NONE break else: - raise ConfigFormatError('%s: Unexpected character: %r' % (self.location(), c)) + raise ConfigFormatError('%s: Unexpected character: %r' % (self.location(), c)) if token: self.lastc = token[-1] else: - self.lastc = None + self.lastc = None self.last_token = tt - # Python 2.x specific unicode conversion - if sys.version_info[0] == 2 and tt == WORD and isinstance(token, unicode): - token = token.encode('ascii') - return (tt, token) -
-
[docs] def load(self, stream, parent=None, suffix=None): + # Python 2.x specific unicode conversion + if sys.version_info[0] == 2 and tt == WORD and isinstance(token, unicode): + token = token.encode('ascii') + return (tt, token)
+ +
[docs] def load(self, stream, parent=None, suffix=None): """ Load the configuration from the specified stream. @@ -1284,16 +1272,16 @@ @raise ConfigError: If parent is specified but suffix is not. @raise ConfigFormatError: If there are syntax errors in the stream. """ - if parent is not None: - if suffix is None: - raise ConfigError("internal error: load called with parent but no suffix") - self.config.setPath(makePath(object.__getattribute__(parent, 'path'), suffix)) + if parent is not None: + if suffix is None: + raise ConfigError("internal error: load called with parent but no suffix") + self.config.setPath(makePath(object.__getattribute__(parent, 'path'), suffix)) self.setStream(stream) self.token = self.getToken() self.parseMappingBody(self.config) if self.token[0] != EOF: - raise ConfigFormatError('%s: expecting EOF, found %r' % (self.location(), self.token[1])) -
+ raise ConfigFormatError('%s: expecting EOF, found %r' % (self.location(), self.token[1])) +
[docs] def setStream(self, stream): """ Set the stream to the specified value, and prepare to read from it. @@ -1302,14 +1290,14 @@ @type stream: A stream (file-like object). """ self.stream = stream - if hasattr(stream, 'name'): + if hasattr(stream, 'name'): filename = stream.name else: - filename = '?' + filename = '?' self.filename = filename self.lineno = 1 - self.colno = 1 -
+ self.colno = 1 +
[docs] def match(self, t): """ Ensure that the current token type matches the specified value, and @@ -1323,11 +1311,11 @@ @raise ConfigFormatError: If the token does not match what's expected. """ if self.token[0] != t: - raise ConfigFormatError("%s: expecting %s, found %r" % (self.location(), t, self.token[1])) + raise ConfigFormatError("%s: expecting %s, found %r" % (self.location(), t, self.token[1])) rv = self.token self.token = self.getToken() - return rv -
+ return rv +
[docs] def parseMappingBody(self, parent): """ Parse the internals of a mapping, and add entries to the provided @@ -1337,8 +1325,8 @@ @type parent: A L{Mapping} instance. """ while self.token[0] in [WORD, STRING]: - self.parseKeyValuePair(parent) -
+ self.parseKeyValuePair(parent) +
[docs] def parseKeyValuePair(self, parent): """ Parse a key-value pair, and add it to the provided L{Mapping}. @@ -1354,30 +1342,30 @@ suffix = tv elif tt == STRING: key = eval(tv) - suffix = '[%s]' % tv + suffix = '[%s]' % tv else: - msg = "%s: expecting word or string, found %r" + msg = "%s: expecting word or string, found %r" raise ConfigFormatError(msg % (self.location(), tv)) self.token = self.getToken() - # for now, we allow key on its own as a short form of key : True + # for now, we allow key on its own as a short form of key : True if self.token[0] == COLON: self.token = self.getToken() value = self.parseValue(parent, suffix) else: - value = True + value = True try: parent.addMapping(key, value, comment) except Exception as e: - raise ConfigFormatError("%s: %s, %r" % (self.location(), e, + raise ConfigFormatError("%s: %s, %r" % (self.location(), e, self.token[1])) tt = self.token[0] if tt not in [EOF, WORD, STRING, RCURLY, COMMA]: - msg = "%s: expecting one of EOF, WORD, STRING, \ -RCURLY, COMMA, found %r" + msg = "%s: expecting one of EOF, WORD, STRING, \ +RCURLY, COMMA, found %r" raise ConfigFormatError(msg % (self.location(), self.token[1])) if tt == COMMA: - self.token = self.getToken() -
+ self.token = self.getToken() +
[docs] def parseValue(self, parent, suffix): """ Parse a value. @@ -1399,10 +1387,10 @@ elif tt in [LCURLY, AT]: rv = self.parseMapping(parent, suffix) else: - raise ConfigFormatError("%s: unexpected input: %r" % + raise ConfigFormatError("%s: unexpected input: %r" % (self.location(), self.token[1])) - return rv -
+ return rv +
[docs] def parseSequence(self, parent, suffix): """ Parse a sequence. @@ -1416,13 +1404,13 @@ @raise ConfigFormatError: if a syntax error is found. """ rv = Sequence(parent) - rv.setPath(makePath(object.__getattribute__(parent, 'path'), suffix)) + rv.setPath(makePath(object.__getattribute__(parent, 'path'), suffix)) self.match(LBRACK) comment = self.comment tt = self.token[0] while tt in [STRING, WORD, NUMBER, LCURLY, LBRACK, LPAREN, DOLLAR, TRUE, FALSE, NONE, BACKTICK]: - suffix = '[%d]' % len(rv) + suffix = '[%d]' % len(rv) value = self.parseValue(parent, suffix) rv.append(value, comment) tt = self.token[0] @@ -1433,8 +1421,8 @@ comment = self.comment continue self.match(RBRACK) - return rv -
+ return rv +
[docs] def parseMapping(self, parent, suffix): """ Parse a mapping. @@ -1451,15 +1439,15 @@ self.match(LCURLY) rv = Mapping(parent) rv.setPath( - makePath(object.__getattribute__(parent, 'path'), suffix)) + makePath(object.__getattribute__(parent, 'path'), suffix)) self.parseMappingBody(rv) self.match(RCURLY) else: self.match(AT) _, fn = self.match(STRING) rv = Config(eval(fn), parent) - return rv -
+ return rv +
[docs] def parseScalar(self): """ Parse a scalar - a terminal value such as a string or number, or @@ -1476,8 +1464,8 @@ rhs = self.parseTerm() lhs = Expression(tt, lhs, rhs) tt = self.token[0] - return lhs -
+ return lhs +
[docs] def parseTerm(self): """ Parse a term in an additive expression (a + b, a - b) @@ -1493,8 +1481,8 @@ rhs = self.parseFactor() lhs = Expression(tt, lhs, rhs) tt = self.token[0] - return lhs -
+ return lhs +
[docs] def parseFactor(self): """ Parse a factor in an multiplicative expression (a * b, a / b, a % b) @@ -1524,10 +1512,10 @@ self.match(MINUS) rv = -self.parseScalar() else: - raise ConfigFormatError("%s: unexpected input: %r" % + raise ConfigFormatError("%s: unexpected input: %r" % (self.location(), self.token[1])) - return rv -
+ return rv +
[docs] def parseReference(self, type): """ Parse a reference. @@ -1540,8 +1528,8 @@ rv = Reference(self.config, type, word[1]) while self.token[0] in [DOT, LBRACK2]: self.parseSuffix(rv) - return rv -
+ return rv +
[docs] def parseSuffix(self, ref): """ Parse a reference suffix. @@ -1559,12 +1547,12 @@ self.match(LBRACK2) tt, tv = self.token if tt not in [NUMBER, STRING]: - raise ConfigFormatError("%s: expected number or string, found %r" % (self.location(), tv)) + raise ConfigFormatError("%s: expected number or string, found %r" % (self.location(), tv)) self.token = self.getToken() tv = eval(tv) self.match(RBRACK) - ref.addElement(LBRACK, tv) -
+ ref.addElement(LBRACK, tv) +
[docs]def defaultMergeResolve(map1, map2, key): """\ A default resolver for merge conflicts. @@ -1588,13 +1576,13 @@ obj1 = map1[key] obj2 = map2[key] if isinstance(obj1, Mapping) and isinstance(obj2, Mapping): - rv = "merge" + rv = "merge" elif isinstance(obj1, Sequence) and isinstance(obj2, Sequence): - rv = "append" + rv = "append" else: - rv = "mismatch" - return rv -
+ rv = "mismatch" + return rv +
[docs]def overwriteMergeResolve(map1, map2, key): """ An overwriting resolver for merge conflicts. Calls L{defaultMergeResolve}, @@ -1608,16 +1596,16 @@ @type key: str """ rv = defaultMergeResolve(map1, map2, key) - if rv == "mismatch": - rv = "overwrite" - return rv -
+ if rv == "mismatch": + rv = "overwrite" + return rv +
[docs]def deepCopyMapping(inMapping): res = Mapping() for element in inMapping: res[element] = inMapping[element] - return res -
+ return res +
[docs]class ConfigMerger(object): """ This class is used for merging two configurations. If a key exists in the @@ -1651,8 +1639,8 @@ @param mergee: The configuration to merge. @type mergee: L{Config}. """ - self.mergeMapping(merged, mergee) -
+ self.mergeMapping(merged, mergee) +
[docs] def overwriteKeys(self, map1, seq2): """ Renint variables. The second mapping is unchanged, @@ -1663,26 +1651,26 @@ @type map2: L{Mapping}. """ - overwrite_list = object.__getattribute__(seq2, 'data') + overwrite_list = object.__getattribute__(seq2, 'data') for overwrite_instruction in overwrite_list: - object.__setattr__(overwrite_instruction, 'parent', map1) - if "__condition__" in overwrite_instruction.keys(): - overwrite_condition = overwrite_instruction["__condition__"] + object.__setattr__(overwrite_instruction, 'parent', map1) + if "__condition__" in overwrite_instruction.keys(): + overwrite_condition = overwrite_instruction["__condition__"] if eval(overwrite_condition, globals(), map1): for key in overwrite_instruction.keys(): - if key == "__condition__": + if key == "__condition__": continue try: - exec( 'map1.' + key + " = " + repr(overwrite_instruction[key])) + exec( 'map1.' + key + " = " + repr(overwrite_instruction[key])) except: - exec('map1.' + key + " = " + str(overwrite_instruction[key])) + exec('map1.' + key + " = " + str(overwrite_instruction[key])) else: for key in overwrite_instruction.keys(): try: - exec('map1.' + key + " = " + repr(overwrite_instruction[key])) + exec('map1.' + key + " = " + repr(overwrite_instruction[key])) except: - exec('map1.' + key + " = " + str(overwrite_instruction[key])) -
+ exec('map1.' + key + " = " + str(overwrite_instruction[key])) +
[docs] def mergeMapping(self, map1, map2): """ Merge two mappings recursively. The second mapping is unchanged, @@ -1696,31 +1684,31 @@ keys = map1.keys() global __resolveOverwrite__ for key in map2.keys(): - if __resolveOverwrite__ and key == "__overwrite__": + if __resolveOverwrite__ and key == "__overwrite__": self.overwriteKeys(map1,map2[key]) elif key not in keys: map1[key] = map2[key] if isinstance(map1[key], Container) : - object.__setattr__(map1[key], 'parent', map1) + object.__setattr__(map1[key], 'parent', map1) else: obj1 = map1[key] obj2 = map2[key] decision = self.resolver(map1, map2, key) - if decision == "merge": + if decision == "merge": self.mergeMapping(obj1, obj2) - elif decision == "append": + elif decision == "append": self.mergeSequence(obj1, obj2) - elif decision == "overwrite": + elif decision == "overwrite": map1[key] = obj2 if isinstance(map1[key], Container): - object.__setattr__(map1[key], 'parent', map1) - elif decision == "mismatch": + object.__setattr__(map1[key], 'parent', map1) + elif decision == "mismatch": self.handleMismatch(obj1, obj2) else: - msg = "unable to merge: don't know how to implement %r" - raise ValueError(msg % decision) -
+ msg = "unable to merge: don't know how to implement %r" + raise ValueError(msg % decision) +
[docs] def mergeSequence(self, seq1, seq2): """ Merge two sequences. The second sequence is unchanged, @@ -1732,15 +1720,15 @@ @param seq2: The sequence to merge. @type seq2: L{Sequence}. """ - data1 = object.__getattribute__(seq1, 'data') - data2 = object.__getattribute__(seq2, 'data') + data1 = object.__getattribute__(seq1, 'data') + data2 = object.__getattribute__(seq2, 'data') for obj in data2: data1.append(obj) - comment1 = object.__getattribute__(seq1, 'comments') - comment2 = object.__getattribute__(seq2, 'comments') + comment1 = object.__getattribute__(seq1, 'comments') + comment2 = object.__getattribute__(seq2, 'comments') for obj in comment2: - comment1.append(obj) -
+ comment1.append(obj) +
[docs] def handleMismatch(self, obj1, obj2): """ Handle a mismatch between two objects. @@ -1750,8 +1738,8 @@ @param obj2: The object to merge. @type obj2: any """ - raise ConfigError("unable to merge %r with %r" % (obj1, obj2)) -
+ raise ConfigError("unable to merge %r with %r" % (obj1, obj2)) +
[docs]class ConfigList(list): """ This class implements an ordered list of configurations and allows you @@ -1772,24 +1760,24 @@ @raise ConfigError: If no configuration in the list has an entry with the specified path. """ - found = False - rv = None + found = False + rv = None for entry in self: try: rv = entry.getByPath(path) - found = True + found = True break except ConfigError: pass if not found: - raise ConfigError("unable to resolve %r" % path) + raise ConfigError("unable to resolve %r" % path) return rv
-
+ diff --git a/doc/build/html/_modules/src/system.html b/doc/build/html/_modules/src/system.html index 1be4ef8..ec2338e 100644 --- a/doc/build/html/_modules/src/system.html +++ b/doc/build/html/_modules/src/system.html @@ -2,39 +2,27 @@ - + - - src.system — salomeTools 5.0.0dev documentation - + src.system — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,23 +31,23 @@

Source code for src.system

-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-#  Copyright (C) 2010-2013  CEA/DEN
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library 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
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+#  Copyright (C) 2010-2013  CEA/DEN
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library 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
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 
 '''
 In this file : all functions that do a system call, 
@@ -70,7 +58,7 @@
 import os
 import tarfile
 
-from . import printcolors
+from . import printcolors
 
 
[docs]def show_in_editor(editor, filePath, logger): '''open filePath using editor. @@ -78,25 +66,25 @@ :param editor str: The editor to use. :param filePath str: The path to the file to open. ''' - # default editor is vi - if editor is None or len(editor) == 0: - editor = 'vi' + # default editor is vi + if editor is None or len(editor) == 0: + editor = 'vi' - if '%s' not in editor: - editor += ' %s' + if '%s' not in editor: + editor += ' %s' try: - # launch cmd using subprocess.Popen + # launch cmd using subprocess.Popen cmd = editor % filePath - logger.write('Launched command:\n' + cmd + '\n', 5) - p = subprocess.Popen(cmd, shell=True) + logger.write('Launched command:\n' + cmd + '\n', 5) + p = subprocess.Popen(cmd, shell=True) p.communicate() except: - logger.write(printcolors.printcError(_("Unable to edit file %s\n") - % filePath), 1) + logger.write(printcolors.printcError(_("Unable to edit file %s\n") + % filePath), 1)
-
-
[docs]def git_extract(from_what, tag, where, logger, environment=None): + +
[docs]def git_extract(from_what, tag, where, logger, environment=None): '''Extracts sources from a git repository. :param from_what str: The remote git repository. @@ -110,32 +98,32 @@ ''' if not where.exists(): where.make() - if tag == "master" or tag == "HEAD": - command = "git clone %(remote)s %(where)s" % \ - { 'remote': from_what, 'tag': tag, 'where': str(where) } + if tag == "master" or tag == "HEAD": + command = "git clone %(remote)s %(where)s" % \ + { 'remote': from_what, 'tag': tag, 'where': str(where) } else: - # NOTICE: this command only works with recent version of git - # because --work-tree does not work with an absolute path - where_git = os.path.join( str(where), ".git" ) - command = "rmdir %(where)s && git clone %(remote)s %(where)s && " + \ - "git --git-dir=%(where_git)s --work-tree=%(where)s checkout %(tag)s" - command = command % {'remote': from_what, - 'tag': tag, - 'where': str(where), - 'where_git': where_git } + # NOTICE: this command only works with recent version of git + # because --work-tree does not work with an absolute path + where_git = os.path.join( str(where), ".git" ) + command = "rmdir %(where)s && git clone %(remote)s %(where)s && " + \ + "git --git-dir=%(where_git)s --work-tree=%(where)s checkout %(tag)s" + command = command % {'remote': from_what, + 'tag': tag, + 'where': str(where), + 'where_git': where_git } - logger.write(command + "\n", 5) + logger.write(command + "\n", 5) - logger.logTxtFile.write("\n" + command + "\n") + logger.logTxtFile.write("\n" + command + "\n") logger.logTxtFile.flush() res = subprocess.call(command, cwd=str(where.dir()), env=environment.environ.environ, - shell=True, + shell=True, stdout=logger.logTxtFile, stderr=subprocess.STDOUT) - return (res == 0) -
+ return (res == 0)
+
[docs]def archive_extract(from_what, where, logger): '''Extracts sources from an archive. @@ -149,13 +137,13 @@ archive = tarfile.open(from_what) for i in archive.getmembers(): archive.extract(i, path=str(where)) - return True, os.path.commonprefix(archive.getnames()) + return True, os.path.commonprefix(archive.getnames()) except Exception as exc: - logger.write("archive_extract: %s\n" % exc) - return False, None -
+ logger.write("archive_extract: %s\n" % exc) + return False, None
+
[docs]def cvs_extract(protocol, user, server, base, tag, product, where, - logger, checkout=False, environment=None): + logger, checkout=False, environment=None): '''Extracts sources from a cvs repository. :param protocol str: The cvs protocol. @@ -173,48 +161,48 @@ :rtype: boolean ''' - opttag = '' - if tag is not None and len(tag) > 0: - opttag = '-r ' + tag + opttag = '' + if tag is not None and len(tag) > 0: + opttag = '-r ' + tag - cmd = 'export' + cmd = 'export' if checkout: - cmd = 'checkout' + cmd = 'checkout' elif len(opttag) == 0: - opttag = '-DNOW' + opttag = '-DNOW' if len(protocol) > 0: - root = "%s@%s:%s" % (user, server, base) - command = "cvs -d :%(protocol)s:%(root)s %(command)s -d %(where)s %(tag)s %(product)s" % \ - { 'protocol': protocol, 'root': root, 'where': str(where.base()), - 'tag': opttag, 'product': product, 'command': cmd } + root = "%s@%s:%s" % (user, server, base) + command = "cvs -d :%(protocol)s:%(root)s %(command)s -d %(where)s %(tag)s %(product)s" % \ + { 'protocol': protocol, 'root': root, 'where': str(where.base()), + 'tag': opttag, 'product': product, 'command': cmd } else: - command = "cvs -d %(root)s %(command)s -d %(where)s %(tag)s %(base)s/%(product)s" % \ - { 'root': server, 'base': base, 'where': str(where.base()), - 'tag': opttag, 'product': product, 'command': cmd } + command = "cvs -d %(root)s %(command)s -d %(where)s %(tag)s %(base)s/%(product)s" % \ + { 'root': server, 'base': base, 'where': str(where.base()), + 'tag': opttag, 'product': product, 'command': cmd } - logger.write(command + "\n", 5) + logger.write(command + "\n", 5) if not where.dir().exists(): where.dir().make() - logger.logTxtFile.write("\n" + command + "\n") + logger.logTxtFile.write("\n" + command + "\n") logger.logTxtFile.flush() res = subprocess.call(command, cwd=str(where.dir()), env=environment.environ.environ, - shell=True, + shell=True, stdout=logger.logTxtFile, stderr=subprocess.STDOUT) - return (res == 0) -
+ return (res == 0)
+
[docs]def svn_extract(user, from_what, tag, where, logger, - checkout=False, - environment=None): + checkout=False, + environment=None): '''Extracts sources from a svn repository. :param user str: The user to be used. @@ -232,30 +220,30 @@ where.make() if checkout: - command = "svn checkout --username %(user)s %(remote)s %(where)s" % \ - { 'remote': from_what, 'user' : user, 'where': str(where) } + command = "svn checkout --username %(user)s %(remote)s %(where)s" % \ + { 'remote': from_what, 'user' : user, 'where': str(where) } else: - command = "" + command = "" if os.path.exists(str(where)): - command = "/bin/rm -rf %(where)s && " % \ - { 'remote': from_what, 'where': str(where) } + command = "/bin/rm -rf %(where)s && " % \ + { 'remote': from_what, 'where': str(where) } - if tag == "master": - command += "svn export --username %(user)s %(remote)s %(where)s" % \ - { 'remote': from_what, 'user' : user, 'where': str(where) } + if tag == "master": + command += "svn export --username %(user)s %(remote)s %(where)s" % \ + { 'remote': from_what, 'user' : user, 'where': str(where) } else: - command += "svn export -r %(tag)s --username %(user)s %(remote)s %(where)s" % \ - { 'tag' : tag, 'remote': from_what, 'user' : user, 'where': str(where) } + command += "svn export -r %(tag)s --username %(user)s %(remote)s %(where)s" % \ + { 'tag' : tag, 'remote': from_what, 'user' : user, 'where': str(where) } - logger.logTxtFile.write(command + "\n") + logger.logTxtFile.write(command + "\n") - logger.write(command + "\n", 5) - logger.logTxtFile.write("\n" + command + "\n") + logger.write(command + "\n", 5) + logger.logTxtFile.write("\n" + command + "\n") logger.logTxtFile.flush() res = subprocess.call(command, cwd=str(where.dir()), env=environment.environ.environ, - shell=True, + shell=True, stdout=logger.logTxtFile, stderr=subprocess.STDOUT) return (res == 0)
@@ -264,7 +252,7 @@
-
+ diff --git a/doc/build/html/_modules/src/template.html b/doc/build/html/_modules/src/template.html index 3572001..e79f036 100644 --- a/doc/build/html/_modules/src/template.html +++ b/doc/build/html/_modules/src/template.html @@ -2,39 +2,27 @@ - + - - src.template — salomeTools 5.0.0dev documentation - + src.template — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,40 +31,41 @@

Source code for src.template

-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-#  Copyright (C) 2010-2013  CEA/DEN
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library 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
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+#  Copyright (C) 2010-2013  CEA/DEN
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library 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
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 
 import string
 
 
[docs]class MyTemplate(string.Template): - delimiter = '¤' -
+ delimiter = '¤'
+
[docs]def substitute(template_file, subst_dic): - template = open(template_file, 'r') + template = open(template_file, 'r') template = MyTemplate(template.read()) - return template.safe_substitute(subst_dic) -
+ return template.safe_substitute(subst_dic)
+ +
-
+ diff --git a/doc/build/html/_modules/src/test_module.html b/doc/build/html/_modules/src/test_module.html index 87448aa..c9b8bca 100644 --- a/doc/build/html/_modules/src/test_module.html +++ b/doc/build/html/_modules/src/test_module.html @@ -2,39 +2,27 @@ - + - - src.test_module — salomeTools 5.0.0dev documentation - + src.test_module — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,32 +31,32 @@

Source code for src.test_module

-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-#  Copyright (C) 2010-2013  CEA/DEN
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library 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
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-
-# Python 2/3 compatibility for execfile function
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+#  Copyright (C) 2010-2013  CEA/DEN
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library 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
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+
+# Python 2/3 compatibility for execfile function
 try:
-    execfile
+    execfile
 except:
     def execfile(somefile, global_vars, local_vars):
         with open(somefile) as f:
-            code = compile(f.read(), somefile, 'exec')
-            exec(code, global_vars, local_vars)
+            code = compile(f.read(), somefile, 'exec')
+            exec(code, global_vars, local_vars)
 
 
 import os
@@ -79,34 +67,34 @@
 import imp
 import subprocess
 
-from . import fork
+from . import fork
 import src
 
-# directories not considered as test grids
-C_IGNORE_GRIDS = ['.git', '.svn', 'RESSOURCES']
+# directories not considered as test grids
+C_IGNORE_GRIDS = ['.git', '.svn', 'RESSOURCES']
 
 DEFAULT_TIMEOUT = 150
 
-# Get directory to be used for the temporary files.
-#
+# Get directory to be used for the temporary files.
+#
 
[docs]def getTmpDirDEFAULT(): if src.architecture.is_windows(): - directory = os.getenv("TEMP") + directory = os.getenv("TEMP") else: - # for Linux: use /tmp/logs/{user} folder - directory = os.path.join( '/tmp', 'logs', os.getenv("USER", "unknown")) - return directory -
+ # for Linux: use /tmp/logs/{user} folder + directory = os.path.join( '/tmp', 'logs', os.getenv("USER", "unknown")) + return directory
+
[docs]class Test: def __init__(self, config, logger, tmp_working_dir, - testbase="", - grids=None, - sessions=None, - launcher="", - show_desktop=True): + testbase="", + grids=None, + sessions=None, + launcher="", + show_desktop=True): self.grids = grids self.config = config self.logger = logger @@ -116,15 +104,15 @@ self.show_desktop = show_desktop res = self.prepare_testbase(testbase) - self.test_base_found = True + self.test_base_found = True if res == 1: - # Fail - self.test_base_found = False + # Fail + self.test_base_found = False self.settings = {} - self.known_errors = None + self.known_errors = None - # create section for results + # create section for results self.config.TESTS = src.pyconf.Sequence(self.config) self.nb_run = 0 @@ -134,137 +122,137 @@ self.nb_acknoledge = 0 def _copy_dir(self, source, target): - if self.config.VARS.python >= "2.6": + if self.config.VARS.python >= "2.6": shutil.copytree(source, target, - symlinks=True, - ignore=shutil.ignore_patterns('.git*','.svn*')) + symlinks=True, + ignore=shutil.ignore_patterns('.git*','.svn*')) else: shutil.copytree(source, target, - symlinks=True) + symlinks=True)
[docs] def prepare_testbase_from_dir(self, testbase_name, testbase_dir): - self.logger.write(_("get test base from dir: %s\n") % \ + self.logger.write(_("get test base from dir: %s\n") % \ src.printcolors.printcLabel(testbase_dir), 3) if not os.access(testbase_dir, os.X_OK): - raise src.SatException(_("testbase %(name)s (%(dir)s) does not " - "exist ...\n") % { 'name': testbase_name, - 'dir': testbase_dir }) + raise src.SatException(_("testbase %(name)s (%(dir)s) does not " + "exist ...\n") % { 'name': testbase_name, + 'dir': testbase_dir }) self._copy_dir(testbase_dir, - os.path.join(self.tmp_working_dir, 'BASES', testbase_name)) -
+ os.path.join(self.tmp_working_dir, 'BASES', testbase_name))
+
[docs] def prepare_testbase_from_git(self, testbase_name, testbase_base, testbase_tag): self.logger.write( - _("get test base '%(testbase)s' with '%(tag)s' tag from git\n") % { - "testbase" : src.printcolors.printcLabel(testbase_name), - "tag" : src.printcolors.printcLabel(testbase_tag)}, + _("get test base '%(testbase)s' with '%(tag)s' tag from git\n") % { + "testbase" : src.printcolors.printcLabel(testbase_name), + "tag" : src.printcolors.printcLabel(testbase_tag)}, 3) try: - def set_signal(): # pragma: no cover + def set_signal(): # pragma: no cover """see http://bugs.python.org/issue1652""" import signal signal.signal(signal.SIGPIPE, signal.SIG_DFL) - cmd = "git clone --depth 1 %(base)s %(dir)s" - cmd += " && cd %(dir)s" - if testbase_tag=='master': - cmd += " && git fetch origin %(branch)s" + cmd = "git clone --depth 1 %(base)s %(dir)s" + cmd += " && cd %(dir)s" + if testbase_tag=='master': + cmd += " && git fetch origin %(branch)s" else: - cmd += " && git fetch origin %(branch)s:%(branch)s" - cmd += " && git checkout %(branch)s" - cmd = cmd % { 'branch': testbase_tag, - 'base': testbase_base, - 'dir': testbase_name } + cmd += " && git fetch origin %(branch)s:%(branch)s" + cmd += " && git checkout %(branch)s" + cmd = cmd % { 'branch': testbase_tag, + 'base': testbase_base, + 'dir': testbase_name } - self.logger.write("> %s\n" % cmd, 5) + self.logger.write("> %s\n" % cmd, 5) if src.architecture.is_windows(): - # preexec_fn not supported on windows platform + # preexec_fn not supported on windows platform res = subprocess.call(cmd, - cwd=os.path.join(self.tmp_working_dir, 'BASES'), - shell=True, + cwd=os.path.join(self.tmp_working_dir, 'BASES'), + shell=True, stdout=self.logger.logTxtFile, stderr=subprocess.PIPE) else: res = subprocess.call(cmd, - cwd=os.path.join(self.tmp_working_dir, 'BASES'), - shell=True, + cwd=os.path.join(self.tmp_working_dir, 'BASES'), + shell=True, preexec_fn=set_signal, stdout=self.logger.logTxtFile, stderr=subprocess.PIPE) if res != 0: - raise src.SatException(_("Error: unable to get test base " - "'%(name)s' from git '%(repo)s'.") % \ - { 'name': testbase_name, - 'repo': testbase_base }) + raise src.SatException(_("Error: unable to get test base " + "'%(name)s' from git '%(repo)s'.") % \ + { 'name': testbase_name, + 'repo': testbase_base }) except OSError: - self.logger.error(_("git is not installed. exiting...\n")) - sys.exit(0) -
+ self.logger.error(_("git is not installed. exiting...\n")) + sys.exit(0)
+
[docs] def prepare_testbase_from_svn(self, user, testbase_name, testbase_base): - self.logger.write(_("get test base '%s' from svn\n") % \ + self.logger.write(_("get test base '%s' from svn\n") % \ src.printcolors.printcLabel(testbase_name), 3) try: - def set_signal(): # pragma: no cover + def set_signal(): # pragma: no cover """see http://bugs.python.org/issue1652""" import signal signal.signal(signal.SIGPIPE, signal.SIG_DFL) - cmd = "svn checkout --username %(user)s %(base)s %(dir)s" - cmd = cmd % { 'user': user, - 'base': testbase_base, - 'dir': testbase_name } + cmd = "svn checkout --username %(user)s %(base)s %(dir)s" + cmd = cmd % { 'user': user, + 'base': testbase_base, + 'dir': testbase_name } - # Get the application environment - self.logger.write(_("Set the application environment\n"), 5) + # Get the application environment + self.logger.write(_("Set the application environment\n"), 5) env_appli = src.environment.SalomeEnviron(self.config, src.environment.Environ(dict(os.environ))) env_appli.set_application_env(self.logger) - self.logger.write("> %s\n" % cmd, 5) + self.logger.write("> %s\n" % cmd, 5) if src.architecture.is_windows(): - # preexec_fn not supported on windows platform + # preexec_fn not supported on windows platform res = subprocess.call(cmd, - cwd=os.path.join(self.tmp_working_dir, 'BASES'), - shell=True, + cwd=os.path.join(self.tmp_working_dir, 'BASES'), + shell=True, stdout=self.logger.logTxtFile, stderr=subprocess.PIPE) else: res = subprocess.call(cmd, - cwd=os.path.join(self.tmp_working_dir, 'BASES'), - shell=True, + cwd=os.path.join(self.tmp_working_dir, 'BASES'), + shell=True, preexec_fn=set_signal, stdout=self.logger.logTxtFile, stderr=subprocess.PIPE, env=env_appli.environ.environ,) if res != 0: - raise src.SatException(_("Error: unable to get test base '%(nam" - "e)s' from svn '%(repo)s'.") % \ - { 'name': testbase_name, - 'repo': testbase_base }) + raise src.SatException(_("Error: unable to get test base '%(nam" + "e)s' from svn '%(repo)s'.") % \ + { 'name': testbase_name, + 'repo': testbase_base }) except OSError: - self.logger.error(_("svn is not installed. exiting...\n")) - sys.exit(0) + self.logger.error(_("svn is not installed. exiting...\n")) + sys.exit(0)
- ## - # Configure tests base.
+ ## + # Configure tests base.
[docs] def prepare_testbase(self, test_base_name): src.printcolors.print_value(self.logger, - _("Test base"), + _("Test base"), test_base_name, 3) - self.logger.write("\n", 3, False) + self.logger.write("\n", 3, False) - # search for the test base - test_base_info = None + # search for the test base + test_base_info = None for project_name in self.config.PROJECTS.projects: project_info = self.config.PROJECTS.projects[project_name] - if "test_bases" not in project_info: + if "test_bases" not in project_info: continue for t_b_info in project_info.test_bases: if t_b_info.name == test_base_name: @@ -272,63 +260,63 @@ if not test_base_info: if os.path.exists(test_base_name): - self.prepare_testbase_from_dir("DIR", test_base_name) - self.currentTestBase = "DIR" + self.prepare_testbase_from_dir("DIR", test_base_name) + self.currentTestBase = "DIR" return 0 if not test_base_info: - message = (_("########## ERROR: test base '%s' not found\n") % + message = (_("########## ERROR: test base '%s' not found\n") % test_base_name) - self.logger.write("%s\n" % src.printcolors.printcError(message)) + self.logger.write("%s\n" % src.printcolors.printcError(message)) return 1 - if test_base_info.get_sources == "dir": + if test_base_info.get_sources == "dir": self.prepare_testbase_from_dir(test_base_name, test_base_info.info.dir) - elif test_base_info.get_sources == "git": + elif test_base_info.get_sources == "git": self.prepare_testbase_from_git(test_base_name, test_base_info.info.base, self.config.APPLICATION.test_base.tag) - elif test_base_info.get_sources == "svn": + elif test_base_info.get_sources == "svn": svn_user = src.get_cfg_param(test_base_info.info, - "svn_user", + "svn_user", self.config.USER.svn_user) self.prepare_testbase_from_svn(svn_user, test_base_name, test_base_info.info.base) else: - raise src.SatException(_("unknown source type '%(type)s' for test b" - "ase '%(base)s' ...\n") % { - 'type': test_base_info.get_sources, - 'base': test_base_name }) + raise src.SatException(_("unknown source type '%(type)s' for test b" + "ase '%(base)s' ...\n") % { + 'type': test_base_info.get_sources, + 'base': test_base_name }) - self.currentTestBase = test_base_name + self.currentTestBase = test_base_name
- ## - # Searches if the script is declared in known errors pyconf. - # Update the status if needed.
+ ## + # Searches if the script is declared in known errors pyconf. + # Update the status if needed.
[docs] def search_known_errors(self, status, test_grid, test_session, test): test_path = os.path.join(test_grid, test_session, test) if not src.config_has_application(self.config): return status, [] - if self.known_errors is None: + if self.known_errors is None: return status, [] platform = self.config.VARS.arch application = self.config.VARS.application error = self.known_errors.get_error(test_path, application, platform) - if error is None: + if error is None: return status, [] if status == src.OK_STATUS: if not error.fixed: - # the error is fixed + # the error is fixed self.known_errors.fix_error(error) - #import testerror - #testerror.write_test_failures( - # self.config.TOOLS.testerror.file_path, - # self.known_errors.errors) + #import testerror + #testerror.write_test_failures( + # self.config.TOOLS.testerror.file_path, + # self.known_errors.errors) return status, [ error.date, error.expected, error.comment, @@ -336,39 +324,39 @@ if error.fixed: self.known_errors.unfix_error(error) - #import testerror - #testerror.write_test_failures(self.config.TOOLS.testerror.file_path, - # self.known_errors.errors) + #import testerror + #testerror.write_test_failures(self.config.TOOLS.testerror.file_path, + # self.known_errors.errors) delta = self.known_errors.get_expecting_days(error) kfres = [ error.date, error.expected, error.comment, error.fixed ] if delta < 0: return src.KO_STATUS, kfres - return src.KNOWNFAILURE_STATUS, kfres + return src.KNOWNFAILURE_STATUS, kfres
- ## - # Read the *.result.py files. + ## + # Read the *.result.py files.
[docs] def read_results(self, listTest, has_timed_out): results = {} for test in listTest: resfile = os.path.join(self.currentDir, self.currentgrid, self.currentsession, - test[:-3] + ".result.py") + test[:-3] + ".result.py") - # check if <test>.result.py file exists + # check if <test>.result.py file exists if not os.path.exists(resfile): - results[test] = ["?", -1, "", []] + results[test] = ["?", -1, "", []] else: gdic, ldic = {}, {} - execfile(resfile, gdic, ldic) + execfile(resfile, gdic, ldic) status = src.TIMEOUT_STATUS if not has_timed_out: status = src.KO_STATUS - if ldic.has_key('status'): - status = ldic['status'] + if ldic.has_key('status'): + status = ldic['status'] expected = [] if status == src.KO_STATUS or status == src.OK_STATUS: @@ -377,289 +365,289 @@ self.currentsession, test) - callback = "" - if ldic.has_key('callback'): - callback = ldic['callback'] + callback = "" + if ldic.has_key('callback'): + callback = ldic['callback'] elif status == src.KO_STATUS: - callback = "CRASH" + callback = "CRASH" exec_time = -1 - if ldic.has_key('time'): + if ldic.has_key('time'): try: - exec_time = float(ldic['time']) + exec_time = float(ldic['time']) except: pass results[test] = [status, exec_time, callback, expected] - # check if <test>.py file exists + # check if <test>.py file exists testfile = os.path.join(self.currentDir, self.currentgrid, self.currentsession, test) if not os.path.exists(testfile): - results[test].append('') + results[test].append('') else: - text = open(testfile, "r").read() + text = open(testfile, "r").read() results[test].append(text) - # check if <test>.out.py file exists + # check if <test>.out.py file exists outfile = os.path.join(self.currentDir, self.currentgrid, self.currentsession, - test[:-3] + ".out.py") + test[:-3] + ".out.py") if not os.path.exists(outfile): - results[test].append('') + results[test].append('') else: - text = open(outfile, "r").read() + text = open(outfile, "r").read() results[test].append(text) - return results + return results
- ## - # Generates the script to be run by Salome. - # This python script includes init and close statements and a loop - # calling all the scripts of a single directory. + ## + # Generates the script to be run by Salome. + # This python script includes init and close statements and a loop + # calling all the scripts of a single directory.
[docs] def generate_script(self, listTest, script_path, ignoreList): - # open template file + # open template file template_file = open(os.path.join(self.config.VARS.srcDir, - "test", - "scriptTemplate.py"), 'r') + "test", + "scriptTemplate.py"), 'r') template = string.Template(template_file.read()) - # create substitution dictionary + # create substitution dictionary d = dict() - d['resourcesWay'] = os.path.join(self.currentDir, 'RESSOURCES') - d['tmpDir'] = os.path.join(self.tmp_working_dir, 'WORK') - d['toolsWay'] = os.path.join(self.config.VARS.srcDir, "test") - d['sessionDir'] = os.path.join(self.currentDir, + d['resourcesWay'] = os.path.join(self.currentDir, 'RESSOURCES') + d['tmpDir'] = os.path.join(self.tmp_working_dir, 'WORK') + d['toolsWay'] = os.path.join(self.config.VARS.srcDir, "test") + d['sessionDir'] = os.path.join(self.currentDir, self.currentgrid, self.currentsession) - d['resultFile'] = os.path.join(self.tmp_working_dir, - 'WORK', - 'exec_result') - d['listTest'] = listTest - d['sessionName'] = self.currentsession - d['ignore'] = ignoreList - - # create script with template - script = open(script_path, 'w') + d['resultFile'] = os.path.join(self.tmp_working_dir, + 'WORK', + 'exec_result') + d['listTest'] = listTest + d['sessionName'] = self.currentsession + d['ignore'] = ignoreList + + # create script with template + script = open(script_path, 'w') script.write(template.safe_substitute(d)) - script.close() + script.close()
- # Find the getTmpDir function that gives access to *pidict file directory. - # (the *pidict file exists when SALOME is launched) + # Find the getTmpDir function that gives access to *pidict file directory. + # (the *pidict file exists when SALOME is launched)
[docs] def get_tmp_dir(self): - # Rare case where there is no KERNEL in grid list - # (for example MED_STANDALONE) - if ('APPLICATION' in self.config - and 'KERNEL' not in self.config.APPLICATION.products - and 'KERNEL_ROOT_DIR' not in os.environ): + # Rare case where there is no KERNEL in grid list + # (for example MED_STANDALONE) + if ('APPLICATION' in self.config + and 'KERNEL' not in self.config.APPLICATION.products + and 'KERNEL_ROOT_DIR' not in os.environ): return getTmpDirDEFAULT - # Case where "sat test" is launched in an existing SALOME environment - if 'KERNEL_ROOT_DIR' in os.environ: - root_dir = os.environ['KERNEL_ROOT_DIR'] + # Case where "sat test" is launched in an existing SALOME environment + if 'KERNEL_ROOT_DIR' in os.environ: + root_dir = os.environ['KERNEL_ROOT_DIR'] - if ('APPLICATION' in self.config - and 'KERNEL' in self.config.APPLICATION.products): + if ('APPLICATION' in self.config + and 'KERNEL' in self.config.APPLICATION.products): root_dir = src.product.get_product_config(self.config, - "KERNEL").install_dir + "KERNEL").install_dir - # Case where there the appli option is called (with path to launcher) + # Case where there the appli option is called (with path to launcher) if len(self.launcher) > 0: - # There are two cases : The old application (runAppli) - # and the new one + # There are two cases : The old application (runAppli) + # and the new one launcherName = os.path.basename(self.launcher) launcherDir = os.path.dirname(self.launcher) - if launcherName == 'runAppli': - # Old application - cmd = ("for i in " + launcherDir + "/env.d/*.sh; do source ${i};" - " done ; echo $KERNEL_ROOT_DIR") + if launcherName == 'runAppli': + # Old application + cmd = ("for i in " + launcherDir + "/env.d/*.sh; do source ${i};" + " done ; echo $KERNEL_ROOT_DIR") else: - # New application - cmd = ("echo -e 'import os\nprint os.environ[\"KERNEL_" + - "ROOT_DIR\"]' > tmpscript.py; %s shell" + - " tmpscript.py") % self.launcher - - # OP 14/11/2017 Ajout de traces pour essayer de decouvrir le pb - # de remontee de log des tests - #root_dir = subprocess.Popen(cmd, - # stdout=subprocess.PIPE, - # shell=True, - # executable='/bin/bash').communicate()[0].split()[-1] + # New application + cmd = ("echo -e 'import os\nprint os.environ[\"KERNEL_" + + "ROOT_DIR\"]' > tmpscript.py; %s shell" + + " tmpscript.py") % self.launcher + + # OP 14/11/2017 Ajout de traces pour essayer de decouvrir le pb + # de remontee de log des tests + #root_dir = subprocess.Popen(cmd, + # stdout=subprocess.PIPE, + # shell=True, + # executable='/bin/bash').communicate()[0].split()[-1] subproc_res = subprocess.Popen(cmd, stdout=subprocess.PIPE, - shell=True, - executable='/bin/bash').communicate() - #print "TRACES OP - test_module.py/Test.get_tmp_dir() subproc_res = " + shell=True, + executable='/bin/bash').communicate() + #print "TRACES OP - test_module.py/Test.get_tmp_dir() subproc_res = " for resLine in subproc_res: - print "- '#%s#'" %resLine + print "- '#%s#'" %resLine root_dir = subproc_res[0].split()[-1] - # OP 14/11/2017 Ajout de traces pour essayer de decouvrir le pb - # de remontee de log des tests - #print "TRACES OP - test_module.py/Test.get_tmp_dir() root_dir = '#%s#'" %root_dir + # OP 14/11/2017 Ajout de traces pour essayer de decouvrir le pb + # de remontee de log des tests + #print "TRACES OP - test_module.py/Test.get_tmp_dir() root_dir = '#%s#'" %root_dir - # import grid salome_utils from KERNEL that gives - # the right getTmpDir function - (file_, pathname, description) = imp.find_module("salome_utils", + # import grid salome_utils from KERNEL that gives + # the right getTmpDir function + (file_, pathname, description) = imp.find_module("salome_utils", [os.path.join(root_dir, - 'bin', - 'salome')]) + 'bin', + 'salome')]) try: - grid = imp.load_module("salome_utils", + grid = imp.load_module("salome_utils", file_, pathname, description) return grid.getLogDir except: - grid = imp.load_module("salome_utils", + grid = imp.load_module("salome_utils", file_, pathname, description) return grid.getTmpDir finally: if file_: - file_.close() + file_.close()
+ -
[docs] def get_test_timeout(self, test_name, default_value): - if ("timeout" in self.settings and - test_name in self.settings["timeout"]): - return self.settings["timeout"][test_name] + if ("timeout" in self.settings and + test_name in self.settings["timeout"]): + return self.settings["timeout"][test_name] + + return default_value
- return default_value -
[docs] def generate_launching_commands(self): - # Case where "sat test" is launched in an existing SALOME environment - if 'KERNEL_ROOT_DIR' in os.environ: - binSalome = "runSalome" - binPython = "python" - killSalome = "killSalome.py" + # Case where "sat test" is launched in an existing SALOME environment + if 'KERNEL_ROOT_DIR' in os.environ: + binSalome = "runSalome" + binPython = "python" + killSalome = "killSalome.py" - # Rare case where there is no KERNEL in grid list - # (for example MED_STANDALONE) - if ('APPLICATION' in self.config and - 'KERNEL' not in self.config.APPLICATION.products): - binSalome = "runSalome" - binPython = "python" - killSalome = "killSalome.py" - src.environment.load_environment(self.config, False, self.logger) + # Rare case where there is no KERNEL in grid list + # (for example MED_STANDALONE) + if ('APPLICATION' in self.config and + 'KERNEL' not in self.config.APPLICATION.products): + binSalome = "runSalome" + binPython = "python" + killSalome = "killSalome.py" + src.environment.load_environment(self.config, False, self.logger) return binSalome, binPython, killSalome - # Case where there the appli option is called (with path to launcher) + # Case where there the appli option is called (with path to launcher) if len(self.launcher) > 0: - # There are two cases : The old application (runAppli) - # and the new one + # There are two cases : The old application (runAppli) + # and the new one launcherName = os.path.basename(self.launcher) launcherDir = os.path.dirname(self.launcher) - if launcherName == 'runAppli': - # Old application + if launcherName == 'runAppli': + # Old application binSalome = self.launcher - binPython = ("for i in " + + binPython = ("for i in " + launcherDir + - "/env.d/*.sh; do source ${i}; done ; python") - killSalome = ("for i in " + + "/env.d/*.sh; do source ${i}; done ; python") + killSalome = ("for i in " + launcherDir + - "/env.d/*.sh; do source ${i}; done ; killSalome.py'") + "/env.d/*.sh; do source ${i}; done ; killSalome.py'") return binSalome, binPython, killSalome else: - # New application + # New application binSalome = self.launcher - binPython = self.launcher + ' shell' - killSalome = self.launcher + ' killall' + binPython = self.launcher + ' shell' + killSalome = self.launcher + ' killall' return binSalome, binPython, killSalome - # SALOME version detection and APPLI repository detection + # SALOME version detection and APPLI repository detection VersionSalome = src.get_salome_version(self.config) - appdir = 'APPLI' - if "APPLI" in self.config and "application_name" in self.config.APPLI: + appdir = 'APPLI' + if "APPLI" in self.config and "application_name" in self.config.APPLI: appdir = self.config.APPLI.application_name - # Case where SALOME has NOT the launcher that uses the SalomeContext API + # Case where SALOME has NOT the launcher that uses the SalomeContext API if VersionSalome < 730: binSalome = os.path.join(self.config.APPLICATION.workdir, appdir, - "runAppli") - binPython = "python" - killSalome = "killSalome.py" - src.environment.load_environment(self.config, False, self.logger) + "runAppli") + binPython = "python" + killSalome = "killSalome.py" + src.environment.load_environment(self.config, False, self.logger) return binSalome, binPython, killSalome - # Case where SALOME has the launcher that uses the SalomeContext API + # Case where SALOME has the launcher that uses the SalomeContext API else: launcher_name = src.get_launcher_name(self.config) binSalome = os.path.join(self.config.APPLICATION.workdir, launcher_name) - binPython = binSalome + ' shell' - killSalome = binSalome + ' killall' + binPython = binSalome + ' shell' + killSalome = binSalome + ' killall' return binSalome, binPython, killSalome - return binSalome, binPython, killSalome + return binSalome, binPython, killSalome
- ## - # Runs tests of a session (using a single instance of Salome). + ## + # Runs tests of a session (using a single instance of Salome).
[docs] def run_tests(self, listTest, ignoreList): out_path = os.path.join(self.currentDir, self.currentgrid, self.currentsession) - sessionname = "%s/%s" % (self.currentgrid, self.currentsession) + sessionname = "%s/%s" % (self.currentgrid, self.currentsession) time_out = self.get_test_timeout(sessionname, DEFAULT_TIMEOUT) time_out_salome = DEFAULT_TIMEOUT - # generate wrapper script - script_path = os.path.join(out_path, 'wrapperScript.py') + # generate wrapper script + script_path = os.path.join(out_path, 'wrapperScript.py') self.generate_script(listTest, script_path, ignoreList) tmpDir = self.get_tmp_dir() binSalome, binPython, killSalome = self.generate_launching_commands() - if self.settings.has_key("run_with_grids") \ - and self.settings["run_with_grids"].has_key(sessionname): + if self.settings.has_key("run_with_grids") \ + and self.settings["run_with_grids"].has_key(sessionname): binSalome = (binSalome + - " -m %s" % self.settings["run_with_grids"][sessionname]) + " -m %s" % self.settings["run_with_grids"][sessionname]) - logWay = os.path.join(self.tmp_working_dir, "WORK", "log_cxx") + logWay = os.path.join(self.tmp_working_dir, "WORK", "log_cxx") - status = False + status = False elapsed = -1 - if self.currentsession.startswith("NOGUI_"): - # runSalome -t (bash) + if self.currentsession.startswith("NOGUI_"): + # runSalome -t (bash) status, elapsed = fork.batch(binSalome, self.logger, os.path.join(self.tmp_working_dir, - "WORK"), - [ "-t", - "--shutdown-server=1", + "WORK"), + [ "-t", + "--shutdown-server=1", script_path ], delai=time_out, log=logWay) - elif self.currentsession.startswith("PY_"): - # python script.py + elif self.currentsession.startswith("PY_"): + # python script.py status, elapsed = fork.batch(binPython, self.logger, os.path.join(self.tmp_working_dir, - "WORK"), + "WORK"), [script_path], delai=time_out, log=logWay) else: - opt = "-z 0" - if self.show_desktop: opt = "--show-desktop=0" + opt = "-z 0" + if self.show_desktop: opt = "--show-desktop=0" status, elapsed = fork.batch_salome(binSalome, self.logger, os.path.join( self.tmp_working_dir, - "WORK"), + "WORK"), [ opt, - "--shutdown-server=1", + "--shutdown-server=1", script_path ], getTmpDir=tmpDir, fin=killSalome, @@ -667,10 +655,10 @@ log=logWay, delaiapp=time_out_salome) - self.logger.write("status = %s, elapsed = %s\n" % (status, elapsed), + self.logger.write("status = %s, elapsed = %s\n" % (status, elapsed), 5) - # create the test result to add in the config object + # create the test result to add in the config object test_info = src.pyconf.Mapping(self.config) test_info.testbase = self.currentTestBase test_info.grid = self.currentgrid @@ -681,7 +669,7 @@ for sr in sorted(script_results.keys()): self.nb_run += 1 - # create script result + # create script result script_info = src.pyconf.Mapping(self.config) script_info.name = sr script_info.res = script_results[sr][0] @@ -705,26 +693,26 @@ script_info.content = script_results[sr][4] script_info.out = script_results[sr][5] - # add it to the list of results - test_info.script.append(script_info, '') + # add it to the list of results + test_info.script.append(script_info, '') - # display the results + # display the results if script_info.time > 0: - exectime = "(%7.3f s)" % script_info.time + exectime = "(%7.3f s)" % script_info.time else: - exectime = "" + exectime = "" - sp = "." * (35 - len(script_info.name)) + sp = "." * (35 - len(script_info.name)) self.logger.write(self.write_test_margin(3), 3) - self.logger.write("script %s %s %s %s\n" % ( + self.logger.write("script %s %s %s %s\n" % ( src.printcolors.printcLabel(script_info.name), sp, src.printcolors.printc(script_info.res), - exectime), 3, False) + exectime), 3, False) if script_info and len(callback) > 0: - self.logger.write("Exception in %s\n%s\n" % \ + self.logger.write("Exception in %s\n%s\n" % \ (script_info.name, - src.printcolors.printcWarning(callback)), 2, False) + src.printcolors.printcWarning(callback)), 2, False) if script_info.res == src.OK_STATUS: self.nb_succeed += 1 @@ -734,49 +722,49 @@ self.nb_timeout += 1 elif script_info.res == src.NA_STATUS: self.nb_run -= 1 - elif script_info.res == "?": + elif script_info.res == "?": self.nb_not_run += 1 - self.config.TESTS.append(test_info, '') + self.config.TESTS.append(test_info, '')
- ## - # Runs all tests of a session. + ## + # Runs all tests of a session.
[docs] def run_session_tests(self): self.logger.write(self.write_test_margin(2), 3) - self.logger.write("Session = %s\n" % src.printcolors.printcLabel( - self.currentsession), 3, False) + self.logger.write("Session = %s\n" % src.printcolors.printcLabel( + self.currentsession), 3, False) - # prepare list of tests to run + # prepare list of tests to run tests = os.listdir(os.path.join(self.currentDir, self.currentgrid, self.currentsession)) - tests = filter(lambda l: l.endswith(".py"), tests) + tests = filter(lambda l: l.endswith(".py"), tests) tests = sorted(tests, key=str.lower) - # build list of known failures - cat = "%s/%s/" % (self.currentgrid, self.currentsession) + # build list of known failures + cat = "%s/%s/" % (self.currentgrid, self.currentsession) ignoreDict = {} for k in self.ignore_tests.keys(): if k.startswith(cat): ignoreDict[k[len(cat):]] = self.ignore_tests[k] - self.run_tests(tests, ignoreDict) + self.run_tests(tests, ignoreDict)
- ## - # Runs all tests of a grid. + ## + # Runs all tests of a grid.
[docs] def run_grid_tests(self): self.logger.write(self.write_test_margin(1), 3) - self.logger.write("grid = %s\n" % src.printcolors.printcLabel( - self.currentgrid), 3, False) + self.logger.write("grid = %s\n" % src.printcolors.printcLabel( + self.currentgrid), 3, False) grid_path = os.path.join(self.currentDir, self.currentgrid) sessions = [] - if self.sessions is not None: - sessions = self.sessions # user choice + if self.sessions is not None: + sessions = self.sessions # user choice else: - # use all scripts in grid + # use all scripts in grid sessions = filter(lambda l: l not in C_IGNORE_GRIDS, os.listdir(grid_path)) sessions = filter(lambda l: os.path.isdir(os.path.join(grid_path, @@ -786,64 +774,64 @@ for session_ in sessions: if not os.path.exists(os.path.join(grid_path, session_)): self.logger.write(self.write_test_margin(2), 3) - self.logger.write(src.printcolors.printcWarning("Session %s not" - " found" % session_) + "\n", 3, False) + self.logger.write(src.printcolors.printcWarning("Session %s not" + " found" % session_) + "\n", 3, False) else: self.currentsession = session_ - self.run_session_tests() + self.run_session_tests()
- ## - # Runs test testbase. + ## + # Runs test testbase.
[docs] def run_testbase_tests(self): - res_dir = os.path.join(self.currentDir, "RESSOURCES") - os.environ['PYTHONPATH'] = (res_dir + + res_dir = os.path.join(self.currentDir, "RESSOURCES") + os.environ['PYTHONPATH'] = (res_dir + os.pathsep + - os.environ['PYTHONPATH']) - os.environ['TT_BASE_RESSOURCES'] = res_dir + os.environ['PYTHONPATH']) + os.environ['TT_BASE_RESSOURCES'] = res_dir src.printcolors.print_value(self.logger, - "TT_BASE_RESSOURCES", + "TT_BASE_RESSOURCES", res_dir, 4) - self.logger.write("\n", 4, False) + self.logger.write("\n", 4, False) self.logger.write(self.write_test_margin(0), 3) - testbase_label = "Test base = %s\n" % src.printcolors.printcLabel( + testbase_label = "Test base = %s\n" % src.printcolors.printcLabel( self.currentTestBase) - self.logger.write(testbase_label, 3, False) - self.logger.write("-" * len(src.printcolors.cleancolor(testbase_label)), + self.logger.write(testbase_label, 3, False) + self.logger.write("-" * len(src.printcolors.cleancolor(testbase_label)), 3) - self.logger.write("\n", 3, False) + self.logger.write("\n", 3, False) - # load settings - settings_file = os.path.join(res_dir, "test_settings.py") + # load settings + settings_file = os.path.join(res_dir, "test_settings.py") if os.path.exists(settings_file): gdic, ldic = {}, {} - execfile(settings_file, gdic, ldic) - self.logger.write(_("Load test settings\n"), 3) - self.settings = ldic['settings_dic'] - self.ignore_tests = ldic['known_failures_list'] + execfile(settings_file, gdic, ldic) + self.logger.write(_("Load test settings\n"), 3) + self.settings = ldic['settings_dic'] + self.ignore_tests = ldic['known_failures_list'] if isinstance(self.ignore_tests, list): self.ignore_tests = {} - self.logger.write(src.printcolors.printcWarning("known_failur" - "es_list must be a dictionary (not a list)") + "\n", 1, False) + self.logger.write(src.printcolors.printcWarning("known_failur" + "es_list must be a dictionary (not a list)") + "\n", 1, False) else: self.ignore_tests = {} self.settings.clear() - # read known failures pyconf - if "testerror" in self.config.LOCAL: - #import testerror - #self.known_errors = testerror.read_test_failures( - # self.config.TOOLS.testerror.file_path, - # do_error=False) + # read known failures pyconf + if "testerror" in self.config.LOCAL: + #import testerror + #self.known_errors = testerror.read_test_failures( + # self.config.TOOLS.testerror.file_path, + # do_error=False) pass else: - self.known_errors = None + self.known_errors = None - if self.grids is not None: - grids = self.grids # given by user + if self.grids is not None: + grids = self.grids # given by user else: - # select all the grids (i.e. directories) in the directory + # select all the grids (i.e. directories) in the directory grids = filter(lambda l: l not in C_IGNORE_GRIDS, os.listdir(self.currentDir)) grids = filter(lambda l: os.path.isdir( @@ -855,65 +843,65 @@ if not os.path.exists(os.path.join(self.currentDir, grid)): self.logger.write(self.write_test_margin(1), 3) self.logger.write(src.printcolors.printcWarning( - "grid %s does not exist\n" % grid), 3, False) + "grid %s does not exist\n" % grid), 3, False) else: self.currentgrid = grid - self.run_grid_tests() -
+ self.run_grid_tests() +
[docs] def run_script(self, script_name): - if ('APPLICATION' in self.config and + if ('APPLICATION' in self.config and script_name in self.config.APPLICATION): script = self.config.APPLICATION[script_name] if len(script) == 0: return - self.logger.write("\n", 2, False) + self.logger.write("\n", 2, False) if not os.path.exists(script): - self.logger.write(src.printcolors.printcWarning("WARNING: scrip" - "t not found: %s" % script) + "\n", 2) + self.logger.write(src.printcolors.printcWarning("WARNING: scrip" + "t not found: %s" % script) + "\n", 2) else: - self.logger.write(src.printcolors.printcHeader("----------- sta" - "rt %s" % script_name) + "\n", 2) - self.logger.write("Run script: %s\n" % script, 2) - subprocess.Popen(script, shell=True).wait() - self.logger.write(src.printcolors.printcHeader("----------- end" - " %s" % script_name) + "\n", 2) -
+ self.logger.write(src.printcolors.printcHeader("----------- sta" + "rt %s" % script_name) + "\n", 2) + self.logger.write("Run script: %s\n" % script, 2) + subprocess.Popen(script, shell=True).wait() + self.logger.write(src.printcolors.printcHeader("----------- end" + " %s" % script_name) + "\n", 2) +
[docs] def run_all_tests(self): initTime = datetime.datetime.now() - self.run_script('test_setup') - self.logger.write("\n", 2, False) + self.run_script('test_setup') + self.logger.write("\n", 2, False) self.logger.write(src.printcolors.printcHeader( - _("=== STARTING TESTS")) + "\n", 2) - self.logger.write("\n", 2, False) + _("=== STARTING TESTS")) + "\n", 2) + self.logger.write("\n", 2, False) self.currentDir = os.path.join(self.tmp_working_dir, - 'BASES', + 'BASES', self.currentTestBase) self.run_testbase_tests() - # calculate total execution time + # calculate total execution time totalTime = datetime.datetime.now() - initTime totalTime -= datetime.timedelta(microseconds=totalTime.microseconds) - self.logger.write("\n", 2, False) - self.logger.write(src.printcolors.printcHeader(_("=== END TESTS")), 2) - self.logger.write(" %s\n" % src.printcolors.printcInfo(str(totalTime)), + self.logger.write("\n", 2, False) + self.logger.write(src.printcolors.printcHeader(_("=== END TESTS")), 2) + self.logger.write(" %s\n" % src.printcolors.printcInfo(str(totalTime)), 2, - False) + False) - # - # Start the tests - # - self.run_script('test_cleanup') - self.logger.write("\n", 2, False) + # + # Start the tests + # + self.run_script('test_cleanup') + self.logger.write("\n", 2, False) - # evaluate results - res_count = "%d / %d" % (self.nb_succeed, + # evaluate results + res_count = "%d / %d" % (self.nb_succeed, self.nb_run - self.nb_acknoledge) - res_out = _("Tests Results: %(succeed)d / %(total)d\n") % \ - { 'succeed': self.nb_succeed, 'total': self.nb_run } + res_out = _("Tests Results: %(succeed)d / %(total)d\n") % \ + { 'succeed': self.nb_succeed, 'total': self.nb_run } if self.nb_succeed == self.nb_run: res_out = src.printcolors.printcSuccess(res_out) else: @@ -921,11 +909,11 @@ self.logger.write(res_out, 1) if self.nb_timeout > 0: - self.logger.write(_("%d tests TIMEOUT\n") % self.nb_timeout, 1) - res_count += " TO: %d" % self.nb_timeout + self.logger.write(_("%d tests TIMEOUT\n") % self.nb_timeout, 1) + res_count += " TO: %d" % self.nb_timeout if self.nb_not_run > 0: - self.logger.write(_("%d tests not executed\n") % self.nb_not_run, 1) - res_count += " NR: %d" % self.nb_not_run + self.logger.write(_("%d tests not executed\n") % self.nb_not_run, 1) + res_count += " NR: %d" % self.nb_not_run status = src.OK_STATUS if self.nb_run - self.nb_succeed - self.nb_acknoledge > 0: @@ -933,22 +921,23 @@ elif self.nb_acknoledge: status = src.KNOWNFAILURE_STATUS - self.logger.write(_("Status: %s\n" % status), 3) + self.logger.write(_("Status: %s\n" % status), 3) - return self.nb_run - self.nb_succeed - self.nb_acknoledge + return self.nb_run - self.nb_succeed - self.nb_acknoledge
- ## - # Write margin to show test results. + ## + # Write margin to show test results.
[docs] def write_test_margin(self, tab): if tab == 0: - return "" - return "| " * (tab - 1) + "+ " -
+ return "" + return "| " * (tab - 1) + "+ " + + -
+ diff --git a/doc/build/html/_modules/src/xmlManager.html b/doc/build/html/_modules/src/xmlManager.html index 6655274..e068203 100644 --- a/doc/build/html/_modules/src/xmlManager.html +++ b/doc/build/html/_modules/src/xmlManager.html @@ -2,39 +2,27 @@ - + - - src.xmlManager — salomeTools 5.0.0dev documentation - + src.xmlManager — salomeTools 5.0.0dev documentation - - + - - - + + + - - +
@@ -43,34 +31,34 @@

Source code for src.xmlManager

-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-#  Copyright (C) 2010-2013  CEA/DEN
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library 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
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+#  Copyright (C) 2010-2013  CEA/DEN
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library 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
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 
 import os
-try: # For python2
+try: # For python2
     import sys
-    reload(sys)  
-    sys.setdefaultencoding('utf8')
+    reload(sys)  
+    sys.setdefaultencoding('utf8')
 except:
     pass
 
 import src
-from . import ElementTree as etree
+from . import ElementTree as etree
 
 
[docs]class XmlLogFile(object): '''Class to manage writing in salomeTools xml log file @@ -83,14 +71,14 @@ :param attrib dict: the dictionary that contains the attributes and value of the root node ''' - # Initialize the filePath and ensure that the directory - # that contain the file exists (make it if necessary) + # Initialize the filePath and ensure that the directory + # that contain the file exists (make it if necessary) self.logFile = filePath src.ensure_path_exists(os.path.dirname(filePath)) - # Initialize the field that contain the xml in memory + # Initialize the field that contain the xml in memory self.xmlroot = etree.Element(rootname, attrib = attrib) -
[docs] def write_tree(self, stylesheet=None, file_path = None): +
[docs] def write_tree(self, stylesheet=None, file_path = None): '''Write the xml tree in the log file path. Add the stylesheet if asked. :param stylesheet str: The stylesheet to apply to the xml file @@ -99,17 +87,17 @@ if file_path: log_file_path = file_path try: - f = open(log_file_path, 'w') - f.write("<?xml version='1.0' encoding='utf-8'?>\n") + f = open(log_file_path, 'w') + f.write("<?xml version='1.0' encoding='utf-8'?>\n") if stylesheet: - f.write("<?xml-stylesheet type='text/xsl' href='%s'?>\n" % + f.write("<?xml-stylesheet type='text/xsl' href='%s'?>\n" % stylesheet) - f.write(etree.tostring(self.xmlroot, encoding='utf-8')) + f.write(etree.tostring(self.xmlroot, encoding='utf-8')) f.close() except IOError: - pass -
-
[docs] def add_simple_node(self, node_name, text=None, attrib={}): + pass
+ +
[docs] def add_simple_node(self, node_name, text=None, attrib={}): '''Add a node with some attibutes and text to the root node. :param node_name str: the name of the node to add @@ -120,28 +108,28 @@ n = etree.Element(node_name, attrib=attrib) n.text = text self.xmlroot.append(n) - return n -
+ return n
+
[docs] def append_node_text(self, node_name, text): '''Append a new text to the node that has node_name as name :param node_name str: The name of the node on which append text :param text str: The text to append ''' - # find the corresponding node + # find the corresponding node for field in self.xmlroot: if field.tag == node_name: - # append the text - field.text += text -
+ # append the text + field.text += text
+
[docs] def append_node_attrib(self, node_name, attrib): '''Append a new attributes to the node that has node_name as name :param node_name str: The name of the node on which append text :param attrib dixt: The attrib to append ''' - self.xmlroot.find(node_name).attrib.update(attrib) -
+ self.xmlroot.find(node_name).attrib.update(attrib)
+
[docs]class ReadXmlFile(object): '''Class to manage reading of an xml log file ''' @@ -160,8 +148,8 @@ :return: The attributes of the root node :rtype: dict ''' - return self.xmlroot.attrib -
+ return self.xmlroot.attrib
+
[docs] def get_attrib(self, node_name): '''Get the attibutes of the node node_name in self.xmlroot @@ -170,7 +158,7 @@ :rtype: dict ''' attrib = self.xmlroot.find(node_name).attrib - # To be python 3 compatible, convert bytes to str if there are any + # To be python 3 compatible, convert bytes to str if there are any fixedAttrib = {} for k in attrib.keys(): if isinstance(k, bytes): @@ -182,8 +170,8 @@ else: value = attrib[k] fixedAttrib[key] = value - return fixedAttrib -
+ return fixedAttrib +
[docs] def get_node_text(self, node): '''Get the text of the first node that has name that corresponds to the parameter node @@ -193,9 +181,9 @@ that corresponds to the parameter node :rtype: str ''' - return self.xmlroot.find(node).text -
-
[docs]def add_simple_node(root_node, node_name, text=None, attrib={}): + return self.xmlroot.find(node).text
+ +
[docs]def add_simple_node(root_node, node_name, text=None, attrib={}): '''Add a node with some attibutes and text to the root node. :param root_node etree.Element: the Etree element where to add the new node @@ -207,8 +195,8 @@ n = etree.Element(node_name, attrib=attrib) n.text = text root_node.append(n) - return n -
+ return n +
[docs]def append_node_attrib(root_node, attrib): '''Append a new attributes to the node that has node_name as name @@ -216,8 +204,8 @@ where to append the new attibutes :param attrib dixt: The attrib to append ''' - root_node.attrib.update(attrib) -
+ root_node.attrib.update(attrib) +
[docs]def find_node_by_attrib(xmlroot, name_node, key, value): '''Find the nfirst ode from xmlroot that has name name_node and that has in its attributes {key : value}. Return the node @@ -235,9 +223,9 @@ continue if node.attrib[key] == value: return node - return None + return None
- +
[docs]def write_report(filename, xmlroot, stylesheet): """Writes a report file from a XML tree. @@ -248,19 +236,19 @@ if not os.path.exists(os.path.dirname(filename)): os.makedirs(os.path.dirname(filename)) - f = open(filename, "w") - f.write("<?xml version='1.0' encoding='utf-8'?>\n") + f = open(filename, "w") + f.write("<?xml version='1.0' encoding='utf-8'?>\n") if len(stylesheet) > 0: - f.write("<?xml-stylesheet type='text/xsl' href='%s'?>\n" % stylesheet) - f.write(etree.tostring(xmlroot, encoding='utf-8')) - f.close() -
+ f.write("<?xml-stylesheet type='text/xsl' href='%s'?>\n" % stylesheet) + f.write(etree.tostring(xmlroot, encoding='utf-8')) + f.close() + -
+ diff --git a/doc/build/html/_sources/commands/apidoc/modules.rst.txt b/doc/build/html/_sources/commands/apidoc/modules.rst.txt new file mode 100644 index 0000000..e9ff8ac --- /dev/null +++ b/doc/build/html/_sources/commands/apidoc/modules.rst.txt @@ -0,0 +1,7 @@ +src +=== + +.. toctree:: + :maxdepth: 4 + + src diff --git a/doc/build/html/_sources/commands/apidoc/modules.txt b/doc/build/html/_sources/commands/apidoc/modules.txt deleted file mode 100644 index e9ff8ac..0000000 --- a/doc/build/html/_sources/commands/apidoc/modules.txt +++ /dev/null @@ -1,7 +0,0 @@ -src -=== - -.. toctree:: - :maxdepth: 4 - - src diff --git a/doc/build/html/_sources/commands/apidoc/src.colorama.rst.txt b/doc/build/html/_sources/commands/apidoc/src.colorama.rst.txt new file mode 100644 index 0000000..ba8c5f6 --- /dev/null +++ b/doc/build/html/_sources/commands/apidoc/src.colorama.rst.txt @@ -0,0 +1,51 @@ +colorama Package +================ + +:mod:`colorama` Package +----------------------- + +.. automodule:: src.colorama + :members: + :undoc-members: + :show-inheritance: + +:mod:`ansi` Module +------------------ + +.. automodule:: src.colorama.ansi + :members: + :undoc-members: + :show-inheritance: + +:mod:`ansitowin32` Module +------------------------- + +.. automodule:: src.colorama.ansitowin32 + :members: + :undoc-members: + :show-inheritance: + +:mod:`initialise` Module +------------------------ + +.. automodule:: src.colorama.initialise + :members: + :undoc-members: + :show-inheritance: + +:mod:`win32` Module +------------------- + +.. automodule:: src.colorama.win32 + :members: + :undoc-members: + :show-inheritance: + +:mod:`winterm` Module +--------------------- + +.. automodule:: src.colorama.winterm + :members: + :undoc-members: + :show-inheritance: + diff --git a/doc/build/html/_sources/commands/apidoc/src.colorama.txt b/doc/build/html/_sources/commands/apidoc/src.colorama.txt deleted file mode 100644 index ba8c5f6..0000000 --- a/doc/build/html/_sources/commands/apidoc/src.colorama.txt +++ /dev/null @@ -1,51 +0,0 @@ -colorama Package -================ - -:mod:`colorama` Package ------------------------ - -.. automodule:: src.colorama - :members: - :undoc-members: - :show-inheritance: - -:mod:`ansi` Module ------------------- - -.. automodule:: src.colorama.ansi - :members: - :undoc-members: - :show-inheritance: - -:mod:`ansitowin32` Module -------------------------- - -.. automodule:: src.colorama.ansitowin32 - :members: - :undoc-members: - :show-inheritance: - -:mod:`initialise` Module ------------------------- - -.. automodule:: src.colorama.initialise - :members: - :undoc-members: - :show-inheritance: - -:mod:`win32` Module -------------------- - -.. automodule:: src.colorama.win32 - :members: - :undoc-members: - :show-inheritance: - -:mod:`winterm` Module ---------------------- - -.. automodule:: src.colorama.winterm - :members: - :undoc-members: - :show-inheritance: - diff --git a/doc/build/html/_sources/commands/apidoc/src.rst.txt b/doc/build/html/_sources/commands/apidoc/src.rst.txt new file mode 100644 index 0000000..ac8627e --- /dev/null +++ b/doc/build/html/_sources/commands/apidoc/src.rst.txt @@ -0,0 +1,146 @@ +src Package +=========== + +:mod:`src` Package +------------------ + +.. automodule:: src.__init__ + :members: + :undoc-members: + :show-inheritance: + +:mod:`ElementTree` Module +------------------------- + +.. automodule:: src.ElementTree + :members: + :undoc-members: + :show-inheritance: + +:mod:`architecture` Module +-------------------------- + +.. automodule:: src.architecture + :members: + :undoc-members: + :show-inheritance: + +:mod:`compilation` Module +------------------------- + +.. automodule:: src.compilation + :members: + :undoc-members: + :show-inheritance: + +:mod:`debug` Module +------------------- + +.. automodule:: src.debug + :members: + :undoc-members: + :show-inheritance: + +:mod:`environment` Module +------------------------- + +.. automodule:: src.environment + :members: + :undoc-members: + :show-inheritance: + +:mod:`fileEnviron` Module +------------------------- + +.. automodule:: src.fileEnviron + :members: + :undoc-members: + :show-inheritance: + +:mod:`fork` Module +------------------ + +.. automodule:: src.fork + :members: + :undoc-members: + :show-inheritance: + +:mod:`logger` Module +-------------------- + +.. automodule:: src.logger + :members: + :undoc-members: + :show-inheritance: + +:mod:`options` Module +--------------------- + +.. automodule:: src.options + :members: + :undoc-members: + :show-inheritance: + +:mod:`printcolors` Module +------------------------- + +.. automodule:: src.printcolors + :members: + :undoc-members: + :show-inheritance: + +:mod:`product` Module +--------------------- + +.. automodule:: src.product + :members: + :undoc-members: + :show-inheritance: + +:mod:`pyconf` Module +-------------------- + +.. automodule:: src.pyconf + :members: + :undoc-members: + :show-inheritance: + +:mod:`system` Module +-------------------- + +.. automodule:: src.system + :members: + :undoc-members: + :show-inheritance: + +:mod:`template` Module +---------------------- + +.. automodule:: src.template + :members: + :undoc-members: + :show-inheritance: + +:mod:`test_module` Module +------------------------- + +.. automodule:: src.test_module + :members: + :undoc-members: + :show-inheritance: + +:mod:`xmlManager` Module +------------------------ + +.. automodule:: src.xmlManager + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + + src.colorama + diff --git a/doc/build/html/_sources/commands/apidoc/src.txt b/doc/build/html/_sources/commands/apidoc/src.txt deleted file mode 100644 index ac8627e..0000000 --- a/doc/build/html/_sources/commands/apidoc/src.txt +++ /dev/null @@ -1,146 +0,0 @@ -src Package -=========== - -:mod:`src` Package ------------------- - -.. automodule:: src.__init__ - :members: - :undoc-members: - :show-inheritance: - -:mod:`ElementTree` Module -------------------------- - -.. automodule:: src.ElementTree - :members: - :undoc-members: - :show-inheritance: - -:mod:`architecture` Module --------------------------- - -.. automodule:: src.architecture - :members: - :undoc-members: - :show-inheritance: - -:mod:`compilation` Module -------------------------- - -.. automodule:: src.compilation - :members: - :undoc-members: - :show-inheritance: - -:mod:`debug` Module -------------------- - -.. automodule:: src.debug - :members: - :undoc-members: - :show-inheritance: - -:mod:`environment` Module -------------------------- - -.. automodule:: src.environment - :members: - :undoc-members: - :show-inheritance: - -:mod:`fileEnviron` Module -------------------------- - -.. automodule:: src.fileEnviron - :members: - :undoc-members: - :show-inheritance: - -:mod:`fork` Module ------------------- - -.. automodule:: src.fork - :members: - :undoc-members: - :show-inheritance: - -:mod:`logger` Module --------------------- - -.. automodule:: src.logger - :members: - :undoc-members: - :show-inheritance: - -:mod:`options` Module ---------------------- - -.. automodule:: src.options - :members: - :undoc-members: - :show-inheritance: - -:mod:`printcolors` Module -------------------------- - -.. automodule:: src.printcolors - :members: - :undoc-members: - :show-inheritance: - -:mod:`product` Module ---------------------- - -.. automodule:: src.product - :members: - :undoc-members: - :show-inheritance: - -:mod:`pyconf` Module --------------------- - -.. automodule:: src.pyconf - :members: - :undoc-members: - :show-inheritance: - -:mod:`system` Module --------------------- - -.. automodule:: src.system - :members: - :undoc-members: - :show-inheritance: - -:mod:`template` Module ----------------------- - -.. automodule:: src.template - :members: - :undoc-members: - :show-inheritance: - -:mod:`test_module` Module -------------------------- - -.. automodule:: src.test_module - :members: - :undoc-members: - :show-inheritance: - -:mod:`xmlManager` Module ------------------------- - -.. automodule:: src.xmlManager - :members: - :undoc-members: - :show-inheritance: - -Subpackages ------------ - -.. toctree:: - - src.colorama - diff --git a/doc/build/html/_sources/commands/application.rst.txt b/doc/build/html/_sources/commands/application.rst.txt new file mode 100644 index 0000000..2052da0 --- /dev/null +++ b/doc/build/html/_sources/commands/application.rst.txt @@ -0,0 +1,55 @@ + +.. include:: ../../rst_prolog.rst + +Command application +********************* + +Description +=========== +The **application** command creates a virtual SALOME_ application. +Virtual SALOME applications are used to start SALOME when distribution is needed. + +Usage +===== +* Create an application: :: + + sat application + + Create the virtual application directory in the salomeTool application directory ``$APPLICATION.workdir``. + +* Give a name to the application: :: + + sat application --name + + *Remark*: this option overrides the name given in the virtual_app section of the configuration file ``$APPLICATION.virtual_app.name``. + +* Change the directory where the application is created: :: + + sat application --target + +* Set a specific SALOME_ resources catalog (it will be used for the distribution of components on distant machines): :: + + sat application --catalog + + Note that the catalog specified will be copied to the application directory. + +* Generate the catalog for a list of machines: :: + + sat application --gencat machine1,machine2,machine3 + + This will create a catalog by querying each machine through ssh protocol (memory, number of processor) with ssh. + +* Generate a mesa application (if mesa and llvm are parts of the application). Use this option only if you have to use salome through ssh and have problems with ssh X forwarding of OpengGL modules (like Paravis): :: + + sat launcher --use_mesa + +Some useful configuration pathes +================================= + +The virtual application can be configured with the virtual_app section of the configutation file. + +* **APPLICATION.virtual_app** + + * **name** : name of the launcher (to replace the default runAppli). + * **application_name** : (optional) the name of the virtual application directory, if missing the default value is ``$name + _appli``. + diff --git a/doc/build/html/_sources/commands/application.txt b/doc/build/html/_sources/commands/application.txt deleted file mode 100644 index 2052da0..0000000 --- a/doc/build/html/_sources/commands/application.txt +++ /dev/null @@ -1,55 +0,0 @@ - -.. include:: ../../rst_prolog.rst - -Command application -********************* - -Description -=========== -The **application** command creates a virtual SALOME_ application. -Virtual SALOME applications are used to start SALOME when distribution is needed. - -Usage -===== -* Create an application: :: - - sat application - - Create the virtual application directory in the salomeTool application directory ``$APPLICATION.workdir``. - -* Give a name to the application: :: - - sat application --name - - *Remark*: this option overrides the name given in the virtual_app section of the configuration file ``$APPLICATION.virtual_app.name``. - -* Change the directory where the application is created: :: - - sat application --target - -* Set a specific SALOME_ resources catalog (it will be used for the distribution of components on distant machines): :: - - sat application --catalog - - Note that the catalog specified will be copied to the application directory. - -* Generate the catalog for a list of machines: :: - - sat application --gencat machine1,machine2,machine3 - - This will create a catalog by querying each machine through ssh protocol (memory, number of processor) with ssh. - -* Generate a mesa application (if mesa and llvm are parts of the application). Use this option only if you have to use salome through ssh and have problems with ssh X forwarding of OpengGL modules (like Paravis): :: - - sat launcher --use_mesa - -Some useful configuration pathes -================================= - -The virtual application can be configured with the virtual_app section of the configutation file. - -* **APPLICATION.virtual_app** - - * **name** : name of the launcher (to replace the default runAppli). - * **application_name** : (optional) the name of the virtual application directory, if missing the default value is ``$name + _appli``. - diff --git a/doc/build/html/_sources/commands/clean.rst.txt b/doc/build/html/_sources/commands/clean.rst.txt new file mode 100644 index 0000000..e5d2f38 --- /dev/null +++ b/doc/build/html/_sources/commands/clean.rst.txt @@ -0,0 +1,61 @@ + +.. include:: ../../rst_prolog.rst + +Command clean +**************** + +Description +============ + +The **clean** command removes products in the *source, build, or install* directories of an application. Theses directories are usually named ``SOURCES, BUILD, INSTALL``. + +Use the options to define what directories you want to suppress and to set the list of products + + +Usage +======= + +* Clean all previously created *build* and *install* directories (example application as *SALOME_xx*): + + .. code-block:: bash + + # take care, is long time to restore, sometimes + sat clean SALOME-xx --build --install + +* Clean previously created *build* and *install* directories, only for products with property *is_salome_module*: + + .. code-block:: bash + + sat clean SALOME-xxx --build --install \ + --properties is_salome_module:yes + + +Availables options +====================== + + * **--products** : Products to clean. + + * **--properties** : + + | Filter the products by their properties. + | Syntax: *--properties :* + + * **--sources** : Clean the product source directories. + + * **--build** : Clean the product build directories. + + * **--install** : Clean the product install directories. + + * **--all** : Clean the product source, build and install directories. + + * **--sources_without_dev** : + + | Do not clean the products in development mode, + | (they could have VCS_ commits pending). + + + +Some useful configuration pathes +================================= + +No specific configuration. diff --git a/doc/build/html/_sources/commands/clean.txt b/doc/build/html/_sources/commands/clean.txt deleted file mode 100644 index e5d2f38..0000000 --- a/doc/build/html/_sources/commands/clean.txt +++ /dev/null @@ -1,61 +0,0 @@ - -.. include:: ../../rst_prolog.rst - -Command clean -**************** - -Description -============ - -The **clean** command removes products in the *source, build, or install* directories of an application. Theses directories are usually named ``SOURCES, BUILD, INSTALL``. - -Use the options to define what directories you want to suppress and to set the list of products - - -Usage -======= - -* Clean all previously created *build* and *install* directories (example application as *SALOME_xx*): - - .. code-block:: bash - - # take care, is long time to restore, sometimes - sat clean SALOME-xx --build --install - -* Clean previously created *build* and *install* directories, only for products with property *is_salome_module*: - - .. code-block:: bash - - sat clean SALOME-xxx --build --install \ - --properties is_salome_module:yes - - -Availables options -====================== - - * **--products** : Products to clean. - - * **--properties** : - - | Filter the products by their properties. - | Syntax: *--properties :* - - * **--sources** : Clean the product source directories. - - * **--build** : Clean the product build directories. - - * **--install** : Clean the product install directories. - - * **--all** : Clean the product source, build and install directories. - - * **--sources_without_dev** : - - | Do not clean the products in development mode, - | (they could have VCS_ commits pending). - - - -Some useful configuration pathes -================================= - -No specific configuration. diff --git a/doc/build/html/_sources/commands/compile.rst.txt b/doc/build/html/_sources/commands/compile.rst.txt new file mode 100644 index 0000000..915705e --- /dev/null +++ b/doc/build/html/_sources/commands/compile.rst.txt @@ -0,0 +1,75 @@ + +.. include:: ../../rst_prolog.rst + +Command compile +**************** + +Description +=========== +The **compile** command allows compiling the products of a SALOME_ application. + + +Usage +===== +* Compile a complete application: :: + + sat compile + +* Compile only some products: :: + + sat compile --products , ... + +* Use *sat -t* to duplicate the logs in the terminal (by default the log are stored and displayed with *sat log* command): :: + + sat -t compile --products + +* Compile a module and its dependencies: :: + + sat compile --products med --with_fathers + +* Compile a module and the modules depending on it (for example plugins): :: + + sat compile --products med --with_children + +* Clean the build and install directories before starting compilation: :: + + sat compile --products GEOM --clean_all + + .. note:: | a warning will be shown if option *--products* is missing + | (as it will clean everything) + +* Clean only the install directories before starting compilation: :: + + sat compile --clean_install + +* Add options for make: :: + + sat compile --products --make_flags + +* Use the *--check* option to execute the unit tests after compilation: :: + + sat compile --check + +* Remove the build directory after successful compilation (some build directory like qt are big): :: + + sat compile --products qt --clean_build_after + +* Stop the compilation as soon as the compilation of a module fails: :: + + sat compile --stop_first_fail + +* Do not compile, just show if products are installed or not, and where is the installation: :: + + sat compile --show + + +Some useful configuration pathes +================================= + +The way to compile a product is defined in the *pyconf file configuration*. +The main options are: + + * **build_source** : the method used to build the product (cmake/autotools/script) + * **compil_script** : the compilation script if build_source is equal to "script" + * **cmake_options** : additional options for cmake. + * **nb_proc** : number of jobs to use with make for this product. diff --git a/doc/build/html/_sources/commands/compile.txt b/doc/build/html/_sources/commands/compile.txt deleted file mode 100644 index 915705e..0000000 --- a/doc/build/html/_sources/commands/compile.txt +++ /dev/null @@ -1,75 +0,0 @@ - -.. include:: ../../rst_prolog.rst - -Command compile -**************** - -Description -=========== -The **compile** command allows compiling the products of a SALOME_ application. - - -Usage -===== -* Compile a complete application: :: - - sat compile - -* Compile only some products: :: - - sat compile --products , ... - -* Use *sat -t* to duplicate the logs in the terminal (by default the log are stored and displayed with *sat log* command): :: - - sat -t compile --products - -* Compile a module and its dependencies: :: - - sat compile --products med --with_fathers - -* Compile a module and the modules depending on it (for example plugins): :: - - sat compile --products med --with_children - -* Clean the build and install directories before starting compilation: :: - - sat compile --products GEOM --clean_all - - .. note:: | a warning will be shown if option *--products* is missing - | (as it will clean everything) - -* Clean only the install directories before starting compilation: :: - - sat compile --clean_install - -* Add options for make: :: - - sat compile --products --make_flags - -* Use the *--check* option to execute the unit tests after compilation: :: - - sat compile --check - -* Remove the build directory after successful compilation (some build directory like qt are big): :: - - sat compile --products qt --clean_build_after - -* Stop the compilation as soon as the compilation of a module fails: :: - - sat compile --stop_first_fail - -* Do not compile, just show if products are installed or not, and where is the installation: :: - - sat compile --show - - -Some useful configuration pathes -================================= - -The way to compile a product is defined in the *pyconf file configuration*. -The main options are: - - * **build_source** : the method used to build the product (cmake/autotools/script) - * **compil_script** : the compilation script if build_source is equal to "script" - * **cmake_options** : additional options for cmake. - * **nb_proc** : number of jobs to use with make for this product. diff --git a/doc/build/html/_sources/commands/config.rst.txt b/doc/build/html/_sources/commands/config.rst.txt new file mode 100644 index 0000000..ffcfdf9 --- /dev/null +++ b/doc/build/html/_sources/commands/config.rst.txt @@ -0,0 +1,89 @@ + +.. include:: ../../rst_prolog.rst + +Command config +****************** + +Description +=========== +The **config** command manages sat configuration. +It allows display, manipulation and operation on configuration files + +Usage +===== +* Edit the user personal configuration file ``$HOME/.salomeTools/SAT.pyconf``. It is used to store the user personal choices, like the favorite editor, browser, pdf viewer: :: + + sat config --edit + +* List the available applications (they come from the sat projects defined in ``data/local.pyconf``: :: + + sat config --list + +* Edit the configuration of an application: :: + + sat config --edit + +* Copy an application configuration file into the user personal directory: :: + + sat config --copy [new_name] + +* | Print the value of a configuration parameter. + | Use the automatic completion to get recursively the parameter names. + | Use *--no_label* option to get *only* the value, *without* label (useful in automatic scripts). + | Examples (with *SALOME-xx* as *SALOME-8.4.0* ): + + .. code-block:: bash + + # sat config --value + sat config --value . # all the configuration + sat config --value LOCAL + sat config --value LOCAL.workdir + + # sat config --value + sat config SALOME-xx --value APPLICATION.workdir + sat config SALOME-xx --no_label --value APPLICATION.workdir + +* | Print in one-line-by-value mode the value of a configuration parameter, + | with its source *expression*, if any. + | This is a debug mode, useful for developers. + | Prints the parameter path, the source expression if any, and the final value: + + :: + + sat config SALOME-xx -g USER + + .. note:: And so, *not only for fun*, to get **all expressions** of configuration + + .. code-block:: bash + + sat config SALOME-xx -g . | grep -e "-->" + + +* Print the patches that are applied: :: + + sat config SALOME-xx --show_patchs + +* Get information on a product configuration: + +.. code-block:: bash + + # sat config --info + sat config SALOME-xx --info KERNEL + sat config SALOME-xx --info qt + +Some useful configuration pathes +================================= + +Exploring a current configuration. + +* **PATHS**: To get list of directories where to find files. + +* **USER**: To get user preferences (editor, pdf viewer, web browser, default working dir). + +sat commands: :: + + sat config SALOME-xx -v PATHS + sat config SALOME-xx -v USERS + + + diff --git a/doc/build/html/_sources/commands/config.txt b/doc/build/html/_sources/commands/config.txt deleted file mode 100644 index 79a4a46..0000000 --- a/doc/build/html/_sources/commands/config.txt +++ /dev/null @@ -1,89 +0,0 @@ - -.. include:: ../../rst_prolog.rst - -Command config -****************** - -Description -=========== -The **config** command manages sat configuration. -It allows display, manipulation and operation on configuration files - -Usage -===== -* Edit the user personal configuration file ``$HOME/.salomeTools/SAT.pyconf``. It is used to store the user personal choices, like the favorite editor, browser, pdf viewer: :: - - sat config --edit - -* List the available applications (they come from the sat projects defined in ``data/local.pyconf``: :: - - sat config --list - -* Edit the configuration of an application: :: - - sat config --edit - -* Copy an application configuration file into the user personal directory: :: - - sat config --copy [new_name] - -* | Print the value of a configuration parameter. - | Use the automatic completion to get recursively the parameter names. - | Use *--no_label* option to get *only* the value, *without* label (useful in automatic scripts). - | Examples (with *SALOME-xx* as *SALOME-8.4.0* ): - - .. code-block:: bash - - # sat config --value - sat config --value . # all the configuration - sat config --value LOCAL - sat config --value LOCAL.workdir - - # sat config --value - sat config SALOME-xx --value APPLICATION.workdir - sat config SALOME-xx --no_label --value APPLICATION.workdir - -* | Print in one-line-by-value mode the value of a configuration parameter, - | with its source *expression*, if any. - | This is a debug mode, useful for developers. - | Prints the parameter path, the source expression if any, and the final value: - - :: - - sat config SALOME-xx -g USER - - .. note:: And so, *not only for fun*, to get **all expressions** of configuration - - .. code-block:: bash - - sat config SALOME-xx -g . | grep -e "-->" - - -* Print the patches that are applied: :: - - sat config SALOME-xx --show_patchs - -* Get information on a product configuration: - - .. code-block:: bash - - # sat config --info - sat config SALOME-xx --info KERNEL - sat config SALOME-xx --info qt - -Some useful configuration pathes -================================= - -Exploring a current configuration. - -* **PATHS**: To get list of directories where to find files. - -* **USER**: To get user preferences (editor, pdf viewer, web browser, default working dir). - -sat commands: :: - - sat config SALOME-xx -v PATHS - sat config SALOME-xx -v USERS - - - diff --git a/doc/build/html/_sources/commands/environ.rst.txt b/doc/build/html/_sources/commands/environ.rst.txt new file mode 100644 index 0000000..d487e4c --- /dev/null +++ b/doc/build/html/_sources/commands/environ.rst.txt @@ -0,0 +1,139 @@ + +.. include:: ../../rst_prolog.rst + +Command environ +**************** + +Description +=========== +The **environ** command generates the environment files used +to run and compile your application (as SALOME_ is an example). + +.. note :: + these files are **not** required, + salomeTool set the environment himself, when compiling. + And so does the salome launcher. + + These files are useful when someone wants to check the environment. + They could be used in debug mode to set the environment for *gdb*. + +The configuration part at the end of this page explains how +to specify the environment used by sat (at build or run time), +and saved in some files by *sat environ* command. + +Usage +===== +* Create the shell environment files of the application: :: + + sat environ + +* Create the environment files of the application for a given shell. + Options are bash, bat (for windows) and cfg (the configuration format used by SALOME_): :: + + sat environ --shell [bash|cfg|all] + +* Use a different prefix for the files (default is 'env'): + + .. code-block:: bash + + # This will create file _launch.sh, _build.sh + sat environ --prefix + +* Use a different target directory for the files: + + .. code-block:: bash + + # This will create file env_launch.sh, env_build.sh + # in the directory corresponding to + sat environ --target + +* Generate the environment files only with the given products: + + .. code-block:: bash + + # This will create the environment files only for the given products + # and their prerequisites. + # It is useful when you want to visualise which environment uses + # sat to compile a given product. + sat environ --product ,, ... + + +Configuration +============= + +The specification of the environment can be done through several mechanisms. + +1. For salome products (the products with the property ``is_SALOME_module`` as ``yes``) the environment is set automatically by sat, in respect with SALOME_ requirements. + +2. For other products, the environment is set with the use of the environ section within the pyconf file of the product. The user has two possibilities, either set directly the environment within the section, or specify a python script which wil be used to set the environment programmatically. + +Within the section, the user can define environment variables. He can also modify PATH variables, by appending or prepending directories. +In the following example, we prepend */lib* to ``LD_LIBRARY_PATH`` (note the *left first* underscore), append */lib* to ``PYTHONPATH`` (note the *right last* underscore), and set ``LAPACK_ROOT_DIR`` to **: + +.. code-block:: bash + + environ : + { + _LD_LIBRARY_PATH : $install_dir + $VARS.sep + "lib" + PYTHONPATH_ : $install_dir + $VARS.sep + "lib" + LAPACK_ROOT_DIR : $install_dir + } + +It is possible to distinguish the build environment from the launch environment: use a subsection called *build* or *launch*. In the example below, ``LD_LIBRARY_PATH`` and ``PYTHONPATH`` are only modified at run time, not at compile time: + +.. code-block:: bash + + environ : + { + build : + { + LAPACK_ROOT_DIR : $install_dir + } + launch : + { + LAPACK_ROOT_DIR : $install_dir + _LD_LIBRARY_PATH : $install_dir + $VARS.sep + "lib" + PYTHONPATH_ : $install_dir + $VARS.sep + "lib" + } + } + +3. The last possibility is to set the environment with a python script. The script should be provided in the *products/env_scripts* directory of the sat project, and its name is specified in the environment section with the key ``environ.env_script``: + +.. code-block:: python + + environ : + { + env_script : 'lapack.py' + } + +Please note that the two modes are complementary and are both taken into account. +Most of the time, the first mode is sufficient. + +The second mode can be used when the environment has to be set programmatically. +The developer implements a handle (as a python method) +which is called by sat to set the environment. +Here is an example: + +.. code-block:: python + + + #!/usr/bin/env python + #-*- coding:utf-8 -*- + + import os.path + import platform + + def set_env(env, prereq_dir, version): + env.set("TRUST_ROOT_DIR",prereq_dir) + env.prepend('PATH', os.path.join(prereq_dir, 'bin')) + env.prepend('PATH', os.path.join(prereq_dir, 'include')) + env.prepend('LD_LIBRARY_PATH', os.path.join(prereq_dir, 'lib')) + return + +SalomeTools defines four handles: + +* **set_env(env, prereq_dir, version)** : used at build and run time. +* **set_env_launch(env, prereq_dir, version)** : used only at run time (if defined!) +* **set_env_build(env, prereq_dir, version)** : used only at build time (if defined!) +* **set_native_env(env)** : used only for native products, at build and run time. + diff --git a/doc/build/html/_sources/commands/environ.txt b/doc/build/html/_sources/commands/environ.txt deleted file mode 100644 index 13b9508..0000000 --- a/doc/build/html/_sources/commands/environ.txt +++ /dev/null @@ -1,139 +0,0 @@ - -.. include:: ../../rst_prolog.rst - -Command environ -**************** - -Description -=========== -The **environ** command generates the environment files used -to run and compile your application (as SALOME_ is an example). - -.. note :: - these files are **not** required, - salomeTool set the environment himself, when compiling. - And so does the salome launcher. - - These files are useful when someone wants to check the environment. - They could be used in debug mode to set the environment for *gdb*. - -The configuration part at the end of this page explains how -to specify the environment used by sat (at build or run time), -and saved in some files by *sat environ* command. - -Usage -===== -* Create the shell environment files of the application: :: - - sat environ - -* Create the environment files of the application for a given shell. - Options are bash, bat (for windows) and cfg (the configuration format used by SALOME_): :: - - sat environ --shell [bash|cfg|all] - -* Use a different prefix for the files (default is 'env'): - - .. code-block:: bash - - # This will create file _launch.sh, _build.sh - sat environ --prefix - -* Use a different target directory for the files: - - .. code-block:: bash - - # This will create file env_launch.sh, env_build.sh - # in the directory corresponding to - sat environ --target - -* Generate the environment files only with the given products: - - .. code-block:: bash - - # This will create the environment files only for the given products - # and their prerequisites. - # It is useful when you want to visualise which environment uses - # sat to compile a given product. - sat environ --product ,, ... - - -Configuration -============= - -The specification of the environment can be done through several mechanisms. - -1. For salome products (the products with the property ``is_SALOME_module`` as ``yes``) the environment is set automatically by sat, in respect with SALOME_ requirements. - -2. For other products, the environment is set with the use of the environ section within the pyconf file of the product. The user has two possibilities, either set directly the environment within the section, or specify a python script which wil be used to set the environment programmatically. - -Within the section, the user can define environment variables. He can also modify PATH variables, by appending or prepending directories. -In the following example, we prepend */lib* to ``LD_LIBRARY_PATH`` (note the *left first* underscore), append */lib* to ``PYTHONPATH`` (note the *right last* underscore), and set ``LAPACK_ROOT_DIR`` to **: - -.. code-block:: python - - environ : - { - _LD_LIBRARY_PATH : $install_dir + $VARS.sep + "lib" - PYTHONPATH_ : $install_dir + $VARS.sep + "lib" - LAPACK_ROOT_DIR : $install_dir - } - -It is possible to distinguish the build environment from the launch environment: use a subsection called *build* or *launch*. In the example below, ``LD_LIBRARY_PATH`` and ``PYTHONPATH`` are only modified at run time, not at compile time: - -.. code-block:: python - - environ : - { - build : - { - LAPACK_ROOT_DIR : $install_dir - } - launch : - { - LAPACK_ROOT_DIR : $install_dir - _LD_LIBRARY_PATH : $install_dir + $VARS.sep + "lib" - PYTHONPATH_ : $install_dir + $VARS.sep + "lib" - } - } - -3. The last possibility is to set the environment with a python script. The script should be provided in the *products/env_scripts* directory of the sat project, and its name is specified in the environment section with the key ``environ.env_script``: - -.. code-block:: python - - environ : - { - env_script : 'lapack.py' - } - -Please note that the two modes are complementary and are both taken into account. -Most of the time, the first mode is sufficient. - -The second mode can be used when the environment has to be set programmatically. -The developer implements a handle (as a python method) -which is called by sat to set the environment. -Here is an example: - -.. code-block:: python - - - #!/usr/bin/env python - #-*- coding:utf-8 -*- - - import os.path - import platform - - def set_env(env, prereq_dir, version): - env.set("TRUST_ROOT_DIR",prereq_dir) - env.prepend('PATH', os.path.join(prereq_dir, 'bin')) - env.prepend('PATH', os.path.join(prereq_dir, 'include')) - env.prepend('LD_LIBRARY_PATH', os.path.join(prereq_dir, 'lib')) - return - -SalomeTools defines four handles: - -* **set_env(env, prereq_dir, version)** : used at build and run time. -* **set_env_launch(env, prereq_dir, version)** : used only at run time (if defined!) -* **set_env_build(env, prereq_dir, version)** : used only at build time (if defined!) -* **set_native_env(env)** : used only for native products, at build and run time. - diff --git a/doc/build/html/_sources/commands/generate.rst.txt b/doc/build/html/_sources/commands/generate.rst.txt new file mode 100644 index 0000000..f753261 --- /dev/null +++ b/doc/build/html/_sources/commands/generate.rst.txt @@ -0,0 +1,39 @@ + +.. include:: ../../rst_prolog.rst + +Command generate +**************** + +Description +=========== +The **generate** command generates and compile SALOME modules from cpp modules using YACSGEN. + +.. note:: This command uses YACSGEN to generate the module. It needs to be specified with *--yacsgen* option, or defined in the product or by the environment variable ``$YACSGEN_ROOT_DIR``. + + +Remarks +======= +* This command will only apply on the CPP modules of the application, those who have both properties: :: + + cpp : "yes" + generate : "yes" + +* The cpp module are usually computational components, and the generated module brings the CORBA layer which allows distributing the compononent on remore machines. cpp modules should conform to YACSGEN/hxx2salome requirements (please refer to YACSGEN documentation) + + +Usage +===== +* Generate all the modules of a product: :: + + sat generate + +* Generate only specific modules: :: + + sat generate --products + + Remark: modules which don't have the *generate* property are ignored. + +* Use a specific version of YACSGEN: :: + + sat generate --yacsgen + diff --git a/doc/build/html/_sources/commands/generate.txt b/doc/build/html/_sources/commands/generate.txt deleted file mode 100644 index f753261..0000000 --- a/doc/build/html/_sources/commands/generate.txt +++ /dev/null @@ -1,39 +0,0 @@ - -.. include:: ../../rst_prolog.rst - -Command generate -**************** - -Description -=========== -The **generate** command generates and compile SALOME modules from cpp modules using YACSGEN. - -.. note:: This command uses YACSGEN to generate the module. It needs to be specified with *--yacsgen* option, or defined in the product or by the environment variable ``$YACSGEN_ROOT_DIR``. - - -Remarks -======= -* This command will only apply on the CPP modules of the application, those who have both properties: :: - - cpp : "yes" - generate : "yes" - -* The cpp module are usually computational components, and the generated module brings the CORBA layer which allows distributing the compononent on remore machines. cpp modules should conform to YACSGEN/hxx2salome requirements (please refer to YACSGEN documentation) - - -Usage -===== -* Generate all the modules of a product: :: - - sat generate - -* Generate only specific modules: :: - - sat generate --products - - Remark: modules which don't have the *generate* property are ignored. - -* Use a specific version of YACSGEN: :: - - sat generate --yacsgen - diff --git a/doc/build/html/_sources/commands/launcher.rst.txt b/doc/build/html/_sources/commands/launcher.rst.txt new file mode 100644 index 0000000..864a31a --- /dev/null +++ b/doc/build/html/_sources/commands/launcher.rst.txt @@ -0,0 +1,52 @@ + +.. include:: ../../rst_prolog.rst + +Command launcher +****************** + +Description +=========== +The **launcher** command creates a SALOME launcher, a python script file to start SALOME_. + + +Usage +===== +* Create a launcher: :: + + sat launcher + + Generate a launcher in the application directory, i.e ``$APPLICATION.workdir``. + +* Create a launcher with a given name (default name is ``APPLICATION.profile.launcher_name``) :: + + sat launcher --name ZeLauncher + + The launcher will be called *ZeLauncher*. + +* Set a specific resources catalog: :: + + sat launcher --catalog + + Note that the catalog specified will be copied to the profile directory. + +* Generate the catalog for a list of machines: :: + + sat launcher --gencat + + This will create a catalog by querying each machine (memory, number of processor) with ssh. + +* Generate a mesa launcher (if mesa and llvm are parts of the application). Use this option only if you have to use salome through ssh and have problems with ssh X forwarding of OpengGL modules (like Paravis): :: + + sat launcher --use_mesa + + +Configuration +============= + +Some useful configuration pathes: + +* **APPLICATION.profile** + + * **product** : the name of the profile product (the product in charge of holding the application stuff, like logos, splashscreen) + * **launcher_name** : the name of the launcher. + diff --git a/doc/build/html/_sources/commands/launcher.txt b/doc/build/html/_sources/commands/launcher.txt deleted file mode 100644 index 864a31a..0000000 --- a/doc/build/html/_sources/commands/launcher.txt +++ /dev/null @@ -1,52 +0,0 @@ - -.. include:: ../../rst_prolog.rst - -Command launcher -****************** - -Description -=========== -The **launcher** command creates a SALOME launcher, a python script file to start SALOME_. - - -Usage -===== -* Create a launcher: :: - - sat launcher - - Generate a launcher in the application directory, i.e ``$APPLICATION.workdir``. - -* Create a launcher with a given name (default name is ``APPLICATION.profile.launcher_name``) :: - - sat launcher --name ZeLauncher - - The launcher will be called *ZeLauncher*. - -* Set a specific resources catalog: :: - - sat launcher --catalog - - Note that the catalog specified will be copied to the profile directory. - -* Generate the catalog for a list of machines: :: - - sat launcher --gencat - - This will create a catalog by querying each machine (memory, number of processor) with ssh. - -* Generate a mesa launcher (if mesa and llvm are parts of the application). Use this option only if you have to use salome through ssh and have problems with ssh X forwarding of OpengGL modules (like Paravis): :: - - sat launcher --use_mesa - - -Configuration -============= - -Some useful configuration pathes: - -* **APPLICATION.profile** - - * **product** : the name of the profile product (the product in charge of holding the application stuff, like logos, splashscreen) - * **launcher_name** : the name of the launcher. - diff --git a/doc/build/html/_sources/commands/log.rst.txt b/doc/build/html/_sources/commands/log.rst.txt new file mode 100644 index 0000000..9908f4b --- /dev/null +++ b/doc/build/html/_sources/commands/log.rst.txt @@ -0,0 +1,46 @@ + +.. include:: ../../rst_prolog.rst + +Command log +**************** + +Description +=========== +The **log** command displays sat log in a web browser or in a terminal. + +Usage +===== +* Show (in a web browser) the log of the commands corresponding to an application: :: + + sat log + +* Show the log for commands that do not use any application: :: + + sat log + +* The --terminal (or -t) display the log directly in the terminal, through a CLI_ interactive menu: :: + + sat log --terminal + +* The --last option displays only the last command: :: + + sat log --last + +* To access the last compilation log in terminal mode, use --last_terminal option: :: + + sat log --last_terminal + +* The --clean (int) option erases the n older log files and print the number of remaining log files: :: + + sat log --clean 50 + + + +Some useful configuration pathes +================================= + +* **USER** + + * **browser** : The browser used to show the log (by default *firefox*). + * **log_dir** : The directory used to store the log files. + diff --git a/doc/build/html/_sources/commands/log.txt b/doc/build/html/_sources/commands/log.txt deleted file mode 100644 index 9908f4b..0000000 --- a/doc/build/html/_sources/commands/log.txt +++ /dev/null @@ -1,46 +0,0 @@ - -.. include:: ../../rst_prolog.rst - -Command log -**************** - -Description -=========== -The **log** command displays sat log in a web browser or in a terminal. - -Usage -===== -* Show (in a web browser) the log of the commands corresponding to an application: :: - - sat log - -* Show the log for commands that do not use any application: :: - - sat log - -* The --terminal (or -t) display the log directly in the terminal, through a CLI_ interactive menu: :: - - sat log --terminal - -* The --last option displays only the last command: :: - - sat log --last - -* To access the last compilation log in terminal mode, use --last_terminal option: :: - - sat log --last_terminal - -* The --clean (int) option erases the n older log files and print the number of remaining log files: :: - - sat log --clean 50 - - - -Some useful configuration pathes -================================= - -* **USER** - - * **browser** : The browser used to show the log (by default *firefox*). - * **log_dir** : The directory used to store the log files. - diff --git a/doc/build/html/_sources/commands/package.rst.txt b/doc/build/html/_sources/commands/package.rst.txt new file mode 100644 index 0000000..6d6648a --- /dev/null +++ b/doc/build/html/_sources/commands/package.rst.txt @@ -0,0 +1,81 @@ + +.. include:: ../../rst_prolog.rst + +Command package +**************** + +Description +============ +The **package** command creates a SALOME_ archive (usually a compressed Tar_ file .tgz). +This tar file is used later to intall SALOME on other remote computer. + +Depending on the selected options, the archive includes sources and binaries +of SALOME products and prerequisites. + +Usually utility *salomeTools* is included in the archive. + +.. note:: + By default the package includes the sources of prerequisites and products. + To select a subset use the *--without_property* or *--with_vcs* options. + + +Usage +===== +* Create a package for a product (example as *SALOME_xx*): :: + + sat package SALOME_xx + + This command will create an archive named ``SALOME_xx.tgz`` + in the working directory (``USER.workDir``). + If the archive already exists, do nothing. + + +* Create a package with a specific name: :: + + sat package SALOME_xx --name YourSpecificName + +.. note:: + By default, the archive is created in the working directory of the user (``USER.workDir``). + + If the option *--name* is used with a path (relative or absolute) it will be used. + + If the option *--name* is not used and binaries (prerequisites and products) + are included in the package, the OS_ architecture + will be appended to the name (example: ``SALOME_xx-CO7.tgz``). + + Examples: :: + + # Creates SALOME_xx.tgz in $USER.workDir + sat package SALOME_xx + + # Creates SALOME_xx_.tgz in $USER.workDir + sat package SALOME_xx --binaries + + # Creates MySpecificName.tgz in $USER.workDir + sat package SALOME_xx --name MySpecificName + + +* Force the creation of the archive (if it already exists): :: + + sat package SALOME_xx --force + + +* Include the binaries in the archive (products and prerequisites): :: + + sat package SALOME_xx --binaries + + This command will create an archive named ``SALOME_xx _.tgz`` + where is the OS_ architecture of the machine. + + +* Do not delete Version Control System (VCS_) informations from the configurations files of the embedded salomeTools: :: + + sat package SALOME_xx --with_vcs + + The version control systems known by this option are CVS_, SVN_ and Git_. + + +Some useful configuration pathes +================================= + +No specific configuration. diff --git a/doc/build/html/_sources/commands/package.txt b/doc/build/html/_sources/commands/package.txt deleted file mode 100644 index 6d6648a..0000000 --- a/doc/build/html/_sources/commands/package.txt +++ /dev/null @@ -1,81 +0,0 @@ - -.. include:: ../../rst_prolog.rst - -Command package -**************** - -Description -============ -The **package** command creates a SALOME_ archive (usually a compressed Tar_ file .tgz). -This tar file is used later to intall SALOME on other remote computer. - -Depending on the selected options, the archive includes sources and binaries -of SALOME products and prerequisites. - -Usually utility *salomeTools* is included in the archive. - -.. note:: - By default the package includes the sources of prerequisites and products. - To select a subset use the *--without_property* or *--with_vcs* options. - - -Usage -===== -* Create a package for a product (example as *SALOME_xx*): :: - - sat package SALOME_xx - - This command will create an archive named ``SALOME_xx.tgz`` - in the working directory (``USER.workDir``). - If the archive already exists, do nothing. - - -* Create a package with a specific name: :: - - sat package SALOME_xx --name YourSpecificName - -.. note:: - By default, the archive is created in the working directory of the user (``USER.workDir``). - - If the option *--name* is used with a path (relative or absolute) it will be used. - - If the option *--name* is not used and binaries (prerequisites and products) - are included in the package, the OS_ architecture - will be appended to the name (example: ``SALOME_xx-CO7.tgz``). - - Examples: :: - - # Creates SALOME_xx.tgz in $USER.workDir - sat package SALOME_xx - - # Creates SALOME_xx_.tgz in $USER.workDir - sat package SALOME_xx --binaries - - # Creates MySpecificName.tgz in $USER.workDir - sat package SALOME_xx --name MySpecificName - - -* Force the creation of the archive (if it already exists): :: - - sat package SALOME_xx --force - - -* Include the binaries in the archive (products and prerequisites): :: - - sat package SALOME_xx --binaries - - This command will create an archive named ``SALOME_xx _.tgz`` - where is the OS_ architecture of the machine. - - -* Do not delete Version Control System (VCS_) informations from the configurations files of the embedded salomeTools: :: - - sat package SALOME_xx --with_vcs - - The version control systems known by this option are CVS_, SVN_ and Git_. - - -Some useful configuration pathes -================================= - -No specific configuration. diff --git a/doc/build/html/_sources/commands/prepare.rst.txt b/doc/build/html/_sources/commands/prepare.rst.txt new file mode 100644 index 0000000..a28fdae --- /dev/null +++ b/doc/build/html/_sources/commands/prepare.rst.txt @@ -0,0 +1,100 @@ + +.. include:: ../../rst_prolog.rst + +Command prepare +**************** + +Description +=========== +The **prepare** command brings the sources of an application in the *sources +application directory*, in order to compile them with the compile command. + +The sources can be prepared from VCS software (*cvs, svn, git*), an archive or a directory. + +.. warning:: When sat prepares a product, it first removes the + existing directory, except if the development mode is activated. + When you are working on a product, you need to declare in + the application configuration this product in **dev** mode. + +Remarks +======= + +VCS bases (git, svn, cvs) +------------------------- + +The *prepare* command does not manage authentication on the cvs server. +For example, to prepare modules from a cvs server, you first need to login once. + +To avoid typing a password for each product, +you may use a ssh key with passphrase, or store your password +(in .cvspass or .gitconfig files). +If you have security concerns, it is also possible to use +a bash agent and type your password only once. + + + +Dev mode +-------- + +By default *prepare* uses *export* mode: it creates an image +of the sources, corresponding to the tag or branch specified, +without any link to the VCS base. +To perform a *checkout* (svn, cvs) or a *git clone* (git), +you need to declare the product in dev mode in your application configuration: +edit the application configuration file (pyconf) and modify the product declaration: + +.. code-block:: bash + + sat config -e + # and edit the product section: + # : {tag : "my_tag", dev : "yes", debug : "yes"} + +The first time you will execute the *sat prepare* command, +your module will be downloaded in *checkout* mode +(inside the SOURCES directory of the application. +Then, you can develop in this repository, and finally push +them in the base when they are ready. +If you type during the development process by mistake +a *sat prepare* command, the sources in dev mode will +not be altered/removed (Unless you use -f option) + + +Usage +===== +* Prepare the sources of a complete application in SOURCES directory (all products): :: + + sat prepare + +* Prepare only some modules: :: + + sat prepare --products , ... + +* Use --force to force to prepare the products in development mode + (this will remove the sources and do a new clone/checkout): :: + + sat prepare --force + +* Use --force_patch to force to apply patch to the products + in development mode (otherwise they are not applied): :: + + sat prepare --force_patch + + +Some useful configuration pathes +================================= + +Command *sat prepare* uses the *pyconf file configuration* of each product to know how to get the sources. + +.. note:: to verify configuration of a product, and get name of this *pyconf files configuration* + + .. code-block :: bash + + sat config --info + + +* **get_method**: the method to use to prepare the module, possible values are cvs, git, archive, dir. +* **git_info** : (used if get_method = git) information to prepare sources from git. +* **svn_info** : (used if get_method = svn) information to prepare sources from cvs. +* **cvs_info** : (used if get_method = cvs) information to prepare sources from cvs. +* **archive_info** : (used if get_method = archive) the path to the archive. +* **dir_info** : (used if get_method = dir) the directory with the sources. diff --git a/doc/build/html/_sources/commands/prepare.txt b/doc/build/html/_sources/commands/prepare.txt deleted file mode 100644 index a28fdae..0000000 --- a/doc/build/html/_sources/commands/prepare.txt +++ /dev/null @@ -1,100 +0,0 @@ - -.. include:: ../../rst_prolog.rst - -Command prepare -**************** - -Description -=========== -The **prepare** command brings the sources of an application in the *sources -application directory*, in order to compile them with the compile command. - -The sources can be prepared from VCS software (*cvs, svn, git*), an archive or a directory. - -.. warning:: When sat prepares a product, it first removes the - existing directory, except if the development mode is activated. - When you are working on a product, you need to declare in - the application configuration this product in **dev** mode. - -Remarks -======= - -VCS bases (git, svn, cvs) -------------------------- - -The *prepare* command does not manage authentication on the cvs server. -For example, to prepare modules from a cvs server, you first need to login once. - -To avoid typing a password for each product, -you may use a ssh key with passphrase, or store your password -(in .cvspass or .gitconfig files). -If you have security concerns, it is also possible to use -a bash agent and type your password only once. - - - -Dev mode --------- - -By default *prepare* uses *export* mode: it creates an image -of the sources, corresponding to the tag or branch specified, -without any link to the VCS base. -To perform a *checkout* (svn, cvs) or a *git clone* (git), -you need to declare the product in dev mode in your application configuration: -edit the application configuration file (pyconf) and modify the product declaration: - -.. code-block:: bash - - sat config -e - # and edit the product section: - # : {tag : "my_tag", dev : "yes", debug : "yes"} - -The first time you will execute the *sat prepare* command, -your module will be downloaded in *checkout* mode -(inside the SOURCES directory of the application. -Then, you can develop in this repository, and finally push -them in the base when they are ready. -If you type during the development process by mistake -a *sat prepare* command, the sources in dev mode will -not be altered/removed (Unless you use -f option) - - -Usage -===== -* Prepare the sources of a complete application in SOURCES directory (all products): :: - - sat prepare - -* Prepare only some modules: :: - - sat prepare --products , ... - -* Use --force to force to prepare the products in development mode - (this will remove the sources and do a new clone/checkout): :: - - sat prepare --force - -* Use --force_patch to force to apply patch to the products - in development mode (otherwise they are not applied): :: - - sat prepare --force_patch - - -Some useful configuration pathes -================================= - -Command *sat prepare* uses the *pyconf file configuration* of each product to know how to get the sources. - -.. note:: to verify configuration of a product, and get name of this *pyconf files configuration* - - .. code-block :: bash - - sat config --info - - -* **get_method**: the method to use to prepare the module, possible values are cvs, git, archive, dir. -* **git_info** : (used if get_method = git) information to prepare sources from git. -* **svn_info** : (used if get_method = svn) information to prepare sources from cvs. -* **cvs_info** : (used if get_method = cvs) information to prepare sources from cvs. -* **archive_info** : (used if get_method = archive) the path to the archive. -* **dir_info** : (used if get_method = dir) the directory with the sources. diff --git a/doc/build/html/_sources/configuration.rst.txt b/doc/build/html/_sources/configuration.rst.txt new file mode 100644 index 0000000..7f415a3 --- /dev/null +++ b/doc/build/html/_sources/configuration.rst.txt @@ -0,0 +1,88 @@ +************* +Configuration +************* + +*salomeTools* uses files to store its configuration parameters. + +There are several configuration files which are loaded by salomeTools in a specific order. +When all the files are loaded a *config* object is created. +Then, this object is passed to all command scripts. + + +Syntax +====== +The configuration files use a python-like structure format +(see `config module `_ for a complete description). + +* **{}** define a dictionary, +* **[]** define a list, +* **@** can be used to include a file, +* **$prefix** reference to another parameter (ex: ``$PRODUCT.name``), +* **#** comments. + +.. note:: in this documentation a reference to a configuration parameter will be noted ``XXX.YYY``. + +Description +=========== + +.. _VARS-Section: + +VARS section +------------- +| This section is dynamically created by salomeTools at run time. +| It contains information about the environment: date, time, OS, architecture etc. + +:: + + # to get the current setting + sat config --value VARS + +PRODUCTS section +------------------ +| This section is defined in the product file. +| It contains instructions on how to build a version of SALOME (list of prerequisites-products and versions) + +:: + + # to get the current setting + sat config SALOME-xx --value PRODUCTS + +APPLICATION section +--------------------- +| This section is optional, it is also defined in the product file. +| It gives additional parameters to create an application based on SALOME, as versions of products to use. + +:: + + # to get the current setting + sat config SALOME-xx --value APPLICATION + + +.. _USER-Section: + +USER section +-------------- +This section is defined by the user configuration file, +``~/.salomeTools/salomeTools.pyconf``. + +The ``USER`` section defines some parameters (not exhaustive): + +* **workDir** : + + | The working directory. + | Each product will be usually installed here (in sub-directories). + +* **browser** : The web browser to use (*firefox*). + +* **editor** : The editor to use (*vi, pluma*). + +* and other user preferences. + +:: + + # to get the current setting + sat config SALOME-xx --value USER + + + + diff --git a/doc/build/html/_sources/configuration.txt b/doc/build/html/_sources/configuration.txt deleted file mode 100644 index 7f415a3..0000000 --- a/doc/build/html/_sources/configuration.txt +++ /dev/null @@ -1,88 +0,0 @@ -************* -Configuration -************* - -*salomeTools* uses files to store its configuration parameters. - -There are several configuration files which are loaded by salomeTools in a specific order. -When all the files are loaded a *config* object is created. -Then, this object is passed to all command scripts. - - -Syntax -====== -The configuration files use a python-like structure format -(see `config module `_ for a complete description). - -* **{}** define a dictionary, -* **[]** define a list, -* **@** can be used to include a file, -* **$prefix** reference to another parameter (ex: ``$PRODUCT.name``), -* **#** comments. - -.. note:: in this documentation a reference to a configuration parameter will be noted ``XXX.YYY``. - -Description -=========== - -.. _VARS-Section: - -VARS section -------------- -| This section is dynamically created by salomeTools at run time. -| It contains information about the environment: date, time, OS, architecture etc. - -:: - - # to get the current setting - sat config --value VARS - -PRODUCTS section ------------------- -| This section is defined in the product file. -| It contains instructions on how to build a version of SALOME (list of prerequisites-products and versions) - -:: - - # to get the current setting - sat config SALOME-xx --value PRODUCTS - -APPLICATION section ---------------------- -| This section is optional, it is also defined in the product file. -| It gives additional parameters to create an application based on SALOME, as versions of products to use. - -:: - - # to get the current setting - sat config SALOME-xx --value APPLICATION - - -.. _USER-Section: - -USER section --------------- -This section is defined by the user configuration file, -``~/.salomeTools/salomeTools.pyconf``. - -The ``USER`` section defines some parameters (not exhaustive): - -* **workDir** : - - | The working directory. - | Each product will be usually installed here (in sub-directories). - -* **browser** : The web browser to use (*firefox*). - -* **editor** : The editor to use (*vi, pluma*). - -* and other user preferences. - -:: - - # to get the current setting - sat config SALOME-xx --value USER - - - - diff --git a/doc/build/html/_sources/index.rst.txt b/doc/build/html/_sources/index.rst.txt new file mode 100644 index 0000000..3428cdf --- /dev/null +++ b/doc/build/html/_sources/index.rst.txt @@ -0,0 +1,83 @@ + +.. include:: ../rst_prolog.rst + +.. empty first toctree is used for pdf contents maxdepth, see sphinx/builders/latex/__init__.py, toctrees[0].get('maxdepth') + +.. toctree:: + :maxdepth: 2 + +************ +Salome Tools +************ + +.. image:: images/sat_about.png + :scale: 100 % + :align: center + +.. warning:: This documentation is under construction. + +The **Sa**\ lome\ **T**\ ools (sat) is a suite of commands +that can be used to perform operations on SALOME_. + +For example, sat allows you to compile SALOME's codes +(prerequisites, products) +create application, run tests, create package, etc. + +This utility code is a set of Python_ scripts files. + +Find a `pdf version of this documentation `_ + + +Quick start +=========== + +.. toctree:: + :maxdepth: 1 + + Installation of salomeTools + Configuration + Usage of salomeTools + +List of Commands +================ + +.. toctree:: + :maxdepth: 1 + + config + prepare + compile + launcher + application + log + environ + clean + package + generate + +Developer documentation +======================= + +.. toctree:: + :maxdepth: 1 + + Add a command + + +Code documentation +================== + +.. toctree:: + :maxdepth: 1 + + SAT modules + + +Release Notes +============= + +.. toctree:: + :maxdepth: 1 + + Release Notes 5.0.0 + diff --git a/doc/build/html/_sources/index.txt b/doc/build/html/_sources/index.txt deleted file mode 100644 index 2cfb090..0000000 --- a/doc/build/html/_sources/index.txt +++ /dev/null @@ -1,76 +0,0 @@ - -.. include:: ../rst_prolog.rst - -************ -Salome Tools -************ - -.. image:: images/sat_about.png - :scale: 100 % - :align: center - -.. warning:: This documentation is under construction. - -The **Sa**\ lome\ **T**\ ools (sat) is a suite of commands -that can be used to perform operations on SALOME_. - -For example, sat allows you to compile SALOME's codes -(prerequisites, products) -create application, run tests, create package, etc. - -This utility code is a set of Python_ scripts files. - - -Quick start -=========== - -.. toctree:: - :maxdepth: 1 - - Installation of salomeTools - Configuration - Usage of salomeTools - -List of Commands -================ - -.. toctree:: - :maxdepth: 1 - - config - prepare - compile - launcher - application - log - environ - clean - package - generate - -Developer documentation -======================= - -.. toctree:: - :maxdepth: 1 - - Add a command - - -Code documentation -================== - -.. toctree:: - :maxdepth: 1 - - SAT modules - - -Release Notes -============= - -.. toctree:: - :maxdepth: 1 - - Release Notes 5.0.0 - diff --git a/doc/build/html/_sources/installation_of_sat.rst.txt b/doc/build/html/_sources/installation_of_sat.rst.txt new file mode 100644 index 0000000..da661be --- /dev/null +++ b/doc/build/html/_sources/installation_of_sat.rst.txt @@ -0,0 +1,15 @@ +************ +Installation +************ + +Usually user could find (and use) command **sat** directly after a 'detar' installation of SALOME. + +.. code-block:: bash + + tar -xf .../SALOME_xx.tgz + cd SALOME_xx + ls -l sat # sat -> salomeTools/sat + + +Python package (scripts of salomeTools) actually remains in directory *salomeTools*. + diff --git a/doc/build/html/_sources/installation_of_sat.txt b/doc/build/html/_sources/installation_of_sat.txt deleted file mode 100644 index da661be..0000000 --- a/doc/build/html/_sources/installation_of_sat.txt +++ /dev/null @@ -1,15 +0,0 @@ -************ -Installation -************ - -Usually user could find (and use) command **sat** directly after a 'detar' installation of SALOME. - -.. code-block:: bash - - tar -xf .../SALOME_xx.tgz - cd SALOME_xx - ls -l sat # sat -> salomeTools/sat - - -Python package (scripts of salomeTools) actually remains in directory *salomeTools*. - diff --git a/doc/build/html/_sources/release_notes/release_notes_5.0.0.rst.txt b/doc/build/html/_sources/release_notes/release_notes_5.0.0.rst.txt new file mode 100644 index 0000000..55b6aad --- /dev/null +++ b/doc/build/html/_sources/release_notes/release_notes_5.0.0.rst.txt @@ -0,0 +1,5 @@ +*************** +Release notes +*************** + +In construction. diff --git a/doc/build/html/_sources/release_notes/release_notes_5.0.0.txt b/doc/build/html/_sources/release_notes/release_notes_5.0.0.txt deleted file mode 100644 index 55b6aad..0000000 --- a/doc/build/html/_sources/release_notes/release_notes_5.0.0.txt +++ /dev/null @@ -1,5 +0,0 @@ -*************** -Release notes -*************** - -In construction. diff --git a/doc/build/html/_sources/usage_of_sat.rst.txt b/doc/build/html/_sources/usage_of_sat.rst.txt new file mode 100644 index 0000000..80c7b46 --- /dev/null +++ b/doc/build/html/_sources/usage_of_sat.rst.txt @@ -0,0 +1,97 @@ + +.. include:: ../rst_prolog.rst + +******************** +Usage of SAlomeTools +******************** + +Usage +===== +sat usage is a Command Line Interface (CLI_). + +.. code-block:: bash + + sat [generic_options] [command] [product] [command_options] + +Options of sat +-------------- + +Useful *not exhaustive* generic options of *sat* CLI. + +*--help or -h* +............... + +Get help as simple text. + +.. code-block:: bash + + sat --help # get the list of existing commands + sat --help compile # get the help on a specific command 'compile' + + +*--debug or -g* +................ + +Execution in debug mode allows to see more trace and *stack* if an exception is raised. + +*--verbose or -v* +.................. + +Change verbosity level (default is 3). + +.. code-block:: bash + + # for product 'SALOME_xx' for example + # execute compile command in debug mode with trace level 4 + sat -g -v 4 compile SALOME_xx + + +Build a SALOME product +====================== + +Get the list of available products +---------------------------------- + +To get the list of the current available products in your context: + +.. code-block:: bash + + sat config --list + +Prepare sources of a product +---------------------------- + +To prepare (get) *all* the sources of a product (*SALOME_xx* for example): + +.. code-block:: bash + + sat prepare SALOME_xx + +| The sources are usually copied in directories +| *$USER.workDir + SALOME_xx... + SOURCES + $PRODUCT.name* + + +Compile SALOME +---------------- + +To compile products: + +.. code-block:: bash + + # compile all prerequisites/products + sat compile SALOME_xx + + # compile only 2 products (KERNEL and SAMPLES), if not done yet + sat compile SALOME_xx --products KERNEL,SAMPLES + + # compile only 2 products, unconditionaly + sat compile SALOME_xx ---products SAMPLES --clean_all + + +| The products are usually build in the directories +| *$USER.workDir + SALOME_xx... + BUILD + $PRODUCT.name* +| +| The products are usually installed in the directories +| *$USER.workDir + SALOME_xx... + INSTALL + $PRODUCT.name* + + diff --git a/doc/build/html/_sources/usage_of_sat.txt b/doc/build/html/_sources/usage_of_sat.txt deleted file mode 100644 index 80c7b46..0000000 --- a/doc/build/html/_sources/usage_of_sat.txt +++ /dev/null @@ -1,97 +0,0 @@ - -.. include:: ../rst_prolog.rst - -******************** -Usage of SAlomeTools -******************** - -Usage -===== -sat usage is a Command Line Interface (CLI_). - -.. code-block:: bash - - sat [generic_options] [command] [product] [command_options] - -Options of sat --------------- - -Useful *not exhaustive* generic options of *sat* CLI. - -*--help or -h* -............... - -Get help as simple text. - -.. code-block:: bash - - sat --help # get the list of existing commands - sat --help compile # get the help on a specific command 'compile' - - -*--debug or -g* -................ - -Execution in debug mode allows to see more trace and *stack* if an exception is raised. - -*--verbose or -v* -.................. - -Change verbosity level (default is 3). - -.. code-block:: bash - - # for product 'SALOME_xx' for example - # execute compile command in debug mode with trace level 4 - sat -g -v 4 compile SALOME_xx - - -Build a SALOME product -====================== - -Get the list of available products ----------------------------------- - -To get the list of the current available products in your context: - -.. code-block:: bash - - sat config --list - -Prepare sources of a product ----------------------------- - -To prepare (get) *all* the sources of a product (*SALOME_xx* for example): - -.. code-block:: bash - - sat prepare SALOME_xx - -| The sources are usually copied in directories -| *$USER.workDir + SALOME_xx... + SOURCES + $PRODUCT.name* - - -Compile SALOME ----------------- - -To compile products: - -.. code-block:: bash - - # compile all prerequisites/products - sat compile SALOME_xx - - # compile only 2 products (KERNEL and SAMPLES), if not done yet - sat compile SALOME_xx --products KERNEL,SAMPLES - - # compile only 2 products, unconditionaly - sat compile SALOME_xx ---products SAMPLES --clean_all - - -| The products are usually build in the directories -| *$USER.workDir + SALOME_xx... + BUILD + $PRODUCT.name* -| -| The products are usually installed in the directories -| *$USER.workDir + SALOME_xx... + INSTALL + $PRODUCT.name* - - diff --git a/doc/build/html/_sources/write_command.rst.txt b/doc/build/html/_sources/write_command.rst.txt new file mode 100644 index 0000000..9a68de8 --- /dev/null +++ b/doc/build/html/_sources/write_command.rst.txt @@ -0,0 +1,157 @@ + +.. include:: ../rst_prolog.rst + + +Add a user custom command +*************************** + +Introduction +============ + +.. note:: This documentation is for Python_ developers. + + +The salomeTools product provides a simple way to develop commands. +The first thing to do is to add a file with *.py* extension in the ``commands`` directory of salomeTools. + +Here are the basic requirements that must be followed in this file in order to add a command. + +Basic requirements +================== + +By adding a file *mycommand.py* in the ``commands`` directory, salomeTools will define a new command named ``mycommand``. + +In *mycommand.py*, there must be the following method: :: + + def run(args, runner, logger): + # your algorithm ... + pass + +In fact, at this point, the command will already be functional. +But there are some useful services provided by salomeTools : + +* You can give some options to your command: + +.. code-block:: python + + import src + + # Define all possible option for mycommand command : 'sat mycommand ' + parser = src.options.Options() + parser.add_option('m', 'myoption', \ + 'boolean', 'myoption', \ + 'My option changes the behavior of my command.') + + def run(args, runner, logger): + # Parse the options + (options, args) = parser.parse_args(args) + # algorithm + + +* You can add a *description* method that will display a message when the user will call the help: + + +.. code-block:: python + :emphasize-lines: 9,10 + + import src + + # Define all possible option for mycommand command : 'sat mycommand ' + parser = src.options.Options() + parser.add_option('m', 'myoption', \ + 'boolean', 'myoption', \ + 'My option changes the behavior of my command.') + + def description(): + return _("The help of mycommand.") + + def run(args, runner, logger): + # Parse the options + (options, args) = parser.parse_args(args) + # algorithm + +HowTo access salomeTools config and other commands +======================================================== + +The *runner* variable is an python instance of *Sat* class. +It gives access to *runner.cfg* which is the data model defined from all +*configuration pyconf files* of salomeTools +For example, *runner.cfg.APPLICATION.workdir* +contains the root directory of the current application. + +The *runner* variable gives also access to other commands of salomeTools: + +.. code-block:: python + + # as CLI_ 'sat prepare ...' + runner.prepare(runner.cfg.VARS.application) + +HowTo logger +============== + +The logger variable is an instance of the Logger class. +It gives access to the write method. + +When this method is called, the message passed as parameter +will be displayed in the terminal and written in an xml log file. + +.. code-block:: python + + logger.write("My message", 3) # 3 as default + +The second argument defines the level of verbosity +that is wanted for this message. +It has to be between 1 and 5 (the most verbose level). + +HELLO example +============== + +Here is a *hello* command, file *commands/hello.py*: + +.. code-block:: python + + import src + + """ + hello.py + Define all possible options for hello command: + sat hello + """ + + parser = src.options.Options() + parser.add_option('f', 'french', 'boolean', 'french', "french set hello message in french.") + + def description(): + return _("The help of hello.") + + def run(args, runner, logger): + # Parse the options + (options, args) = parser.parse_args(args) + # algorithm + if not options.french: + logger.write('HELLO! WORLD!\n') + else: + logger.write('Bonjour tout le monde!\n') + +A first call of hello: + +.. code-block:: bash + + # Get the help of hello: + ./sat --help hello + + # To get bonjour + ./sat hello --french + Bonjour tout le monde! + + # To get hello + ./sat hello + HELLO! WORLD! + + # To get the log + ./sat log + + + + + diff --git a/doc/build/html/_sources/write_command.txt b/doc/build/html/_sources/write_command.txt deleted file mode 100644 index 9a68de8..0000000 --- a/doc/build/html/_sources/write_command.txt +++ /dev/null @@ -1,157 +0,0 @@ - -.. include:: ../rst_prolog.rst - - -Add a user custom command -*************************** - -Introduction -============ - -.. note:: This documentation is for Python_ developers. - - -The salomeTools product provides a simple way to develop commands. -The first thing to do is to add a file with *.py* extension in the ``commands`` directory of salomeTools. - -Here are the basic requirements that must be followed in this file in order to add a command. - -Basic requirements -================== - -By adding a file *mycommand.py* in the ``commands`` directory, salomeTools will define a new command named ``mycommand``. - -In *mycommand.py*, there must be the following method: :: - - def run(args, runner, logger): - # your algorithm ... - pass - -In fact, at this point, the command will already be functional. -But there are some useful services provided by salomeTools : - -* You can give some options to your command: - -.. code-block:: python - - import src - - # Define all possible option for mycommand command : 'sat mycommand ' - parser = src.options.Options() - parser.add_option('m', 'myoption', \ - 'boolean', 'myoption', \ - 'My option changes the behavior of my command.') - - def run(args, runner, logger): - # Parse the options - (options, args) = parser.parse_args(args) - # algorithm - - -* You can add a *description* method that will display a message when the user will call the help: - - -.. code-block:: python - :emphasize-lines: 9,10 - - import src - - # Define all possible option for mycommand command : 'sat mycommand ' - parser = src.options.Options() - parser.add_option('m', 'myoption', \ - 'boolean', 'myoption', \ - 'My option changes the behavior of my command.') - - def description(): - return _("The help of mycommand.") - - def run(args, runner, logger): - # Parse the options - (options, args) = parser.parse_args(args) - # algorithm - -HowTo access salomeTools config and other commands -======================================================== - -The *runner* variable is an python instance of *Sat* class. -It gives access to *runner.cfg* which is the data model defined from all -*configuration pyconf files* of salomeTools -For example, *runner.cfg.APPLICATION.workdir* -contains the root directory of the current application. - -The *runner* variable gives also access to other commands of salomeTools: - -.. code-block:: python - - # as CLI_ 'sat prepare ...' - runner.prepare(runner.cfg.VARS.application) - -HowTo logger -============== - -The logger variable is an instance of the Logger class. -It gives access to the write method. - -When this method is called, the message passed as parameter -will be displayed in the terminal and written in an xml log file. - -.. code-block:: python - - logger.write("My message", 3) # 3 as default - -The second argument defines the level of verbosity -that is wanted for this message. -It has to be between 1 and 5 (the most verbose level). - -HELLO example -============== - -Here is a *hello* command, file *commands/hello.py*: - -.. code-block:: python - - import src - - """ - hello.py - Define all possible options for hello command: - sat hello - """ - - parser = src.options.Options() - parser.add_option('f', 'french', 'boolean', 'french', "french set hello message in french.") - - def description(): - return _("The help of hello.") - - def run(args, runner, logger): - # Parse the options - (options, args) = parser.parse_args(args) - # algorithm - if not options.french: - logger.write('HELLO! WORLD!\n') - else: - logger.write('Bonjour tout le monde!\n') - -A first call of hello: - -.. code-block:: bash - - # Get the help of hello: - ./sat --help hello - - # To get bonjour - ./sat hello --french - Bonjour tout le monde! - - # To get hello - ./sat hello - HELLO! WORLD! - - # To get the log - ./sat log - - - - - diff --git a/doc/build/html/_static/basic.css b/doc/build/html/_static/basic.css index 43e8baf..19ced10 100644 --- a/doc/build/html/_static/basic.css +++ b/doc/build/html/_static/basic.css @@ -4,7 +4,7 @@ * * Sphinx stylesheet -- basic theme. * - * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -52,6 +52,8 @@ div.sphinxsidebar { width: 230px; margin-left: -100%; font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; } div.sphinxsidebar ul { @@ -80,15 +82,24 @@ div.sphinxsidebar input { } div.sphinxsidebar #searchbox input[type="text"] { - width: 170px; + float: left; + width: 80%; + padding: 0.25em; + box-sizing: border-box; } div.sphinxsidebar #searchbox input[type="submit"] { - width: 30px; + float: left; + width: 20%; + border-left: none; + padding: 0.25em; + box-sizing: border-box; } + img { border: 0; + max-width: 100%; } /* -- search page ----------------------------------------------------------- */ @@ -123,6 +134,8 @@ ul.keywordmatches li.goodmatch a { table.contentstable { width: 90%; + margin-left: auto; + margin-right: auto; } table.contentstable p.biglink { @@ -150,9 +163,14 @@ table.indextable td { vertical-align: top; } -table.indextable dl, table.indextable dd { +table.indextable ul { margin-top: 0; margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; } table.indextable tr.pcap { @@ -184,8 +202,27 @@ div.genindex-jumpbox { padding: 0.4em; } +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + /* -- general body styles --------------------------------------------------- */ +div.body { + min-width: 450px; + max-width: 800px; +} + +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + a.headerlink { visibility: hidden; } @@ -196,7 +233,10 @@ h3:hover > a.headerlink, h4:hover > a.headerlink, h5:hover > a.headerlink, h6:hover > a.headerlink, -dt:hover > a.headerlink { +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { visibility: visible; } @@ -208,10 +248,6 @@ div.body td { text-align: left; } -.field-list ul { - padding-left: 1em; -} - .first { margin-top: 0 !important; } @@ -313,6 +349,18 @@ table.docutils { border-collapse: collapse; } +table.align-center { + margin-left: auto; + margin-right: auto; +} + +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + table.docutils td, table.docutils th { padding: 1px 8px 1px 5px; border-top: 0; @@ -321,10 +369,6 @@ table.docutils td, table.docutils th { border-bottom: 1px solid #aaa; } -table.field-list td, table.field-list th { - border: 0 !important; -} - table.footnote td, table.footnote th { border: 0 !important; } @@ -343,6 +387,46 @@ table.citation td { border-bottom: none; } +/* -- figures --------------------------------------------------------------- */ + +div.figure { + margin: 0.5em; + padding: 0.5em; +} + +div.figure p.caption { + padding: 0.3em; +} + +div.figure p.caption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text { +} + +/* -- field list styles ----------------------------------------------------- */ + +table.field-list td, table.field-list th { + border: 0 !important; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + /* -- other body styles ----------------------------------------------------- */ ol.arabic { @@ -383,32 +467,27 @@ dd { margin-left: 30px; } -dt:target, .highlighted { +dt:target, span.highlighted { background-color: #fbe54e; } +rect.highlighted { + fill: #fbe54e; +} + dl.glossary dt { font-weight: bold; font-size: 1.1em; } -.field-list ul { - margin: 0; - padding-left: 1em; -} - -.field-list p { - margin: 0; -} - -.refcount { - color: #060; -} - .optional { font-size: 1.3em; } +.sig-paren { + font-size: larger; +} + .versionmodified { font-style: italic; } @@ -459,6 +538,13 @@ pre { overflow-y: hidden; /* fixes display issues on Chrome browsers */ } +span.pre { + -moz-hyphens: none; + -ms-hyphens: none; + -webkit-hyphens: none; + hyphens: none; +} + td.linenos pre { padding: 5px 0px; border: 0; @@ -474,22 +560,51 @@ table.highlighttable td { padding: 0 0.5em 0 0.5em; } -tt.descname { +div.code-block-caption { + padding: 2px 5px; + font-size: small; +} + +div.code-block-caption code { + background-color: transparent; +} + +div.code-block-caption + div > div.highlight > pre { + margin-top: 0; +} + +div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.code-block-caption span.caption-text { +} + +div.literal-block-wrapper { + padding: 1em 1em 0; +} + +div.literal-block-wrapper div.highlight { + margin: 0; +} + +code.descname { background-color: transparent; font-weight: bold; font-size: 1.2em; } -tt.descclassname { +code.descclassname { background-color: transparent; } -tt.xref, a tt { +code.xref, a code { background-color: transparent; font-weight: bold; } -h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { background-color: transparent; } @@ -521,6 +636,16 @@ span.eqno { float: right; } +span.eqno a.headerlink { + position: relative; + left: 0px; + z-index: 1; +} + +div.math:hover a.headerlink { + visibility: visible; +} + /* -- printout stylesheet --------------------------------------------------- */ @media print { diff --git a/doc/build/html/_static/comment-bright.png b/doc/build/html/_static/comment-bright.png index 551517b..15e27ed 100644 Binary files a/doc/build/html/_static/comment-bright.png and b/doc/build/html/_static/comment-bright.png differ diff --git a/doc/build/html/_static/comment-close.png b/doc/build/html/_static/comment-close.png index 09b54be..4d91bcf 100644 Binary files a/doc/build/html/_static/comment-close.png and b/doc/build/html/_static/comment-close.png differ diff --git a/doc/build/html/_static/comment.png b/doc/build/html/_static/comment.png index 92feb52..dfbc0cb 100644 Binary files a/doc/build/html/_static/comment.png and b/doc/build/html/_static/comment.png differ diff --git a/doc/build/html/_static/doctools.js b/doc/build/html/_static/doctools.js index d4619fd..d892892 100644 --- a/doc/build/html/_static/doctools.js +++ b/doc/build/html/_static/doctools.js @@ -4,7 +4,7 @@ * * Sphinx JavaScript utilities for all documentation. * - * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -32,7 +32,7 @@ if (!window.console || !console.firebug) { */ jQuery.urldecode = function(x) { return decodeURIComponent(x).replace(/\+/g, ' '); -} +}; /** * small helper function to urlencode strings @@ -45,7 +45,7 @@ jQuery.urlencode = encodeURIComponent; * it will always return arrays of strings for the value parts. */ jQuery.getQueryParameters = function(s) { - if (typeof s == 'undefined') + if (typeof s === 'undefined') s = document.location.search; var parts = s.substr(s.indexOf('?') + 1).split('&'); var result = {}; @@ -61,48 +61,86 @@ jQuery.getQueryParameters = function(s) { return result; }; -/** - * small function to check if an array contains - * a given item. - */ -jQuery.contains = function(arr, item) { - for (var i = 0; i < arr.length; i++) { - if (arr[i] == item) - return true; - } - return false; -}; - /** * highlight a given string on a jquery object by wrapping it in * span elements with the given class name. */ jQuery.fn.highlightText = function(text, className) { - function highlight(node) { - if (node.nodeType == 3) { + function highlight(node, addItems) { + if (node.nodeType === 3) { var val = node.nodeValue; var pos = val.toLowerCase().indexOf(text); - if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { - var span = document.createElement("span"); - span.className = className; + if (pos >= 0 && + !jQuery(node.parentNode).hasClass(className) && + !jQuery(node.parentNode).hasClass("nohighlight")) { + var span; + var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg"); + if (isInSVG) { + span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + } else { + span = document.createElement("span"); + span.className = className; + } span.appendChild(document.createTextNode(val.substr(pos, text.length))); node.parentNode.insertBefore(span, node.parentNode.insertBefore( document.createTextNode(val.substr(pos + text.length)), node.nextSibling)); node.nodeValue = val.substr(0, pos); + if (isInSVG) { + var bbox = span.getBBox(); + var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); + rect.x.baseVal.value = bbox.x; + rect.y.baseVal.value = bbox.y; + rect.width.baseVal.value = bbox.width; + rect.height.baseVal.value = bbox.height; + rect.setAttribute('class', className); + var parentOfText = node.parentNode.parentNode; + addItems.push({ + "parent": node.parentNode, + "target": rect}); + } } } else if (!jQuery(node).is("button, select, textarea")) { jQuery.each(node.childNodes, function() { - highlight(this); + highlight(this, addItems); }); } } - return this.each(function() { - highlight(this); + var addItems = []; + var result = this.each(function() { + highlight(this, addItems); }); + for (var i = 0; i < addItems.length; ++i) { + jQuery(addItems[i].parent).before(addItems[i].target); + } + return result; }; +/* + * backward compatibility for jQuery.browser + * This will be supported until firefox bug is fixed. + */ +if (!jQuery.browser) { + jQuery.uaMatch = function(ua) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || + /(webkit)[ \/]([\w.]+)/.exec(ua) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || + /(msie) ([\w.]+)/.exec(ua) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; + }; + jQuery.browser = {}; + jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; +} + /** * Small JavaScript module for the documentation. */ @@ -112,27 +150,28 @@ var Documentation = { this.fixFirefoxAnchorBug(); this.highlightSearchWords(); this.initIndexTable(); + }, /** * i18n support */ TRANSLATIONS : {}, - PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, + PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; }, LOCALE : 'unknown', // gettext and ngettext don't access this so that the functions // can safely bound to a different name (_ = Documentation.gettext) gettext : function(string) { var translated = Documentation.TRANSLATIONS[string]; - if (typeof translated == 'undefined') + if (typeof translated === 'undefined') return string; - return (typeof translated == 'string') ? translated : translated[0]; + return (typeof translated === 'string') ? translated : translated[0]; }, ngettext : function(singular, plural, n) { var translated = Documentation.TRANSLATIONS[singular]; - if (typeof translated == 'undefined') + if (typeof translated === 'undefined') return (n == 1) ? singular : plural; return translated[Documentation.PLURALEXPR(n)]; }, @@ -164,6 +203,7 @@ var Documentation = { /** * workaround a firefox stupidity + * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075 */ fixFirefoxAnchorBug : function() { if (document.location.hash && $.browser.mozilla) @@ -180,6 +220,9 @@ var Documentation = { var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; if (terms.length) { var body = $('div.body'); + if (!body.length) { + body = $('body'); + } window.setTimeout(function() { $.each(terms, function() { body.highlightText(this.toLowerCase(), 'highlighted'); @@ -199,7 +242,7 @@ var Documentation = { var src = $(this).attr('src'); var idnum = $(this).attr('id').substr(7); $('tr.cg-' + idnum).toggle(); - if (src.substr(-9) == 'minus.png') + if (src.substr(-9) === 'minus.png') $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); else $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); @@ -231,11 +274,34 @@ var Documentation = { var path = document.location.pathname; var parts = path.split(/\//); $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { - if (this == '..') + if (this === '..') parts.pop(); }); var url = parts.join('/'); return path.substring(url.lastIndexOf('/') + 1, path.length - 1); + }, + + initOnKeyListeners: function() { + $(document).keyup(function(event) { + var activeElementType = document.activeElement.tagName; + // don't navigate when in search box or textarea + if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { + switch (event.keyCode) { + case 37: // left + var prevHref = $('link[rel="prev"]').prop('href'); + if (prevHref) { + window.location.href = prevHref; + return false; + } + case 39: // right + var nextHref = $('link[rel="next"]').prop('href'); + if (nextHref) { + window.location.href = nextHref; + return false; + } + } + } + }); } }; @@ -244,4 +310,4 @@ _ = Documentation.gettext; $(document).ready(function() { Documentation.init(); -}); +}); \ No newline at end of file diff --git a/doc/build/html/_static/documentation_options.js b/doc/build/html/_static/documentation_options.js new file mode 100644 index 0000000..47f9066 --- /dev/null +++ b/doc/build/html/_static/documentation_options.js @@ -0,0 +1,9 @@ +var DOCUMENTATION_OPTIONS = { + URL_ROOT: '', + VERSION: '5.0.0dev', + LANGUAGE: 'None', + COLLAPSE_INDEX: false, + FILE_SUFFIX: '.html', + HAS_SOURCE: true, + SOURCELINK_SUFFIX: '.txt' +}; \ No newline at end of file diff --git a/doc/build/html/_static/down-pressed.png b/doc/build/html/_static/down-pressed.png index 6f7ad78..5756c8c 100644 Binary files a/doc/build/html/_static/down-pressed.png and b/doc/build/html/_static/down-pressed.png differ diff --git a/doc/build/html/_static/down.png b/doc/build/html/_static/down.png index 3003a88..1b3bdad 100644 Binary files a/doc/build/html/_static/down.png and b/doc/build/html/_static/down.png differ diff --git a/doc/build/html/_static/file.png b/doc/build/html/_static/file.png index d18082e..a858a41 100644 Binary files a/doc/build/html/_static/file.png and b/doc/build/html/_static/file.png differ diff --git a/doc/build/html/_static/jquery-3.2.1.js b/doc/build/html/_static/jquery-3.2.1.js new file mode 100644 index 0000000..d2d8ca4 --- /dev/null +++ b/doc/build/html/_static/jquery-3.2.1.js @@ -0,0 +1,10253 @@ +/*! + * jQuery JavaScript Library v3.2.1 + * https://jquery.com/ + * + * Includes Sizzle.js + * https://sizzlejs.com/ + * + * Copyright JS Foundation and other contributors + * Released under the MIT license + * https://jquery.org/license + * + * Date: 2017-03-20T18:59Z + */ +( function( global, factory ) { + + "use strict"; + + if ( typeof module === "object" && typeof module.exports === "object" ) { + + // For CommonJS and CommonJS-like environments where a proper `window` + // is present, execute the factory and get jQuery. + // For environments that do not have a `window` with a `document` + // (such as Node.js), expose a factory as module.exports. + // This accentuates the need for the creation of a real `window`. + // e.g. var jQuery = require("jquery")(window); + // See ticket #14549 for more info. + module.exports = global.document ? + factory( global, true ) : + function( w ) { + if ( !w.document ) { + throw new Error( "jQuery requires a window with a document" ); + } + return factory( w ); + }; + } else { + factory( global ); + } + +// Pass this if window is not defined yet +} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { + +// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 +// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode +// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common +// enough that all such attempts are guarded in a try block. +"use strict"; + +var arr = []; + +var document = window.document; + +var getProto = Object.getPrototypeOf; + +var slice = arr.slice; + +var concat = arr.concat; + +var push = arr.push; + +var indexOf = arr.indexOf; + +var class2type = {}; + +var toString = class2type.toString; + +var hasOwn = class2type.hasOwnProperty; + +var fnToString = hasOwn.toString; + +var ObjectFunctionString = fnToString.call( Object ); + +var support = {}; + + + + function DOMEval( code, doc ) { + doc = doc || document; + + var script = doc.createElement( "script" ); + + script.text = code; + doc.head.appendChild( script ).parentNode.removeChild( script ); + } +/* global Symbol */ +// Defining this global in .eslintrc.json would create a danger of using the global +// unguarded in another place, it seems safer to define global only for this module + + + +var + version = "3.2.1", + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + + // The jQuery object is actually just the init constructor 'enhanced' + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); + }, + + // Support: Android <=4.0 only + // Make sure we trim BOM and NBSP + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([a-z])/g, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }; + +jQuery.fn = jQuery.prototype = { + + // The current version of jQuery being used + jquery: version, + + constructor: jQuery, + + // The default length of a jQuery object is 0 + length: 0, + + toArray: function() { + return slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + + // Return all the elements in a clean array + if ( num == null ) { + return slice.call( this ); + } + + // Return just the one element from the set + return num < 0 ? this[ num + this.length ] : this[ num ]; + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + each: function( callback ) { + return jQuery.each( this, callback ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map( this, function( elem, i ) { + return callback.call( elem, i, elem ); + } ) ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); + }, + + end: function() { + return this.prevObject || this.constructor(); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: arr.sort, + splice: arr.splice +}; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[ 0 ] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + + // Skip the boolean and the target + target = arguments[ i ] || {}; + i++; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { + target = {}; + } + + // Extend jQuery itself if only one argument is passed + if ( i === length ) { + target = this; + i--; + } + + for ( ; i < length; i++ ) { + + // Only deal with non-null/undefined values + if ( ( options = arguments[ i ] ) != null ) { + + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject( copy ) || + ( copyIsArray = Array.isArray( copy ) ) ) ) { + + if ( copyIsArray ) { + copyIsArray = false; + clone = src && Array.isArray( src ) ? src : []; + + } else { + clone = src && jQuery.isPlainObject( src ) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend( { + + // Unique for each copy of jQuery on the page + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), + + // Assume jQuery is ready without the ready module + isReady: true, + + error: function( msg ) { + throw new Error( msg ); + }, + + noop: function() {}, + + isFunction: function( obj ) { + return jQuery.type( obj ) === "function"; + }, + + isWindow: function( obj ) { + return obj != null && obj === obj.window; + }, + + isNumeric: function( obj ) { + + // As of jQuery 3.0, isNumeric is limited to + // strings and numbers (primitives or objects) + // that can be coerced to finite numbers (gh-2662) + var type = jQuery.type( obj ); + return ( type === "number" || type === "string" ) && + + // parseFloat NaNs numeric-cast false positives ("") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + !isNaN( obj - parseFloat( obj ) ); + }, + + isPlainObject: function( obj ) { + var proto, Ctor; + + // Detect obvious negatives + // Use toString instead of jQuery.type to catch host objects + if ( !obj || toString.call( obj ) !== "[object Object]" ) { + return false; + } + + proto = getProto( obj ); + + // Objects with no prototype (e.g., `Object.create( null )`) are plain + if ( !proto ) { + return true; + } + + // Objects with prototype are plain iff they were constructed by a global Object function + Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; + return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; + }, + + isEmptyObject: function( obj ) { + + /* eslint-disable no-unused-vars */ + // See https://github.com/eslint/eslint/issues/6125 + var name; + + for ( name in obj ) { + return false; + } + return true; + }, + + type: function( obj ) { + if ( obj == null ) { + return obj + ""; + } + + // Support: Android <=2.3 only (functionish RegExp) + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call( obj ) ] || "object" : + typeof obj; + }, + + // Evaluates a script in a global context + globalEval: function( code ) { + DOMEval( code ); + }, + + // Convert dashed to camelCase; used by the css and data modules + // Support: IE <=9 - 11, Edge 12 - 13 + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + each: function( obj, callback ) { + var length, i = 0; + + if ( isArrayLike( obj ) ) { + length = obj.length; + for ( ; i < length; i++ ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } else { + for ( i in obj ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } + + return obj; + }, + + // Support: Android <=4.0 only + trim: function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArrayLike( Object( arr ) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + return arr == null ? -1 : indexOf.call( arr, elem, i ); + }, + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + merge: function( first, second ) { + var len = +second.length, + j = 0, + i = first.length; + + for ( ; j < len; j++ ) { + first[ i++ ] = second[ j ]; + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], + i = 0, + length = elems.length, + callbackExpect = !invert; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var length, value, + i = 0, + ret = []; + + // Go through the array, translating each of the items to their new values + if ( isArrayLike( elems ) ) { + length = elems.length; + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + } + + // Flatten any nested arrays + return concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + now: Date.now, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support +} ); + +if ( typeof Symbol === "function" ) { + jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; +} + +// Populate the class2type map +jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), +function( i, name ) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +} ); + +function isArrayLike( obj ) { + + // Support: real iOS 8.2 only (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = !!obj && "length" in obj && obj.length, + type = jQuery.type( obj ); + + if ( type === "function" || jQuery.isWindow( obj ) ) { + return false; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; +} +var Sizzle = +/*! + * Sizzle CSS Selector Engine v2.3.3 + * https://sizzlejs.com/ + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2016-08-08 + */ +(function( window ) { + +var i, + support, + Expr, + getText, + isXML, + tokenize, + compile, + select, + outermostContext, + sortInput, + hasDuplicate, + + // Local document vars + setDocument, + document, + docElem, + documentIsHTML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + + // Instance-specific data + expando = "sizzle" + 1 * new Date(), + preferredDoc = window.document, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }, + + // Instance methods + hasOwn = ({}).hasOwnProperty, + arr = [], + pop = arr.pop, + push_native = arr.push, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf as it's faster than native + // https://jsperf.com/thor-indexof-vs-for/5 + indexOf = function( list, elem ) { + var i = 0, + len = list.length; + for ( ; i < len; i++ ) { + if ( list[i] === elem ) { + return i; + } + } + return -1; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + + // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", + + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + + "*\\]", + + pseudos = ":(" + identifier + ")(?:\\((" + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rwhitespace = new RegExp( whitespace + "+", "g" ), + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), + + rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + identifier + ")" ), + "CLASS": new RegExp( "^\\.(" + identifier + ")" ), + "TAG": new RegExp( "^(" + identifier + "|[*])" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rnative = /^[^{]+\{\s*\[native \w/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + + // CSS escapes + // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), + funescape = function( _, escaped, escapedWhitespace ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + // Support: Firefox<24 + // Workaround erroneous numeric interpretation of +"0x" + return high !== high || escapedWhitespace ? + escaped : + high < 0 ? + // BMP codepoint + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }, + + // CSS string/identifier serialization + // https://drafts.csswg.org/cssom/#common-serializing-idioms + rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, + fcssescape = function( ch, asCodePoint ) { + if ( asCodePoint ) { + + // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER + if ( ch === "\0" ) { + return "\uFFFD"; + } + + // Control characters and (dependent upon position) numbers get escaped as code points + return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; + } + + // Other potentially-special ASCII characters get backslash-escaped + return "\\" + ch; + }, + + // Used for iframes + // See setDocument() + // Removing the function wrapper causes a "Permission Denied" + // error in IE + unloadHandler = function() { + setDocument(); + }, + + disabledAncestor = addCombinator( + function( elem ) { + return elem.disabled === true && ("form" in elem || "label" in elem); + }, + { dir: "parentNode", next: "legend" } + ); + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + (arr = slice.call( preferredDoc.childNodes )), + preferredDoc.childNodes + ); + // Support: Android<4.0 + // Detect silently failing push.apply + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + push_native.apply( target, slice.call(els) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length, + i = 0; + // Can't trust NodeList.length + while ( (target[j++] = els[i++]) ) {} + target.length = j - 1; + } + }; +} + +function Sizzle( selector, context, results, seed ) { + var m, i, elem, nid, match, groups, newSelector, + newContext = context && context.ownerDocument, + + // nodeType defaults to 9, since context defaults to document + nodeType = context ? context.nodeType : 9; + + results = results || []; + + // Return early from calls with invalid selector or context + if ( typeof selector !== "string" || !selector || + nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { + + return results; + } + + // Try to shortcut find operations (as opposed to filters) in HTML documents + if ( !seed ) { + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + context = context || document; + + if ( documentIsHTML ) { + + // If the selector is sufficiently simple, try using a "get*By*" DOM method + // (excepting DocumentFragment context, where the methods don't exist) + if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { + + // ID selector + if ( (m = match[1]) ) { + + // Document context + if ( nodeType === 9 ) { + if ( (elem = context.getElementById( m )) ) { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + + // Element context + } else { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( newContext && (elem = newContext.getElementById( m )) && + contains( context, elem ) && + elem.id === m ) { + + results.push( elem ); + return results; + } + } + + // Type selector + } else if ( match[2] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Class selector + } else if ( (m = match[3]) && support.getElementsByClassName && + context.getElementsByClassName ) { + + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // Take advantage of querySelectorAll + if ( support.qsa && + !compilerCache[ selector + " " ] && + (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { + + if ( nodeType !== 1 ) { + newContext = context; + newSelector = selector; + + // qSA looks outside Element context, which is not what we want + // Thanks to Andrew Dupont for this workaround technique + // Support: IE <=8 + // Exclude object elements + } else if ( context.nodeName.toLowerCase() !== "object" ) { + + // Capture the context ID, setting it first if necessary + if ( (nid = context.getAttribute( "id" )) ) { + nid = nid.replace( rcssescape, fcssescape ); + } else { + context.setAttribute( "id", (nid = expando) ); + } + + // Prefix every selector in the list + groups = tokenize( selector ); + i = groups.length; + while ( i-- ) { + groups[i] = "#" + nid + " " + toSelector( groups[i] ); + } + newSelector = groups.join( "," ); + + // Expand context for sibling selectors + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || + context; + } + + if ( newSelector ) { + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch ( qsaError ) { + } finally { + if ( nid === expando ) { + context.removeAttribute( "id" ); + } + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Create key-value caches of limited size + * @returns {function(string, object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key + " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key + " " ] = value); + } + return cache; +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created element and returns a boolean result + */ +function assert( fn ) { + var el = document.createElement("fieldset"); + + try { + return !!fn( el ); + } catch (e) { + return false; + } finally { + // Remove from its parent by default + if ( el.parentNode ) { + el.parentNode.removeChild( el ); + } + // release memory in IE + el = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split("|"), + i = arr.length; + + while ( i-- ) { + Expr.attrHandle[ arr[i] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + a.sourceIndex - b.sourceIndex; + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for :enabled/:disabled + * @param {Boolean} disabled true for :disabled; false for :enabled + */ +function createDisabledPseudo( disabled ) { + + // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable + return function( elem ) { + + // Only certain elements can match :enabled or :disabled + // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled + // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled + if ( "form" in elem ) { + + // Check for inherited disabledness on relevant non-disabled elements: + // * listed form-associated elements in a disabled fieldset + // https://html.spec.whatwg.org/multipage/forms.html#category-listed + // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled + // * option elements in a disabled optgroup + // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled + // All such elements have a "form" property. + if ( elem.parentNode && elem.disabled === false ) { + + // Option elements defer to a parent optgroup if present + if ( "label" in elem ) { + if ( "label" in elem.parentNode ) { + return elem.parentNode.disabled === disabled; + } else { + return elem.disabled === disabled; + } + } + + // Support: IE 6 - 11 + // Use the isDisabled shortcut property to check for disabled fieldset ancestors + return elem.isDisabled === disabled || + + // Where there is no isDisabled, check manually + /* jshint -W018 */ + elem.isDisabled !== !disabled && + disabledAncestor( elem ) === disabled; + } + + return elem.disabled === disabled; + + // Try to winnow out elements that can't be disabled before trusting the disabled property. + // Some victims get caught in our net (label, legend, menu, track), but it shouldn't + // even exist on them, let alone have a boolean value. + } else if ( "label" in elem ) { + return elem.disabled === disabled; + } + + // Remaining elements are neither :enabled nor :disabled + return false; + }; +} + +/** + * Returns a function to use in pseudos for positionals + * @param {Function} fn + */ +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Checks a node for validity as a Sizzle context + * @param {Element|Object=} context + * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value + */ +function testContext( context ) { + return context && typeof context.getElementsByTagName !== "undefined" && context; +} + +// Expose support vars for convenience +support = Sizzle.support = {}; + +/** + * Detects XML nodes + * @param {Element|Object} elem An element or a document + * @returns {Boolean} True iff elem is a non-HTML XML node + */ +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var hasCompare, subWindow, + doc = node ? node.ownerDocument || node : preferredDoc; + + // Return early if doc is invalid or already selected + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Update global variables + document = doc; + docElem = document.documentElement; + documentIsHTML = !isXML( document ); + + // Support: IE 9-11, Edge + // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) + if ( preferredDoc !== document && + (subWindow = document.defaultView) && subWindow.top !== subWindow ) { + + // Support: IE 11, Edge + if ( subWindow.addEventListener ) { + subWindow.addEventListener( "unload", unloadHandler, false ); + + // Support: IE 9 - 10 only + } else if ( subWindow.attachEvent ) { + subWindow.attachEvent( "onunload", unloadHandler ); + } + } + + /* Attributes + ---------------------------------------------------------------------- */ + + // Support: IE<8 + // Verify that getAttribute really returns attributes and not properties + // (excepting IE8 booleans) + support.attributes = assert(function( el ) { + el.className = "i"; + return !el.getAttribute("className"); + }); + + /* getElement(s)By* + ---------------------------------------------------------------------- */ + + // Check if getElementsByTagName("*") returns only elements + support.getElementsByTagName = assert(function( el ) { + el.appendChild( document.createComment("") ); + return !el.getElementsByTagName("*").length; + }); + + // Support: IE<9 + support.getElementsByClassName = rnative.test( document.getElementsByClassName ); + + // Support: IE<10 + // Check if getElementById returns elements by name + // The broken getElementById methods don't pick up programmatically-set names, + // so use a roundabout getElementsByName test + support.getById = assert(function( el ) { + docElem.appendChild( el ).id = expando; + return !document.getElementsByName || !document.getElementsByName( expando ).length; + }); + + // ID filter and find + if ( support.getById ) { + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute("id") === attrId; + }; + }; + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { + var elem = context.getElementById( id ); + return elem ? [ elem ] : []; + } + }; + } else { + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== "undefined" && + elem.getAttributeNode("id"); + return node && node.value === attrId; + }; + }; + + // Support: IE 6 - 7 only + // getElementById is not reliable as a find shortcut + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { + var node, i, elems, + elem = context.getElementById( id ); + + if ( elem ) { + + // Verify the id attribute + node = elem.getAttributeNode("id"); + if ( node && node.value === id ) { + return [ elem ]; + } + + // Fall back on getElementsByName + elems = context.getElementsByName( id ); + i = 0; + while ( (elem = elems[i++]) ) { + node = elem.getAttributeNode("id"); + if ( node && node.value === id ) { + return [ elem ]; + } + } + } + + return []; + } + }; + } + + // Tag + Expr.find["TAG"] = support.getElementsByTagName ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( tag ); + + // DocumentFragment nodes don't have gEBTN + } else if ( support.qsa ) { + return context.querySelectorAll( tag ); + } + } : + + function( tag, context ) { + var elem, + tmp = [], + i = 0, + // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + while ( (elem = results[i++]) ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Class + Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { + if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { + return context.getElementsByClassName( className ); + } + }; + + /* QSA/matchesSelector + ---------------------------------------------------------------------- */ + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21) + // We allow this because of a bug in IE8/9 that throws an error + // whenever `document.activeElement` is accessed on an iframe + // So, we allow :focus to pass through QSA all the time to avoid the IE error + // See https://bugs.jquery.com/ticket/13378 + rbuggyQSA = []; + + if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( el ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explicitly + // setting a boolean content attribute, + // since its presence should be enough + // https://bugs.jquery.com/ticket/12359 + docElem.appendChild( el ).innerHTML = "" + + ""; + + // Support: IE8, Opera 11-12.16 + // Nothing should be selected when empty strings follow ^= or $= or *= + // The test attribute must be unknown in Opera but "safe" for WinRT + // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section + if ( el.querySelectorAll("[msallowcapture^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); + } + + // Support: IE8 + // Boolean attributes and "value" are not treated correctly + if ( !el.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); + } + + // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ + if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { + rbuggyQSA.push("~="); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !el.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + + // Support: Safari 8+, iOS 8+ + // https://bugs.webkit.org/show_bug.cgi?id=136851 + // In-page `selector#id sibling-combinator selector` fails + if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { + rbuggyQSA.push(".#.+[+~]"); + } + }); + + assert(function( el ) { + el.innerHTML = "" + + ""; + + // Support: Windows 8 Native Apps + // The type and name attributes are restricted during .innerHTML assignment + var input = document.createElement("input"); + input.setAttribute( "type", "hidden" ); + el.appendChild( input ).setAttribute( "name", "D" ); + + // Support: IE8 + // Enforce case-sensitivity of name attribute + if ( el.querySelectorAll("[name=d]").length ) { + rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( el.querySelectorAll(":enabled").length !== 2 ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Support: IE9-11+ + // IE's :disabled selector does not pick up the children of disabled fieldsets + docElem.appendChild( el ).disabled = true; + if ( el.querySelectorAll(":disabled").length !== 2 ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + el.querySelectorAll("*,:x"); + rbuggyQSA.push(",.*:"); + }); + } + + if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || + docElem.webkitMatchesSelector || + docElem.mozMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector) )) ) { + + assert(function( el ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( el, "*" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( el, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + }); + } + + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); + rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); + + /* Contains + ---------------------------------------------------------------------- */ + hasCompare = rnative.test( docElem.compareDocumentPosition ); + + // Element contains another + // Purposefully self-exclusive + // As in, an element does not contain itself + contains = hasCompare || rnative.test( docElem.contains ) ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + /* Sorting + ---------------------------------------------------------------------- */ + + // Document order sorting + sortOrder = hasCompare ? + function( a, b ) { + + // Flag for duplicate removal + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + // Sort on method existence if only one input has compareDocumentPosition + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; + if ( compare ) { + return compare; + } + + // Calculate position if both inputs belong to the same document + compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? + a.compareDocumentPosition( b ) : + + // Otherwise we know they are disconnected + 1; + + // Disconnected nodes + if ( compare & 1 || + (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { + + // Choose the first element that is related to our preferred document + if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { + return -1; + } + if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { + return 1; + } + + // Maintain original order + return sortInput ? + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + 0; + } + + return compare & 4 ? -1 : 1; + } : + function( a, b ) { + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // Parentless nodes are either documents or disconnected + if ( !aup || !bup ) { + return a === document ? -1 : + b === document ? 1 : + aup ? -1 : + bup ? 1 : + sortInput ? + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + return document; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + if ( support.matchesSelector && documentIsHTML && + !compilerCache[ expr + " " ] && + ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { + + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch (e) {} + } + + return Sizzle( expr, document, null, [ elem ] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + var fn = Expr.attrHandle[ name.toLowerCase() ], + // Don't get fooled by Object.prototype properties (jQuery #13807) + val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? + fn( elem, name, !documentIsHTML ) : + undefined; + + return val !== undefined ? + val : + support.attributes || !documentIsHTML ? + elem.getAttribute( name ) : + (val = elem.getAttributeNode(name)) && val.specified ? + val.value : + null; +}; + +Sizzle.escape = function( sel ) { + return (sel + "").replace( rcssescape, fcssescape ); +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Document sorting and removing duplicates + * @param {ArrayLike} results + */ +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + j = 0, + i = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + sortInput = !support.sortStable && results.slice( 0 ); + results.sort( sortOrder ); + + if ( hasDuplicate ) { + while ( (elem = results[i++]) ) { + if ( elem === results[ i ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + // Clear input after sorting to release objects + // See https://github.com/jquery/sizzle/pull/225 + sortInput = null; + + return results; +}; + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + while ( (node = elem[i++]) ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (jQuery #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + attrHandle: {}, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1].slice( 0, 3 ) === "nth" ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[6] && match[2]; + + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[3] ) { + match[2] = match[4] || match[5] || ""; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeNameSelector ) { + var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + return nodeNameSelector === "*" ? + function() { return true; } : + function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.slice( -check.length ) === check : + operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache, uniqueCache, outerCache, node, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType, + diff = false; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? + node.nodeName.toLowerCase() === name : + node.nodeType === 1 ) { + + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + + // Seek `elem` from a previously-cached index + + // ...in a gzip-friendly way + node = parent; + outerCache = node[ expando ] || (node[ expando ] = {}); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + (outerCache[ node.uniqueID ] = {}); + + cache = uniqueCache[ type ] || []; + nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; + diff = nodeIndex && cache[ 2 ]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + (diff = nodeIndex = 0) || start.pop()) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + } else { + // Use previously-cached element index if available + if ( useCache ) { + // ...in a gzip-friendly way + node = elem; + outerCache = node[ expando ] || (node[ expando ] = {}); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + (outerCache[ node.uniqueID ] = {}); + + cache = uniqueCache[ type ] || []; + nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; + diff = nodeIndex; + } + + // xml :nth-child(...) + // or :nth-last-child(...) or :nth(-last)?-of-type(...) + if ( diff === false ) { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || + (diff = nodeIndex = 0) || start.pop()) ) { + + if ( ( ofType ? + node.nodeName.toLowerCase() === name : + node.nodeType === 1 ) && + ++diff ) { + + // Cache the index of each encountered element + if ( useCache ) { + outerCache = node[ expando ] || (node[ expando ] = {}); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + (outerCache[ node.uniqueID ] = {}); + + uniqueCache[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + // Don't keep the element (issue #299) + input[0] = null; + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + text = text.replace( runescape, funescape ); + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + // lang value must be a valid identifier + if ( !ridentifier.test(lang || "") ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsHTML ? + elem.lang : + elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + "enabled": createDisabledPseudo( false ), + "disabled": createDisabledPseudo( true ), + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), + // but not by others (comment: 8; processing instruction: 7; etc.) + // nodeType < 6 works because attributes (2) do not appear as children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeType < 6 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + + // Support: IE<8 + // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); + }, + + // Position-in-collection + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +// Easy API for creating new setFilters +function setFilters() {} +setFilters.prototype = Expr.filters = Expr.pseudos; +Expr.setFilters = new setFilters(); + +tokenize = Sizzle.tokenize = function( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( (tokens = []) ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push({ + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, " " ) + }); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + matched = match.shift(); + tokens.push({ + value: matched, + type: type, + matches: match + }); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +}; + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + skip = combinator.next, + key = skip || dir, + checkNonElements = base && key === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + return false; + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var oldCache, uniqueCache, outerCache, + newCache = [ dirruns, doneName ]; + + // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); + + if ( skip && skip === elem.nodeName.toLowerCase() ) { + elem = elem[ dir ] || elem; + } else if ( (oldCache = uniqueCache[ key ]) && + oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { + + // Assign to newCache so results back-propagate to previous elements + return (newCache[ 2 ] = oldCache[ 2 ]); + } else { + // Reuse newcache so results back-propagate to previous elements + uniqueCache[ key ] = newCache; + + // A match means we're done; a fail means we have to keep checking + if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { + return true; + } + } + } + } + } + return false; + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + // Avoid hanging onto element (issue #299) + checkContext = null; + return ret; + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) + ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, outermost ) { + var elem, j, matcher, + matchedCount = 0, + i = "0", + unmatched = seed && [], + setMatched = [], + contextBackup = outermostContext, + // We must always have either seed elements or outermost context + elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), + len = elems.length; + + if ( outermost ) { + outermostContext = context === document || context || outermost; + } + + // Add elements passing elementMatchers directly to results + // Support: IE<9, Safari + // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id + for ( ; i !== len && (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + if ( !context && elem.ownerDocument !== document ) { + setDocument( elem ); + xml = !documentIsHTML; + } + while ( (matcher = elementMatchers[j++]) ) { + if ( matcher( elem, context || document, xml) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // `i` is now the count of elements visited above, and adding it to `matchedCount` + // makes the latter nonnegative. + matchedCount += i; + + // Apply set filters to unmatched elements + // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` + // equals `i`), unless we didn't visit _any_ elements in the above loop because we have + // no element matchers and no seed. + // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that + // case, which will result in a "00" `matchedCount` that differs from `i` but is also + // numerically zero. + if ( bySet && i !== matchedCount ) { + j = 0; + while ( (matcher = setMatchers[j++]) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !match ) { + match = tokenize( selector ); + } + i = match.length; + while ( i-- ) { + cached = matcherFromTokens( match[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + + // Save selector and tokenization + cached.selector = selector; + } + return cached; +}; + +/** + * A low-level selection function that works with Sizzle's compiled + * selector functions + * @param {String|Function} selector A selector or a pre-compiled + * selector function built with Sizzle.compile + * @param {Element} context + * @param {Array} [results] + * @param {Array} [seed] A set of elements to match against + */ +select = Sizzle.select = function( selector, context, results, seed ) { + var i, tokens, token, type, find, + compiled = typeof selector === "function" && selector, + match = !seed && tokenize( (selector = compiled.selector || selector) ); + + results = results || []; + + // Try to minimize operations if there is only one selector in the list and no seed + // (the latter of which guarantees us context) + if ( match.length === 1 ) { + + // Reduce context if the leading compound selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { + + context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; + if ( !context ) { + return results; + + // Precompiled matchers will still verify ancestry, so step up a level + } else if ( compiled ) { + context = context.parentNode; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; + } + + break; + } + } + } + } + + // Compile and execute a filtering function if one is not provided + // Provide `match` to avoid retokenization if we modified the selector above + ( compiled || compile( selector, match ) )( + seed, + context, + !documentIsHTML, + results, + !context || rsibling.test( selector ) && testContext( context.parentNode ) || context + ); + return results; +}; + +// One-time assignments + +// Sort stability +support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; + +// Support: Chrome 14-35+ +// Always assume duplicates if they aren't passed to the comparison function +support.detectDuplicates = !!hasDuplicate; + +// Initialize against the default document +setDocument(); + +// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) +// Detached nodes confoundingly follow *each other* +support.sortDetached = assert(function( el ) { + // Should return 1, but returns 4 (following) + return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; +}); + +// Support: IE<8 +// Prevent attribute/property "interpolation" +// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !assert(function( el ) { + el.innerHTML = ""; + return el.firstChild.getAttribute("href") === "#" ; +}) ) { + addHandle( "type|href|height|width", function( elem, name, isXML ) { + if ( !isXML ) { + return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); + } + }); +} + +// Support: IE<9 +// Use defaultValue in place of getAttribute("value") +if ( !support.attributes || !assert(function( el ) { + el.innerHTML = ""; + el.firstChild.setAttribute( "value", "" ); + return el.firstChild.getAttribute( "value" ) === ""; +}) ) { + addHandle( "value", function( elem, name, isXML ) { + if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { + return elem.defaultValue; + } + }); +} + +// Support: IE<9 +// Use getAttributeNode to fetch booleans when getAttribute lies +if ( !assert(function( el ) { + return el.getAttribute("disabled") == null; +}) ) { + addHandle( booleans, function( elem, name, isXML ) { + var val; + if ( !isXML ) { + return elem[ name ] === true ? name.toLowerCase() : + (val = elem.getAttributeNode( name )) && val.specified ? + val.value : + null; + } + }); +} + +return Sizzle; + +})( window ); + + + +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; + +// Deprecated +jQuery.expr[ ":" ] = jQuery.expr.pseudos; +jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; +jQuery.escapeSelector = Sizzle.escape; + + + + +var dir = function( elem, dir, until ) { + var matched = [], + truncate = until !== undefined; + + while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { + if ( elem.nodeType === 1 ) { + if ( truncate && jQuery( elem ).is( until ) ) { + break; + } + matched.push( elem ); + } + } + return matched; +}; + + +var siblings = function( n, elem ) { + var matched = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + matched.push( n ); + } + } + + return matched; +}; + + +var rneedsContext = jQuery.expr.match.needsContext; + + + +function nodeName( elem, name ) { + + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + +}; +var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); + + + +var risSimple = /^.[^:#\[\.,]*$/; + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, not ) { + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep( elements, function( elem, i ) { + return !!qualifier.call( elem, i, elem ) !== not; + } ); + } + + // Single element + if ( qualifier.nodeType ) { + return jQuery.grep( elements, function( elem ) { + return ( elem === qualifier ) !== not; + } ); + } + + // Arraylike of elements (jQuery, arguments, Array) + if ( typeof qualifier !== "string" ) { + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) > -1 ) !== not; + } ); + } + + // Simple selector that can be filtered directly, removing non-Elements + if ( risSimple.test( qualifier ) ) { + return jQuery.filter( qualifier, elements, not ); + } + + // Complex selector, compare the two sets, removing non-Elements + qualifier = jQuery.filter( qualifier, elements ); + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1; + } ); +} + +jQuery.filter = function( expr, elems, not ) { + var elem = elems[ 0 ]; + + if ( not ) { + expr = ":not(" + expr + ")"; + } + + if ( elems.length === 1 && elem.nodeType === 1 ) { + return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; + } + + return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + } ) ); +}; + +jQuery.fn.extend( { + find: function( selector ) { + var i, ret, + len = this.length, + self = this; + + if ( typeof selector !== "string" ) { + return this.pushStack( jQuery( selector ).filter( function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + } ) ); + } + + ret = this.pushStack( [] ); + + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, self[ i ], ret ); + } + + return len > 1 ? jQuery.uniqueSort( ret ) : ret; + }, + filter: function( selector ) { + return this.pushStack( winnow( this, selector || [], false ) ); + }, + not: function( selector ) { + return this.pushStack( winnow( this, selector || [], true ) ); + }, + is: function( selector ) { + return !!winnow( + this, + + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + typeof selector === "string" && rneedsContext.test( selector ) ? + jQuery( selector ) : + selector || [], + false + ).length; + } +} ); + + +// Initialize a jQuery object + + +// A central reference to the root jQuery(document) +var rootjQuery, + + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + // Shortcut simple #id case for speed + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, + + init = jQuery.fn.init = function( selector, context, root ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Method init() accepts an alternate rootjQuery + // so migrate can support jQuery.sub (gh-2101) + root = root || rootjQuery; + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector[ 0 ] === "<" && + selector[ selector.length - 1 ] === ">" && + selector.length >= 3 ) { + + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && ( match[ 1 ] || !context ) ) { + + // HANDLE: $(html) -> $(array) + if ( match[ 1 ] ) { + context = context instanceof jQuery ? context[ 0 ] : context; + + // Option to run scripts is true for back-compat + // Intentionally let the error be thrown if parseHTML is not present + jQuery.merge( this, jQuery.parseHTML( + match[ 1 ], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[ 2 ] ); + + if ( elem ) { + + // Inject the element directly into the jQuery object + this[ 0 ] = elem; + this.length = 1; + } + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || root ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this[ 0 ] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return root.ready !== undefined ? + root.ready( selector ) : + + // Execute immediately if ready is not present + selector( jQuery ); + } + + return jQuery.makeArray( selector, this ); + }; + +// Give the init function the jQuery prototype for later instantiation +init.prototype = jQuery.fn; + +// Initialize central reference +rootjQuery = jQuery( document ); + + +var rparentsprev = /^(?:parents|prev(?:Until|All))/, + + // Methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend( { + has: function( target ) { + var targets = jQuery( target, this ), + l = targets.length; + + return this.filter( function() { + var i = 0; + for ( ; i < l; i++ ) { + if ( jQuery.contains( this, targets[ i ] ) ) { + return true; + } + } + } ); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + matched = [], + targets = typeof selectors !== "string" && jQuery( selectors ); + + // Positional selectors never match, since there's no _selection_ context + if ( !rneedsContext.test( selectors ) ) { + for ( ; i < l; i++ ) { + for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { + + // Always skip document fragments + if ( cur.nodeType < 11 && ( targets ? + targets.index( cur ) > -1 : + + // Don't pass non-elements to Sizzle + cur.nodeType === 1 && + jQuery.find.matchesSelector( cur, selectors ) ) ) { + + matched.push( cur ); + break; + } + } + } + } + + return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); + }, + + // Determine the position of an element within the set + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; + } + + // Index in selector + if ( typeof elem === "string" ) { + return indexOf.call( jQuery( elem ), this[ 0 ] ); + } + + // Locate the position of the desired element + return indexOf.call( this, + + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[ 0 ] : elem + ); + }, + + add: function( selector, context ) { + return this.pushStack( + jQuery.uniqueSort( + jQuery.merge( this.get(), jQuery( selector, context ) ) + ) + ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter( selector ) + ); + } +} ); + +function sibling( cur, dir ) { + while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} + return cur; +} + +jQuery.each( { + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return siblings( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return siblings( elem.firstChild ); + }, + contents: function( elem ) { + if ( nodeName( elem, "iframe" ) ) { + return elem.contentDocument; + } + + // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only + // Treat the template element as a regular one in browsers that + // don't support it. + if ( nodeName( elem, "template" ) ) { + elem = elem.content || elem; + } + + return jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var matched = jQuery.map( this, fn, until ); + + if ( name.slice( -5 ) !== "Until" ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + matched = jQuery.filter( selector, matched ); + } + + if ( this.length > 1 ) { + + // Remove duplicates + if ( !guaranteedUnique[ name ] ) { + jQuery.uniqueSort( matched ); + } + + // Reverse order for parents* and prev-derivatives + if ( rparentsprev.test( name ) ) { + matched.reverse(); + } + } + + return this.pushStack( matched ); + }; +} ); +var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); + + + +// Convert String-formatted options into Object-formatted ones +function createOptions( options ) { + var object = {}; + jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { + object[ flag ] = true; + } ); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + createOptions( options ) : + jQuery.extend( {}, options ); + + var // Flag to know if list is currently firing + firing, + + // Last fire value for non-forgettable lists + memory, + + // Flag to know if list was already fired + fired, + + // Flag to prevent firing + locked, + + // Actual callback list + list = [], + + // Queue of execution data for repeatable lists + queue = [], + + // Index of currently firing callback (modified by add/remove as needed) + firingIndex = -1, + + // Fire callbacks + fire = function() { + + // Enforce single-firing + locked = locked || options.once; + + // Execute callbacks for all pending executions, + // respecting firingIndex overrides and runtime changes + fired = firing = true; + for ( ; queue.length; firingIndex = -1 ) { + memory = queue.shift(); + while ( ++firingIndex < list.length ) { + + // Run callback and check for early termination + if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && + options.stopOnFalse ) { + + // Jump to end and forget the data so .add doesn't re-fire + firingIndex = list.length; + memory = false; + } + } + } + + // Forget the data if we're done with it + if ( !options.memory ) { + memory = false; + } + + firing = false; + + // Clean up if we're done firing for good + if ( locked ) { + + // Keep an empty list if we have data for future add calls + if ( memory ) { + list = []; + + // Otherwise, this object is spent + } else { + list = ""; + } + } + }, + + // Actual Callbacks object + self = { + + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + + // If we have memory from a past run, we should fire after adding + if ( memory && !firing ) { + firingIndex = list.length - 1; + queue.push( memory ); + } + + ( function add( args ) { + jQuery.each( args, function( _, arg ) { + if ( jQuery.isFunction( arg ) ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { + + // Inspect recursively + add( arg ); + } + } ); + } )( arguments ); + + if ( memory && !firing ) { + fire(); + } + } + return this; + }, + + // Remove a callback from the list + remove: function() { + jQuery.each( arguments, function( _, arg ) { + var index; + while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + + // Handle firing indexes + if ( index <= firingIndex ) { + firingIndex--; + } + } + } ); + return this; + }, + + // Check if a given callback is in the list. + // If no argument is given, return whether or not list has callbacks attached. + has: function( fn ) { + return fn ? + jQuery.inArray( fn, list ) > -1 : + list.length > 0; + }, + + // Remove all callbacks from the list + empty: function() { + if ( list ) { + list = []; + } + return this; + }, + + // Disable .fire and .add + // Abort any current/pending executions + // Clear all callbacks and values + disable: function() { + locked = queue = []; + list = memory = ""; + return this; + }, + disabled: function() { + return !list; + }, + + // Disable .fire + // Also disable .add unless we have memory (since it would have no effect) + // Abort any pending executions + lock: function() { + locked = queue = []; + if ( !memory && !firing ) { + list = memory = ""; + } + return this; + }, + locked: function() { + return !!locked; + }, + + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( !locked ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + queue.push( args ); + if ( !firing ) { + fire(); + } + } + return this; + }, + + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; + + +function Identity( v ) { + return v; +} +function Thrower( ex ) { + throw ex; +} + +function adoptValue( value, resolve, reject, noValue ) { + var method; + + try { + + // Check for promise aspect first to privilege synchronous behavior + if ( value && jQuery.isFunction( ( method = value.promise ) ) ) { + method.call( value ).done( resolve ).fail( reject ); + + // Other thenables + } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) { + method.call( value, resolve, reject ); + + // Other non-thenables + } else { + + // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: + // * false: [ value ].slice( 0 ) => resolve( value ) + // * true: [ value ].slice( 1 ) => resolve() + resolve.apply( undefined, [ value ].slice( noValue ) ); + } + + // For Promises/A+, convert exceptions into rejections + // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in + // Deferred#then to conditionally suppress rejection. + } catch ( value ) { + + // Support: Android 4.0 only + // Strict mode functions invoked without .call/.apply get global-object context + reject.apply( undefined, [ value ] ); + } +} + +jQuery.extend( { + + Deferred: function( func ) { + var tuples = [ + + // action, add listener, callbacks, + // ... .then handlers, argument index, [final state] + [ "notify", "progress", jQuery.Callbacks( "memory" ), + jQuery.Callbacks( "memory" ), 2 ], + [ "resolve", "done", jQuery.Callbacks( "once memory" ), + jQuery.Callbacks( "once memory" ), 0, "resolved" ], + [ "reject", "fail", jQuery.Callbacks( "once memory" ), + jQuery.Callbacks( "once memory" ), 1, "rejected" ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + "catch": function( fn ) { + return promise.then( null, fn ); + }, + + // Keep pipe for back-compat + pipe: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + + return jQuery.Deferred( function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + + // Map tuples (progress, done, fail) to arguments (done, fail, progress) + var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; + + // deferred.progress(function() { bind to newDefer or newDefer.notify }) + // deferred.done(function() { bind to newDefer or newDefer.resolve }) + // deferred.fail(function() { bind to newDefer or newDefer.reject }) + deferred[ tuple[ 1 ] ]( function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .progress( newDefer.notify ) + .done( newDefer.resolve ) + .fail( newDefer.reject ); + } else { + newDefer[ tuple[ 0 ] + "With" ]( + this, + fn ? [ returned ] : arguments + ); + } + } ); + } ); + fns = null; + } ).promise(); + }, + then: function( onFulfilled, onRejected, onProgress ) { + var maxDepth = 0; + function resolve( depth, deferred, handler, special ) { + return function() { + var that = this, + args = arguments, + mightThrow = function() { + var returned, then; + + // Support: Promises/A+ section 2.3.3.3.3 + // https://promisesaplus.com/#point-59 + // Ignore double-resolution attempts + if ( depth < maxDepth ) { + return; + } + + returned = handler.apply( that, args ); + + // Support: Promises/A+ section 2.3.1 + // https://promisesaplus.com/#point-48 + if ( returned === deferred.promise() ) { + throw new TypeError( "Thenable self-resolution" ); + } + + // Support: Promises/A+ sections 2.3.3.1, 3.5 + // https://promisesaplus.com/#point-54 + // https://promisesaplus.com/#point-75 + // Retrieve `then` only once + then = returned && + + // Support: Promises/A+ section 2.3.4 + // https://promisesaplus.com/#point-64 + // Only check objects and functions for thenability + ( typeof returned === "object" || + typeof returned === "function" ) && + returned.then; + + // Handle a returned thenable + if ( jQuery.isFunction( then ) ) { + + // Special processors (notify) just wait for resolution + if ( special ) { + then.call( + returned, + resolve( maxDepth, deferred, Identity, special ), + resolve( maxDepth, deferred, Thrower, special ) + ); + + // Normal processors (resolve) also hook into progress + } else { + + // ...and disregard older resolution values + maxDepth++; + + then.call( + returned, + resolve( maxDepth, deferred, Identity, special ), + resolve( maxDepth, deferred, Thrower, special ), + resolve( maxDepth, deferred, Identity, + deferred.notifyWith ) + ); + } + + // Handle all other returned values + } else { + + // Only substitute handlers pass on context + // and multiple values (non-spec behavior) + if ( handler !== Identity ) { + that = undefined; + args = [ returned ]; + } + + // Process the value(s) + // Default process is resolve + ( special || deferred.resolveWith )( that, args ); + } + }, + + // Only normal processors (resolve) catch and reject exceptions + process = special ? + mightThrow : + function() { + try { + mightThrow(); + } catch ( e ) { + + if ( jQuery.Deferred.exceptionHook ) { + jQuery.Deferred.exceptionHook( e, + process.stackTrace ); + } + + // Support: Promises/A+ section 2.3.3.3.4.1 + // https://promisesaplus.com/#point-61 + // Ignore post-resolution exceptions + if ( depth + 1 >= maxDepth ) { + + // Only substitute handlers pass on context + // and multiple values (non-spec behavior) + if ( handler !== Thrower ) { + that = undefined; + args = [ e ]; + } + + deferred.rejectWith( that, args ); + } + } + }; + + // Support: Promises/A+ section 2.3.3.3.1 + // https://promisesaplus.com/#point-57 + // Re-resolve promises immediately to dodge false rejection from + // subsequent errors + if ( depth ) { + process(); + } else { + + // Call an optional hook to record the stack, in case of exception + // since it's otherwise lost when execution goes async + if ( jQuery.Deferred.getStackHook ) { + process.stackTrace = jQuery.Deferred.getStackHook(); + } + window.setTimeout( process ); + } + }; + } + + return jQuery.Deferred( function( newDefer ) { + + // progress_handlers.add( ... ) + tuples[ 0 ][ 3 ].add( + resolve( + 0, + newDefer, + jQuery.isFunction( onProgress ) ? + onProgress : + Identity, + newDefer.notifyWith + ) + ); + + // fulfilled_handlers.add( ... ) + tuples[ 1 ][ 3 ].add( + resolve( + 0, + newDefer, + jQuery.isFunction( onFulfilled ) ? + onFulfilled : + Identity + ) + ); + + // rejected_handlers.add( ... ) + tuples[ 2 ][ 3 ].add( + resolve( + 0, + newDefer, + jQuery.isFunction( onRejected ) ? + onRejected : + Thrower + ) + ); + } ).promise(); + }, + + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 5 ]; + + // promise.progress = list.add + // promise.done = list.add + // promise.fail = list.add + promise[ tuple[ 1 ] ] = list.add; + + // Handle state + if ( stateString ) { + list.add( + function() { + + // state = "resolved" (i.e., fulfilled) + // state = "rejected" + state = stateString; + }, + + // rejected_callbacks.disable + // fulfilled_callbacks.disable + tuples[ 3 - i ][ 2 ].disable, + + // progress_callbacks.lock + tuples[ 0 ][ 2 ].lock + ); + } + + // progress_handlers.fire + // fulfilled_handlers.fire + // rejected_handlers.fire + list.add( tuple[ 3 ].fire ); + + // deferred.notify = function() { deferred.notifyWith(...) } + // deferred.resolve = function() { deferred.resolveWith(...) } + // deferred.reject = function() { deferred.rejectWith(...) } + deferred[ tuple[ 0 ] ] = function() { + deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); + return this; + }; + + // deferred.notifyWith = list.fireWith + // deferred.resolveWith = list.fireWith + // deferred.rejectWith = list.fireWith + deferred[ tuple[ 0 ] + "With" ] = list.fireWith; + } ); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( singleValue ) { + var + + // count of uncompleted subordinates + remaining = arguments.length, + + // count of unprocessed arguments + i = remaining, + + // subordinate fulfillment data + resolveContexts = Array( i ), + resolveValues = slice.call( arguments ), + + // the master Deferred + master = jQuery.Deferred(), + + // subordinate callback factory + updateFunc = function( i ) { + return function( value ) { + resolveContexts[ i ] = this; + resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; + if ( !( --remaining ) ) { + master.resolveWith( resolveContexts, resolveValues ); + } + }; + }; + + // Single- and empty arguments are adopted like Promise.resolve + if ( remaining <= 1 ) { + adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, + !remaining ); + + // Use .then() to unwrap secondary thenables (cf. gh-3000) + if ( master.state() === "pending" || + jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { + + return master.then(); + } + } + + // Multiple arguments are aggregated like Promise.all array elements + while ( i-- ) { + adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); + } + + return master.promise(); + } +} ); + + +// These usually indicate a programmer mistake during development, +// warn about them ASAP rather than swallowing them by default. +var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; + +jQuery.Deferred.exceptionHook = function( error, stack ) { + + // Support: IE 8 - 9 only + // Console exists when dev tools are open, which can happen at any time + if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { + window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); + } +}; + + + + +jQuery.readyException = function( error ) { + window.setTimeout( function() { + throw error; + } ); +}; + + + + +// The deferred used on DOM ready +var readyList = jQuery.Deferred(); + +jQuery.fn.ready = function( fn ) { + + readyList + .then( fn ) + + // Wrap jQuery.readyException in a function so that the lookup + // happens at the time of error handling instead of callback + // registration. + .catch( function( error ) { + jQuery.readyException( error ); + } ); + + return this; +}; + +jQuery.extend( { + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + } +} ); + +jQuery.ready.then = readyList.then; + +// The ready event handler and self cleanup method +function completed() { + document.removeEventListener( "DOMContentLoaded", completed ); + window.removeEventListener( "load", completed ); + jQuery.ready(); +} + +// Catch cases where $(document).ready() is called +// after the browser event has already occurred. +// Support: IE <=9 - 10 only +// Older IE sometimes signals "interactive" too soon +if ( document.readyState === "complete" || + ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { + + // Handle it asynchronously to allow scripts the opportunity to delay ready + window.setTimeout( jQuery.ready ); + +} else { + + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed ); +} + + + + +// Multifunctional method to get and set values of a collection +// The value/s can optionally be executed if it's a function +var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + len = elems.length, + bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === "object" ) { + chainable = true; + for ( i in key ) { + access( elems, fn, i, key[ i ], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !jQuery.isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < len; i++ ) { + fn( + elems[ i ], key, raw ? + value : + value.call( elems[ i ], i, fn( elems[ i ], key ) ) + ); + } + } + } + + if ( chainable ) { + return elems; + } + + // Gets + if ( bulk ) { + return fn.call( elems ); + } + + return len ? fn( elems[ 0 ], key ) : emptyGet; +}; +var acceptData = function( owner ) { + + // Accepts only: + // - Node + // - Node.ELEMENT_NODE + // - Node.DOCUMENT_NODE + // - Object + // - Any + return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); +}; + + + + +function Data() { + this.expando = jQuery.expando + Data.uid++; +} + +Data.uid = 1; + +Data.prototype = { + + cache: function( owner ) { + + // Check if the owner object already has a cache + var value = owner[ this.expando ]; + + // If not, create one + if ( !value ) { + value = {}; + + // We can accept data for non-element nodes in modern browsers, + // but we should not, see #8335. + // Always return an empty object. + if ( acceptData( owner ) ) { + + // If it is a node unlikely to be stringify-ed or looped over + // use plain assignment + if ( owner.nodeType ) { + owner[ this.expando ] = value; + + // Otherwise secure it in a non-enumerable property + // configurable must be true to allow the property to be + // deleted when data is removed + } else { + Object.defineProperty( owner, this.expando, { + value: value, + configurable: true + } ); + } + } + } + + return value; + }, + set: function( owner, data, value ) { + var prop, + cache = this.cache( owner ); + + // Handle: [ owner, key, value ] args + // Always use camelCase key (gh-2257) + if ( typeof data === "string" ) { + cache[ jQuery.camelCase( data ) ] = value; + + // Handle: [ owner, { properties } ] args + } else { + + // Copy the properties one-by-one to the cache object + for ( prop in data ) { + cache[ jQuery.camelCase( prop ) ] = data[ prop ]; + } + } + return cache; + }, + get: function( owner, key ) { + return key === undefined ? + this.cache( owner ) : + + // Always use camelCase key (gh-2257) + owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ]; + }, + access: function( owner, key, value ) { + + // In cases where either: + // + // 1. No key was specified + // 2. A string key was specified, but no value provided + // + // Take the "read" path and allow the get method to determine + // which value to return, respectively either: + // + // 1. The entire cache object + // 2. The data stored at the key + // + if ( key === undefined || + ( ( key && typeof key === "string" ) && value === undefined ) ) { + + return this.get( owner, key ); + } + + // When the key is not a string, or both a key and value + // are specified, set or extend (existing objects) with either: + // + // 1. An object of properties + // 2. A key and value + // + this.set( owner, key, value ); + + // Since the "set" path can have two possible entry points + // return the expected data based on which path was taken[*] + return value !== undefined ? value : key; + }, + remove: function( owner, key ) { + var i, + cache = owner[ this.expando ]; + + if ( cache === undefined ) { + return; + } + + if ( key !== undefined ) { + + // Support array or space separated string of keys + if ( Array.isArray( key ) ) { + + // If key is an array of keys... + // We always set camelCase keys, so remove that. + key = key.map( jQuery.camelCase ); + } else { + key = jQuery.camelCase( key ); + + // If a key with the spaces exists, use it. + // Otherwise, create an array by matching non-whitespace + key = key in cache ? + [ key ] : + ( key.match( rnothtmlwhite ) || [] ); + } + + i = key.length; + + while ( i-- ) { + delete cache[ key[ i ] ]; + } + } + + // Remove the expando if there's no more data + if ( key === undefined || jQuery.isEmptyObject( cache ) ) { + + // Support: Chrome <=35 - 45 + // Webkit & Blink performance suffers when deleting properties + // from DOM nodes, so set to undefined instead + // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) + if ( owner.nodeType ) { + owner[ this.expando ] = undefined; + } else { + delete owner[ this.expando ]; + } + } + }, + hasData: function( owner ) { + var cache = owner[ this.expando ]; + return cache !== undefined && !jQuery.isEmptyObject( cache ); + } +}; +var dataPriv = new Data(); + +var dataUser = new Data(); + + + +// Implementation Summary +// +// 1. Enforce API surface and semantic compatibility with 1.9.x branch +// 2. Improve the module's maintainability by reducing the storage +// paths to a single mechanism. +// 3. Use the same single mechanism to support "private" and "user" data. +// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) +// 5. Avoid exposing implementation details on user objects (eg. expando properties) +// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 + +var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, + rmultiDash = /[A-Z]/g; + +function getData( data ) { + if ( data === "true" ) { + return true; + } + + if ( data === "false" ) { + return false; + } + + if ( data === "null" ) { + return null; + } + + // Only convert to a number if it doesn't change the string + if ( data === +data + "" ) { + return +data; + } + + if ( rbrace.test( data ) ) { + return JSON.parse( data ); + } + + return data; +} + +function dataAttr( elem, key, data ) { + var name; + + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = getData( data ); + } catch ( e ) {} + + // Make sure we set the data so it isn't changed later + dataUser.set( elem, key, data ); + } else { + data = undefined; + } + } + return data; +} + +jQuery.extend( { + hasData: function( elem ) { + return dataUser.hasData( elem ) || dataPriv.hasData( elem ); + }, + + data: function( elem, name, data ) { + return dataUser.access( elem, name, data ); + }, + + removeData: function( elem, name ) { + dataUser.remove( elem, name ); + }, + + // TODO: Now that all calls to _data and _removeData have been replaced + // with direct calls to dataPriv methods, these can be deprecated. + _data: function( elem, name, data ) { + return dataPriv.access( elem, name, data ); + }, + + _removeData: function( elem, name ) { + dataPriv.remove( elem, name ); + } +} ); + +jQuery.fn.extend( { + data: function( key, value ) { + var i, name, data, + elem = this[ 0 ], + attrs = elem && elem.attributes; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = dataUser.get( elem ); + + if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { + i = attrs.length; + while ( i-- ) { + + // Support: IE 11 only + // The attrs elements can be null (#14894) + if ( attrs[ i ] ) { + name = attrs[ i ].name; + if ( name.indexOf( "data-" ) === 0 ) { + name = jQuery.camelCase( name.slice( 5 ) ); + dataAttr( elem, name, data[ name ] ); + } + } + } + dataPriv.set( elem, "hasDataAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each( function() { + dataUser.set( this, key ); + } ); + } + + return access( this, function( value ) { + var data; + + // The calling jQuery object (element matches) is not empty + // (and therefore has an element appears at this[ 0 ]) and the + // `value` parameter was not undefined. An empty jQuery object + // will result in `undefined` for elem = this[ 0 ] which will + // throw an exception if an attempt to read a data cache is made. + if ( elem && value === undefined ) { + + // Attempt to get data from the cache + // The key will always be camelCased in Data + data = dataUser.get( elem, key ); + if ( data !== undefined ) { + return data; + } + + // Attempt to "discover" the data in + // HTML5 custom data-* attrs + data = dataAttr( elem, key ); + if ( data !== undefined ) { + return data; + } + + // We tried really hard, but the data doesn't exist. + return; + } + + // Set the data... + this.each( function() { + + // We always store the camelCased key + dataUser.set( this, key, value ); + } ); + }, null, value, arguments.length > 1, null, true ); + }, + + removeData: function( key ) { + return this.each( function() { + dataUser.remove( this, key ); + } ); + } +} ); + + +jQuery.extend( { + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = dataPriv.get( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || Array.isArray( data ) ) { + queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // Clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // Not public - generate a queueHooks object, or return the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { + empty: jQuery.Callbacks( "once memory" ).add( function() { + dataPriv.remove( elem, [ type + "queue", key ] ); + } ) + } ); + } +} ); + +jQuery.fn.extend( { + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[ 0 ], type ); + } + + return data === undefined ? + this : + this.each( function() { + var queue = jQuery.queue( this, type, data ); + + // Ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + } ); + }, + dequeue: function( type ) { + return this.each( function() { + jQuery.dequeue( this, type ); + } ); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while ( i-- ) { + tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +} ); +var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; + +var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); + + +var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; + +var isHiddenWithinTree = function( elem, el ) { + + // isHiddenWithinTree might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + + // Inline style trumps all + return elem.style.display === "none" || + elem.style.display === "" && + + // Otherwise, check computed style + // Support: Firefox <=43 - 45 + // Disconnected elements can have computed display: none, so first confirm that elem is + // in the document. + jQuery.contains( elem.ownerDocument, elem ) && + + jQuery.css( elem, "display" ) === "none"; + }; + +var swap = function( elem, options, callback, args ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.apply( elem, args || [] ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; +}; + + + + +function adjustCSS( elem, prop, valueParts, tween ) { + var adjusted, + scale = 1, + maxIterations = 20, + currentValue = tween ? + function() { + return tween.cur(); + } : + function() { + return jQuery.css( elem, prop, "" ); + }, + initial = currentValue(), + unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), + + // Starting value computation is required for potential unit mismatches + initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && + rcssNum.exec( jQuery.css( elem, prop ) ); + + if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { + + // Trust units reported by jQuery.css + unit = unit || initialInUnit[ 3 ]; + + // Make sure we update the tween properties later on + valueParts = valueParts || []; + + // Iteratively approximate from a nonzero starting point + initialInUnit = +initial || 1; + + do { + + // If previous iteration zeroed out, double until we get *something*. + // Use string for doubling so we don't accidentally see scale as unchanged below + scale = scale || ".5"; + + // Adjust and apply + initialInUnit = initialInUnit / scale; + jQuery.style( elem, prop, initialInUnit + unit ); + + // Update scale, tolerating zero or NaN from tween.cur() + // Break the loop if scale is unchanged or perfect, or if we've just had enough. + } while ( + scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations + ); + } + + if ( valueParts ) { + initialInUnit = +initialInUnit || +initial || 0; + + // Apply relative offset (+=/-=) if specified + adjusted = valueParts[ 1 ] ? + initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : + +valueParts[ 2 ]; + if ( tween ) { + tween.unit = unit; + tween.start = initialInUnit; + tween.end = adjusted; + } + } + return adjusted; +} + + +var defaultDisplayMap = {}; + +function getDefaultDisplay( elem ) { + var temp, + doc = elem.ownerDocument, + nodeName = elem.nodeName, + display = defaultDisplayMap[ nodeName ]; + + if ( display ) { + return display; + } + + temp = doc.body.appendChild( doc.createElement( nodeName ) ); + display = jQuery.css( temp, "display" ); + + temp.parentNode.removeChild( temp ); + + if ( display === "none" ) { + display = "block"; + } + defaultDisplayMap[ nodeName ] = display; + + return display; +} + +function showHide( elements, show ) { + var display, elem, + values = [], + index = 0, + length = elements.length; + + // Determine new display value for elements that need to change + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + + display = elem.style.display; + if ( show ) { + + // Since we force visibility upon cascade-hidden elements, an immediate (and slow) + // check is required in this first loop unless we have a nonempty display value (either + // inline or about-to-be-restored) + if ( display === "none" ) { + values[ index ] = dataPriv.get( elem, "display" ) || null; + if ( !values[ index ] ) { + elem.style.display = ""; + } + } + if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { + values[ index ] = getDefaultDisplay( elem ); + } + } else { + if ( display !== "none" ) { + values[ index ] = "none"; + + // Remember what we're overwriting + dataPriv.set( elem, "display", display ); + } + } + } + + // Set the display of the elements in a second loop to avoid constant reflow + for ( index = 0; index < length; index++ ) { + if ( values[ index ] != null ) { + elements[ index ].style.display = values[ index ]; + } + } + + return elements; +} + +jQuery.fn.extend( { + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state ) { + if ( typeof state === "boolean" ) { + return state ? this.show() : this.hide(); + } + + return this.each( function() { + if ( isHiddenWithinTree( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + } ); + } +} ); +var rcheckableType = ( /^(?:checkbox|radio)$/i ); + +var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); + +var rscriptType = ( /^$|\/(?:java|ecma)script/i ); + + + +// We have to close these tags to support XHTML (#13200) +var wrapMap = { + + // Support: IE <=9 only + option: [ 1, "" ], + + // XHTML parsers do not magically insert elements in the + // same way that tag soup parsers do. So we cannot shorten + // this by omitting or other required elements. + thead: [ 1, "", "
" ], + col: [ 2, "", "
" ], + tr: [ 2, "", "
" ], + td: [ 3, "", "
" ], + + _default: [ 0, "", "" ] +}; + +// Support: IE <=9 only +wrapMap.optgroup = wrapMap.option; + +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + + +function getAll( context, tag ) { + + // Support: IE <=9 - 11 only + // Use typeof to avoid zero-argument method invocation on host objects (#15151) + var ret; + + if ( typeof context.getElementsByTagName !== "undefined" ) { + ret = context.getElementsByTagName( tag || "*" ); + + } else if ( typeof context.querySelectorAll !== "undefined" ) { + ret = context.querySelectorAll( tag || "*" ); + + } else { + ret = []; + } + + if ( tag === undefined || tag && nodeName( context, tag ) ) { + return jQuery.merge( [ context ], ret ); + } + + return ret; +} + + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + dataPriv.set( + elems[ i ], + "globalEval", + !refElements || dataPriv.get( refElements[ i ], "globalEval" ) + ); + } +} + + +var rhtml = /<|&#?\w+;/; + +function buildFragment( elems, context, scripts, selection, ignored ) { + var elem, tmp, tag, wrap, contains, j, + fragment = context.createDocumentFragment(), + nodes = [], + i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; + + // Descend through wrappers to the right content + j = wrap[ 0 ]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, tmp.childNodes ); + + // Remember the top-level container + tmp = fragment.firstChild; + + // Ensure the created nodes are orphaned (#12392) + tmp.textContent = ""; + } + } + } + + // Remove wrapper from fragment + fragment.textContent = ""; + + i = 0; + while ( ( elem = nodes[ i++ ] ) ) { + + // Skip elements already in the context collection (trac-4087) + if ( selection && jQuery.inArray( elem, selection ) > -1 ) { + if ( ignored ) { + ignored.push( elem ); + } + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( fragment.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( ( elem = tmp[ j++ ] ) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + return fragment; +} + + +( function() { + var fragment = document.createDocumentFragment(), + div = fragment.appendChild( document.createElement( "div" ) ), + input = document.createElement( "input" ); + + // Support: Android 4.0 - 4.3 only + // Check state lost if the name is set (#11217) + // Support: Windows Web Apps (WWA) + // `name` and `type` must use .setAttribute for WWA (#14901) + input.setAttribute( "type", "radio" ); + input.setAttribute( "checked", "checked" ); + input.setAttribute( "name", "t" ); + + div.appendChild( input ); + + // Support: Android <=4.1 only + // Older WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE <=11 only + // Make sure textarea (and checkbox) defaultValue is properly cloned + div.innerHTML = ""; + support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; +} )(); +var documentElement = document.documentElement; + + + +var + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, + rtypenamespace = /^([^.]*)(?:\.(.+)|)/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +// Support: IE <=9 only +// See #13393 for more info +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} + +function on( elem, types, selector, data, fn, one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + on( elem, type, selector, data, types[ type ], one ); + } + return elem; + } + + if ( data == null && fn == null ) { + + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return elem; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return elem.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + } ); +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + + var handleObjIn, eventHandle, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = dataPriv.get( elem ); + + // Don't attach events to noData or text/comment nodes (but allow plain objects) + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Ensure that invalid selectors throw exceptions at attach time + // Evaluate against documentElement in case elem is a non-element node (e.g., document) + if ( selector ) { + jQuery.find.matchesSelector( documentElement, selector ); + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !( events = elemData.events ) ) { + events = elemData.events = {}; + } + if ( !( eventHandle = elemData.handle ) ) { + eventHandle = elemData.handle = function( e ) { + + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? + jQuery.event.dispatch.apply( elem, arguments ) : undefined; + }; + } + + // Handle multiple events separated by a space + types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // There *must* be a type, no attaching namespace-only handlers + if ( !type ) { + continue; + } + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend( { + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join( "." ) + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !( handlers = events[ type ] ) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener if the special events handler returns false + if ( !special.setup || + special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var j, origCount, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); + + if ( !elemData || !( events = elemData.events ) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[ 2 ] && + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || + selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || + special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove data and the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + dataPriv.remove( elem, "handle events" ); + } + }, + + dispatch: function( nativeEvent ) { + + // Make a writable jQuery.Event from the native event object + var event = jQuery.event.fix( nativeEvent ); + + var i, j, ret, matched, handleObj, handlerQueue, + args = new Array( arguments.length ), + handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[ 0 ] = event; + + for ( i = 1; i < arguments.length; i++ ) { + args[ i ] = arguments[ i ]; + } + + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( ( handleObj = matched.handlers[ j++ ] ) && + !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or 2) have namespace(s) + // a subset or equal to those in the bound event (both can have no namespace). + if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || + handleObj.handler ).apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( ( event.result = ret ) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var i, handleObj, sel, matchedHandlers, matchedSelectors, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + if ( delegateCount && + + // Support: IE <=9 + // Black-hole SVG instance trees (trac-13180) + cur.nodeType && + + // Support: Firefox <=42 + // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) + // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click + // Support: IE 11 only + // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) + !( event.type === "click" && event.button >= 1 ) ) { + + for ( ; cur !== this; cur = cur.parentNode || this ) { + + // Don't check non-elements (#13208) + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { + matchedHandlers = []; + matchedSelectors = {}; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matchedSelectors[ sel ] === undefined ) { + matchedSelectors[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) > -1 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matchedSelectors[ sel ] ) { + matchedHandlers.push( handleObj ); + } + } + if ( matchedHandlers.length ) { + handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); + } + } + } + } + + // Add the remaining (directly-bound) handlers + cur = this; + if ( delegateCount < handlers.length ) { + handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); + } + + return handlerQueue; + }, + + addProp: function( name, hook ) { + Object.defineProperty( jQuery.Event.prototype, name, { + enumerable: true, + configurable: true, + + get: jQuery.isFunction( hook ) ? + function() { + if ( this.originalEvent ) { + return hook( this.originalEvent ); + } + } : + function() { + if ( this.originalEvent ) { + return this.originalEvent[ name ]; + } + }, + + set: function( value ) { + Object.defineProperty( this, name, { + enumerable: true, + configurable: true, + writable: true, + value: value + } ); + } + } ); + }, + + fix: function( originalEvent ) { + return originalEvent[ jQuery.expando ] ? + originalEvent : + new jQuery.Event( originalEvent ); + }, + + special: { + load: { + + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + focus: { + + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== safeActiveElement() && this.focus ) { + this.focus(); + return false; + } + }, + delegateType: "focusin" + }, + blur: { + trigger: function() { + if ( this === safeActiveElement() && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: "focusout" + }, + click: { + + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) { + this.click(); + return false; + } + }, + + // For cross-browser consistency, don't fire native .click() on links + _default: function( event ) { + return nodeName( event.target, "a" ); + } + }, + + beforeunload: { + postDispatch: function( event ) { + + // Support: Firefox 20+ + // Firefox doesn't alert if the returnValue field is not set. + if ( event.result !== undefined && event.originalEvent ) { + event.originalEvent.returnValue = event.result; + } + } + } + } +}; + +jQuery.removeEvent = function( elem, type, handle ) { + + // This "if" is needed for plain objects + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle ); + } +}; + +jQuery.Event = function( src, props ) { + + // Allow instantiation without the 'new' keyword + if ( !( this instanceof jQuery.Event ) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = src.defaultPrevented || + src.defaultPrevented === undefined && + + // Support: Android <=2.3 only + src.returnValue === false ? + returnTrue : + returnFalse; + + // Create target properties + // Support: Safari <=6 - 7 only + // Target should not be a text node (#504, #13143) + this.target = ( src.target && src.target.nodeType === 3 ) ? + src.target.parentNode : + src.target; + + this.currentTarget = src.currentTarget; + this.relatedTarget = src.relatedTarget; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + constructor: jQuery.Event, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + isSimulated: false, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + + if ( e && !this.isSimulated ) { + e.preventDefault(); + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + + if ( e && !this.isSimulated ) { + e.stopPropagation(); + } + }, + stopImmediatePropagation: function() { + var e = this.originalEvent; + + this.isImmediatePropagationStopped = returnTrue; + + if ( e && !this.isSimulated ) { + e.stopImmediatePropagation(); + } + + this.stopPropagation(); + } +}; + +// Includes all common event props including KeyEvent and MouseEvent specific props +jQuery.each( { + altKey: true, + bubbles: true, + cancelable: true, + changedTouches: true, + ctrlKey: true, + detail: true, + eventPhase: true, + metaKey: true, + pageX: true, + pageY: true, + shiftKey: true, + view: true, + "char": true, + charCode: true, + key: true, + keyCode: true, + button: true, + buttons: true, + clientX: true, + clientY: true, + offsetX: true, + offsetY: true, + pointerId: true, + pointerType: true, + screenX: true, + screenY: true, + targetTouches: true, + toElement: true, + touches: true, + + which: function( event ) { + var button = event.button; + + // Add which for key events + if ( event.which == null && rkeyEvent.test( event.type ) ) { + return event.charCode != null ? event.charCode : event.keyCode; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { + if ( button & 1 ) { + return 1; + } + + if ( button & 2 ) { + return 3; + } + + if ( button & 4 ) { + return 2; + } + + return 0; + } + + return event.which; + } +}, jQuery.event.addProp ); + +// Create mouseenter/leave events using mouseover/out and event-time checks +// so that event delegation works in jQuery. +// Do the same for pointerenter/pointerleave and pointerover/pointerout +// +// Support: Safari 7 only +// Safari sends mouseenter too often; see: +// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 +// for the description of the bug (it existed in older Chrome versions as well). +jQuery.each( { + mouseenter: "mouseover", + mouseleave: "mouseout", + pointerenter: "pointerover", + pointerleave: "pointerout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mouseenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +} ); + +jQuery.fn.extend( { + + on: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn ); + }, + one: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? + handleObj.origType + "." + handleObj.namespace : + handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each( function() { + jQuery.event.remove( this, types, fn, selector ); + } ); + } +} ); + + +var + + /* eslint-disable max-len */ + + // See https://github.com/eslint/eslint/issues/3229 + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, + + /* eslint-enable */ + + // Support: IE <=10 - 11, Edge 12 - 13 + // In IE/Edge using regex groups here causes severe slowdowns. + // See https://connect.microsoft.com/IE/feedback/details/1736512/ + rnoInnerhtml = /\s*$/g; + +// Prefer a tbody over its parent table for containing new rows +function manipulationTarget( elem, content ) { + if ( nodeName( elem, "table" ) && + nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { + + return jQuery( ">tbody", elem )[ 0 ] || elem; + } + + return elem; +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + + if ( match ) { + elem.type = match[ 1 ]; + } else { + elem.removeAttribute( "type" ); + } + + return elem; +} + +function cloneCopyEvent( src, dest ) { + var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; + + if ( dest.nodeType !== 1 ) { + return; + } + + // 1. Copy private data: events, handlers, etc. + if ( dataPriv.hasData( src ) ) { + pdataOld = dataPriv.access( src ); + pdataCur = dataPriv.set( dest, pdataOld ); + events = pdataOld.events; + + if ( events ) { + delete pdataCur.handle; + pdataCur.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + } + + // 2. Copy user data + if ( dataUser.hasData( src ) ) { + udataOld = dataUser.access( src ); + udataCur = jQuery.extend( {}, udataOld ); + + dataUser.set( dest, udataCur ); + } +} + +// Fix IE bugs, see support tests +function fixInput( src, dest ) { + var nodeName = dest.nodeName.toLowerCase(); + + // Fails to persist the checked state of a cloned checkbox or radio button. + if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + dest.checked = src.checked; + + // Fails to return the selected option to the default selected state when cloning options + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +function domManip( collection, args, callback, ignored ) { + + // Flatten any nested arrays + args = concat.apply( [], args ); + + var fragment, first, scripts, hasScripts, node, doc, + i = 0, + l = collection.length, + iNoClone = l - 1, + value = args[ 0 ], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || + ( l > 1 && typeof value === "string" && + !support.checkClone && rchecked.test( value ) ) ) { + return collection.each( function( index ) { + var self = collection.eq( index ); + if ( isFunction ) { + args[ 0 ] = value.call( this, index, self.html() ); + } + domManip( self, args, callback, ignored ); + } ); + } + + if ( l ) { + fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + // Require either new content or an interest in ignored elements to invoke the callback + if ( first || ignored ) { + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item + // instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( collection[ i ], node, i ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !dataPriv.access( node, "globalEval" ) && + jQuery.contains( doc, node ) ) { + + if ( node.src ) { + + // Optional AJAX dependency, but won't run scripts if not present + if ( jQuery._evalUrl ) { + jQuery._evalUrl( node.src ); + } + } else { + DOMEval( node.textContent.replace( rcleanScript, "" ), doc ); + } + } + } + } + } + } + + return collection; +} + +function remove( elem, selector, keepData ) { + var node, + nodes = selector ? jQuery.filter( selector, elem ) : elem, + i = 0; + + for ( ; ( node = nodes[ i ] ) != null; i++ ) { + if ( !keepData && node.nodeType === 1 ) { + jQuery.cleanData( getAll( node ) ); + } + + if ( node.parentNode ) { + if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { + setGlobalEval( getAll( node, "script" ) ); + } + node.parentNode.removeChild( node ); + } + } + + return elem; +} + +jQuery.extend( { + htmlPrefilter: function( html ) { + return html.replace( rxhtmlTag, "<$1>" ); + }, + + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var i, l, srcElements, destElements, + clone = elem.cloneNode( true ), + inPage = jQuery.contains( elem.ownerDocument, elem ); + + // Fix IE cloning issues + if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && + !jQuery.isXMLDoc( elem ) ) { + + // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + fixInput( srcElements[ i ], destElements[ i ] ); + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + cloneCopyEvent( srcElements[ i ], destElements[ i ] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + // Return the cloned set + return clone; + }, + + cleanData: function( elems ) { + var data, elem, type, + special = jQuery.event.special, + i = 0; + + for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { + if ( acceptData( elem ) ) { + if ( ( data = elem[ dataPriv.expando ] ) ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Support: Chrome <=35 - 45+ + // Assign undefined instead of using delete, see Data#remove + elem[ dataPriv.expando ] = undefined; + } + if ( elem[ dataUser.expando ] ) { + + // Support: Chrome <=35 - 45+ + // Assign undefined instead of using delete, see Data#remove + elem[ dataUser.expando ] = undefined; + } + } + } + } +} ); + +jQuery.fn.extend( { + detach: function( selector ) { + return remove( this, selector, true ); + }, + + remove: function( selector ) { + return remove( this, selector ); + }, + + text: function( value ) { + return access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().each( function() { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.textContent = value; + } + } ); + }, null, value, arguments.length ); + }, + + append: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + } ); + }, + + prepend: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + } ); + }, + + before: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + } ); + }, + + after: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + } ); + }, + + empty: function() { + var elem, + i = 0; + + for ( ; ( elem = this[ i ] ) != null; i++ ) { + if ( elem.nodeType === 1 ) { + + // Prevent memory leaks + jQuery.cleanData( getAll( elem, false ) ); + + // Remove any remaining nodes + elem.textContent = ""; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function() { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + } ); + }, + + html: function( value ) { + return access( this, function( value ) { + var elem = this[ 0 ] || {}, + i = 0, + l = this.length; + + if ( value === undefined && elem.nodeType === 1 ) { + return elem.innerHTML; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { + + value = jQuery.htmlPrefilter( value ); + + try { + for ( ; i < l; i++ ) { + elem = this[ i ] || {}; + + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch ( e ) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function() { + var ignored = []; + + // Make the changes, replacing each non-ignored context element with the new content + return domManip( this, arguments, function( elem ) { + var parent = this.parentNode; + + if ( jQuery.inArray( this, ignored ) < 0 ) { + jQuery.cleanData( getAll( this ) ); + if ( parent ) { + parent.replaceChild( elem, this ); + } + } + + // Force callback invocation + }, ignored ); + } +} ); + +jQuery.each( { + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1, + i = 0; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone( true ); + jQuery( insert[ i ] )[ original ]( elems ); + + // Support: Android <=4.0 only, PhantomJS 1 only + // .get() because push.apply(_, arraylike) throws on ancient WebKit + push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +} ); +var rmargin = ( /^margin/ ); + +var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); + +var getStyles = function( elem ) { + + // Support: IE <=11 only, Firefox <=30 (#15098, #14150) + // IE throws on elements created in popups + // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" + var view = elem.ownerDocument.defaultView; + + if ( !view || !view.opener ) { + view = window; + } + + return view.getComputedStyle( elem ); + }; + + + +( function() { + + // Executing both pixelPosition & boxSizingReliable tests require only one layout + // so they're executed at the same time to save the second computation. + function computeStyleTests() { + + // This is a singleton, we need to execute it only once + if ( !div ) { + return; + } + + div.style.cssText = + "box-sizing:border-box;" + + "position:relative;display:block;" + + "margin:auto;border:1px;padding:1px;" + + "top:1%;width:50%"; + div.innerHTML = ""; + documentElement.appendChild( container ); + + var divStyle = window.getComputedStyle( div ); + pixelPositionVal = divStyle.top !== "1%"; + + // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 + reliableMarginLeftVal = divStyle.marginLeft === "2px"; + boxSizingReliableVal = divStyle.width === "4px"; + + // Support: Android 4.0 - 4.3 only + // Some styles come back with percentage values, even though they shouldn't + div.style.marginRight = "50%"; + pixelMarginRightVal = divStyle.marginRight === "4px"; + + documentElement.removeChild( container ); + + // Nullify the div so it wouldn't be stored in the memory and + // it will also be a sign that checks already performed + div = null; + } + + var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, + container = document.createElement( "div" ), + div = document.createElement( "div" ); + + // Finish early in limited (non-browser) environments + if ( !div.style ) { + return; + } + + // Support: IE <=9 - 11 only + // Style of cloned element affects source element cloned (#8908) + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; + + container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + + "padding:0;margin-top:1px;position:absolute"; + container.appendChild( div ); + + jQuery.extend( support, { + pixelPosition: function() { + computeStyleTests(); + return pixelPositionVal; + }, + boxSizingReliable: function() { + computeStyleTests(); + return boxSizingReliableVal; + }, + pixelMarginRight: function() { + computeStyleTests(); + return pixelMarginRightVal; + }, + reliableMarginLeft: function() { + computeStyleTests(); + return reliableMarginLeftVal; + } + } ); +} )(); + + +function curCSS( elem, name, computed ) { + var width, minWidth, maxWidth, ret, + + // Support: Firefox 51+ + // Retrieving style before computed somehow + // fixes an issue with getting wrong values + // on detached elements + style = elem.style; + + computed = computed || getStyles( elem ); + + // getPropertyValue is needed for: + // .css('filter') (IE 9 only, #12537) + // .css('--customProperty) (#3144) + if ( computed ) { + ret = computed.getPropertyValue( name ) || computed[ name ]; + + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Android Browser returns percentage for some values, + // but width seems to be reliably pixels. + // This is against the CSSOM draft spec: + // https://drafts.csswg.org/cssom/#resolved-values + if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { + + // Remember the original values + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + // Put in the new values to get a computed value out + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + // Revert the changed values + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret !== undefined ? + + // Support: IE <=9 - 11 only + // IE returns zIndex value as an integer. + ret + "" : + ret; +} + + +function addGetHookIf( conditionFn, hookFn ) { + + // Define the hook, we'll check on the first run if it's really needed. + return { + get: function() { + if ( conditionFn() ) { + + // Hook not needed (or it's not possible to use it due + // to missing dependency), remove it. + delete this.get; + return; + } + + // Hook needed; redefine it so that the support test is not executed again. + return ( this.get = hookFn ).apply( this, arguments ); + } + }; +} + + +var + + // Swappable if display is none or starts with table + // except "table", "table-cell", or "table-caption" + // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + rcustomProp = /^--/, + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: "0", + fontWeight: "400" + }, + + cssPrefixes = [ "Webkit", "Moz", "ms" ], + emptyStyle = document.createElement( "div" ).style; + +// Return a css property mapped to a potentially vendor prefixed property +function vendorPropName( name ) { + + // Shortcut for names that are not vendor prefixed + if ( name in emptyStyle ) { + return name; + } + + // Check for vendor prefixed names + var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in emptyStyle ) { + return name; + } + } +} + +// Return a property mapped along what jQuery.cssProps suggests or to +// a vendor prefixed property. +function finalPropName( name ) { + var ret = jQuery.cssProps[ name ]; + if ( !ret ) { + ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name; + } + return ret; +} + +function setPositiveNumber( elem, value, subtract ) { + + // Any relative (+/-) values have already been + // normalized at this point + var matches = rcssNum.exec( value ); + return matches ? + + // Guard against undefined "subtract", e.g., when used as in cssHooks + Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : + value; +} + +function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { + var i, + val = 0; + + // If we already have the right measurement, avoid augmentation + if ( extra === ( isBorderBox ? "border" : "content" ) ) { + i = 4; + + // Otherwise initialize for horizontal or vertical properties + } else { + i = name === "width" ? 1 : 0; + } + + for ( ; i < 4; i += 2 ) { + + // Both box models exclude margin, so add it if we want it + if ( extra === "margin" ) { + val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); + } + + if ( isBorderBox ) { + + // border-box includes padding, so remove it if we want content + if ( extra === "content" ) { + val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + } + + // At this point, extra isn't border nor margin, so remove border + if ( extra !== "margin" ) { + val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } else { + + // At this point, extra isn't content, so add padding + val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + + // At this point, extra isn't content nor padding, so add border + if ( extra !== "padding" ) { + val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } + } + + return val; +} + +function getWidthOrHeight( elem, name, extra ) { + + // Start with computed style + var valueIsBorderBox, + styles = getStyles( elem ), + val = curCSS( elem, name, styles ), + isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test( val ) ) { + return val; + } + + // Check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable elem.style + valueIsBorderBox = isBorderBox && + ( support.boxSizingReliable() || val === elem.style[ name ] ); + + // Fall back to offsetWidth/Height when value is "auto" + // This happens for inline elements with no explicit setting (gh-3571) + if ( val === "auto" ) { + val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ]; + } + + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + + // Use the active box-sizing model to add/subtract irrelevant styles + return ( val + + augmentWidthOrHeight( + elem, + name, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox, + styles + ) + ) + "px"; +} + +jQuery.extend( { + + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + } + } + } + }, + + // Don't automatically add "px" to these possibly-unitless properties + cssNumber: { + "animationIterationCount": true, + "columnCount": true, + "fillOpacity": true, + "flexGrow": true, + "flexShrink": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "order": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + "float": "cssFloat" + }, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, hooks, + origName = jQuery.camelCase( name ), + isCustomProp = rcustomProp.test( name ), + style = elem.style; + + // Make sure that we're working with the right name. We don't + // want to query the value if it is a CSS custom property + // since they are user-defined. + if ( !isCustomProp ) { + name = finalPropName( origName ); + } + + // Gets hook for the prefixed version, then unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // Convert "+=" or "-=" to relative numbers (#7345) + if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { + value = adjustCSS( elem, name, ret ); + + // Fixes bug #9237 + type = "number"; + } + + // Make sure that null and NaN values aren't set (#7116) + if ( value == null || value !== value ) { + return; + } + + // If a number was passed in, add the unit (except for certain CSS properties) + if ( type === "number" ) { + value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); + } + + // background-* props affect original clone's values + if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { + style[ name ] = "inherit"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !( "set" in hooks ) || + ( value = hooks.set( elem, value, extra ) ) !== undefined ) { + + if ( isCustomProp ) { + style.setProperty( name, value ); + } else { + style[ name ] = value; + } + } + + } else { + + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && + ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { + + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, extra, styles ) { + var val, num, hooks, + origName = jQuery.camelCase( name ), + isCustomProp = rcustomProp.test( name ); + + // Make sure that we're working with the right name. We don't + // want to modify the value if it is a CSS custom property + // since they are user-defined. + if ( !isCustomProp ) { + name = finalPropName( origName ); + } + + // Try prefixed name followed by the unprefixed name + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name, styles ); + } + + // Convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Make numeric if forced or a qualifier was provided and val looks numeric + if ( extra === "" || extra ) { + num = parseFloat( val ); + return extra === true || isFinite( num ) ? num || 0 : val; + } + + return val; + } +} ); + +jQuery.each( [ "height", "width" ], function( i, name ) { + jQuery.cssHooks[ name ] = { + get: function( elem, computed, extra ) { + if ( computed ) { + + // Certain elements can have dimension info if we invisibly show them + // but it must have a current display style that would benefit + return rdisplayswap.test( jQuery.css( elem, "display" ) ) && + + // Support: Safari 8+ + // Table columns in Safari have non-zero offsetWidth & zero + // getBoundingClientRect().width unless display is changed. + // Support: IE <=11 only + // Running getBoundingClientRect on a disconnected node + // in IE throws an error. + ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? + swap( elem, cssShow, function() { + return getWidthOrHeight( elem, name, extra ); + } ) : + getWidthOrHeight( elem, name, extra ); + } + }, + + set: function( elem, value, extra ) { + var matches, + styles = extra && getStyles( elem ), + subtract = extra && augmentWidthOrHeight( + elem, + name, + extra, + jQuery.css( elem, "boxSizing", false, styles ) === "border-box", + styles + ); + + // Convert to pixels if value adjustment is needed + if ( subtract && ( matches = rcssNum.exec( value ) ) && + ( matches[ 3 ] || "px" ) !== "px" ) { + + elem.style[ name ] = value; + value = jQuery.css( elem, name ); + } + + return setPositiveNumber( elem, value, subtract ); + } + }; +} ); + +jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, + function( elem, computed ) { + if ( computed ) { + return ( parseFloat( curCSS( elem, "marginLeft" ) ) || + elem.getBoundingClientRect().left - + swap( elem, { marginLeft: 0 }, function() { + return elem.getBoundingClientRect().left; + } ) + ) + "px"; + } + } +); + +// These hooks are used by animate to expand properties +jQuery.each( { + margin: "", + padding: "", + border: "Width" +}, function( prefix, suffix ) { + jQuery.cssHooks[ prefix + suffix ] = { + expand: function( value ) { + var i = 0, + expanded = {}, + + // Assumes a single number if not a string + parts = typeof value === "string" ? value.split( " " ) : [ value ]; + + for ( ; i < 4; i++ ) { + expanded[ prefix + cssExpand[ i ] + suffix ] = + parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; + } + + return expanded; + } + }; + + if ( !rmargin.test( prefix ) ) { + jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; + } +} ); + +jQuery.fn.extend( { + css: function( name, value ) { + return access( this, function( elem, name, value ) { + var styles, len, + map = {}, + i = 0; + + if ( Array.isArray( name ) ) { + styles = getStyles( elem ); + len = name.length; + + for ( ; i < len; i++ ) { + map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); + } + + return map; + } + + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + } +} ); + + +function Tween( elem, options, prop, end, easing ) { + return new Tween.prototype.init( elem, options, prop, end, easing ); +} +jQuery.Tween = Tween; + +Tween.prototype = { + constructor: Tween, + init: function( elem, options, prop, end, easing, unit ) { + this.elem = elem; + this.prop = prop; + this.easing = easing || jQuery.easing._default; + this.options = options; + this.start = this.now = this.cur(); + this.end = end; + this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + }, + cur: function() { + var hooks = Tween.propHooks[ this.prop ]; + + return hooks && hooks.get ? + hooks.get( this ) : + Tween.propHooks._default.get( this ); + }, + run: function( percent ) { + var eased, + hooks = Tween.propHooks[ this.prop ]; + + if ( this.options.duration ) { + this.pos = eased = jQuery.easing[ this.easing ]( + percent, this.options.duration * percent, 0, 1, this.options.duration + ); + } else { + this.pos = eased = percent; + } + this.now = ( this.end - this.start ) * eased + this.start; + + if ( this.options.step ) { + this.options.step.call( this.elem, this.now, this ); + } + + if ( hooks && hooks.set ) { + hooks.set( this ); + } else { + Tween.propHooks._default.set( this ); + } + return this; + } +}; + +Tween.prototype.init.prototype = Tween.prototype; + +Tween.propHooks = { + _default: { + get: function( tween ) { + var result; + + // Use a property on the element directly when it is not a DOM element, + // or when there is no matching style property that exists. + if ( tween.elem.nodeType !== 1 || + tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { + return tween.elem[ tween.prop ]; + } + + // Passing an empty string as a 3rd parameter to .css will automatically + // attempt a parseFloat and fallback to a string if the parse fails. + // Simple values such as "10px" are parsed to Float; + // complex values such as "rotate(1rad)" are returned as-is. + result = jQuery.css( tween.elem, tween.prop, "" ); + + // Empty strings, null, undefined and "auto" are converted to 0. + return !result || result === "auto" ? 0 : result; + }, + set: function( tween ) { + + // Use step hook for back compat. + // Use cssHook if its there. + // Use .style if available and use plain properties where available. + if ( jQuery.fx.step[ tween.prop ] ) { + jQuery.fx.step[ tween.prop ]( tween ); + } else if ( tween.elem.nodeType === 1 && + ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || + jQuery.cssHooks[ tween.prop ] ) ) { + jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); + } else { + tween.elem[ tween.prop ] = tween.now; + } + } + } +}; + +// Support: IE <=9 only +// Panic based approach to setting things on disconnected nodes +Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { + set: function( tween ) { + if ( tween.elem.nodeType && tween.elem.parentNode ) { + tween.elem[ tween.prop ] = tween.now; + } + } +}; + +jQuery.easing = { + linear: function( p ) { + return p; + }, + swing: function( p ) { + return 0.5 - Math.cos( p * Math.PI ) / 2; + }, + _default: "swing" +}; + +jQuery.fx = Tween.prototype.init; + +// Back compat <1.8 extension point +jQuery.fx.step = {}; + + + + +var + fxNow, inProgress, + rfxtypes = /^(?:toggle|show|hide)$/, + rrun = /queueHooks$/; + +function schedule() { + if ( inProgress ) { + if ( document.hidden === false && window.requestAnimationFrame ) { + window.requestAnimationFrame( schedule ); + } else { + window.setTimeout( schedule, jQuery.fx.interval ); + } + + jQuery.fx.tick(); + } +} + +// Animations created synchronously will run synchronously +function createFxNow() { + window.setTimeout( function() { + fxNow = undefined; + } ); + return ( fxNow = jQuery.now() ); +} + +// Generate parameters to create a standard animation +function genFx( type, includeWidth ) { + var which, + i = 0, + attrs = { height: type }; + + // If we include width, step value is 1 to do all cssExpand values, + // otherwise step value is 2 to skip over Left and Right + includeWidth = includeWidth ? 1 : 0; + for ( ; i < 4; i += 2 - includeWidth ) { + which = cssExpand[ i ]; + attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; + } + + if ( includeWidth ) { + attrs.opacity = attrs.width = type; + } + + return attrs; +} + +function createTween( value, prop, animation ) { + var tween, + collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), + index = 0, + length = collection.length; + for ( ; index < length; index++ ) { + if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { + + // We're done with this property + return tween; + } + } +} + +function defaultPrefilter( elem, props, opts ) { + var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, + isBox = "width" in props || "height" in props, + anim = this, + orig = {}, + style = elem.style, + hidden = elem.nodeType && isHiddenWithinTree( elem ), + dataShow = dataPriv.get( elem, "fxshow" ); + + // Queue-skipping animations hijack the fx hooks + if ( !opts.queue ) { + hooks = jQuery._queueHooks( elem, "fx" ); + if ( hooks.unqueued == null ) { + hooks.unqueued = 0; + oldfire = hooks.empty.fire; + hooks.empty.fire = function() { + if ( !hooks.unqueued ) { + oldfire(); + } + }; + } + hooks.unqueued++; + + anim.always( function() { + + // Ensure the complete handler is called before this completes + anim.always( function() { + hooks.unqueued--; + if ( !jQuery.queue( elem, "fx" ).length ) { + hooks.empty.fire(); + } + } ); + } ); + } + + // Detect show/hide animations + for ( prop in props ) { + value = props[ prop ]; + if ( rfxtypes.test( value ) ) { + delete props[ prop ]; + toggle = toggle || value === "toggle"; + if ( value === ( hidden ? "hide" : "show" ) ) { + + // Pretend to be hidden if this is a "show" and + // there is still data from a stopped show/hide + if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { + hidden = true; + + // Ignore all other no-op show/hide data + } else { + continue; + } + } + orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); + } + } + + // Bail out if this is a no-op like .hide().hide() + propTween = !jQuery.isEmptyObject( props ); + if ( !propTween && jQuery.isEmptyObject( orig ) ) { + return; + } + + // Restrict "overflow" and "display" styles during box animations + if ( isBox && elem.nodeType === 1 ) { + + // Support: IE <=9 - 11, Edge 12 - 13 + // Record all 3 overflow attributes because IE does not infer the shorthand + // from identically-valued overflowX and overflowY + opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; + + // Identify a display type, preferring old show/hide data over the CSS cascade + restoreDisplay = dataShow && dataShow.display; + if ( restoreDisplay == null ) { + restoreDisplay = dataPriv.get( elem, "display" ); + } + display = jQuery.css( elem, "display" ); + if ( display === "none" ) { + if ( restoreDisplay ) { + display = restoreDisplay; + } else { + + // Get nonempty value(s) by temporarily forcing visibility + showHide( [ elem ], true ); + restoreDisplay = elem.style.display || restoreDisplay; + display = jQuery.css( elem, "display" ); + showHide( [ elem ] ); + } + } + + // Animate inline elements as inline-block + if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { + if ( jQuery.css( elem, "float" ) === "none" ) { + + // Restore the original display value at the end of pure show/hide animations + if ( !propTween ) { + anim.done( function() { + style.display = restoreDisplay; + } ); + if ( restoreDisplay == null ) { + display = style.display; + restoreDisplay = display === "none" ? "" : display; + } + } + style.display = "inline-block"; + } + } + } + + if ( opts.overflow ) { + style.overflow = "hidden"; + anim.always( function() { + style.overflow = opts.overflow[ 0 ]; + style.overflowX = opts.overflow[ 1 ]; + style.overflowY = opts.overflow[ 2 ]; + } ); + } + + // Implement show/hide animations + propTween = false; + for ( prop in orig ) { + + // General show/hide setup for this element animation + if ( !propTween ) { + if ( dataShow ) { + if ( "hidden" in dataShow ) { + hidden = dataShow.hidden; + } + } else { + dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); + } + + // Store hidden/visible for toggle so `.stop().toggle()` "reverses" + if ( toggle ) { + dataShow.hidden = !hidden; + } + + // Show elements before animating them + if ( hidden ) { + showHide( [ elem ], true ); + } + + /* eslint-disable no-loop-func */ + + anim.done( function() { + + /* eslint-enable no-loop-func */ + + // The final step of a "hide" animation is actually hiding the element + if ( !hidden ) { + showHide( [ elem ] ); + } + dataPriv.remove( elem, "fxshow" ); + for ( prop in orig ) { + jQuery.style( elem, prop, orig[ prop ] ); + } + } ); + } + + // Per-property setup + propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); + if ( !( prop in dataShow ) ) { + dataShow[ prop ] = propTween.start; + if ( hidden ) { + propTween.end = propTween.start; + propTween.start = 0; + } + } + } +} + +function propFilter( props, specialEasing ) { + var index, name, easing, value, hooks; + + // camelCase, specialEasing and expand cssHook pass + for ( index in props ) { + name = jQuery.camelCase( index ); + easing = specialEasing[ name ]; + value = props[ index ]; + if ( Array.isArray( value ) ) { + easing = value[ 1 ]; + value = props[ index ] = value[ 0 ]; + } + + if ( index !== name ) { + props[ name ] = value; + delete props[ index ]; + } + + hooks = jQuery.cssHooks[ name ]; + if ( hooks && "expand" in hooks ) { + value = hooks.expand( value ); + delete props[ name ]; + + // Not quite $.extend, this won't overwrite existing keys. + // Reusing 'index' because we have the correct "name" + for ( index in value ) { + if ( !( index in props ) ) { + props[ index ] = value[ index ]; + specialEasing[ index ] = easing; + } + } + } else { + specialEasing[ name ] = easing; + } + } +} + +function Animation( elem, properties, options ) { + var result, + stopped, + index = 0, + length = Animation.prefilters.length, + deferred = jQuery.Deferred().always( function() { + + // Don't match elem in the :animated selector + delete tick.elem; + } ), + tick = function() { + if ( stopped ) { + return false; + } + var currentTime = fxNow || createFxNow(), + remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), + + // Support: Android 2.3 only + // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) + temp = remaining / animation.duration || 0, + percent = 1 - temp, + index = 0, + length = animation.tweens.length; + + for ( ; index < length; index++ ) { + animation.tweens[ index ].run( percent ); + } + + deferred.notifyWith( elem, [ animation, percent, remaining ] ); + + // If there's more to do, yield + if ( percent < 1 && length ) { + return remaining; + } + + // If this was an empty animation, synthesize a final progress notification + if ( !length ) { + deferred.notifyWith( elem, [ animation, 1, 0 ] ); + } + + // Resolve the animation and report its conclusion + deferred.resolveWith( elem, [ animation ] ); + return false; + }, + animation = deferred.promise( { + elem: elem, + props: jQuery.extend( {}, properties ), + opts: jQuery.extend( true, { + specialEasing: {}, + easing: jQuery.easing._default + }, options ), + originalProperties: properties, + originalOptions: options, + startTime: fxNow || createFxNow(), + duration: options.duration, + tweens: [], + createTween: function( prop, end ) { + var tween = jQuery.Tween( elem, animation.opts, prop, end, + animation.opts.specialEasing[ prop ] || animation.opts.easing ); + animation.tweens.push( tween ); + return tween; + }, + stop: function( gotoEnd ) { + var index = 0, + + // If we are going to the end, we want to run all the tweens + // otherwise we skip this part + length = gotoEnd ? animation.tweens.length : 0; + if ( stopped ) { + return this; + } + stopped = true; + for ( ; index < length; index++ ) { + animation.tweens[ index ].run( 1 ); + } + + // Resolve when we played the last frame; otherwise, reject + if ( gotoEnd ) { + deferred.notifyWith( elem, [ animation, 1, 0 ] ); + deferred.resolveWith( elem, [ animation, gotoEnd ] ); + } else { + deferred.rejectWith( elem, [ animation, gotoEnd ] ); + } + return this; + } + } ), + props = animation.props; + + propFilter( props, animation.opts.specialEasing ); + + for ( ; index < length; index++ ) { + result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); + if ( result ) { + if ( jQuery.isFunction( result.stop ) ) { + jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = + jQuery.proxy( result.stop, result ); + } + return result; + } + } + + jQuery.map( props, createTween, animation ); + + if ( jQuery.isFunction( animation.opts.start ) ) { + animation.opts.start.call( elem, animation ); + } + + // Attach callbacks from options + animation + .progress( animation.opts.progress ) + .done( animation.opts.done, animation.opts.complete ) + .fail( animation.opts.fail ) + .always( animation.opts.always ); + + jQuery.fx.timer( + jQuery.extend( tick, { + elem: elem, + anim: animation, + queue: animation.opts.queue + } ) + ); + + return animation; +} + +jQuery.Animation = jQuery.extend( Animation, { + + tweeners: { + "*": [ function( prop, value ) { + var tween = this.createTween( prop, value ); + adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); + return tween; + } ] + }, + + tweener: function( props, callback ) { + if ( jQuery.isFunction( props ) ) { + callback = props; + props = [ "*" ]; + } else { + props = props.match( rnothtmlwhite ); + } + + var prop, + index = 0, + length = props.length; + + for ( ; index < length; index++ ) { + prop = props[ index ]; + Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; + Animation.tweeners[ prop ].unshift( callback ); + } + }, + + prefilters: [ defaultPrefilter ], + + prefilter: function( callback, prepend ) { + if ( prepend ) { + Animation.prefilters.unshift( callback ); + } else { + Animation.prefilters.push( callback ); + } + } +} ); + +jQuery.speed = function( speed, easing, fn ) { + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { + complete: fn || !fn && easing || + jQuery.isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing + }; + + // Go to the end state if fx are off + if ( jQuery.fx.off ) { + opt.duration = 0; + + } else { + if ( typeof opt.duration !== "number" ) { + if ( opt.duration in jQuery.fx.speeds ) { + opt.duration = jQuery.fx.speeds[ opt.duration ]; + + } else { + opt.duration = jQuery.fx.speeds._default; + } + } + } + + // Normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; + } + + // Queueing + opt.old = opt.complete; + + opt.complete = function() { + if ( jQuery.isFunction( opt.old ) ) { + opt.old.call( this ); + } + + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); + } + }; + + return opt; +}; + +jQuery.fn.extend( { + fadeTo: function( speed, to, easing, callback ) { + + // Show any hidden elements after setting opacity to 0 + return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() + + // Animate to the value specified + .end().animate( { opacity: to }, speed, easing, callback ); + }, + animate: function( prop, speed, easing, callback ) { + var empty = jQuery.isEmptyObject( prop ), + optall = jQuery.speed( speed, easing, callback ), + doAnimation = function() { + + // Operate on a copy of prop so per-property easing won't be lost + var anim = Animation( this, jQuery.extend( {}, prop ), optall ); + + // Empty animations, or finishing resolves immediately + if ( empty || dataPriv.get( this, "finish" ) ) { + anim.stop( true ); + } + }; + doAnimation.finish = doAnimation; + + return empty || optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); + }, + stop: function( type, clearQueue, gotoEnd ) { + var stopQueue = function( hooks ) { + var stop = hooks.stop; + delete hooks.stop; + stop( gotoEnd ); + }; + + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue && type !== false ) { + this.queue( type || "fx", [] ); + } + + return this.each( function() { + var dequeue = true, + index = type != null && type + "queueHooks", + timers = jQuery.timers, + data = dataPriv.get( this ); + + if ( index ) { + if ( data[ index ] && data[ index ].stop ) { + stopQueue( data[ index ] ); + } + } else { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { + stopQueue( data[ index ] ); + } + } + } + + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && + ( type == null || timers[ index ].queue === type ) ) { + + timers[ index ].anim.stop( gotoEnd ); + dequeue = false; + timers.splice( index, 1 ); + } + } + + // Start the next in the queue if the last step wasn't forced. + // Timers currently will call their complete callbacks, which + // will dequeue but only if they were gotoEnd. + if ( dequeue || !gotoEnd ) { + jQuery.dequeue( this, type ); + } + } ); + }, + finish: function( type ) { + if ( type !== false ) { + type = type || "fx"; + } + return this.each( function() { + var index, + data = dataPriv.get( this ), + queue = data[ type + "queue" ], + hooks = data[ type + "queueHooks" ], + timers = jQuery.timers, + length = queue ? queue.length : 0; + + // Enable finishing flag on private data + data.finish = true; + + // Empty the queue first + jQuery.queue( this, type, [] ); + + if ( hooks && hooks.stop ) { + hooks.stop.call( this, true ); + } + + // Look for any active animations, and finish them + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && timers[ index ].queue === type ) { + timers[ index ].anim.stop( true ); + timers.splice( index, 1 ); + } + } + + // Look for any animations in the old queue and finish them + for ( index = 0; index < length; index++ ) { + if ( queue[ index ] && queue[ index ].finish ) { + queue[ index ].finish.call( this ); + } + } + + // Turn off finishing flag + delete data.finish; + } ); + } +} ); + +jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { + var cssFn = jQuery.fn[ name ]; + jQuery.fn[ name ] = function( speed, easing, callback ) { + return speed == null || typeof speed === "boolean" ? + cssFn.apply( this, arguments ) : + this.animate( genFx( name, true ), speed, easing, callback ); + }; +} ); + +// Generate shortcuts for custom animations +jQuery.each( { + slideDown: genFx( "show" ), + slideUp: genFx( "hide" ), + slideToggle: genFx( "toggle" ), + fadeIn: { opacity: "show" }, + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } +}, function( name, props ) { + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); + }; +} ); + +jQuery.timers = []; +jQuery.fx.tick = function() { + var timer, + i = 0, + timers = jQuery.timers; + + fxNow = jQuery.now(); + + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + + // Run the timer and safely remove it when done (allowing for external removal) + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); + } + } + + if ( !timers.length ) { + jQuery.fx.stop(); + } + fxNow = undefined; +}; + +jQuery.fx.timer = function( timer ) { + jQuery.timers.push( timer ); + jQuery.fx.start(); +}; + +jQuery.fx.interval = 13; +jQuery.fx.start = function() { + if ( inProgress ) { + return; + } + + inProgress = true; + schedule(); +}; + +jQuery.fx.stop = function() { + inProgress = null; +}; + +jQuery.fx.speeds = { + slow: 600, + fast: 200, + + // Default speed + _default: 400 +}; + + +// Based off of the plugin by Clint Helfers, with permission. +// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ +jQuery.fn.delay = function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = window.setTimeout( next, time ); + hooks.stop = function() { + window.clearTimeout( timeout ); + }; + } ); +}; + + +( function() { + var input = document.createElement( "input" ), + select = document.createElement( "select" ), + opt = select.appendChild( document.createElement( "option" ) ); + + input.type = "checkbox"; + + // Support: Android <=4.3 only + // Default value for a checkbox should be "on" + support.checkOn = input.value !== ""; + + // Support: IE <=11 only + // Must access selectedIndex to make default options select + support.optSelected = opt.selected; + + // Support: IE <=11 only + // An input loses its value after becoming a radio + input = document.createElement( "input" ); + input.value = "t"; + input.type = "radio"; + support.radioValue = input.value === "t"; +} )(); + + +var boolHook, + attrHandle = jQuery.expr.attrHandle; + +jQuery.fn.extend( { + attr: function( name, value ) { + return access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each( function() { + jQuery.removeAttr( this, name ); + } ); + } +} ); + +jQuery.extend( { + attr: function( elem, name, value ) { + var ret, hooks, + nType = elem.nodeType; + + // Don't get/set attributes on text, comment and attribute nodes + if ( nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + // Attribute hooks are determined by the lowercase version + // Grab necessary hook if one is defined + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + hooks = jQuery.attrHooks[ name.toLowerCase() ] || + ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); + } + + if ( value !== undefined ) { + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; + } + + if ( hooks && "set" in hooks && + ( ret = hooks.set( elem, value, name ) ) !== undefined ) { + return ret; + } + + elem.setAttribute( name, value + "" ); + return value; + } + + if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { + return ret; + } + + ret = jQuery.find.attr( elem, name ); + + // Non-existent attributes return null, we normalize to undefined + return ret == null ? undefined : ret; + }, + + attrHooks: { + type: { + set: function( elem, value ) { + if ( !support.radioValue && value === "radio" && + nodeName( elem, "input" ) ) { + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + } + }, + + removeAttr: function( elem, value ) { + var name, + i = 0, + + // Attribute names can contain non-HTML whitespace characters + // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 + attrNames = value && value.match( rnothtmlwhite ); + + if ( attrNames && elem.nodeType === 1 ) { + while ( ( name = attrNames[ i++ ] ) ) { + elem.removeAttribute( name ); + } + } + } +} ); + +// Hooks for boolean attributes +boolHook = { + set: function( elem, value, name ) { + if ( value === false ) { + + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + elem.setAttribute( name, name ); + } + return name; + } +}; + +jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { + var getter = attrHandle[ name ] || jQuery.find.attr; + + attrHandle[ name ] = function( elem, name, isXML ) { + var ret, handle, + lowercaseName = name.toLowerCase(); + + if ( !isXML ) { + + // Avoid an infinite loop by temporarily removing this function from the getter + handle = attrHandle[ lowercaseName ]; + attrHandle[ lowercaseName ] = ret; + ret = getter( elem, name, isXML ) != null ? + lowercaseName : + null; + attrHandle[ lowercaseName ] = handle; + } + return ret; + }; +} ); + + + + +var rfocusable = /^(?:input|select|textarea|button)$/i, + rclickable = /^(?:a|area)$/i; + +jQuery.fn.extend( { + prop: function( name, value ) { + return access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + return this.each( function() { + delete this[ jQuery.propFix[ name ] || name ]; + } ); + } +} ); + +jQuery.extend( { + prop: function( elem, name, value ) { + var ret, hooks, + nType = elem.nodeType; + + // Don't get/set properties on text, comment and attribute nodes + if ( nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && + ( ret = hooks.set( elem, value, name ) ) !== undefined ) { + return ret; + } + + return ( elem[ name ] = value ); + } + + if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { + return ret; + } + + return elem[ name ]; + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + + // Support: IE <=9 - 11 only + // elem.tabIndex doesn't always return the + // correct value when it hasn't been explicitly set + // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + // Use proper attribute retrieval(#12072) + var tabindex = jQuery.find.attr( elem, "tabindex" ); + + if ( tabindex ) { + return parseInt( tabindex, 10 ); + } + + if ( + rfocusable.test( elem.nodeName ) || + rclickable.test( elem.nodeName ) && + elem.href + ) { + return 0; + } + + return -1; + } + } + }, + + propFix: { + "for": "htmlFor", + "class": "className" + } +} ); + +// Support: IE <=11 only +// Accessing the selectedIndex property +// forces the browser to respect setting selected +// on the option +// The getter ensures a default option is selected +// when in an optgroup +// eslint rule "no-unused-expressions" is disabled for this code +// since it considers such accessions noop +if ( !support.optSelected ) { + jQuery.propHooks.selected = { + get: function( elem ) { + + /* eslint no-unused-expressions: "off" */ + + var parent = elem.parentNode; + if ( parent && parent.parentNode ) { + parent.parentNode.selectedIndex; + } + return null; + }, + set: function( elem ) { + + /* eslint no-unused-expressions: "off" */ + + var parent = elem.parentNode; + if ( parent ) { + parent.selectedIndex; + + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + } + }; +} + +jQuery.each( [ + "tabIndex", + "readOnly", + "maxLength", + "cellSpacing", + "cellPadding", + "rowSpan", + "colSpan", + "useMap", + "frameBorder", + "contentEditable" +], function() { + jQuery.propFix[ this.toLowerCase() ] = this; +} ); + + + + + // Strip and collapse whitespace according to HTML spec + // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace + function stripAndCollapse( value ) { + var tokens = value.match( rnothtmlwhite ) || []; + return tokens.join( " " ); + } + + +function getClass( elem ) { + return elem.getAttribute && elem.getAttribute( "class" ) || ""; +} + +jQuery.fn.extend( { + addClass: function( value ) { + var classes, elem, cur, curValue, clazz, j, finalValue, + i = 0; + + if ( jQuery.isFunction( value ) ) { + return this.each( function( j ) { + jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); + } ); + } + + if ( typeof value === "string" && value ) { + classes = value.match( rnothtmlwhite ) || []; + + while ( ( elem = this[ i++ ] ) ) { + curValue = getClass( elem ); + cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); + + if ( cur ) { + j = 0; + while ( ( clazz = classes[ j++ ] ) ) { + if ( cur.indexOf( " " + clazz + " " ) < 0 ) { + cur += clazz + " "; + } + } + + // Only assign if different to avoid unneeded rendering. + finalValue = stripAndCollapse( cur ); + if ( curValue !== finalValue ) { + elem.setAttribute( "class", finalValue ); + } + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classes, elem, cur, curValue, clazz, j, finalValue, + i = 0; + + if ( jQuery.isFunction( value ) ) { + return this.each( function( j ) { + jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); + } ); + } + + if ( !arguments.length ) { + return this.attr( "class", "" ); + } + + if ( typeof value === "string" && value ) { + classes = value.match( rnothtmlwhite ) || []; + + while ( ( elem = this[ i++ ] ) ) { + curValue = getClass( elem ); + + // This expression is here for better compressibility (see addClass) + cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); + + if ( cur ) { + j = 0; + while ( ( clazz = classes[ j++ ] ) ) { + + // Remove *all* instances + while ( cur.indexOf( " " + clazz + " " ) > -1 ) { + cur = cur.replace( " " + clazz + " ", " " ); + } + } + + // Only assign if different to avoid unneeded rendering. + finalValue = stripAndCollapse( cur ); + if ( curValue !== finalValue ) { + elem.setAttribute( "class", finalValue ); + } + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value; + + if ( typeof stateVal === "boolean" && type === "string" ) { + return stateVal ? this.addClass( value ) : this.removeClass( value ); + } + + if ( jQuery.isFunction( value ) ) { + return this.each( function( i ) { + jQuery( this ).toggleClass( + value.call( this, i, getClass( this ), stateVal ), + stateVal + ); + } ); + } + + return this.each( function() { + var className, i, self, classNames; + + if ( type === "string" ) { + + // Toggle individual class names + i = 0; + self = jQuery( this ); + classNames = value.match( rnothtmlwhite ) || []; + + while ( ( className = classNames[ i++ ] ) ) { + + // Check each className given, space separated list + if ( self.hasClass( className ) ) { + self.removeClass( className ); + } else { + self.addClass( className ); + } + } + + // Toggle whole class name + } else if ( value === undefined || type === "boolean" ) { + className = getClass( this ); + if ( className ) { + + // Store className if set + dataPriv.set( this, "__className__", className ); + } + + // If the element has a class name or if we're passed `false`, + // then remove the whole classname (if there was one, the above saved it). + // Otherwise bring back whatever was previously saved (if anything), + // falling back to the empty string if nothing was stored. + if ( this.setAttribute ) { + this.setAttribute( "class", + className || value === false ? + "" : + dataPriv.get( this, "__className__" ) || "" + ); + } + } + } ); + }, + + hasClass: function( selector ) { + var className, elem, + i = 0; + + className = " " + selector + " "; + while ( ( elem = this[ i++ ] ) ) { + if ( elem.nodeType === 1 && + ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { + return true; + } + } + + return false; + } +} ); + + + + +var rreturn = /\r/g; + +jQuery.fn.extend( { + val: function( value ) { + var hooks, ret, isFunction, + elem = this[ 0 ]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || + jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && + "get" in hooks && + ( ret = hooks.get( elem, "value" ) ) !== undefined + ) { + return ret; + } + + ret = elem.value; + + // Handle most common string cases + if ( typeof ret === "string" ) { + return ret.replace( rreturn, "" ); + } + + // Handle cases where value is null/undef or number + return ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each( function( i ) { + var val; + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, jQuery( this ).val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + + } else if ( typeof val === "number" ) { + val += ""; + + } else if ( Array.isArray( val ) ) { + val = jQuery.map( val, function( value ) { + return value == null ? "" : value + ""; + } ); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + } ); + } +} ); + +jQuery.extend( { + valHooks: { + option: { + get: function( elem ) { + + var val = jQuery.find.attr( elem, "value" ); + return val != null ? + val : + + // Support: IE <=10 - 11 only + // option.text throws exceptions (#14686, #14858) + // Strip and collapse whitespace + // https://html.spec.whatwg.org/#strip-and-collapse-whitespace + stripAndCollapse( jQuery.text( elem ) ); + } + }, + select: { + get: function( elem ) { + var value, option, i, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one", + values = one ? null : [], + max = one ? index + 1 : options.length; + + if ( index < 0 ) { + i = max; + + } else { + i = one ? index : 0; + } + + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; + + // Support: IE <=9 only + // IE8-9 doesn't update selected after form reset (#2551) + if ( ( option.selected || i === index ) && + + // Don't return options that are disabled or in a disabled optgroup + !option.disabled && + ( !option.parentNode.disabled || + !nodeName( option.parentNode, "optgroup" ) ) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + }, + + set: function( elem, value ) { + var optionSet, option, + options = elem.options, + values = jQuery.makeArray( value ), + i = options.length; + + while ( i-- ) { + option = options[ i ]; + + /* eslint-disable no-cond-assign */ + + if ( option.selected = + jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 + ) { + optionSet = true; + } + + /* eslint-enable no-cond-assign */ + } + + // Force browsers to behave consistently when non-matching value is set + if ( !optionSet ) { + elem.selectedIndex = -1; + } + return values; + } + } + } +} ); + +// Radios and checkboxes getter/setter +jQuery.each( [ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + set: function( elem, value ) { + if ( Array.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); + } + } + }; + if ( !support.checkOn ) { + jQuery.valHooks[ this ].get = function( elem ) { + return elem.getAttribute( "value" ) === null ? "on" : elem.value; + }; + } +} ); + + + + +// Return jQuery for attributes-only inclusion + + +var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/; + +jQuery.extend( jQuery.event, { + + trigger: function( event, data, elem, onlyHandlers ) { + + var i, cur, tmp, bubbleType, ontype, handle, special, + eventPath = [ elem || document ], + type = hasOwn.call( event, "type" ) ? event.type : event, + namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "." ) > -1 ) { + + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split( "." ); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf( ":" ) < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) + event.isTrigger = onlyHandlers ? 2 : 3; + event.namespace = namespaces.join( "." ); + event.rnamespace = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === ( elem.ownerDocument || document ) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && + dataPriv.get( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && handle.apply && acceptData( cur ) ) { + event.result = handle.apply( cur, data ); + if ( event.result === false ) { + event.preventDefault(); + } + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( ( !special._default || + special._default.apply( eventPath.pop(), data ) === false ) && + acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name as the event. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + elem[ type ](); + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + // Piggyback on a donor event to simulate a different one + // Used only for `focus(in | out)` events + simulate: function( type, elem, event ) { + var e = jQuery.extend( + new jQuery.Event(), + event, + { + type: type, + isSimulated: true + } + ); + + jQuery.event.trigger( e, null, elem ); + } + +} ); + +jQuery.fn.extend( { + + trigger: function( type, data ) { + return this.each( function() { + jQuery.event.trigger( type, data, this ); + } ); + }, + triggerHandler: function( type, data ) { + var elem = this[ 0 ]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +} ); + + +jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup contextmenu" ).split( " " ), + function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; +} ); + +jQuery.fn.extend( { + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } +} ); + + + + +support.focusin = "onfocusin" in window; + + +// Support: Firefox <=44 +// Firefox doesn't have focus(in | out) events +// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 +// +// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 +// focus(in | out) events fire after focus & blur events, +// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order +// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 +if ( !support.focusin ) { + jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler on the document while someone wants focusin/focusout + var handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + var doc = this.ownerDocument || this, + attaches = dataPriv.access( doc, fix ); + + if ( !attaches ) { + doc.addEventListener( orig, handler, true ); + } + dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); + }, + teardown: function() { + var doc = this.ownerDocument || this, + attaches = dataPriv.access( doc, fix ) - 1; + + if ( !attaches ) { + doc.removeEventListener( orig, handler, true ); + dataPriv.remove( doc, fix ); + + } else { + dataPriv.access( doc, fix, attaches ); + } + } + }; + } ); +} +var location = window.location; + +var nonce = jQuery.now(); + +var rquery = ( /\?/ ); + + + +// Cross-browser xml parsing +jQuery.parseXML = function( data ) { + var xml; + if ( !data || typeof data !== "string" ) { + return null; + } + + // Support: IE 9 - 11 only + // IE throws on parseFromString with invalid input. + try { + xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); + } catch ( e ) { + xml = undefined; + } + + if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; +}; + + +var + rbracket = /\[\]$/, + rCRLF = /\r?\n/g, + rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, + rsubmittable = /^(?:input|select|textarea|keygen)/i; + +function buildParams( prefix, obj, traditional, add ) { + var name; + + if ( Array.isArray( obj ) ) { + + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + + // Treat each array item as a scalar. + add( prefix, v ); + + } else { + + // Item is non-scalar (array or object), encode its numeric index. + buildParams( + prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", + v, + traditional, + add + ); + } + } ); + + } else if ( !traditional && jQuery.type( obj ) === "object" ) { + + // Serialize object item. + for ( name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); + } + + } else { + + // Serialize scalar item. + add( prefix, obj ); + } +} + +// Serialize an array of form elements or a set of +// key/values into a query string +jQuery.param = function( a, traditional ) { + var prefix, + s = [], + add = function( key, valueOrFunction ) { + + // If value is a function, invoke it and use its return value + var value = jQuery.isFunction( valueOrFunction ) ? + valueOrFunction() : + valueOrFunction; + + s[ s.length ] = encodeURIComponent( key ) + "=" + + encodeURIComponent( value == null ? "" : value ); + }; + + // If an array was passed in, assume that it is an array of form elements. + if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { + + // Serialize the form elements + jQuery.each( a, function() { + add( this.name, this.value ); + } ); + + } else { + + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for ( prefix in a ) { + buildParams( prefix, a[ prefix ], traditional, add ); + } + } + + // Return the resulting serialization + return s.join( "&" ); +}; + +jQuery.fn.extend( { + serialize: function() { + return jQuery.param( this.serializeArray() ); + }, + serializeArray: function() { + return this.map( function() { + + // Can add propHook for "elements" to filter or add form elements + var elements = jQuery.prop( this, "elements" ); + return elements ? jQuery.makeArray( elements ) : this; + } ) + .filter( function() { + var type = this.type; + + // Use .is( ":disabled" ) so that fieldset[disabled] works + return this.name && !jQuery( this ).is( ":disabled" ) && + rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && + ( this.checked || !rcheckableType.test( type ) ); + } ) + .map( function( i, elem ) { + var val = jQuery( this ).val(); + + if ( val == null ) { + return null; + } + + if ( Array.isArray( val ) ) { + return jQuery.map( val, function( val ) { + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + } ); + } + + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + } ).get(); + } +} ); + + +var + r20 = /%20/g, + rhash = /#.*$/, + rantiCache = /([?&])_=[^&]*/, + rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, + + // #7653, #8125, #8152: local protocol detection + rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, + rnoContent = /^(?:GET|HEAD)$/, + rprotocol = /^\/\//, + + /* Prefilters + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) + * 2) These are called: + * - BEFORE asking for a transport + * - AFTER param serialization (s.data is a string if s.processData is true) + * 3) key is the dataType + * 4) the catchall symbol "*" can be used + * 5) execution will start with transport dataType and THEN continue down to "*" if needed + */ + prefilters = {}, + + /* Transports bindings + * 1) key is the dataType + * 2) the catchall symbol "*" can be used + * 3) selection will start with transport dataType and THEN go to "*" if needed + */ + transports = {}, + + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression + allTypes = "*/".concat( "*" ), + + // Anchor tag for parsing the document origin + originAnchor = document.createElement( "a" ); + originAnchor.href = location.href; + +// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport +function addToPrefiltersOrTransports( structure ) { + + // dataTypeExpression is optional and defaults to "*" + return function( dataTypeExpression, func ) { + + if ( typeof dataTypeExpression !== "string" ) { + func = dataTypeExpression; + dataTypeExpression = "*"; + } + + var dataType, + i = 0, + dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; + + if ( jQuery.isFunction( func ) ) { + + // For each dataType in the dataTypeExpression + while ( ( dataType = dataTypes[ i++ ] ) ) { + + // Prepend if requested + if ( dataType[ 0 ] === "+" ) { + dataType = dataType.slice( 1 ) || "*"; + ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); + + // Otherwise append + } else { + ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); + } + } + } + }; +} + +// Base inspection function for prefilters and transports +function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { + + var inspected = {}, + seekingTransport = ( structure === transports ); + + function inspect( dataType ) { + var selected; + inspected[ dataType ] = true; + jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { + var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); + if ( typeof dataTypeOrTransport === "string" && + !seekingTransport && !inspected[ dataTypeOrTransport ] ) { + + options.dataTypes.unshift( dataTypeOrTransport ); + inspect( dataTypeOrTransport ); + return false; + } else if ( seekingTransport ) { + return !( selected = dataTypeOrTransport ); + } + } ); + return selected; + } + + return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); +} + +// A special extend for ajax options +// that takes "flat" options (not to be deep extended) +// Fixes #9887 +function ajaxExtend( target, src ) { + var key, deep, + flatOptions = jQuery.ajaxSettings.flatOptions || {}; + + for ( key in src ) { + if ( src[ key ] !== undefined ) { + ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; + } + } + if ( deep ) { + jQuery.extend( true, target, deep ); + } + + return target; +} + +/* Handles responses to an ajax request: + * - finds the right dataType (mediates between content-type and expected dataType) + * - returns the corresponding response + */ +function ajaxHandleResponses( s, jqXHR, responses ) { + + var ct, type, finalDataType, firstDataType, + contents = s.contents, + dataTypes = s.dataTypes; + + // Remove auto dataType and get content-type in the process + while ( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); + } + } + + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } + } + + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + + // Or just use first one + finalDataType = finalDataType || firstDataType; + } + + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } +} + +/* Chain conversions given the request and the original response + * Also sets the responseXXX fields on the jqXHR instance + */ +function ajaxConvert( s, response, jqXHR, isSuccess ) { + var conv2, current, conv, tmp, prev, + converters = {}, + + // Work with a copy of dataTypes in case we need to modify it for conversion + dataTypes = s.dataTypes.slice(); + + // Create converters map with lowercased keys + if ( dataTypes[ 1 ] ) { + for ( conv in s.converters ) { + converters[ conv.toLowerCase() ] = s.converters[ conv ]; + } + } + + current = dataTypes.shift(); + + // Convert to each sequential dataType + while ( current ) { + + if ( s.responseFields[ current ] ) { + jqXHR[ s.responseFields[ current ] ] = response; + } + + // Apply the dataFilter if provided + if ( !prev && isSuccess && s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); + } + + prev = current; + current = dataTypes.shift(); + + if ( current ) { + + // There's only work to do if current dataType is non-auto + if ( current === "*" ) { + + current = prev; + + // Convert response if prev dataType is non-auto and differs from current + } else if ( prev !== "*" && prev !== current ) { + + // Seek a direct converter + conv = converters[ prev + " " + current ] || converters[ "* " + current ]; + + // If none found, seek a pair + if ( !conv ) { + for ( conv2 in converters ) { + + // If conv2 outputs current + tmp = conv2.split( " " ); + if ( tmp[ 1 ] === current ) { + + // If prev can be converted to accepted input + conv = converters[ prev + " " + tmp[ 0 ] ] || + converters[ "* " + tmp[ 0 ] ]; + if ( conv ) { + + // Condense equivalence converters + if ( conv === true ) { + conv = converters[ conv2 ]; + + // Otherwise, insert the intermediate dataType + } else if ( converters[ conv2 ] !== true ) { + current = tmp[ 0 ]; + dataTypes.unshift( tmp[ 1 ] ); + } + break; + } + } + } + } + + // Apply converter (if not an equivalence) + if ( conv !== true ) { + + // Unless errors are allowed to bubble, catch and return them + if ( conv && s.throws ) { + response = conv( response ); + } else { + try { + response = conv( response ); + } catch ( e ) { + return { + state: "parsererror", + error: conv ? e : "No conversion from " + prev + " to " + current + }; + } + } + } + } + } + } + + return { state: "success", data: response }; +} + +jQuery.extend( { + + // Counter for holding the number of active queries + active: 0, + + // Last-Modified header cache for next request + lastModified: {}, + etag: {}, + + ajaxSettings: { + url: location.href, + type: "GET", + isLocal: rlocalProtocol.test( location.protocol ), + global: true, + processData: true, + async: true, + contentType: "application/x-www-form-urlencoded; charset=UTF-8", + + /* + timeout: 0, + data: null, + dataType: null, + username: null, + password: null, + cache: null, + throws: false, + traditional: false, + headers: {}, + */ + + accepts: { + "*": allTypes, + text: "text/plain", + html: "text/html", + xml: "application/xml, text/xml", + json: "application/json, text/javascript" + }, + + contents: { + xml: /\bxml\b/, + html: /\bhtml/, + json: /\bjson\b/ + }, + + responseFields: { + xml: "responseXML", + text: "responseText", + json: "responseJSON" + }, + + // Data converters + // Keys separate source (or catchall "*") and destination types with a single space + converters: { + + // Convert anything to text + "* text": String, + + // Text to html (true = no transformation) + "text html": true, + + // Evaluate text as a json expression + "text json": JSON.parse, + + // Parse text as xml + "text xml": jQuery.parseXML + }, + + // For options that shouldn't be deep extended: + // you can add your own custom options here if + // and when you create one that shouldn't be + // deep extended (see ajaxExtend) + flatOptions: { + url: true, + context: true + } + }, + + // Creates a full fledged settings object into target + // with both ajaxSettings and settings fields. + // If target is omitted, writes into ajaxSettings. + ajaxSetup: function( target, settings ) { + return settings ? + + // Building a settings object + ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : + + // Extending ajaxSettings + ajaxExtend( jQuery.ajaxSettings, target ); + }, + + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), + ajaxTransport: addToPrefiltersOrTransports( transports ), + + // Main method + ajax: function( url, options ) { + + // If url is an object, simulate pre-1.5 signature + if ( typeof url === "object" ) { + options = url; + url = undefined; + } + + // Force options to be an object + options = options || {}; + + var transport, + + // URL without anti-cache param + cacheURL, + + // Response headers + responseHeadersString, + responseHeaders, + + // timeout handle + timeoutTimer, + + // Url cleanup var + urlAnchor, + + // Request state (becomes false upon send and true upon completion) + completed, + + // To know if global events are to be dispatched + fireGlobals, + + // Loop variable + i, + + // uncached part of the url + uncached, + + // Create the final options object + s = jQuery.ajaxSetup( {}, options ), + + // Callbacks context + callbackContext = s.context || s, + + // Context for global events is callbackContext if it is a DOM node or jQuery collection + globalEventContext = s.context && + ( callbackContext.nodeType || callbackContext.jquery ) ? + jQuery( callbackContext ) : + jQuery.event, + + // Deferreds + deferred = jQuery.Deferred(), + completeDeferred = jQuery.Callbacks( "once memory" ), + + // Status-dependent callbacks + statusCode = s.statusCode || {}, + + // Headers (they are sent all at once) + requestHeaders = {}, + requestHeadersNames = {}, + + // Default abort message + strAbort = "canceled", + + // Fake xhr + jqXHR = { + readyState: 0, + + // Builds headers hashtable if needed + getResponseHeader: function( key ) { + var match; + if ( completed ) { + if ( !responseHeaders ) { + responseHeaders = {}; + while ( ( match = rheaders.exec( responseHeadersString ) ) ) { + responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; + } + } + match = responseHeaders[ key.toLowerCase() ]; + } + return match == null ? null : match; + }, + + // Raw string + getAllResponseHeaders: function() { + return completed ? responseHeadersString : null; + }, + + // Caches the header + setRequestHeader: function( name, value ) { + if ( completed == null ) { + name = requestHeadersNames[ name.toLowerCase() ] = + requestHeadersNames[ name.toLowerCase() ] || name; + requestHeaders[ name ] = value; + } + return this; + }, + + // Overrides response content-type header + overrideMimeType: function( type ) { + if ( completed == null ) { + s.mimeType = type; + } + return this; + }, + + // Status-dependent callbacks + statusCode: function( map ) { + var code; + if ( map ) { + if ( completed ) { + + // Execute the appropriate callbacks + jqXHR.always( map[ jqXHR.status ] ); + } else { + + // Lazy-add the new callbacks in a way that preserves old ones + for ( code in map ) { + statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; + } + } + } + return this; + }, + + // Cancel the request + abort: function( statusText ) { + var finalText = statusText || strAbort; + if ( transport ) { + transport.abort( finalText ); + } + done( 0, finalText ); + return this; + } + }; + + // Attach deferreds + deferred.promise( jqXHR ); + + // Add protocol if not provided (prefilters might expect it) + // Handle falsy url in the settings object (#10093: consistency with old signature) + // We also use the url parameter if available + s.url = ( ( url || s.url || location.href ) + "" ) + .replace( rprotocol, location.protocol + "//" ); + + // Alias method option to type as per ticket #12004 + s.type = options.method || options.type || s.method || s.type; + + // Extract dataTypes list + s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; + + // A cross-domain request is in order when the origin doesn't match the current origin. + if ( s.crossDomain == null ) { + urlAnchor = document.createElement( "a" ); + + // Support: IE <=8 - 11, Edge 12 - 13 + // IE throws exception on accessing the href property if url is malformed, + // e.g. http://example.com:80x/ + try { + urlAnchor.href = s.url; + + // Support: IE <=8 - 11 only + // Anchor's host property isn't correctly set when s.url is relative + urlAnchor.href = urlAnchor.href; + s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== + urlAnchor.protocol + "//" + urlAnchor.host; + } catch ( e ) { + + // If there is an error parsing the URL, assume it is crossDomain, + // it can be rejected by the transport if it is invalid + s.crossDomain = true; + } + } + + // Convert data if not already a string + if ( s.data && s.processData && typeof s.data !== "string" ) { + s.data = jQuery.param( s.data, s.traditional ); + } + + // Apply prefilters + inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); + + // If request was aborted inside a prefilter, stop there + if ( completed ) { + return jqXHR; + } + + // We can fire global events as of now if asked to + // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) + fireGlobals = jQuery.event && s.global; + + // Watch for a new set of requests + if ( fireGlobals && jQuery.active++ === 0 ) { + jQuery.event.trigger( "ajaxStart" ); + } + + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = !rnoContent.test( s.type ); + + // Save the URL in case we're toying with the If-Modified-Since + // and/or If-None-Match header later on + // Remove hash to simplify url manipulation + cacheURL = s.url.replace( rhash, "" ); + + // More options handling for requests with no content + if ( !s.hasContent ) { + + // Remember the hash so we can put it back + uncached = s.url.slice( cacheURL.length ); + + // If data is available, append data to url + if ( s.data ) { + cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; + + // #9682: remove data so that it's not used in an eventual retry + delete s.data; + } + + // Add or update anti-cache param if needed + if ( s.cache === false ) { + cacheURL = cacheURL.replace( rantiCache, "$1" ); + uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; + } + + // Put hash and anti-cache on the URL that will be requested (gh-1732) + s.url = cacheURL + uncached; + + // Change '%20' to '+' if this is encoded form body content (gh-2658) + } else if ( s.data && s.processData && + ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { + s.data = s.data.replace( r20, "+" ); + } + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + if ( jQuery.lastModified[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); + } + if ( jQuery.etag[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); + } + } + + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + jqXHR.setRequestHeader( "Content-Type", s.contentType ); + } + + // Set the Accepts header for the server, depending on the dataType + jqXHR.setRequestHeader( + "Accept", + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? + s.accepts[ s.dataTypes[ 0 ] ] + + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : + s.accepts[ "*" ] + ); + + // Check for headers option + for ( i in s.headers ) { + jqXHR.setRequestHeader( i, s.headers[ i ] ); + } + + // Allow custom headers/mimetypes and early abort + if ( s.beforeSend && + ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { + + // Abort if not done already and return + return jqXHR.abort(); + } + + // Aborting is no longer a cancellation + strAbort = "abort"; + + // Install callbacks on deferreds + completeDeferred.add( s.complete ); + jqXHR.done( s.success ); + jqXHR.fail( s.error ); + + // Get transport + transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); + + // If no transport, we auto-abort + if ( !transport ) { + done( -1, "No Transport" ); + } else { + jqXHR.readyState = 1; + + // Send global event + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); + } + + // If request was aborted inside ajaxSend, stop there + if ( completed ) { + return jqXHR; + } + + // Timeout + if ( s.async && s.timeout > 0 ) { + timeoutTimer = window.setTimeout( function() { + jqXHR.abort( "timeout" ); + }, s.timeout ); + } + + try { + completed = false; + transport.send( requestHeaders, done ); + } catch ( e ) { + + // Rethrow post-completion exceptions + if ( completed ) { + throw e; + } + + // Propagate others as results + done( -1, e ); + } + } + + // Callback for when everything is done + function done( status, nativeStatusText, responses, headers ) { + var isSuccess, success, error, response, modified, + statusText = nativeStatusText; + + // Ignore repeat invocations + if ( completed ) { + return; + } + + completed = true; + + // Clear timeout if it exists + if ( timeoutTimer ) { + window.clearTimeout( timeoutTimer ); + } + + // Dereference transport for early garbage collection + // (no matter how long the jqXHR object will be used) + transport = undefined; + + // Cache response headers + responseHeadersString = headers || ""; + + // Set readyState + jqXHR.readyState = status > 0 ? 4 : 0; + + // Determine if successful + isSuccess = status >= 200 && status < 300 || status === 304; + + // Get response data + if ( responses ) { + response = ajaxHandleResponses( s, jqXHR, responses ); + } + + // Convert no matter what (that way responseXXX fields are always set) + response = ajaxConvert( s, response, jqXHR, isSuccess ); + + // If successful, handle type chaining + if ( isSuccess ) { + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + modified = jqXHR.getResponseHeader( "Last-Modified" ); + if ( modified ) { + jQuery.lastModified[ cacheURL ] = modified; + } + modified = jqXHR.getResponseHeader( "etag" ); + if ( modified ) { + jQuery.etag[ cacheURL ] = modified; + } + } + + // if no content + if ( status === 204 || s.type === "HEAD" ) { + statusText = "nocontent"; + + // if not modified + } else if ( status === 304 ) { + statusText = "notmodified"; + + // If we have data, let's convert it + } else { + statusText = response.state; + success = response.data; + error = response.error; + isSuccess = !error; + } + } else { + + // Extract error from statusText and normalize for non-aborts + error = statusText; + if ( status || !statusText ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } + + // Set data for the fake xhr object + jqXHR.status = status; + jqXHR.statusText = ( nativeStatusText || statusText ) + ""; + + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); + } + + // Status-dependent callbacks + jqXHR.statusCode( statusCode ); + statusCode = undefined; + + if ( fireGlobals ) { + globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", + [ jqXHR, s, isSuccess ? success : error ] ); + } + + // Complete + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); + + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); + + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger( "ajaxStop" ); + } + } + } + + return jqXHR; + }, + + getJSON: function( url, data, callback ) { + return jQuery.get( url, data, callback, "json" ); + }, + + getScript: function( url, callback ) { + return jQuery.get( url, undefined, callback, "script" ); + } +} ); + +jQuery.each( [ "get", "post" ], function( i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { + + // Shift arguments if data argument was omitted + if ( jQuery.isFunction( data ) ) { + type = type || callback; + callback = data; + data = undefined; + } + + // The url can be an options object (which then must have .url) + return jQuery.ajax( jQuery.extend( { + url: url, + type: method, + dataType: type, + data: data, + success: callback + }, jQuery.isPlainObject( url ) && url ) ); + }; +} ); + + +jQuery._evalUrl = function( url ) { + return jQuery.ajax( { + url: url, + + // Make this explicit, since user can override this through ajaxSetup (#11264) + type: "GET", + dataType: "script", + cache: true, + async: false, + global: false, + "throws": true + } ); +}; + + +jQuery.fn.extend( { + wrapAll: function( html ) { + var wrap; + + if ( this[ 0 ] ) { + if ( jQuery.isFunction( html ) ) { + html = html.call( this[ 0 ] ); + } + + // The elements to wrap the target around + wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); + + if ( this[ 0 ].parentNode ) { + wrap.insertBefore( this[ 0 ] ); + } + + wrap.map( function() { + var elem = this; + + while ( elem.firstElementChild ) { + elem = elem.firstElementChild; + } + + return elem; + } ).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each( function( i ) { + jQuery( this ).wrapInner( html.call( this, i ) ); + } ); + } + + return this.each( function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + } ); + }, + + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); + + return this.each( function( i ) { + jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html ); + } ); + }, + + unwrap: function( selector ) { + this.parent( selector ).not( "body" ).each( function() { + jQuery( this ).replaceWith( this.childNodes ); + } ); + return this; + } +} ); + + +jQuery.expr.pseudos.hidden = function( elem ) { + return !jQuery.expr.pseudos.visible( elem ); +}; +jQuery.expr.pseudos.visible = function( elem ) { + return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); +}; + + + + +jQuery.ajaxSettings.xhr = function() { + try { + return new window.XMLHttpRequest(); + } catch ( e ) {} +}; + +var xhrSuccessStatus = { + + // File protocol always yields status code 0, assume 200 + 0: 200, + + // Support: IE <=9 only + // #1450: sometimes IE returns 1223 when it should be 204 + 1223: 204 + }, + xhrSupported = jQuery.ajaxSettings.xhr(); + +support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); +support.ajax = xhrSupported = !!xhrSupported; + +jQuery.ajaxTransport( function( options ) { + var callback, errorCallback; + + // Cross domain only allowed if supported through XMLHttpRequest + if ( support.cors || xhrSupported && !options.crossDomain ) { + return { + send: function( headers, complete ) { + var i, + xhr = options.xhr(); + + xhr.open( + options.type, + options.url, + options.async, + options.username, + options.password + ); + + // Apply custom fields if provided + if ( options.xhrFields ) { + for ( i in options.xhrFields ) { + xhr[ i ] = options.xhrFields[ i ]; + } + } + + // Override mime type if needed + if ( options.mimeType && xhr.overrideMimeType ) { + xhr.overrideMimeType( options.mimeType ); + } + + // X-Requested-With header + // For cross-domain requests, seeing as conditions for a preflight are + // akin to a jigsaw puzzle, we simply never set it to be sure. + // (it can always be set on a per-request basis or even using ajaxSetup) + // For same-domain requests, won't change header if already provided. + if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { + headers[ "X-Requested-With" ] = "XMLHttpRequest"; + } + + // Set headers + for ( i in headers ) { + xhr.setRequestHeader( i, headers[ i ] ); + } + + // Callback + callback = function( type ) { + return function() { + if ( callback ) { + callback = errorCallback = xhr.onload = + xhr.onerror = xhr.onabort = xhr.onreadystatechange = null; + + if ( type === "abort" ) { + xhr.abort(); + } else if ( type === "error" ) { + + // Support: IE <=9 only + // On a manual native abort, IE9 throws + // errors on any property access that is not readyState + if ( typeof xhr.status !== "number" ) { + complete( 0, "error" ); + } else { + complete( + + // File: protocol always yields status 0; see #8605, #14207 + xhr.status, + xhr.statusText + ); + } + } else { + complete( + xhrSuccessStatus[ xhr.status ] || xhr.status, + xhr.statusText, + + // Support: IE <=9 only + // IE9 has no XHR2 but throws on binary (trac-11426) + // For XHR2 non-text, let the caller handle it (gh-2498) + ( xhr.responseType || "text" ) !== "text" || + typeof xhr.responseText !== "string" ? + { binary: xhr.response } : + { text: xhr.responseText }, + xhr.getAllResponseHeaders() + ); + } + } + }; + }; + + // Listen to events + xhr.onload = callback(); + errorCallback = xhr.onerror = callback( "error" ); + + // Support: IE 9 only + // Use onreadystatechange to replace onabort + // to handle uncaught aborts + if ( xhr.onabort !== undefined ) { + xhr.onabort = errorCallback; + } else { + xhr.onreadystatechange = function() { + + // Check readyState before timeout as it changes + if ( xhr.readyState === 4 ) { + + // Allow onerror to be called first, + // but that will not handle a native abort + // Also, save errorCallback to a variable + // as xhr.onerror cannot be accessed + window.setTimeout( function() { + if ( callback ) { + errorCallback(); + } + } ); + } + }; + } + + // Create the abort callback + callback = callback( "abort" ); + + try { + + // Do send the request (this may raise an exception) + xhr.send( options.hasContent && options.data || null ); + } catch ( e ) { + + // #14683: Only rethrow if this hasn't been notified as an error yet + if ( callback ) { + throw e; + } + } + }, + + abort: function() { + if ( callback ) { + callback(); + } + } + }; + } +} ); + + + + +// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) +jQuery.ajaxPrefilter( function( s ) { + if ( s.crossDomain ) { + s.contents.script = false; + } +} ); + +// Install script dataType +jQuery.ajaxSetup( { + accepts: { + script: "text/javascript, application/javascript, " + + "application/ecmascript, application/x-ecmascript" + }, + contents: { + script: /\b(?:java|ecma)script\b/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; + } + } +} ); + +// Handle cache's special case and crossDomain +jQuery.ajaxPrefilter( "script", function( s ) { + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + } +} ); + +// Bind script tag hack transport +jQuery.ajaxTransport( "script", function( s ) { + + // This transport only deals with cross domain requests + if ( s.crossDomain ) { + var script, callback; + return { + send: function( _, complete ) { + script = jQuery( " + - - + + + @@ -34,8 +24,7 @@ - - +
-
+ diff --git a/doc/build/html/commands/apidoc/src.colorama.html b/doc/build/html/commands/apidoc/src.colorama.html index 919186d..a4a265f 100644 --- a/doc/build/html/commands/apidoc/src.colorama.html +++ b/doc/build/html/commands/apidoc/src.colorama.html @@ -2,31 +2,20 @@ - + - - colorama Package — salomeTools 5.0.0dev documentation - + colorama Package — salomeTools 5.0.0dev documentation - - + - - - + + + @@ -35,8 +24,7 @@ - - +
@@ -47,330 +35,330 @@

colorama Package¶

-

colorama Package¶

+

colorama Package¶

-

ansi Module¶

+

ansi Module¶

This module generates ANSI character codes to printing colors to terminals. See: http://en.wikipedia.org/wiki/ANSI_escape_code

-class src.colorama.ansi.AnsiBack[source]¶
-

Bases: src.colorama.ansi.AnsiCodes

+class src.colorama.ansi.AnsiBack[source]¶ +

Bases: src.colorama.ansi.AnsiCodes

-BLACK = 40¶
+BLACK = 40¶
-BLUE = 44¶
+BLUE = 44¶
-CYAN = 46¶
+CYAN = 46¶
-GREEN = 42¶
+GREEN = 42¶
-LIGHTBLACK_EX = 100¶
+LIGHTBLACK_EX = 100¶
-LIGHTBLUE_EX = 104¶
+LIGHTBLUE_EX = 104¶
-LIGHTCYAN_EX = 106¶
+LIGHTCYAN_EX = 106¶
-LIGHTGREEN_EX = 102¶
+LIGHTGREEN_EX = 102¶
-LIGHTMAGENTA_EX = 105¶
+LIGHTMAGENTA_EX = 105¶
-LIGHTRED_EX = 101¶
+LIGHTRED_EX = 101¶
-LIGHTWHITE_EX = 107¶
+LIGHTWHITE_EX = 107¶
-LIGHTYELLOW_EX = 103¶
+LIGHTYELLOW_EX = 103¶
-MAGENTA = 45¶
+MAGENTA = 45¶
-RED = 41¶
+RED = 41¶
-RESET = 49¶
+RESET = 49¶
-WHITE = 47¶
+WHITE = 47¶
-YELLOW = 43¶
+YELLOW = 43¶
-class src.colorama.ansi.AnsiCodes[source]¶
-

Bases: object

+class src.colorama.ansi.AnsiCodes[source]¶ +

Bases: object

-class src.colorama.ansi.AnsiCursor[source]¶
-

Bases: object

+class src.colorama.ansi.AnsiCursor[source]¶ +

Bases: object

-BACK(n=1)[source]¶
+BACK(n=1)[source]¶
-DOWN(n=1)[source]¶
+DOWN(n=1)[source]¶
-FORWARD(n=1)[source]¶
+FORWARD(n=1)[source]¶
-POS(x=1, y=1)[source]¶
+POS(x=1, y=1)[source]¶
-UP(n=1)[source]¶
+UP(n=1)[source]¶
-class src.colorama.ansi.AnsiFore[source]¶
-

Bases: src.colorama.ansi.AnsiCodes

+class src.colorama.ansi.AnsiFore[source]¶ +

Bases: src.colorama.ansi.AnsiCodes

-BLACK = 30¶
+BLACK = 30¶
-BLUE = 34¶
+BLUE = 34¶
-CYAN = 36¶
+CYAN = 36¶
-GREEN = 32¶
+GREEN = 32¶
-LIGHTBLACK_EX = 90¶
+LIGHTBLACK_EX = 90¶
-LIGHTBLUE_EX = 94¶
+LIGHTBLUE_EX = 94¶
-LIGHTCYAN_EX = 96¶
+LIGHTCYAN_EX = 96¶
-LIGHTGREEN_EX = 92¶
+LIGHTGREEN_EX = 92¶
-LIGHTMAGENTA_EX = 95¶
+LIGHTMAGENTA_EX = 95¶
-LIGHTRED_EX = 91¶
+LIGHTRED_EX = 91¶
-LIGHTWHITE_EX = 97¶
+LIGHTWHITE_EX = 97¶
-LIGHTYELLOW_EX = 93¶
+LIGHTYELLOW_EX = 93¶
-MAGENTA = 35¶
+MAGENTA = 35¶
-RED = 31¶
+RED = 31¶
-RESET = 39¶
+RESET = 39¶
-WHITE = 37¶
+WHITE = 37¶
-YELLOW = 33¶
+YELLOW = 33¶
-class src.colorama.ansi.AnsiStyle[source]¶
-

Bases: src.colorama.ansi.AnsiCodes

+class src.colorama.ansi.AnsiStyle[source]¶ +

Bases: src.colorama.ansi.AnsiCodes

-BRIGHT = 1¶
+BRIGHT = 1¶
-DIM = 2¶
+DIM = 2¶
-NORMAL = 22¶
+NORMAL = 22¶
-RESET_ALL = 0¶
+RESET_ALL = 0¶
-src.colorama.ansi.clear_line(mode=2)[source]¶
+src.colorama.ansi.clear_line(mode=2)[source]¶
-src.colorama.ansi.clear_screen(mode=2)[source]¶
+src.colorama.ansi.clear_screen(mode=2)[source]¶
-src.colorama.ansi.code_to_chars(code)[source]¶
+src.colorama.ansi.code_to_chars(code)[source]¶
-src.colorama.ansi.set_title(title)[source]¶
+src.colorama.ansi.set_title(title)[source]¶
-

ansitowin32 Module¶

+

ansitowin32 Module¶

-class src.colorama.ansitowin32.AnsiToWin32(wrapped, convert=None, strip=None, autoreset=False)[source]¶
-

Bases: object

-

Implements a 'write()' method which, on Windows, will strip ANSI character +class src.colorama.ansitowin32.AnsiToWin32(wrapped, convert=None, strip=None, autoreset=False)[source]¶ +

Bases: object

+

Implements a ‘write()’ method which, on Windows, will strip ANSI character sequences from the text, and if outputting to a tty, will convert them into win32 function calls.

-ANSI_CSI_RE = <_sre.SRE_Pattern object at 0x3daa930>¶
+ANSI_CSI_RE = <_sre.SRE_Pattern object at 0x4986ff0>¶
-ANSI_OSC_RE = <_sre.SRE_Pattern object at 0x49a74c0>¶
+ANSI_OSC_RE = <_sre.SRE_Pattern object at 0x44e4620>¶
-call_win32(command, params)[source]¶
+call_win32(command, params)[source]¶
-convert_ansi(paramstring, command)[source]¶
+convert_ansi(paramstring, command)[source]¶
-convert_osc(text)[source]¶
+convert_osc(text)[source]¶
-extract_params(command, paramstring)[source]¶
+extract_params(command, paramstring)[source]¶
-get_win32_calls()[source]¶
+get_win32_calls()[source]¶
-reset_all()[source]¶
+reset_all()[source]¶
-should_wrap()[source]¶
+should_wrap()[source]¶

True if this class is actually needed. If false, then the output stream will not be affected, nor will win32 calls be issued, so wrapping stdout is not actually required. This will generally be @@ -380,12 +368,12 @@ autoreset has been requested using kwargs to init()

-write(text)[source]¶
+write(text)[source]¶
-write_and_convert(text)[source]¶
+write_and_convert(text)[source]¶

Write the given text to our wrapped stream, stripping any ANSI sequences from the text, and optionally converting them into win32 calls.

@@ -393,218 +381,218 @@ calls.

-write_plain_text(text, start, end)[source]¶
+write_plain_text(text, start, end)[source]¶
-class src.colorama.ansitowin32.StreamWrapper(wrapped, converter)[source]¶
-

Bases: object

+class src.colorama.ansitowin32.StreamWrapper(wrapped, converter)[source]¶ +

Bases: object

Wraps a stream (such as stdout), acting as a transparent proxy for all -attribute access apart from method 'write()', which is delegated to our +attribute access apart from method ‘write()’, which is delegated to our Converter instance.

-write(text)[source]¶
+write(text)[source]¶
-src.colorama.ansitowin32.is_a_tty(stream)[source]¶
+src.colorama.ansitowin32.is_a_tty(stream)[source]¶
-src.colorama.ansitowin32.is_stream_closed(stream)[source]¶
+src.colorama.ansitowin32.is_stream_closed(stream)[source]¶
-

initialise Module¶

+

initialise Module¶

-src.colorama.initialise.colorama_text(*args, **kwds)[source]¶
+src.colorama.initialise.colorama_text(*args, **kwds)[source]¶
-src.colorama.initialise.deinit()[source]¶
+src.colorama.initialise.deinit()[source]¶
-src.colorama.initialise.init(autoreset=False, convert=None, strip=None, wrap=True)[source]¶
+src.colorama.initialise.init(autoreset=False, convert=None, strip=None, wrap=True)[source]¶
-src.colorama.initialise.reinit()[source]¶
+src.colorama.initialise.reinit()[source]¶
-src.colorama.initialise.reset_all()[source]¶
+src.colorama.initialise.reset_all()[source]¶
-src.colorama.initialise.wrap_stream(stream, convert, strip, autoreset, wrap)[source]¶
+src.colorama.initialise.wrap_stream(stream, convert, strip, autoreset, wrap)[source]¶
-

win32 Module¶

+

win32 Module¶

-src.colorama.win32.SetConsoleTextAttribute(*_)[source]¶
+src.colorama.win32.SetConsoleTextAttribute(*_)[source]¶
-src.colorama.win32.winapi_test(*_)[source]¶
+src.colorama.win32.winapi_test(*_)[source]¶
-

winterm Module¶

+

winterm Module¶

-class src.colorama.winterm.WinColor[source]¶
-

Bases: object

+class src.colorama.winterm.WinColor[source]¶ +

Bases: object

-BLACK = 0¶
+BLACK = 0¶
-BLUE = 1¶
+BLUE = 1¶
-CYAN = 3¶
+CYAN = 3¶
-GREEN = 2¶
+GREEN = 2¶
-GREY = 7¶
+GREY = 7¶
-MAGENTA = 5¶
+MAGENTA = 5¶
-RED = 4¶
+RED = 4¶
-YELLOW = 6¶
+YELLOW = 6¶
-class src.colorama.winterm.WinStyle[source]¶
-

Bases: object

+class src.colorama.winterm.WinStyle[source]¶ +

Bases: object

-BRIGHT = 8¶
+BRIGHT = 8¶
-BRIGHT_BACKGROUND = 128¶
+BRIGHT_BACKGROUND = 128¶
-NORMAL = 0¶
+NORMAL = 0¶
-class src.colorama.winterm.WinTerm[source]¶
-

Bases: object

+class src.colorama.winterm.WinTerm[source]¶ +

Bases: object

-back(back=None, light=False, on_stderr=False)[source]¶
+back(back=None, light=False, on_stderr=False)[source]¶
-cursor_adjust(x, y, on_stderr=False)[source]¶
+cursor_adjust(x, y, on_stderr=False)[source]¶
-erase_line(mode=0, on_stderr=False)[source]¶
+erase_line(mode=0, on_stderr=False)[source]¶
-erase_screen(mode=0, on_stderr=False)[source]¶
+erase_screen(mode=0, on_stderr=False)[source]¶
-fore(fore=None, light=False, on_stderr=False)[source]¶
+fore(fore=None, light=False, on_stderr=False)[source]¶
-get_attrs()[source]¶
+get_attrs()[source]¶
-get_position(handle)[source]¶
+get_position(handle)[source]¶
-reset_all(on_stderr=None)[source]¶
+reset_all(on_stderr=None)[source]¶
-set_attrs(value)[source]¶
+set_attrs(value)[source]¶
-set_console(attrs=None, on_stderr=False)[source]¶
+set_console(attrs=None, on_stderr=False)[source]¶
-set_cursor_position(position=None, on_stderr=False)[source]¶
+set_cursor_position(position=None, on_stderr=False)[source]¶
-set_title(title)[source]¶
+set_title(title)[source]¶
-style(style=None, on_stderr=False)[source]¶
+style(style=None, on_stderr=False)[source]¶
@@ -616,7 +604,7 @@ Converter instance.

-
+ diff --git a/doc/build/html/commands/apidoc/src.html b/doc/build/html/commands/apidoc/src.html index d5596db..3ad8fcf 100644 --- a/doc/build/html/commands/apidoc/src.html +++ b/doc/build/html/commands/apidoc/src.html @@ -2,31 +2,20 @@ - + - - src Package — salomeTools 5.0.0dev documentation - + src Package — salomeTools 5.0.0dev documentation - - + - - - + + + @@ -35,8 +24,7 @@ - - +
@@ -47,114 +35,114 @@

src Package¶

-

src Package¶

+

src Package¶

initial imports and utilities methods for salomeTools

-class src.__init__.Path(path)[source]¶
+class src.__init__.Path(path)[source]¶
-base()[source]¶
+base()[source]¶
-chmod(mode)[source]¶
+chmod(mode)[source]¶
-copy(path, smart=False)[source]¶
+copy(path, smart=False)[source]¶
-copydir(dst, smart=False)[source]¶
+copydir(dst, smart=False)[source]¶
-copyfile(path)[source]¶
+copyfile(path)[source]¶
+copylink(path)[source]¶
-dir()[source]¶
+dir()[source]¶
-exists()[source]¶
+exists()[source]¶
-isdir()[source]¶
+isdir()[source]¶
-isfile()[source]¶
+isfile()[source]¶
+islink()[source]¶
-list()[source]¶
+list()[source]¶
-make(mode=None)[source]¶
+make(mode=None)[source]¶
+readlink()[source]¶
-rm()[source]¶
+rm()[source]¶
-smartcopy(path)[source]¶
+smartcopy(path)[source]¶
+symlink(path)[source]¶
-exception src.__init__.SatException[source]¶
-

Bases: exceptions.Exception

+exception src.__init__.SatException[source]¶ +

Bases: exceptions.Exception

rename Exception Class

-src.__init__.activate_mesa_property(config)[source]¶
+src.__init__.activate_mesa_property(config)[source]¶

Add mesa property into application properties

- +
Parameters:Config (config) -- The global configuration. It must have an application!
Parameters:Config (config) – The global configuration. It must have an application!
@@ -162,13 +150,13 @@
-src.__init__.check_config_has_application(config, details=None)[source]¶
+src.__init__.check_config_has_application(config, details=None)[source]¶

check that the config has the key APPLICATION. Else raise an exception.

- +
Parameters:class 'common.pyconf.Config' (config) -- The config.
Parameters:class 'common.pyconf.Config' (config) – The config.
@@ -176,14 +164,14 @@
-src.__init__.check_config_has_profile(config, details=None)[source]¶
+src.__init__.check_config_has_profile(config, details=None)[source]¶

check that the config has the key APPLICATION.profile. else, raise an exception.

- +
Parameters:class 'common.pyconf.Config' (config) -- The config.
Parameters:class 'common.pyconf.Config' (config) – The config.
@@ -191,18 +179,18 @@ else, raise an exception.

-src.__init__.config_has_application(config)[source]¶
+src.__init__.config_has_application(config)[source]¶
-src.__init__.deepcopy_list(input_list)[source]¶
+src.__init__.deepcopy_list(input_list)[source]¶

Do a deep copy of a list

- + @@ -214,13 +202,13 @@ else, raise an exception.

-src.__init__.ensure_path_exists(p)[source]¶
+src.__init__.ensure_path_exists(p)[source]¶

Create a path if not existing

Parameters:List (input_list) -- The list to copy
Parameters:List (input_list) – The list to copy
Returns:The copy of the list
- +
Parameters:str (p) -- The path.
Parameters:str (p) – The path.
@@ -228,7 +216,7 @@ else, raise an exception.

-src.__init__.find_file_in_lpath(file_name, lpath, additional_dir='')[source]¶
+src.__init__.find_file_in_lpath(file_name, lpath, additional_dir='')[source]¶

Find in all the directories in lpath list the file that has the same name as file_name. If it is found @@ -241,9 +229,9 @@ paths in lpath.

Parameters:
    -
  • str (additional_dir) -- The file name to search
  • -
  • List (lpath) -- The list of directories where to search
  • -
  • str -- The name of the additional directory
  • +
  • str (additional_dir) – The file name to search
  • +
  • List (lpath) – The list of directories where to search
  • +
  • str – The name of the additional directory
@@ -259,13 +247,13 @@ paths in lpath.

-src.__init__.get_base_path(config)[source]¶
+src.__init__.get_base_path(config)[source]¶

Returns the path of the products base.

- + @@ -277,7 +265,7 @@ paths in lpath.

-src.__init__.get_cfg_param(config, param_name, default)[source]¶
+src.__init__.get_cfg_param(config, param_name, default)[source]¶

eearch for param_name value in config. if param_name is not in config then return default, @@ -287,9 +275,9 @@ else return the found value

@@ -305,13 +293,13 @@ else return the found value

-src.__init__.get_launcher_name(config)[source]¶
+src.__init__.get_launcher_name(config)[source]¶

Returns the name of salome launcher.

Parameters:Config (config) -- The global Config instance.
Parameters:Config (config) – The global Config instance.
Returns:The path of the products base.
Parameters:
    -
  • class 'common.pyconf.Config' (config) -- The config.
  • -
  • str (default) -- the name of the parameter to get the value
  • -
  • str -- The value to return if param_name is not in config
  • +
  • class 'common.pyconf.Config' (config) – The config.
  • +
  • str (default) – the name of the parameter to get the value
  • +
  • str – The value to return if param_name is not in config
- + @@ -323,13 +311,13 @@ else return the found value

-src.__init__.get_log_path(config)[source]¶
+src.__init__.get_log_path(config)[source]¶

Returns the path of the logs.

Parameters:Config (config) -- The global Config instance.
Parameters:Config (config) – The global Config instance.
Returns:The name of salome launcher.
- + @@ -341,45 +329,45 @@ else return the found value

-src.__init__.get_property_in_product_cfg(product_cfg, pprty)[source]¶
+src.__init__.get_property_in_product_cfg(product_cfg, pprty)[source]¶
-src.__init__.get_salome_version(config)[source]¶
+src.__init__.get_salome_version(config)[source]¶
-src.__init__.get_tmp_filename(cfg, name)[source]¶
+src.__init__.get_tmp_filename(cfg, name)[source]¶
-src.__init__.handleRemoveReadonly(func, path, exc)[source]¶
+src.__init__.handleRemoveReadonly(func, path, exc)[source]¶
-src.__init__.merge_dicts(*dict_args)[source]¶
+src.__init__.merge_dicts(*dict_args)[source]¶

Given any number of dicts, shallow copy and merge into a new dict, precedence goes to key value pairs in latter dicts.

-src.__init__.only_numbers(str_num)[source]¶
+src.__init__.only_numbers(str_num)[source]¶
-src.__init__.parse_date(date)[source]¶
+src.__init__.parse_date(date)[source]¶

Transform YYYYMMDD_hhmmss into YYYY-MM-DD hh:mm:ss.

Parameters:Config (config) -- The global Config instance.
Parameters:Config (config) – The global Config instance.
Returns:The path of the logs.
- + @@ -391,15 +379,15 @@ precedence goes to key value pairs in latter dicts.

-src.__init__.print_info(logger, info)[source]¶
+src.__init__.print_info(logger, info)[source]¶

Prints the tuples that are in info variable in a formatted way.

Parameters:str (date) -- The date to transform
Parameters:str (date) – The date to transform
Returns:The date in the new format
@@ -409,18 +397,18 @@ precedence goes to key value pairs in latter dicts.

-src.__init__.read_config_from_a_file(filePath)[source]¶
+src.__init__.read_config_from_a_file(filePath)[source]¶
-src.__init__.remove_item_from_list(input_list, item)[source]¶
+src.__init__.remove_item_from_list(input_list, item)[source]¶

Remove all occurences of item from input_list

Parameters:
    -
  • Logger (logger) -- The logging instance to use for the prints.
  • -
  • list (info) -- The list of tuples to display
  • +
  • Logger (logger) – The logging instance to use for the prints.
  • +
  • list (info) – The list of tuples to display
- + @@ -432,184 +420,184 @@ precedence goes to key value pairs in latter dicts.

-src.__init__.replace_in_file(filein, strin, strout)[source]¶
+src.__init__.replace_in_file(filein, strin, strout)[source]¶

Replace <strin> by <strout> in file <filein>

-

ElementTree Module¶

+

ElementTree Module¶

-src.ElementTree.Comment(text=None)[source]¶
+src.ElementTree.Comment(text=None)[source]¶
-src.ElementTree.dump(elem)[source]¶
+src.ElementTree.dump(elem)[source]¶
-src.ElementTree.Element(tag, attrib={}, **extra)[source]¶
+src.ElementTree.Element(tag, attrib={}, **extra)[source]¶
-class src.ElementTree.ElementTree(element=None, file=None)[source]¶
+class src.ElementTree.ElementTree(element=None, file=None)[source]¶
-find(path)[source]¶
+find(path)[source]¶
-findall(path)[source]¶
+findall(path)[source]¶
-findtext(path, default=None)[source]¶
+findtext(path, default=None)[source]¶
-getiterator(tag=None)[source]¶
+getiterator(tag=None)[source]¶
-getroot()[source]¶
+getroot()[source]¶
-parse(source, parser=None)[source]¶
+parse(source, parser=None)[source]¶
-write(file, encoding='us-ascii')[source]¶
+write(file, encoding='us-ascii')[source]¶
-src.ElementTree.fromstring(text)¶
+src.ElementTree.fromstring(text)¶
-src.ElementTree.iselement(element)[source]¶
+src.ElementTree.iselement(element)[source]¶
-class src.ElementTree.iterparse(source, events=None)[source]¶
+class src.ElementTree.iterparse(source, events=None)[source]¶
-next()[source]¶
+next()[source]¶
-src.ElementTree.parse(source, parser=None)[source]¶
+src.ElementTree.parse(source, parser=None)[source]¶
-src.ElementTree.PI(target, text=None)¶
+src.ElementTree.PI(target, text=None)¶
-src.ElementTree.ProcessingInstruction(target, text=None)[source]¶
+src.ElementTree.ProcessingInstruction(target, text=None)[source]¶
-class src.ElementTree.QName(text_or_uri, tag=None)[source]¶
+class src.ElementTree.QName(text_or_uri, tag=None)[source]¶
-src.ElementTree.SubElement(parent, tag, attrib={}, **extra)[source]¶
+src.ElementTree.SubElement(parent, tag, attrib={}, **extra)[source]¶
-src.ElementTree.tostring(element, encoding=None)[source]¶
+src.ElementTree.tostring(element, encoding=None)[source]¶
-class src.ElementTree.TreeBuilder(element_factory=None)[source]¶
+class src.ElementTree.TreeBuilder(element_factory=None)[source]¶
-close()[source]¶
+close()[source]¶
-data(data)[source]¶
+data(data)[source]¶
-end(tag)[source]¶
+end(tag)[source]¶
-start(tag, attrs)[source]¶
+start(tag, attrs)[source]¶
-src.ElementTree.XML(text)[source]¶
+src.ElementTree.XML(text)[source]¶
-class src.ElementTree.XMLTreeBuilder(html=0, target=None)[source]¶
+class src.ElementTree.XMLTreeBuilder(html=0, target=None)[source]¶
-close()[source]¶
+close()[source]¶
-doctype(name, pubid, system)[source]¶
+doctype(name, pubid, system)[source]¶
-feed(data)[source]¶
+feed(data)[source]¶
-

architecture Module¶

+

architecture Module¶

In this file : all the stuff that can change with the architecture on which SAT is running

-src.architecture.get_distrib_version(distrib, codes)[source]¶
+src.architecture.get_distrib_version(distrib, codes)[source]¶

Gets the version of the distribution

Parameters:List (input_list) -- The list to modify
Parameters:List (input_list) – The list to modify
Returns:The without any item
@@ -627,13 +615,13 @@ variable.

-src.architecture.get_distribution(codes)[source]¶
+src.architecture.get_distribution(codes)[source]¶

Gets the code for the distribution

Parameters:
    -
  • str (distrib) -- The distribution on which the version will be found.
  • -
  • L{Mapping} (codes) -- The map containing distribution correlation table.
  • +
  • str (distrib) – The distribution on which the version will be found.
  • +
  • L{Mapping} (codes) – The map containing distribution correlation table.
- + @@ -646,9 +634,11 @@ distribution correlation table contained in codes variable.
-src.architecture.get_nb_proc()[source]¶
-

Gets the number of processors of the machine -on which salomeTools is running.

+src.architecture.get_nb_proc()[source]¶ +
+
Gets the number of processors of the machine
+
on which salomeTools is running.
+
Parameters:L{Mapping} (codes) -- The map containing distribution correlation table.
Parameters:L{Mapping} (codes) – The map containing distribution correlation table.
Returns:The distribution on which salomeTools is running, regarding the distribution correlation table contained in codes variable.
@@ -663,7 +653,7 @@ on which salomeTools is running.

-src.architecture.get_python_version()[source]¶
+src.architecture.get_python_version()[source]¶

Gets the version of the running python.

@@ -679,7 +669,7 @@ on which salomeTools is running.

-src.architecture.get_user()[source]¶
+src.architecture.get_user()[source]¶

method that gets the username that launched sat

@@ -693,7 +683,7 @@ on which salomeTools is running.

-src.architecture.is_windows()[source]¶
+src.architecture.is_windows()[source]¶

method that checks windows OS

@@ -707,96 +697,98 @@ on which salomeTools is running.

-

compilation Module¶

+

compilation Module¶

-class src.compilation.Builder(config, logger, product_info, options=<src.options.OptResult object at 0x39937d0>, check_src=True)[source]¶
-

Class to handle all construction steps, like cmake, configure, make, ...

+class src.compilation.Builder(config, logger, product_info, options=<src.options.OptResult object at 0x37b8f90>, check_src=True)[source]¶ +

Class to handle all construction steps, like cmake, configure, make, …

-build_configure(options='')[source]¶
+build_configure(options='')[source]¶
-check(command='')[source]¶
+check(command='')[source]¶
-cmake(options='')[source]¶
+cmake(options='')[source]¶
-complete_environment(make_options)[source]¶
+complete_environment(make_options)[source]¶
-configure(options='')[source]¶
+configure(options='')[source]¶
-do_batch_script_build(script, nb_proc)[source]¶
+do_batch_script_build(script, nb_proc)[source]¶
-do_default_build(build_conf_options='', configure_options='', show_warning=True)[source]¶
+do_default_build(build_conf_options='', configure_options='', show_warning=True)[source]¶
-do_python_script_build(script, nb_proc)[source]¶
+do_python_script_build(script, nb_proc)[source]¶
-do_script_build(script, number_of_proc=0)[source]¶
+do_script_build(script, number_of_proc=0)[source]¶
-hack_libtool()[source]¶
+hack_libtool()[source]¶
-install()[source]¶
+install()[source]¶
-log(text, level, showInfo=True)[source]¶
+log(text, level, showInfo=True)[source]¶
-log_command(command)[source]¶
+log_command(command)[source]¶
-make(nb_proc, make_opt='')[source]¶
+make(nb_proc, make_opt='')[source]¶
-prepare()[source]¶
+prepare()[source]¶
-put_txt_log_in_appli_log_dir(file_name)[source]¶
-

Put the txt log (that contain the system logs, like make command -output) in the directory <APPLICATION DIR>/LOGS/<product_name>/

+put_txt_log_in_appli_log_dir(file_name)[source]¶ +
+
Put the txt log (that contain the system logs, like make command
+
output) in the directory <APPLICATION DIR>/LOGS/<product_name>/
+
- +
Parameters:Str (file_name) -- the name of the file to write
Parameters:Str (file_name) – the name of the file to write
@@ -804,55 +796,55 @@ output) in the directory <APPLICATION DIR>/LOGS/<product_name>/

-wmake(nb_proc, opt_nb_proc=None)[source]¶
+wmake(nb_proc, opt_nb_proc=None)[source]¶
-

debug Module¶

+

debug Module¶

This file assume DEBUG functionalities use

  • print debug messages in sys.stderr for salomeTools
  • show pretty print debug representation from instances of SAT classes -(pretty print src.pyconf.Config), and python dict/list etc. (as 'aVariable')
  • +(pretty print src.pyconf.Config), and python dict/list etc. (as ‘aVariable’)

WARNING: obviously supposedly show messages in SAT development phase, not production

usage: >> import debug as DBG ->> DBG.write("aTitle", aVariable) # not shown in production ->> DBG.write("aTitle", aVariable, True) # unconditionaly shown (as show=True)

+>> DBG.write(“aTitle”, aVariable) # not shown in production +>> DBG.write(“aTitle”, aVariable, True) # unconditionaly shown (as show=True)

to set show message as development phase: >> DBG.push_debug(True)

to set no show message as production phase: >> DBG.push_debug(False)

to set show message temporary as development phase, only in a method: ->> def aMethodToDebug(...): +>> def aMethodToDebug(…): >> DBG.push_debug(True) #force show as appended status >> etc. method code with some DBG.write() >> DBG.pop_debug() #restore previous status (show or not show) >> return

to set a message for future fix, as temporary problem to not forget: -DBG.tofix("aTitle", aVariable, True/False) #True/False in production shown, or not

-

in command line interface you could redirect stderr to file 'myDebug.log': ->> sat compile ... 2> myDebug.log # only stderr ->> sat compile ... &> myDebug.log # stdout and stderr

+DBG.tofix(“aTitle”, aVariable, True/False) #True/False in production shown, or not

+

in command line interface you could redirect stderr to file ‘myDebug.log’: +>> sat compile … 2> myDebug.log # only stderr +>> sat compile … &> myDebug.log # stdout and stderr

-class src.debug.InStream(buf='')[source]¶
-

Bases: StringIO.StringIO

+class src.debug.InStream(buf='')[source]¶ +

Bases: StringIO.StringIO

utility class for pyconf.Config input iostream

-class src.debug.OutStream(buf='')[source]¶
-

Bases: StringIO.StringIO

+class src.debug.OutStream(buf='')[source]¶ +

Bases: StringIO.StringIO

utility class for pyconf.Config output iostream

-close()[source]¶
+close()[source]¶

because Config.__save__ calls close() stream as file keep value before lost as self.value

@@ -861,56 +853,56 @@ keep value before lost as self.value

-src.debug.getLocalEnv()[source]¶
+src.debug.getLocalEnv()[source]¶

get string for environment variables representation

-src.debug.getStrConfigDbg(config)[source]¶
+src.debug.getStrConfigDbg(config)[source]¶

set string as saveConfigDbg, as (path expression evaluation) for debug

-src.debug.getStrConfigStd(config)[source]¶
+src.debug.getStrConfigStd(config)[source]¶

set string as saveConfigStd, as file .pyconf

-src.debug.indent(text, amount=2, ch=' ')[source]¶
+src.debug.indent(text, amount=2, ch=' ')[source]¶

indent multi lines message

-src.debug.pop_debug()[source]¶
+src.debug.pop_debug()[source]¶

restore previous debug outputs status

-src.debug.push_debug(aBool)[source]¶
+src.debug.push_debug(aBool)[source]¶

set debug outputs activated, or not

-src.debug.saveConfigDbg(config, aStream, indent=0, path='')[source]¶
+src.debug.saveConfigDbg(config, aStream, indent=0, path='')[source]¶

pyconf returns multilines (path expression evaluation) for debug

-src.debug.saveConfigStd(config, aStream)[source]¶
+src.debug.saveConfigStd(config, aStream)[source]¶

returns as file .pyconf

-src.debug.tofix(title, var='', force=None)[source]¶
+src.debug.tofix(title, var='', force=None)[source]¶

write sys.stderr a message if _debug[-1]==True or optionaly force=True use this only if no logger accessible for classic logger.warning(message) or logger.debug(message)

@@ -918,29 +910,29 @@ logger.warning(message) or logger.debug(message)

-src.debug.write(title, var='', force=None, fmt='\n#### DEBUG: %s:\n%s\n')[source]¶
+src.debug.write(title, var='', force=None, fmt='\n#### DEBUG: %s:\n%s\n')[source]¶

write sys.stderr a message if _debug[-1]==True or optionaly force=True

-

environment Module¶

+

environment Module¶

-class src.environment.Environ(environ=None)[source]¶
+class src.environment.Environ(environ=None)[source]¶

Class to manage the environment context

-append(key, value, sep=':')[source]¶
+append(key, value, sep=':')[source]¶

Same as append_value but the value argument can be a list

@@ -950,16 +942,16 @@ logger.warning(message) or logger.debug(message)

-append_value(key, value, sep=':')[source]¶
+append_value(key, value, sep=':')[source]¶

append value to key using sep

Parameters:
    -
  • str (sep) -- the environment variable to append
  • -
  • str or list (value) -- the value(s) to append to key
  • -
  • str -- the separator string
  • +
  • str (sep) – the environment variable to append
  • +
  • str or list (value) – the value(s) to append to key
  • +
  • str – the separator string
@@ -969,16 +961,16 @@ logger.warning(message) or logger.debug(message)

-command_value(key, command)[source]¶
-

Get the value given by the system command "command" +command_value(key, command)[source]¶ +

Get the value given by the system command “command” and put it in the environment variable key

Parameters:
    -
  • str (sep) -- the environment variable to append
  • -
  • str -- the value to append to key
  • -
  • str -- the separator string
  • +
  • str (sep) – the environment variable to append
  • +
  • str – the value to append to key
  • +
  • str – the separator string
@@ -988,13 +980,13 @@ and put it in the environment variable key

-get(key)[source]¶
-

Get the value of the environment variable "key"

+get(key)[source]¶ +

Get the value of the environment variable “key”

Parameters:
    -
  • str (command) -- the environment variable
  • -
  • str -- the command to execute
  • +
  • str (command) – the environment variable
  • +
  • str – the command to execute
- +
Parameters:str (key) -- the environment variable
Parameters:str (key) – the environment variable
@@ -1002,13 +994,13 @@ and put it in the environment variable key

-is_defined(key)[source]¶
+is_defined(key)[source]¶

Check if the key exists in the environment

- +
Parameters:str (key) -- the environment variable to check
Parameters:str (key) – the environment variable to check
@@ -1016,16 +1008,16 @@ and put it in the environment variable key

-prepend(key, value, sep=':')[source]¶
+prepend(key, value, sep=':')[source]¶

Same as prepend_value but the value argument can be a list

@@ -1035,16 +1027,16 @@ and put it in the environment variable key

-prepend_value(key, value, sep=':')[source]¶
+prepend_value(key, value, sep=':')[source]¶

prepend value to key using sep

Parameters:
    -
  • str (sep) -- the environment variable to prepend
  • -
  • str or list (value) -- the value(s) to prepend to key
  • -
  • str -- the separator string
  • +
  • str (sep) – the environment variable to prepend
  • +
  • str or list (value) – the value(s) to prepend to key
  • +
  • str – the separator string
@@ -1054,15 +1046,15 @@ and put it in the environment variable key

-set(key, value)[source]¶
-

Set the environment variable "key" to value "value"

+set(key, value)[source]¶ +

Set the environment variable “key” to value “value”

Parameters:
    -
  • str (sep) -- the environment variable to prepend
  • -
  • str -- the value to prepend to key
  • -
  • str -- the separator string
  • +
  • str (sep) – the environment variable to prepend
  • +
  • str – the value to prepend to key
  • +
  • str – the separator string
@@ -1074,11 +1066,11 @@ and put it in the environment variable key

-class src.environment.FileEnvWriter(config, logger, out_dir, src_root, env_info=None)[source]¶
+class src.environment.FileEnvWriter(config, logger, out_dir, src_root, env_info=None)[source]¶

Class to dump the environment to a file.

-write_cfgForPy_file(filename, additional_env={}, for_package=None, with_commercial=True)[source]¶
+write_cfgForPy_file(filename, additional_env={}, for_package=None, with_commercial=True)[source]¶

Append to current opened aFile a cfgForPy environment (SALOME python launcher).

Parameters:
    -
  • str (value) -- the environment variable to set
  • -
  • str -- the value
  • +
  • str (value) – the environment variable to set
  • +
  • str – the value
@@ -1086,10 +1078,10 @@ environment (SALOME python launcher).

@@ -1100,16 +1092,16 @@ designed for a package.
-write_env_file(filename, forBuild, shell, for_package=None)[source]¶
+write_env_file(filename, forBuild, shell, for_package=None)[source]¶

Create an environment file.

Parameters:
    -
  • str (for_package) -- the file path
  • -
  • dict (additional_env) -- a dictionary of additional variables +
  • str (for_package) – the file path
  • +
  • dict (additional_env) – a dictionary of additional variables to add to the environment
  • -
  • str -- If not None, produce a relative environment +
  • str – If not None, produce a relative environment designed for a package.
@@ -1127,17 +1119,17 @@ designed for a package.
-class src.environment.SalomeEnviron(cfg, environ, forBuild=False, for_package=None, enable_simple_env_script=True)[source]¶
+class src.environment.SalomeEnviron(cfg, environ, forBuild=False, for_package=None, enable_simple_env_script=True)[source]¶

Class to manage the environment of SALOME.

-add_comment(comment)[source]¶
+add_comment(comment)[source]¶

Add a commentary to the out stream (in case of file generation)

Parameters:
    -
  • str (shell) -- the file path
  • -
  • bool (forBuild) -- if true, the build environment
  • -
  • str -- the type of file wanted (.sh, .bat)
  • +
  • str (shell) – the file path
  • +
  • bool (forBuild) – if true, the build environment
  • +
  • str – the type of file wanted (.sh, .bat)
- +
Parameters:str (comment) -- the commentary to add
Parameters:str (comment) – the commentary to add
@@ -1145,13 +1137,13 @@ designed for a package.
-add_line(nb_line)[source]¶
+add_line(nb_line)[source]¶

Add empty lines to the out stream (in case of file generation)

- +
Parameters:int (nb_line) -- the number of empty lines to add
Parameters:int (nb_line) – the number of empty lines to add
@@ -1159,13 +1151,13 @@ designed for a package.
-add_warning(warning)[source]¶
+add_warning(warning)[source]¶

Add a warning to the out stream (in case of file generation)

- +
Parameters:str (warning) -- the warning to add
Parameters:str (warning) – the warning to add
@@ -1173,16 +1165,16 @@ designed for a package.
-append(key, value, sep=':')[source]¶
+append(key, value, sep=':')[source]¶

append value to key using sep

@@ -1192,13 +1184,13 @@ designed for a package.
-dump(out)[source]¶
+dump(out)[source]¶

Write the environment to out

Parameters:
    -
  • str (sep) -- the environment variable to append
  • -
  • str -- the value to append to key
  • -
  • str -- the separator string
  • +
  • str (sep) – the environment variable to append
  • +
  • str – the value to append to key
  • +
  • str – the separator string
- +
Parameters:file (out) -- the stream where to write the environment
Parameters:file (out) – the stream where to write the environment
@@ -1206,13 +1198,13 @@ designed for a package.
-finish(required)[source]¶
+finish(required)[source]¶

Add a final instruction in the out file (in case of file generation)

- +
Parameters:bool (required) -- Do nothing if required is False
Parameters:bool (required) – Do nothing if required is False
@@ -1220,13 +1212,13 @@ designed for a package.
-get(key)[source]¶
-

Get the value of the environment variable "key"

+get(key)[source]¶ +

Get the value of the environment variable “key”

- +
Parameters:str (key) -- the environment variable
Parameters:str (key) – the environment variable
@@ -1234,16 +1226,16 @@ designed for a package.
-get_names(lProducts)[source]¶
+get_names(lProducts)[source]¶

Get the products name to add in SALOME_MODULES environment variable It is the name of the product, except in the case where the is a component name. And it has to be in SALOME_MODULES variable only -if the product has the property has_salome_hui = "yes"

+if the product has the property has_salome_hui = “yes”

- +
Parameters:list (lProducts) -- List of products to potentially add
Parameters:list (lProducts) – List of products to potentially add
@@ -1251,13 +1243,13 @@ if the product has the property has_salome_hui = "yes"

-is_defined(key)[source]¶
+is_defined(key)[source]¶

Check if the key exists in the environment

- +
Parameters:str (key) -- the environment variable to check
Parameters:str (key) – the environment variable to check
@@ -1265,13 +1257,13 @@ if the product has the property has_salome_hui = "yes"

-load_cfg_environment(cfg_env)[source]¶
+load_cfg_environment(cfg_env)[source]¶

Loads environment defined in cfg_env

- +
Parameters:Config (cfg_env) -- A config containing an environment
Parameters:Config (cfg_env) – A config containing an environment
@@ -1279,16 +1271,16 @@ if the product has the property has_salome_hui = "yes"

-prepend(key, value, sep=':')[source]¶
+prepend(key, value, sep=':')[source]¶

prepend value to key using sep

@@ -1298,16 +1290,16 @@ if the product has the property has_salome_hui = "yes"

-run_env_script(product_info, logger=None, native=False)[source]¶
+run_env_script(product_info, logger=None, native=False)[source]¶

Runs an environment script.

Parameters:
    -
  • str (sep) -- the environment variable to prepend
  • -
  • str -- the value to prepend to key
  • -
  • str -- the separator string
  • +
  • str (sep) – the environment variable to prepend
  • +
  • str – the value to prepend to key
  • +
  • str – the separator string
@@ -1317,7 +1309,7 @@ if the product has the property has_salome_hui = "yes"

-run_simple_env_script(script_path, logger=None)[source]¶
+run_simple_env_script(script_path, logger=None)[source]¶

Runs an environment script. Same as run_env_script, but with a script path as parameter.

Parameters:
    -
  • Config (product_info) -- The product description
  • -
  • Logger (logger) -- The logger instance to display messages
  • -
  • Boolean (native) -- if True load set_native_env instead of set_env
  • +
  • Config (product_info) – The product description
  • +
  • Logger (logger) – The logger instance to display messages
  • +
  • Boolean (native) – if True load set_native_env instead of set_env
@@ -1325,8 +1317,8 @@ script path as parameter.

@@ -1336,15 +1328,15 @@ script path as parameter.

-set(key, value)[source]¶
-

Set the environment variable "key" to value "value"

+set(key, value)[source]¶ +

Set the environment variable “key” to value “value”

Parameters:
    -
  • str (script_path) -- a path to an environment script
  • -
  • Logger (logger) -- The logger instance to display messages
  • +
  • str (script_path) – a path to an environment script
  • +
  • Logger (logger) – The logger instance to display messages
@@ -1354,15 +1346,15 @@ script path as parameter.

-set_a_product(product, logger)[source]¶
+set_a_product(product, logger)[source]¶

Sets the environment of a product.

Parameters:
    -
  • str (value) -- the environment variable to set
  • -
  • str -- the value
  • +
  • str (value) – the environment variable to set
  • +
  • str – the value
@@ -1372,13 +1364,13 @@ script path as parameter.

-set_application_env(logger)[source]¶
+set_application_env(logger)[source]¶

Sets the environment defined in the APPLICATION file.

Parameters:
    -
  • str (product) -- The product name
  • -
  • Logger (logger) -- The logger instance to display messages
  • +
  • str (product) – The product name
  • +
  • Logger (logger) – The logger instance to display messages
- +
Parameters:Logger (logger) -- The logger instance to display messages
Parameters:Logger (logger) – The logger instance to display messages
@@ -1386,13 +1378,13 @@ script path as parameter.

-set_cpp_env(product_info)[source]¶
+set_cpp_env(product_info)[source]¶

Sets the generic environment for a SALOME cpp product.

- +
Parameters:Config (product_info) -- The product description
Parameters:Config (product_info) – The product description
@@ -1400,7 +1392,7 @@ script path as parameter.

-set_full_environ(logger, env_info)[source]¶
+set_full_environ(logger, env_info)[source]¶

Sets the full environment for products specified in env_info dictionary.

@@ -1408,8 +1400,8 @@ specified in env_info dictionary.

@@ -1419,15 +1411,15 @@ specified in env_info dictionary.

-set_products(logger, src_root=None)[source]¶
+set_products(logger, src_root=None)[source]¶

Sets the environment for all the products.

Parameters:
    -
  • Logger (logger) -- The logger instance to display messages
  • -
  • list (env_info) -- the list of products
  • +
  • Logger (logger) – The logger instance to display messages
  • +
  • list (env_info) – the list of products
@@ -1437,19 +1429,19 @@ specified in env_info dictionary.

-set_python_libdirs()[source]¶
+set_python_libdirs()[source]¶

Set some generic variables for python library paths

-set_salome_generic_product_env(pi)[source]¶
+set_salome_generic_product_env(pi)[source]¶

Sets the generic environment for a SALOME product.

Parameters:
    -
  • Logger (logger) -- The logger instance to display messages
  • -
  • src (src_root) -- the application working directory
  • +
  • Logger (logger) – The logger instance to display messages
  • +
  • src (src_root) – the application working directory
- +
Parameters:Config (pi) -- The product description
Parameters:Config (pi) – The product description
@@ -1457,7 +1449,7 @@ specified in env_info dictionary.

-set_salome_minimal_product_env(product_info, logger)[source]¶
+set_salome_minimal_product_env(product_info, logger)[source]¶

Sets the minimal environment for a SALOME product. xxx_ROOT_DIR and xxx_SRC_DIR

@@ -1465,8 +1457,8 @@ xxx_ROOT_DIR and xxx_SRC_DIR

@@ -1478,22 +1470,22 @@ xxx_ROOT_DIR and xxx_SRC_DIR

-class src.environment.Shell(name, extension)[source]¶
+class src.environment.Shell(name, extension)[source]¶

Definition of a Shell.

-src.environment.load_environment(config, build, logger)[source]¶
+src.environment.load_environment(config, build, logger)[source]¶

Loads the environment (used to run the tests, for example).

Parameters:
    -
  • Config (product_info) -- The product description
  • -
  • Logger (logger) -- The logger instance to display messages
  • +
  • Config (product_info) – The product description
  • +
  • Logger (logger) – The logger instance to display messages
@@ -1503,16 +1495,16 @@ xxx_ROOT_DIR and xxx_SRC_DIR

-

fileEnviron Module¶

+

fileEnviron Module¶

-class src.fileEnviron.BashFileEnviron(output, environ=None)[source]¶
-

Bases: src.fileEnviron.FileEnviron

+class src.fileEnviron.BashFileEnviron(output, environ=None)[source]¶ +

Bases: src.fileEnviron.FileEnviron

Class for bash shell.

-command_value(key, command)[source]¶
-

Get the value given by the system command "command" +command_value(key, command)[source]¶ +

Get the value given by the system command “command” and put it in the environment variable key. Has to be overwritten in the derived classes This can be seen as a virtual method

@@ -1521,8 +1513,8 @@ This can be seen as a virtual method

@@ -1532,13 +1524,13 @@ This can be seen as a virtual method

-finish(required=True)[source]¶
+finish(required=True)[source]¶

Add a final instruction in the out file (in case of file generation)

Parameters:
    -
  • Config (config) -- the global config
  • -
  • bool (build) -- build environement if True
  • -
  • Logger (logger) -- The logger instance to display messages
  • +
  • Config (config) – the global config
  • +
  • bool (build) – build environement if True
  • +
  • Logger (logger) – The logger instance to display messages
Parameters:
    -
  • str (command) -- the environment variable
  • -
  • str -- the command to execute
  • +
  • str (command) – the environment variable
  • +
  • str – the command to execute
- +
Parameters:bool (required) -- Do nothing if required is False
Parameters:bool (required) – Do nothing if required is False
@@ -1546,15 +1538,15 @@ This can be seen as a virtual method

-set(key, value)[source]¶
-

Set the environment variable "key" to value "value"

+set(key, value)[source]¶ +

Set the environment variable “key” to value “value”

@@ -1566,18 +1558,18 @@ This can be seen as a virtual method

-class src.fileEnviron.BatFileEnviron(output, environ=None)[source]¶
-

Bases: src.fileEnviron.FileEnviron

+class src.fileEnviron.BatFileEnviron(output, environ=None)[source]¶ +

Bases: src.fileEnviron.FileEnviron

for Windows batch shell.

-add_comment(comment)[source]¶
+add_comment(comment)[source]¶

Add a comment in the shell file

Parameters:
    -
  • str (value) -- the environment variable to set
  • -
  • str -- the value
  • +
  • str (value) – the environment variable to set
  • +
  • str – the value
- +
Parameters:str (comment) -- the comment to add
Parameters:str (comment) – the comment to add
@@ -1585,8 +1577,8 @@ This can be seen as a virtual method

-command_value(key, command)[source]¶
-

Get the value given by the system command "command" +command_value(key, command)[source]¶ +

Get the value given by the system command “command” and put it in the environment variable key. Has to be overwritten in the derived classes This can be seen as a virtual method

@@ -1595,8 +1587,8 @@ This can be seen as a virtual method

Parameters:
    -
  • str (command) -- the environment variable
  • -
  • str -- the command to execute
  • +
  • str (command) – the environment variable
  • +
  • str – the command to execute
@@ -1606,14 +1598,14 @@ This can be seen as a virtual method

-finish(required=True)[source]¶
+finish(required=True)[source]¶

Add a final instruction in the out file (in case of file generation) In the particular windows case, do nothing

- +
Parameters:bool (required) -- Do nothing if required is False
Parameters:bool (required) – Do nothing if required is False
@@ -1621,13 +1613,13 @@ In the particular windows case, do nothing

-get(key)[source]¶
-

Get the value of the environment variable "key"

+get(key)[source]¶ +

Get the value of the environment variable “key”

- +
Parameters:str (key) -- the environment variable
Parameters:str (key) – the environment variable
@@ -1635,15 +1627,15 @@ In the particular windows case, do nothing

-set(key, value)[source]¶
-

Set the environment variable "key" to value "value"

+set(key, value)[source]¶ +

Set the environment variable “key” to value “value”

@@ -1655,18 +1647,18 @@ In the particular windows case, do nothing

-class src.fileEnviron.ContextFileEnviron(output, environ=None)[source]¶
-

Bases: src.fileEnviron.FileEnviron

+class src.fileEnviron.ContextFileEnviron(output, environ=None)[source]¶ +

Bases: src.fileEnviron.FileEnviron

Class for a salome context configuration file.

-add_echo(text)[source]¶
+add_echo(text)[source]¶

Add a comment

Parameters:
    -
  • str (value) -- the environment variable to set
  • -
  • str -- the value
  • +
  • str (value) – the environment variable to set
  • +
  • str – the value
- +
Parameters:str (text) -- the comment to add
Parameters:str (text) – the comment to add
@@ -1674,13 +1666,13 @@ In the particular windows case, do nothing

-add_warning(warning)[source]¶
+add_warning(warning)[source]¶

Add a warning

- +
Parameters:str (text) -- the warning to add
Parameters:str (text) – the warning to add
@@ -1688,16 +1680,16 @@ In the particular windows case, do nothing

-append_value(key, value, sep=':')[source]¶
+append_value(key, value, sep=':')[source]¶

append value to key using sep

@@ -1707,8 +1699,8 @@ In the particular windows case, do nothing

-command_value(key, command)[source]¶
-

Get the value given by the system command "command" +command_value(key, command)[source]¶ +

Get the value given by the system command “command” and put it in the environment variable key. Has to be overwritten in the derived classes This can be seen as a virtual method

@@ -1717,8 +1709,8 @@ This can be seen as a virtual method

@@ -1728,13 +1720,13 @@ This can be seen as a virtual method

-finish(required=True)[source]¶
+finish(required=True)[source]¶

Add a final instruction in the out file (in case of file generation)

Parameters:
    -
  • str (sep) -- the environment variable to append
  • -
  • str -- the value to append to key
  • -
  • str -- the separator string
  • +
  • str (sep) – the environment variable to append
  • +
  • str – the value to append to key
  • +
  • str – the separator string
Parameters:
    -
  • str (command) -- the environment variable
  • -
  • str -- the command to execute
  • +
  • str (command) – the environment variable
  • +
  • str – the command to execute
- +
Parameters:bool (required) -- Do nothing if required is False
Parameters:bool (required) – Do nothing if required is False
@@ -1742,13 +1734,13 @@ This can be seen as a virtual method

-get(key)[source]¶
-

Get the value of the environment variable "key"

+get(key)[source]¶ +

Get the value of the environment variable “key”

- +
Parameters:str (key) -- the environment variable
Parameters:str (key) – the environment variable
@@ -1756,16 +1748,16 @@ This can be seen as a virtual method

-prepend_value(key, value, sep=':')[source]¶
+prepend_value(key, value, sep=':')[source]¶

prepend value to key using sep

@@ -1775,15 +1767,15 @@ This can be seen as a virtual method

-set(key, value)[source]¶
-

Set the environment variable "key" to value "value"

+set(key, value)[source]¶ +

Set the environment variable “key” to value “value”

Parameters:
    -
  • str (sep) -- the environment variable to prepend
  • -
  • str -- the value to prepend to key
  • -
  • str -- the separator string
  • +
  • str (sep) – the environment variable to prepend
  • +
  • str – the value to prepend to key
  • +
  • str – the separator string
@@ -1795,18 +1787,18 @@ This can be seen as a virtual method

-class src.fileEnviron.FileEnviron(output, environ=None)[source]¶
-

Bases: object

+class src.fileEnviron.FileEnviron(output, environ=None)[source]¶ +

Bases: object

Base class for shell environment

-add_comment(comment)[source]¶
+add_comment(comment)[source]¶

Add a comment in the shell file

Parameters:
    -
  • str (value) -- the environment variable to set
  • -
  • str -- the value
  • +
  • str (value) – the environment variable to set
  • +
  • str – the value
- +
Parameters:str (comment) -- the comment to add
Parameters:str (comment) – the comment to add
@@ -1814,13 +1806,13 @@ This can be seen as a virtual method

-add_echo(text)[source]¶
-

Add a "echo" in the shell file

+add_echo(text)[source]¶ +

Add a “echo” in the shell file

- +
Parameters:str (text) -- the text to echo
Parameters:str (text) – the text to echo
@@ -1828,13 +1820,13 @@ This can be seen as a virtual method

-add_line(number)[source]¶
+add_line(number)[source]¶

Add some empty lines in the shell file

- +
Parameters:int (number) -- the number of lines to add
Parameters:int (number) – the number of lines to add
@@ -1842,13 +1834,13 @@ This can be seen as a virtual method

-add_warning(warning)[source]¶
-

Add a warning "echo" in the shell file

+add_warning(warning)[source]¶ +

Add a warning “echo” in the shell file

- +
Parameters:str (warning) -- the text to echo
Parameters:str (warning) – the text to echo
@@ -1856,16 +1848,16 @@ This can be seen as a virtual method

-append(key, value, sep=':')[source]¶
+append(key, value, sep=':')[source]¶

Same as append_value but the value argument can be a list

@@ -1875,16 +1867,16 @@ This can be seen as a virtual method

-append_value(key, value, sep=':')[source]¶
+append_value(key, value, sep=':')[source]¶

append value to key using sep

Parameters:
    -
  • str (sep) -- the environment variable to append
  • -
  • str or list (value) -- the value(s) to append to key
  • -
  • str -- the separator string
  • +
  • str (sep) – the environment variable to append
  • +
  • str or list (value) – the value(s) to append to key
  • +
  • str – the separator string
@@ -1894,8 +1886,8 @@ This can be seen as a virtual method

-command_value(key, command)[source]¶
-

Get the value given by the system command "command" +command_value(key, command)[source]¶ +

Get the value given by the system command “command” and put it in the environment variable key. Has to be overwritten in the derived classes This can be seen as a virtual method

@@ -1904,8 +1896,8 @@ This can be seen as a virtual method

@@ -1915,13 +1907,13 @@ This can be seen as a virtual method

-finish(required=True)[source]¶
+finish(required=True)[source]¶

Add a final instruction in the out file (in case of file generation)

Parameters:
    -
  • str (sep) -- the environment variable to append
  • -
  • str -- the value to append to key
  • -
  • str -- the separator string
  • +
  • str (sep) – the environment variable to append
  • +
  • str – the value to append to key
  • +
  • str – the separator string
Parameters:
    -
  • str (command) -- the environment variable
  • -
  • str -- the command to execute
  • +
  • str (command) – the environment variable
  • +
  • str – the command to execute
- +
Parameters:bool (required) -- Do nothing if required is False
Parameters:bool (required) – Do nothing if required is False
@@ -1929,13 +1921,13 @@ This can be seen as a virtual method

-get(key)[source]¶
-

Get the value of the environment variable "key"

+get(key)[source]¶ +

Get the value of the environment variable “key”

- +
Parameters:str (key) -- the environment variable
Parameters:str (key) – the environment variable
@@ -1943,13 +1935,13 @@ This can be seen as a virtual method

-is_defined(key)[source]¶
+is_defined(key)[source]¶

Check if the key exists in the environment

- +
Parameters:str (key) -- the environment variable to check
Parameters:str (key) – the environment variable to check
@@ -1957,16 +1949,16 @@ This can be seen as a virtual method

-prepend(key, value, sep=':')[source]¶
+prepend(key, value, sep=':')[source]¶

Same as prepend_value but the value argument can be a list

@@ -1976,16 +1968,16 @@ This can be seen as a virtual method

-prepend_value(key, value, sep=':')[source]¶
+prepend_value(key, value, sep=':')[source]¶

prepend value to key using sep

Parameters:
    -
  • str (sep) -- the environment variable to prepend
  • -
  • str or list (value) -- the value(s) to prepend to key
  • -
  • str -- the separator string
  • +
  • str (sep) – the environment variable to prepend
  • +
  • str or list (value) – the value(s) to prepend to key
  • +
  • str – the separator string
@@ -1995,15 +1987,15 @@ This can be seen as a virtual method

-set(key, value)[source]¶
-

Set the environment variable 'key' to value 'value'

+set(key, value)[source]¶ +

Set the environment variable ‘key’ to value ‘value’

Parameters:
    -
  • str (sep) -- the environment variable to prepend
  • -
  • str -- the value to prepend to key
  • -
  • str -- the separator string
  • +
  • str (sep) – the environment variable to prepend
  • +
  • str – the value to prepend to key
  • +
  • str – the separator string
@@ -2015,20 +2007,20 @@ This can be seen as a virtual method

-class src.fileEnviron.LauncherFileEnviron(output, environ=None)[source]¶
+class src.fileEnviron.LauncherFileEnviron(output, environ=None)[source]¶

Class to generate a launcher file script (in python syntax) SalomeContext API

-add(key, value)[source]¶
+add(key, value)[source]¶

prepend value to key using sep

Parameters:
    -
  • str (value) -- the environment variable to set
  • -
  • str -- the value
  • +
  • str (value) – the environment variable to set
  • +
  • str – the value
@@ -2038,18 +2030,18 @@ This can be seen as a virtual method

-add_comment(comment)[source]¶
+add_comment(comment)[source]¶
-add_echo(text)[source]¶
+add_echo(text)[source]¶

Add a comment

Parameters:
    -
  • str (value) -- the environment variable to prepend
  • -
  • str -- the value to prepend to key
  • +
  • str (value) – the environment variable to prepend
  • +
  • str – the value to prepend to key
- +
Parameters:str (text) -- the comment to add
Parameters:str (text) – the comment to add
@@ -2057,13 +2049,13 @@ This can be seen as a virtual method

-add_line(number)[source]¶
+add_line(number)[source]¶

Add some empty lines in the launcher file

- +
Parameters:int (number) -- the number of lines to add
Parameters:int (number) – the number of lines to add
@@ -2071,13 +2063,13 @@ This can be seen as a virtual method

-add_warning(warning)[source]¶
+add_warning(warning)[source]¶

Add a warning

- +
Parameters:str (text) -- the warning to add
Parameters:str (text) – the warning to add
@@ -2085,16 +2077,16 @@ This can be seen as a virtual method

-append(key, value, sep=':')[source]¶
+append(key, value, sep=':')[source]¶

Same as append_value but the value argument can be a list

@@ -2104,16 +2096,16 @@ This can be seen as a virtual method

-append_value(key, value, sep=':')[source]¶
+append_value(key, value, sep=':')[source]¶

append value to key using sep

Parameters:
    -
  • str (sep) -- the environment variable to append
  • -
  • str or list (value) -- the value(s) to append to key
  • -
  • str -- the separator string
  • +
  • str (sep) – the environment variable to append
  • +
  • str or list (value) – the value(s) to append to key
  • +
  • str – the separator string
@@ -2123,21 +2115,21 @@ This can be seen as a virtual method

-change_to_launcher(value)[source]¶
+change_to_launcher(value)[source]¶
-command_value(key, command)[source]¶
-

Get the value given by the system command "command" +command_value(key, command)[source]¶ +

Get the value given by the system command “command” and put it in the environment variable key.

Parameters:
    -
  • str (sep) -- the environment variable to append
  • -
  • str -- the value to append to key
  • -
  • str -- the separator string
  • +
  • str (sep) – the environment variable to append
  • +
  • str – the value to append to key
  • +
  • str – the separator string
@@ -2147,14 +2139,14 @@ and put it in the environment variable key.

-finish(required=True)[source]¶
+finish(required=True)[source]¶

Add a final instruction in the out file (in case of file generation) In the particular launcher case, do nothing

Parameters:
    -
  • str (command) -- the environment variable
  • -
  • str -- the command to execute
  • +
  • str (command) – the environment variable
  • +
  • str – the command to execute
- +
Parameters:bool (required) -- Do nothing if required is False
Parameters:bool (required) – Do nothing if required is False
@@ -2162,13 +2154,13 @@ In the particular launcher case, do nothing

-get(key)[source]¶
-

Get the value of the environment variable "key"

+get(key)[source]¶ +

Get the value of the environment variable “key”

- +
Parameters:str (key) -- the environment variable
Parameters:str (key) – the environment variable
@@ -2176,13 +2168,13 @@ In the particular launcher case, do nothing

-is_defined(key)[source]¶
+is_defined(key)[source]¶

Check if the key exists in the environment

- +
Parameters:str (key) -- the environment variable to check
Parameters:str (key) – the environment variable to check
@@ -2190,16 +2182,16 @@ In the particular launcher case, do nothing

-prepend(key, value, sep=':')[source]¶
+prepend(key, value, sep=':')[source]¶

Same as prepend_value but the value argument can be a list

@@ -2209,16 +2201,16 @@ In the particular launcher case, do nothing

-prepend_value(key, value, sep=':')[source]¶
+prepend_value(key, value, sep=':')[source]¶

prepend value to key using sep

Parameters:
    -
  • str (sep) -- the environment variable to prepend
  • -
  • str or list (value) -- the value(s) to prepend to key
  • -
  • str -- the separator string
  • +
  • str (sep) – the environment variable to prepend
  • +
  • str or list (value) – the value(s) to prepend to key
  • +
  • str – the separator string
@@ -2228,15 +2220,15 @@ In the particular launcher case, do nothing

-set(key, value)[source]¶
-

Set the environment variable "key" to value "value"

+set(key, value)[source]¶ +

Set the environment variable “key” to value “value”

Parameters:
    -
  • str (sep) -- the environment variable to prepend
  • -
  • str -- the value to prepend to key
  • -
  • str -- the separator string
  • +
  • str (sep) – the environment variable to prepend
  • +
  • str – the value to prepend to key
  • +
  • str – the separator string
@@ -2248,82 +2240,193 @@ In the particular launcher case, do nothing

-class src.fileEnviron.ScreenEnviron(output, environ=None)[source]¶
-

Bases: src.fileEnviron.FileEnviron

+class src.fileEnviron.ScreenEnviron(output, environ=None)[source]¶ +

Bases: src.fileEnviron.FileEnviron

-add_comment(comment)[source]¶
-
+add_comment(comment)[source]¶ +

Add a comment in the shell file

+
Parameters:
    -
  • str (value) -- the environment variable to set
  • -
  • str -- the value
  • +
  • str (value) – the environment variable to set
  • +
  • str – the value
+++ + + + +
Parameters:str (comment) – the comment to add
+
-add_echo(text)[source]¶
-
+add_echo(text)[source]¶ +

Add a “echo” in the shell file

+ +++ + + + +
Parameters:str (text) – the text to echo
+
-add_line(number)[source]¶
-
+add_line(number)[source]¶ +

Add some empty lines in the shell file

+ +++ + + + +
Parameters:int (number) – the number of lines to add
+
-add_warning(warning)[source]¶
-
+add_warning(warning)[source]¶ +

Add a warning “echo” in the shell file

+ +++ + + + +
Parameters:str (warning) – the text to echo
+
-append(name, value, sep=':')[source]¶
-
+append(name, value, sep=':')[source]¶ +

Same as append_value but the value argument can be a list

+ +++ + + + +
Parameters:
    +
  • str (sep) – the environment variable to append
  • +
  • str or list (value) – the value(s) to append to key
  • +
  • str – the separator string
  • +
+
+
-command_value(key, command)[source]¶
-
+command_value(key, command)[source]¶ +

Get the value given by the system command “command” +and put it in the environment variable key. +Has to be overwritten in the derived classes +This can be seen as a virtual method

+ +++ + + + +
Parameters:
    +
  • str (command) – the environment variable
  • +
  • str – the command to execute
  • +
+
+
-get(name)[source]¶
-
+get(name)[source]¶ +

Get the value of the environment variable “key”

+ +++ + + + +
Parameters:str (key) – the environment variable
+
-is_defined(name)[source]¶
-
+is_defined(name)[source]¶ +

Check if the key exists in the environment

+ +++ + + + +
Parameters:str (key) – the environment variable to check
+
-prepend(name, value, sep=':')[source]¶
-
+prepend(name, value, sep=':')[source]¶ +

Same as prepend_value but the value argument can be a list

+ +++ + + + +
Parameters:
    +
  • str (sep) – the environment variable to prepend
  • +
  • str or list (value) – the value(s) to prepend to key
  • +
  • str – the separator string
  • +
+
+
-run_env_script(module, script)[source]¶
+run_env_script(module, script)[source]¶
-set(name, value)[source]¶
-
+set(name, value)[source]¶ +

Set the environment variable ‘key’ to value ‘value’

+ +++ + + + +
Parameters:
    +
  • str (value) – the environment variable to set
  • +
  • str – the value
  • +
+
+
-write(command, name, value, sign='=')[source]¶
+write(command, name, value, sign='=')[source]¶
-src.fileEnviron.get_file_environ(output, shell, environ=None)[source]¶
+src.fileEnviron.get_file_environ(output, shell, environ=None)[source]¶

Instantiate correct FileEnvironment sub-class.

@@ -2333,7 +2436,7 @@ In the particular launcher case, do nothing

-src.fileEnviron.special_path_separator(name)[source]¶
+src.fileEnviron.special_path_separator(name)[source]¶

TCLLIBPATH, TKLIBPATH, PV_PLUGIN_PATH environments variables need some exotic path separator. This function gives the separator regarding the name of the variable @@ -2342,7 +2445,7 @@ to append or prepend.

- +
Parameters:
    -
  • file (output) -- the output file stream.
  • -
  • str (shell) -- the type of shell syntax to use.
  • -
  • dict (environ) -- a potential additional environment.
  • +
  • file (output) – the output file stream.
  • +
  • str (shell) – the type of shell syntax to use.
  • +
  • dict (environ) – a potential additional environment.
Parameters:str (name) -- The name of the variable to find the separator
Parameters:str (name) – The name of the variable to find the separator
@@ -2350,35 +2453,35 @@ to append or prepend.

-

fork Module¶

+

fork Module¶

-src.fork.batch(cmd, logger, cwd, args=[], log=None, delai=20, sommeil=1)[source]¶
+src.fork.batch(cmd, logger, cwd, args=[], log=None, delai=20, sommeil=1)[source]¶
-src.fork.batch_salome(cmd, logger, cwd, args, getTmpDir, pendant='SALOME_Session_Server', fin='killSalome.py', log=None, delai=20, sommeil=1, delaiapp=0)[source]¶
+src.fork.batch_salome(cmd, logger, cwd, args, getTmpDir, pendant='SALOME_Session_Server', fin='killSalome.py', log=None, delai=20, sommeil=1, delaiapp=0)[source]¶
-src.fork.launch_command(cmd, logger, cwd, args=[], log=None)[source]¶
+src.fork.launch_command(cmd, logger, cwd, args=[], log=None)[source]¶
-src.fork.show_progress(logger, top, delai, ss='')[source]¶
+src.fork.show_progress(logger, top, delai, ss='')[source]¶

shortcut function to display the progression

@@ -2388,16 +2491,16 @@ to append or prepend.

-src.fork.write_back(logger, message, level)[source]¶
+src.fork.write_back(logger, message, level)[source]¶

shortcut function to write at the begin of the line

Parameters:
    -
  • Logger (logger) -- The logging instance
  • -
  • int (delai) -- the number to display
  • -
  • int -- the number max
  • -
  • str (ss) -- the string to display
  • +
  • Logger (logger) – The logging instance
  • +
  • int (delai) – the number to display
  • +
  • int – the number max
  • +
  • str (ss) – the string to display
@@ -2407,31 +2510,31 @@ to append or prepend.

-

logger Module¶

+

logger Module¶

Implements the classes and method relative to the logging

-class src.logger.Logger(config, silent_sysstd=False, all_in_terminal=False, micro_command=False)[source]¶
-

Bases: object

+class src.logger.Logger(config, silent_sysstd=False, all_in_terminal=False, micro_command=False)[source]¶ +

Bases: object

Class to handle log mechanism.

+add_link(log_file_name, command_name, command_res, full_launched_command)[source]¶

Add a link to another log file.

Parameters:
    -
  • Logger (logger) -- The logging instance
  • -
  • str (message) -- the text to display
  • -
  • int (level) -- the level of verbosity
  • +
  • Logger (logger) – The logging instance
  • +
  • str (message) – the text to display
  • +
  • int (level) – the level of verbosity
- @@ -2440,7 +2543,7 @@ to append or prepend.

-end_write(attribute)[source]¶
+end_write(attribute)[source]¶

Called just after command end: Put all fields corresponding to the command end context (time). Write the log xml file on the hard drive. @@ -2449,7 +2552,7 @@ And display the command to launch to get the log

- +
Parameters:
    -
  • str (command_res) -- The file name of the link.
  • -
  • str -- The name of the command linked.
  • -
  • str -- The result of the command linked. "0" or "1"
  • +
  • str (command_res) – The file name of the link.
  • +
  • str – The name of the command linked.
  • +
  • str – The result of the command linked. “0” or “1”
Parma full_launched_command str:
 

The full lanch command -("sat command ...")

+
 

The full lanch command +(“sat command …”)

Parameters:dict (attribute) -- the attribute to add to the node "Site".
Parameters:dict (attribute) – the attribute to add to the node “Site”.
@@ -2457,13 +2560,13 @@ And display the command to launch to get the log

-error(message)[source]¶
+error(message)[source]¶

Print an error.

- +
Parameters:str (message) -- The message to print.
Parameters:str (message) – The message to print.
@@ -2471,20 +2574,20 @@ And display the command to launch to get the log

-flush()[source]¶
+flush()[source]¶

Flush terminal

-put_initial_xml_fields()[source]¶
+put_initial_xml_fields()[source]¶

Called at class initialization: Put all fields -corresponding to the command context (user, time, ...)

+corresponding to the command context (user, time, …)

-write(message, level=None, screenOnly=False)[source]¶
+write(message, level=None, screenOnly=False)[source]¶

function used in the commands to print in the terminal and the log file.

@@ -2492,10 +2595,10 @@ to print in the terminal and the log file.

@@ -2507,14 +2610,14 @@ to the message 0 < level < 6.
-src.logger.date_to_datetime(date)[source]¶
+src.logger.date_to_datetime(date)[source]¶

From a string date in format YYYYMMDD_HHMMSS returns list year, mon, day, hour, minutes, seconds

Parameters:
    -
  • str (message) -- The message to print.
  • -
  • int (level) -- The output level corresponding +
  • str (message) – The message to print.
  • +
  • int (level) – The output level corresponding to the message 0 < level < 6.
  • -
  • boolean (screenOnly) -- if True, do not write in log file.
  • +
  • boolean (screenOnly) – if True, do not write in log file.
- + @@ -2526,15 +2629,15 @@ returns list year, mon, day, hour, minutes, seconds

-src.logger.list_log_file(dirPath, expression)[source]¶
+src.logger.list_log_file(dirPath, expression)[source]¶

Find all files corresponding to expression in dirPath

Parameters:str (date) -- The date in format YYYYMMDD_HHMMSS
Parameters:str (date) – The date in format YYYYMMDD_HHMMSS
Returns:the same date and time in separate variables.
@@ -2550,7 +2653,7 @@ returns list year, mon, day, hour, minutes, seconds

-src.logger.show_command_log(logFilePath, cmd, application, notShownCommands)[source]¶
+src.logger.show_command_log(logFilePath, cmd, application, notShownCommands)[source]¶

Used in updateHatXml. Determine if the log xml file logFilePath has to be shown or not in the hat log.

@@ -2559,11 +2662,11 @@ has to be shown or not in the hat log.

@@ -2581,14 +2684,14 @@ in the log file corresponds to application

-src.logger.timedelta_total_seconds(timedelta)[source]¶
+src.logger.timedelta_total_seconds(timedelta)[source]¶

Replace total_seconds from datetime module in order to be compatible with old python versions

Parameters:
    -
  • str (expression) -- the directory where to search the files
  • -
  • str -- the regular expression of files to find
  • +
  • str (expression) – the directory where to search the files
  • +
  • str – the regular expression of files to find
Parameters:
    -
  • str (application) -- the path to the command xml log file
  • -
  • str -- the command of the log file
  • -
  • str -- the application passed as parameter +
  • str (application) – the path to the command xml log file
  • +
  • str – the command of the log file
  • +
  • str – the application passed as parameter to the salomeTools command
  • -
  • list (notShownCommands) -- the list of commands +
  • list (notShownCommands) – the list of commands that are not shown by default
- + @@ -2600,7 +2703,7 @@ in order to be compatible with old python versions

-src.logger.update_hat_xml(logDir, application=None, notShownCommands=[])[source]¶
+src.logger.update_hat_xml(logDir, application=None, notShownCommands=[])[source]¶

Create the xml file in logDir that contain all the xml file and have a name like YYYYMMDD_HHMMSS_namecmd.xml

Parameters:datetime.timedelta (timedelta) -- The delta between two dates
Parameters:datetime.timedelta (timedelta) – The delta between two dates
Returns:The number of seconds corresponding to timedelta.
@@ -2608,8 +2711,8 @@ and have a name like YYYYMMDD_HHMMSS_namecmd.xml

@@ -2619,13 +2722,13 @@ and have a name like YYYYMMDD_HHMMSS_namecmd.xml

-

options Module¶

+

options Module¶

The Options class that manages the access to all options passed as parameters in salomeTools command lines

-class src.options.OptResult[source]¶
-

Bases: object

+class src.options.OptResult[source]¶ +

Bases: object

An instance of this class will be the object manipulated in code of all salomeTools commands The aim of this class is to have an elegant syntax @@ -2637,25 +2740,27 @@ print(options.level)

-class src.options.Options[source]¶
+class src.options.Options[source]¶

Class to manage all salomeTools options

-add_option(shortName, longName, optionType, destName, helpString='', default=None)[source]¶
-

Method to add an option to a command. It gets all attributes -of an option and append it in the options field

+add_option(shortName, longName, optionType, destName, helpString='', default=None)[source]¶ +
+
Method to add an option to a command. It gets all attributes
+
of an option and append it in the options field
+
Parameters:
    -
  • str (application) -- the directory to parse
  • -
  • str -- the name of the application if there is any
  • +
  • str (application) – the directory to parse
  • +
  • str – the name of the application if there is any
@@ -2672,20 +2777,22 @@ when user ask for help on a command.
-parse_args(argList=None)[source]¶
-

Method that instantiates the class OptResult -that gives access to all options in the code

+parse_args(argList=None)[source]¶ +
+
Method that instantiates the class OptResult
+
that gives access to all options in the code
+
Parameters:
    -
  • str (helpString) -- The short name of the option -(ex "l" for level option).
  • -
  • str -- The long name of the option -(ex "level" for level option).
  • -
  • str -- The type of the option (ex "int").
  • -
  • str -- The name that will be used in the code.
  • -
  • str -- The text to display +
  • str (helpString) – The short name of the option +(ex “l” for level option).
  • +
  • str – The long name of the option +(ex “level” for level option).
  • +
  • str – The type of the option (ex “int”).
  • +
  • str – The name that will be used in the code.
  • +
  • str – The text to display when user ask for help on a command.
- + - +
Parameters:list (argList) -- the raw list of arguments that were passed
Parameters:list (argList) – the raw list of arguments that were passed
Returns:optResult, args : optResult is the option instance to manipulate in the code. args is the full raw list of passed options
Return type:(class 'common.options.OptResult',list)
Return type:(class ‘common.options.OptResult’,list)
@@ -2693,7 +2800,7 @@ is the full raw list of passed options
-print_help()[source]¶
+print_help()[source]¶

Method that display all options stored in self.options and there help

@@ -2711,17 +2818,17 @@ is the full raw list of passed options
-

printcolors Module¶

+

printcolors Module¶

In this file is stored the mechanism that manage color prints in the terminal

-src.printcolors.cleancolor(message)[source]¶
+src.printcolors.cleancolor(message)[source]¶

remove color from a colored text.

- + @@ -2733,21 +2840,21 @@ is the full raw list of passed options
-src.printcolors.print_color_map()[source]¶
+src.printcolors.print_color_map()[source]¶

This method prints the color map

-src.printcolors.print_color_range(start, end)[source]¶
+src.printcolors.print_color_range(start, end)[source]¶

print possible range values for colors

Parameters:str (message) -- The text to be cleaned.
Parameters:str (message) – The text to be cleaned.
Returns:The cleaned text.
@@ -2757,18 +2864,18 @@ is the full raw list of passed options
-src.printcolors.print_value(logger, label, value, level=1, suffix='')[source]¶
+src.printcolors.print_value(logger, label, value, level=1, suffix='')[source]¶

shortcut method to print a label and a value with the info color

Parameters:
    -
  • int (end) -- The smaller value.
  • -
  • int -- The bigger value.
  • +
  • int (end) – The smaller value.
  • +
  • int – The bigger value.
@@ -2778,15 +2885,15 @@ is the full raw list of passed options
-src.printcolors.printc(txt, code='')[source]¶
+src.printcolors.printc(txt, code='')[source]¶

print a text with colors

Parameters:
    -
  • class logger (logger) -- the logger instance.
  • -
  • int (level) -- the label to print.
  • -
  • str (suffix) -- the value to print.
  • -
  • int -- the level of verboseness.
  • -
  • str -- the suffix to add at the end.
  • +
  • class logger (logger) – the logger instance.
  • +
  • int (level) – the label to print.
  • +
  • str (suffix) – the value to print.
  • +
  • int – the level of verboseness.
  • +
  • str – the suffix to add at the end.
@@ -2802,13 +2909,13 @@ is the full raw list of passed options
-src.printcolors.printcError(txt)[source]¶
+src.printcolors.printcError(txt)[source]¶

print a text error color

Parameters:
    -
  • str (code) -- The text to be printed.
  • -
  • str -- The color to use.
  • +
  • str (code) – The text to be printed.
  • +
  • str – The color to use.
- + @@ -2820,13 +2927,13 @@ is the full raw list of passed options
-src.printcolors.printcHeader(txt)[source]¶
+src.printcolors.printcHeader(txt)[source]¶

print a text header color

Parameters:str (txt) -- The text to be printed.
Parameters:str (txt) – The text to be printed.
Returns:The colored text.
- + @@ -2838,13 +2945,13 @@ is the full raw list of passed options
-src.printcolors.printcHighlight(txt)[source]¶
+src.printcolors.printcHighlight(txt)[source]¶

print a text highlight color

Parameters:str (txt) -- The text to be printed.
Parameters:str (txt) – The text to be printed.
Returns:The colored text.
- + @@ -2856,13 +2963,13 @@ is the full raw list of passed options
-src.printcolors.printcInfo(txt)[source]¶
+src.printcolors.printcInfo(txt)[source]¶

print a text info color

Parameters:str (txt) -- The text to be printed.
Parameters:str (txt) – The text to be printed.
Returns:The colored text.
- + @@ -2874,13 +2981,13 @@ is the full raw list of passed options
-src.printcolors.printcLabel(txt)[source]¶
+src.printcolors.printcLabel(txt)[source]¶

print a text label color

Parameters:str (txt) -- The text to be printed.
Parameters:str (txt) – The text to be printed.
Returns:The colored text.
- + @@ -2892,13 +2999,13 @@ is the full raw list of passed options
-src.printcolors.printcSuccess(txt)[source]¶
+src.printcolors.printcSuccess(txt)[source]¶

print a text success color

Parameters:str (txt) -- The text to be printed.
Parameters:str (txt) – The text to be printed.
Returns:The colored text.
- + @@ -2910,13 +3017,13 @@ is the full raw list of passed options
-src.printcolors.printcWarning(txt)[source]¶
+src.printcolors.printcWarning(txt)[source]¶

print a text warning color

Parameters:str (txt) -- The text to be printed.
Parameters:str (txt) – The text to be printed.
Returns:The colored text.
- + @@ -2928,12 +3035,12 @@ is the full raw list of passed options
-

product Module¶

+

product Module¶

In this file are implemented the methods relative to the product notion of salomeTools

-src.product.check_config_exists(config, prod_dir, prod_info)[source]¶
+src.product.check_config_exists(config, prod_dir, prod_info)[source]¶

Verify that the installation directory of a product in a base exists Check all the config-<i> directory and verify the sat-config.pyconf file that is in it

@@ -2942,10 +3049,10 @@ that is in it

@@ -2963,14 +3070,14 @@ and if it is found, the path of the found installation

-src.product.check_installation(product_info)[source]¶
+src.product.check_installation(product_info)[source]¶

Verify if a product is well installed. Checks install directory presence and some additional files if it is defined in the config

Parameters:str (txt) -- The text to be printed.
Parameters:str (txt) – The text to be printed.
Returns:The colored text.
Parameters:
    -
  • Config (product_info) -- The global configuration
  • -
  • str (prod_dir) -- The product installation directory path +
  • Config (product_info) – The global configuration
  • +
  • str (prod_dir) – The product installation directory path (without config-<i>)
  • -
  • Config -- The configuration specific to +
  • Config – The configuration specific to the product
- @@ -2983,13 +3090,13 @@ the product
-src.product.check_source(product_info)[source]¶
+src.product.check_source(product_info)[source]¶

Verify if a sources of product is preset. Checks source directory presence

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if it is well installed
- @@ -3002,17 +3109,17 @@ the product
-src.product.get_base_install_dir(config, prod_info, version)[source]¶
+src.product.get_base_install_dir(config, prod_info, version)[source]¶

Compute the installation directory of a product in base

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if it is well installed
@@ -3028,20 +3135,20 @@ the product
-src.product.get_install_dir(config, base, version, prod_info)[source]¶
+src.product.get_install_dir(config, base, version, prod_info)[source]¶

Compute the installation directory of a given product

Parameters:
    -
  • Config (product_info) -- The global configuration
  • -
  • Config -- The configuration specific to +
  • Config (product_info) – The global configuration
  • +
  • Config – The configuration specific to the product
  • -
  • str (version) -- The version of the product
  • +
  • str (version) – The version of the product
@@ -3058,13 +3165,13 @@ the product
-src.product.get_product_components(product_info)[source]¶
+src.product.get_product_components(product_info)[source]¶

Get the component list to generate with the product

Parameters:
    -
  • Config (product_info) -- The global configuration
  • -
  • str (version) -- This corresponds to the value given by user in its -application.pyconf for the specific product. If "yes", the -user wants the product to be in base. If "no", he wants the +
  • Config (product_info) – The global configuration
  • +
  • str (version) – This corresponds to the value given by user in its +application.pyconf for the specific product. If “yes”, the +user wants the product to be in base. If “no”, he wants the product to be in the application workdir
  • -
  • str -- The version of the product
  • -
  • Config -- The configuration specific to +
  • str – The version of the product
  • +
  • Config – The configuration specific to the product
- @@ -3077,16 +3184,16 @@ the product
-src.product.get_product_config(config, product_name, with_install_dir=True)[source]¶
+src.product.get_product_config(config, product_name, with_install_dir=True)[source]¶

Get the specific configuration of a product from the global configuration

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:The list of names of the components
- @@ -3104,7 +3211,7 @@ of the function check_config_exists)
-src.product.get_product_dependencies(config, product_info)[source]¶
+src.product.get_product_dependencies(config, product_info)[source]¶

Get recursively the list of products that are in the product_info dependencies

Parameters:
    -
  • Config (config) -- The global configuration
  • -
  • str (product_name) -- The name of the product
  • -
  • boolean (with_install_dir) -- If false, do not provide an install +
  • Config (config) – The global configuration
  • +
  • str (product_name) – The name of the product
  • +
  • boolean (with_install_dir) – If false, do not provide an install directory (at false only for internal use of the function check_config_exists)
@@ -3095,7 +3202,7 @@ of the function check_config_exists)
Returns:

the specific configuration of the product

Return type:

Config

+
Return type:

Config

@@ -3112,8 +3219,8 @@ in the product_info dependencies

@@ -3130,17 +3237,17 @@ the product
-src.product.get_product_section(config, product_name, version, section=None)[source]¶
+src.product.get_product_section(config, product_name, version, section=None)[source]¶

Get the product description from the configuration

Parameters:
    -
  • Config (product_info) -- The global configuration
  • -
  • Config -- The configuration specific to +
  • Config (product_info) – The global configuration
  • +
  • Config – The configuration specific to the product
@@ -3148,7 +3255,7 @@ explicitly given - @@ -3157,15 +3264,15 @@ explicitly given
-src.product.get_products_infos(lproducts, config)[source]¶
+src.product.get_products_infos(lproducts, config)[source]¶

Get the specific configuration of a list of products

Parameters:
    -
  • Config (config) -- The global configuration
  • -
  • str (section) -- The product name
  • -
  • str -- The version of the product
  • -
  • str -- The searched section (if not None, the section is +
  • Config (config) – The global configuration
  • +
  • str (section) – The product name
  • +
  • str – The version of the product
  • +
  • str – The searched section (if not None, the section is explicitly given
Returns:

The product description

Return type:

Config

+
Return type:

Config

@@ -3173,7 +3280,7 @@ explicitly given (product name, specific configuration of the product)

- @@ -3182,14 +3289,14 @@ explicitly given
-src.product.product_compiles(product_info)[source]¶
+src.product.product_compiles(product_info)[source]¶

Know if a product compiles or not (some products do not have a compilation procedure)

Parameters:
    -
  • List (lproducts) -- The list of product names
  • -
  • Config (config) -- The global configuration
  • +
  • List (lproducts) – The list of product names
  • +
  • Config (config) – The global configuration
Return type:

[(str, Config)]

+
Return type:

[(str, Config)]

- @@ -3202,13 +3309,13 @@ the product
-src.product.product_has_env_script(product_info)[source]¶
+src.product.product_has_env_script(product_info)[source]¶

Know if a product has an environment script

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product compiles, else False
- @@ -3221,13 +3328,13 @@ the product
+src.product.product_has_logo(product_info)[source]¶

Know if a product has a logo (YACSGEN generate)

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product it has an environment script, else False
- @@ -3240,13 +3347,13 @@ the product
-src.product.product_has_patches(product_info)[source]¶
+src.product.product_has_patches(product_info)[source]¶

Know if a product has one or more patches

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:The path of the logo if the product has a logo, else False
- @@ -3259,13 +3366,13 @@ the product
-src.product.product_has_salome_gui(product_info)[source]¶
+src.product.product_has_salome_gui(product_info)[source]¶

Know if a product has a SALOME gui

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product has one or more patches
- @@ -3278,13 +3385,13 @@ the product
-src.product.product_has_script(product_info)[source]¶
+src.product.product_has_script(product_info)[source]¶

Know if a product has a compilation script

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product has a SALOME gui, else False
- @@ -3297,13 +3404,13 @@ the product
-src.product.product_is_autotools(product_info)[source]¶
+src.product.product_is_autotools(product_info)[source]¶

Know if a product is compiled using the autotools

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product it has a compilation script, else False
- @@ -3316,13 +3423,13 @@ the product
-src.product.product_is_cmake(product_info)[source]¶
+src.product.product_is_cmake(product_info)[source]¶

Know if a product is compiled using the cmake

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product is autotools, else False
- @@ -3335,13 +3442,13 @@ the product
-src.product.product_is_cpp(product_info)[source]¶
+src.product.product_is_cpp(product_info)[source]¶

Know if a product is cpp

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product is cmake, else False
- @@ -3354,13 +3461,13 @@ the product
-src.product.product_is_debug(product_info)[source]¶
+src.product.product_is_debug(product_info)[source]¶

Know if a product is in debug mode

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product is a cpp, else False
- @@ -3373,13 +3480,13 @@ the product
-src.product.product_is_dev(product_info)[source]¶
+src.product.product_is_dev(product_info)[source]¶

Know if a product is in dev mode

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product is in debug mode, else False
- @@ -3392,13 +3499,13 @@ the product
-src.product.product_is_fixed(product_info)[source]¶
+src.product.product_is_fixed(product_info)[source]¶

Know if a product is fixed

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product is in dev mode, else False
- @@ -3411,13 +3518,13 @@ the product
-src.product.product_is_generated(product_info)[source]¶
+src.product.product_is_generated(product_info)[source]¶

Know if a product is generated (YACSGEN)

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product is fixed, else False
- @@ -3430,13 +3537,13 @@ the product
-src.product.product_is_mpi(product_info)[source]¶
+src.product.product_is_mpi(product_info)[source]¶

Know if a product has openmpi in its dependencies

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product is generated
- @@ -3449,13 +3556,13 @@ the product
-src.product.product_is_native(product_info)[source]¶
+src.product.product_is_native(product_info)[source]¶

Know if a product is native

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product has openmpi inits dependencies
- @@ -3468,13 +3575,13 @@ the product
-src.product.product_is_salome(product_info)[source]¶
+src.product.product_is_salome(product_info)[source]¶

Know if a product is a SALOME module

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product is native, else False
- @@ -3487,13 +3594,13 @@ the product
-src.product.product_is_sample(product_info)[source]¶
+src.product.product_is_sample(product_info)[source]¶

Know if a product has the sample type

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product is a SALOME module, else False
- @@ -3506,13 +3613,13 @@ the product
-src.product.product_is_smesh_plugin(product_info)[source]¶
+src.product.product_is_smesh_plugin(product_info)[source]¶

Know if a product is a SMESH plugin

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product has the sample type, else False
- @@ -3525,13 +3632,13 @@ the product
-src.product.product_is_vcs(product_info)[source]¶
+src.product.product_is_vcs(product_info)[source]¶

Know if a product is download using git, svn or cvs (not archive)

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product is a SMESH plugin, else False
- @@ -3544,7 +3651,7 @@ the product
-

pyconf Module¶

+

pyconf Module¶

This is a configuration module for Python.

This module should work under Python versions >= 2.2, and cannot be used with earlier versions since it uses new-style classes.

@@ -3553,40 +3660,41 @@ Python 2.4.2. See the test module (test_config.py) included in the U{distribution<http://www.red-dove.com/python_config.html|_blank>} (follow the download link).

A simple example - with the example configuration file:

-
messages:
+
messages:
 [
   {
     stream : `sys.stderr`
-    message: 'Welcome'
-    name: 'Harry'
+    message: 'Welcome'
+    name: 'Harry'
   }
   {
     stream : `sys.stdout`
-    message: 'Welkom'
-    name: 'Ruud'
+    message: 'Welkom'
+    name: 'Ruud'
   }
   {
     stream : $messages[0].stream
-    message: 'Bienvenue'
+    message: 'Bienvenue'
     name: Yves
   }
-]
+] +

a program to read the configuration would be:

-
from config import Config
+
from config import Config
 
-f = file('simple.cfg')
+f = file('simple.cfg')
 cfg = Config(f)
 for m in cfg.messages:
-    s = '%s, %s' % (m.message, m.name)
+    s = '%s, %s' % (m.message, m.name)
     try:
-        print >> m.stream, s
+        print >> m.stream, s
     except IOError, e:
-        print e
+        print e
 

which, when run, would yield the console output:

-
Welcome, Harry
+
Welcome, Harry
 Welkom, Ruud
 Bienvenue, Yves
 
@@ -3601,24 +3709,24 @@ information.

takes a string (e.g. filename) and returns a stream suitable for reading. If unable to open the stream, an IOError exception should be thrown.

The default value of this variable is L{defaultStreamOpener}. For an example -of how it's used, see test_config.py (search for streamOpener).

+of how it’s used, see test_config.py (search for streamOpener).

-class src.pyconf.Config(streamOrFile=None, parent=None, PWD=None)[source]¶
-

Bases: src.pyconf.Mapping

+class src.pyconf.Config(streamOrFile=None, parent=None, PWD=None)[source]¶ +

Bases: src.pyconf.Mapping

This class represents a configuration, and is the only one which clients need to interface to, under normal circumstances.

-class Namespace[source]¶
-

Bases: object

+class Namespace[source]¶ +

Bases: object

This internal class is used for implementing default namespaces.

An instance acts as a namespace.

-Config.addNamespace(ns, name=None)[source]¶
+addNamespace(ns, name=None)[source]¶

Add a namespace to this configuration which can be used to evaluate (resolve) dotted-identifier expressions. @param ns: The namespace to be added. @@ -3631,7 +3739,7 @@ an additional level of indirection.

-Config.getByPath(path)[source]¶
+getByPath(path)[source]¶

Obtain a value in the configuration via its path. @param path: The path of the required value @type path: str @@ -3642,7 +3750,7 @@ an additional level of indirection.

-Config.load(stream)[source]¶
+load(stream)[source]¶

Load the configuration from the specified stream. Multiple streams can be used to populate the same instance, as long as there are no clashing keys. The stream is closed. @@ -3655,7 +3763,7 @@ existing keys.

-Config.removeNamespace(ns, name=None)[source]¶
+removeNamespace(ns, name=None)[source]¶

Remove a namespace added with L{addNamespace}. @param ns: The namespace to be removed. @param name: The name which was specified when L{addNamespace} was @@ -3667,54 +3775,54 @@ called.

-exception src.pyconf.ConfigError[source]¶
-

Bases: exceptions.Exception

+exception src.pyconf.ConfigError[source]¶ +

Bases: exceptions.Exception

This is the base class of exceptions raised by this module.

-exception src.pyconf.ConfigFormatError[source]¶
-

Bases: src.pyconf.ConfigError

+exception src.pyconf.ConfigFormatError[source]¶ +

Bases: src.pyconf.ConfigError

This is the base class of exceptions raised due to syntax errors in configurations.

-class src.pyconf.ConfigInputStream(stream)[source]¶
-

Bases: object

+class src.pyconf.ConfigInputStream(stream)[source]¶ +

Bases: object

An input stream which can read either ANSI files with default encoding or Unicode files with BOMs.

Handles UTF-8, UTF-16LE, UTF-16BE. Could handle UTF-32 if Python had built-in support.

-close()[source]¶
+close()[source]¶
-read(size)[source]¶
+read(size)[source]¶
-readline()[source]¶
+readline()[source]¶
-class src.pyconf.ConfigList[source]¶
-

Bases: list

+class src.pyconf.ConfigList[source]¶ +

Bases: list

This class implements an ordered list of configurations and allows you to try getting the configuration from each entry in turn, returning the first successfully obtained value.

-getByPath(path)[source]¶
+getByPath(path)[source]¶

Obtain a value from the first configuration in the list which defines it.

@param path: The path of the value to retrieve. @@ -3730,8 +3838,8 @@ the specified path.

-class src.pyconf.ConfigMerger(resolver=<function defaultMergeResolve at 0x3897758>)[source]¶
-

Bases: object

+class src.pyconf.ConfigMerger(resolver=<function defaultMergeResolve at 0x36fa5f0>)[source]¶ +

Bases: object

This class is used for merging two configurations. If a key exists in the merge operand but not the merge target, then the entry is copied from the merge operand to the merge target. If a key exists in both configurations, @@ -3739,7 +3847,7 @@ then a resolver (a callable) is called to decide how to handle the conflict.

-handleMismatch(obj1, obj2)[source]¶
+handleMismatch(obj1, obj2)[source]¶

Handle a mismatch between two objects.

@param obj1: The object to merge into. @type obj1: any @@ -3749,7 +3857,7 @@ conflict.

-merge(merged, mergee)[source]¶
+merge(merged, mergee)[source]¶

Merge two configurations. The second configuration is unchanged, and the first is changed to reflect the results of the merge.

@param merged: The configuration to merge into. @@ -3760,7 +3868,7 @@ and the first is changed to reflect the results of the merge.

-mergeMapping(map1, map2)[source]¶
+mergeMapping(map1, map2)[source]¶

Merge two mappings recursively. The second mapping is unchanged, and the first is changed to reflect the results of the merge.

@param map1: The mapping to merge into. @@ -3771,7 +3879,7 @@ and the first is changed to reflect the results of the merge.

-mergeSequence(seq1, seq2)[source]¶
+mergeSequence(seq1, seq2)[source]¶

Merge two sequences. The second sequence is unchanged, and the first is changed to have the elements of the second appended to it.

@@ -3783,7 +3891,7 @@ appended to it.

-overwriteKeys(map1, seq2)[source]¶
+overwriteKeys(map1, seq2)[source]¶

Renint variables. The second mapping is unchanged, and the first is changed depending the keys of the second mapping. @param map1: The mapping to reinit keys into. @@ -3796,37 +3904,37 @@ and the first is changed depending the keys of the second mapping.

-class src.pyconf.ConfigOutputStream(stream, encoding=None)[source]¶
-

Bases: object

+class src.pyconf.ConfigOutputStream(stream, encoding=None)[source]¶ +

Bases: object

An output stream which can write either ANSI files with default encoding or Unicode files with BOMs.

Handles UTF-8, UTF-16LE, UTF-16BE. Could handle UTF-32 if Python had built-in support.

-close()[source]¶
+close()[source]¶
-flush()[source]¶
+flush()[source]¶
-write(data)[source]¶
+write(data)[source]¶
-class src.pyconf.ConfigReader(config)[source]¶
-

Bases: object

+class src.pyconf.ConfigReader(config)[source]¶ +

Bases: object

This internal class implements a parser for configurations.

-getChar()[source]¶
+getChar()[source]¶

Get the next char from the stream. Update line and column numbers appropriately.

@return: The next character from the stream. @@ -3835,7 +3943,7 @@ appropriately.

-getToken()[source]¶
+getToken()[source]¶

Get a token from the stream. String values are returned in a form where you need to eval() the returned value to get the actual string. The return value is (token_type, token_value).

@@ -3846,7 +3954,7 @@ string. The return value is (token_type, token_value).

-load(stream, parent=None, suffix=None)[source]¶
+load(stream, parent=None, suffix=None)[source]¶

Load the configuration from the specified stream.

@param stream: A stream from which to load the configuration. @type stream: A stream (file-like object). @@ -3862,7 +3970,7 @@ configuration. Should be specified whenever the parent is not None.

-location()[source]¶
+location()[source]¶

Return the current location (filename, line, column) in the stream as a string.

Used when printing error messages,

@@ -3872,7 +3980,7 @@ as a string.

-match(t)[source]¶
+match(t)[source]¶

Ensure that the current token type matches the specified value, and advance to the next token.

@param t: The token type to match. @@ -3880,12 +3988,12 @@ advance to the next token.

@return: The token which was last read from the stream before this function is called. @rtype: a token tuple - see L{getToken}. -@raise ConfigFormatError: If the token does not match what's expected.

+@raise ConfigFormatError: If the token does not match what’s expected.

-parseFactor()[source]¶
+parseFactor()[source]¶

Parse a factor in an multiplicative expression (a * b, a / b, a % b)

@return: the parsed factor @rtype: any scalar @@ -3894,7 +4002,7 @@ function is called.

-parseKeyValuePair(parent)[source]¶
+parseKeyValuePair(parent)[source]¶

Parse a key-value pair, and add it to the provided L{Mapping}.

@param parent: The mapping to add entries to. @type parent: A L{Mapping} instance. @@ -3903,7 +4011,7 @@ function is called.

-parseMapping(parent, suffix)[source]¶
+parseMapping(parent, suffix)[source]¶

Parse a mapping.

@param parent: The container to which the mapping will be added. @type parent: A L{Container} instance. @@ -3916,7 +4024,7 @@ function is called.

-parseMappingBody(parent)[source]¶
+parseMappingBody(parent)[source]¶

Parse the internals of a mapping, and add entries to the provided L{Mapping}.

@param parent: The mapping to add entries to. @@ -3925,7 +4033,7 @@ L{Mapping}.

-parseReference(type)[source]¶
+parseReference(type)[source]¶

Parse a reference.

@return: the parsed reference @rtype: L{Reference} @@ -3934,7 +4042,7 @@ L{Mapping}.

-parseScalar()[source]¶
+parseScalar()[source]¶

Parse a scalar - a terminal value such as a string or number, or an L{Expression} or L{Reference}.

@return: the parsed scalar @@ -3944,7 +4052,7 @@ an L{Expression} or L{Reference}.

-parseSequence(parent, suffix)[source]¶
+parseSequence(parent, suffix)[source]¶

Parse a sequence.

@param parent: The container to which the sequence will be added. @type parent: A L{Container} instance. @@ -3957,7 +4065,7 @@ an L{Expression} or L{Reference}.

-parseSuffix(ref)[source]¶
+parseSuffix(ref)[source]¶

Parse a reference suffix.

@param ref: The reference of which this suffix is a part. @type ref: L{Reference}. @@ -3966,7 +4074,7 @@ an L{Expression} or L{Reference}.

-parseTerm()[source]¶
+parseTerm()[source]¶

Parse a term in an additive expression (a + b, a - b)

@return: the parsed term @rtype: any scalar @@ -3975,7 +4083,7 @@ an L{Expression} or L{Reference}.

-parseValue(parent, suffix)[source]¶
+parseValue(parent, suffix)[source]¶

Parse a value.

@param parent: The container to which the value will be added. @type parent: A L{Container} instance. @@ -3988,7 +4096,7 @@ an L{Expression} or L{Reference}.

-setStream(stream)[source]¶
+setStream(stream)[source]¶

Set the stream to the specified value, and prepare to read from it.

@param stream: A stream from which to load the configuration. @type stream: A stream (file-like object).

@@ -3998,25 +4106,26 @@ an L{Expression} or L{Reference}.

-exception src.pyconf.ConfigResolutionError[source]¶
-

Bases: src.pyconf.ConfigError

+exception src.pyconf.ConfigResolutionError[source]¶ +

Bases: src.pyconf.ConfigError

This is the base class of exceptions raised due to semantic errors in configurations.

-class src.pyconf.Container(parent)[source]¶
-

Bases: object

+class src.pyconf.Container(parent)[source]¶ +

Bases: object

This internal class is the base class for mappings and sequences.

@ivar path: A string which describes how to get to this instance from the root of the hierarchy.

Example:

-
a.list.of[1].or['more'].elements
+
a.list.of[1].or['more'].elements
+
-evaluate(item)[source]¶
+evaluate(item)[source]¶

Evaluate items which are instances of L{Reference} or L{Expression}.

L{Reference} instances are evaluated using L{Reference.resolve}, and L{Expression} instances are evaluated using @@ -4030,7 +4139,7 @@ unchanged.

-setPath(path)[source]¶
+setPath(path)[source]¶

Set the path for this instance. @param path: The path - a string which describes how to get to this instance from the root of the hierarchy. @@ -4039,7 +4148,7 @@ to this instance from the root of the hierarchy.

-writeToStream(stream, indent, container)[source]¶
+writeToStream(stream, indent, container)[source]¶

Write this instance to a stream at the specified indentation level.

Should be redefined in subclasses.

@param stream: The stream to write to @@ -4053,19 +4162,19 @@ to this instance from the root of the hierarchy.

-writeValue(value, stream, indent)[source]¶
+writeValue(value, stream, indent)[source]¶
-class src.pyconf.Expression(op, lhs, rhs)[source]¶
-

Bases: object

+class src.pyconf.Expression(op, lhs, rhs)[source]¶ +

Bases: object

This internal class implements a value which is obtained by evaluating an expression.

-evaluate(container)[source]¶
+evaluate(container)[source]¶

Evaluate this instance in the context of a container.

@param container: The container to evaluate in from. @type container: L{Container} @@ -4081,12 +4190,12 @@ subtracting one string from another.

-class src.pyconf.Mapping(parent=None)[source]¶
-

Bases: src.pyconf.Container

+class src.pyconf.Mapping(parent=None)[source]¶ +

Bases: src.pyconf.Container

This internal class implements key-value mappings in configurations.

-addMapping(key, value, comment, setting=False)[source]¶
+addMapping(key, value, comment, setting=False)[source]¶

Add a key-value mapping with a comment.

@param key: The key for the mapping. @type key: str @@ -4102,29 +4211,29 @@ again and setting is False.

-get(key, default=None)[source]¶
+get(key, default=None)[source]¶

Allows a dictionary-style get operation.

-iteritems()[source]¶
+iteritems()[source]¶
-iterkeys()[source]¶
+iterkeys()[source]¶
-keys()[source]¶
+keys()[source]¶

Return the keys in a similar way to a dictionary.

-writeToStream(stream, indent, container)[source]¶
+writeToStream(stream, indent, container)[source]¶

Write this instance to a stream at the specified indentation level.

Should be redefined in subclasses.

@param stream: The stream to write to @@ -4139,12 +4248,12 @@ again and setting is False.

-class src.pyconf.Reference(config, type, ident)[source]¶
-

Bases: object

+class src.pyconf.Reference(config, type, ident)[source]¶ +

Bases: object

This internal class implements a value which is a reference to another value.

-addElement(type, ident)[source]¶
+addElement(type, ident)[source]¶

Add an element to the reference.

@param type: The type of reference. @type type: BACKTICK or DOLLAR @@ -4154,7 +4263,7 @@ again and setting is False.

-findConfig(container)[source]¶
+findConfig(container)[source]¶

Find the closest enclosing configuration to the specified container.

@param container: The container to start from. @type container: L{Container} @@ -4164,7 +4273,7 @@ again and setting is False.

-resolve(container)[source]¶
+resolve(container)[source]¶

Resolve this instance in the context of a container.

@param container: The container to resolve from. @type container: L{Container} @@ -4177,24 +4286,24 @@ again and setting is False.

-class src.pyconf.Sequence(parent=None)[source]¶
-

Bases: src.pyconf.Container

+class src.pyconf.Sequence(parent=None)[source]¶ +

Bases: src.pyconf.Container

This internal class implements a value which is a sequence of other values.

-class SeqIter(seq)[source]¶
-

Bases: object

+class SeqIter(seq)[source]¶ +

Bases: object

This internal class implements an iterator for a L{Sequence} instance.

-next()[source]¶
+next()[source]¶
-Sequence.append(item, comment)[source]¶
+append(item, comment)[source]¶

Add an item to the sequence.

@param item: The item to add. @type item: any @@ -4204,7 +4313,7 @@ again and setting is False.

-Sequence.writeToStream(stream, indent, container)[source]¶
+writeToStream(stream, indent, container)[source]¶

Write this instance to a stream at the specified indentation level.

Should be redefined in subclasses.

@param stream: The stream to write to @@ -4219,12 +4328,12 @@ again and setting is False.

-src.pyconf.deepCopyMapping(inMapping)[source]¶
+src.pyconf.deepCopyMapping(inMapping)[source]¶
-src.pyconf.defaultMergeResolve(map1, map2, key)[source]¶
+src.pyconf.defaultMergeResolve(map1, map2, key)[source]¶

A default resolver for merge conflicts. Returns a string indicating what action to take to resolve the conflict.

@param map1: The map being merged into. @@ -4234,10 +4343,10 @@ Returns a string indicating what action to take to resolve the conflict.

@param key: The key in map2 (which also exists in map1). @type key: str

-
@return: One of "merge", "append", "mismatch" or "overwrite"
+
@return: One of “merge”, “append”, “mismatch” or “overwrite”
indicating what action should be taken. This should be appropriate to the objects being merged - e.g. -there is no point returning "merge" if the two objects +there is no point returning “merge” if the two objects are instances of L{Sequence}.

@rtype: str

@@ -4245,7 +4354,7 @@ are instances of L{Sequence}.
-src.pyconf.defaultStreamOpener(name)[source]¶
+src.pyconf.defaultStreamOpener(name)[source]¶

This function returns a read-only stream, given its name. The name passed in should correspond to an existing stream, otherwise an exception will be raised.

@@ -4260,18 +4369,19 @@ urllib2.urlopen().

-src.pyconf.isWord(s)[source]¶
+src.pyconf.isWord(s)[source]¶

See if a passed-in value is an identifier. If the value passed in is not a string, False is returned. An identifier consists of alphanumerics or underscore characters.

Examples:

-
isWord('a word') ->False
-isWord('award') -> True
-isWord(9) -> False
-isWord('a_b_c_') ->True
+
isWord('a word') ->False
+isWord('award') -> True
+isWord(9) -> False
+isWord('a_b_c_') ->True
+
-

@note: isWord('9abc') will return True - not exactly correct, but adequate -for the way it's used here.

+

@note: isWord(‘9abc’) will return True - not exactly correct, but adequate +for the way it’s used here.

@param s: The name to be tested @type s: any @return: True if a word, else False @@ -4280,12 +4390,12 @@ for the way it's used here.

-src.pyconf.makePath(prefix, suffix)[source]¶
+src.pyconf.makePath(prefix, suffix)[source]¶

Make a path from a prefix and suffix.

Examples: -makePath('', 'suffix') -> 'suffix' -makePath('prefix', 'suffix') -> 'prefix.suffix' -makePath('prefix', '[1]') -> 'prefix[1]'

+makePath(‘’, ‘suffix’) -> ‘suffix’ +makePath(‘prefix’, ‘suffix’) -> ‘prefix.suffix’ +makePath(‘prefix’, ‘[1]’) -> ‘prefix[1]’

@param prefix: The prefix to use. If it evaluates as false, the suffix is returned. @type prefix: str @param suffix: The suffix to use. It is either an identifier or an index in brackets. @@ -4296,9 +4406,9 @@ makePath('prefix', '[1]') -> 'prefix[1]'

-src.pyconf.overwriteMergeResolve(map1, map2, key)[source]¶
+src.pyconf.overwriteMergeResolve(map1, map2, key)[source]¶

An overwriting resolver for merge conflicts. Calls L{defaultMergeResolve}, -but where a "mismatch" is detected, returns "overwrite" instead.

+but where a “mismatch” is detected, returns “overwrite” instead.

@param map1: The map being merged into. @type map1: L{Mapping}. @param map2: The map being used as the merge operand. @@ -4309,21 +4419,21 @@ but where a "mismatch" is detected, returns "overwrite" inst

-

system Module¶

+

system Module¶

In this file : all functions that do a system call, like open a browser or an editor, or call a git command

-src.system.archive_extract(from_what, where, logger)[source]¶
+src.system.archive_extract(from_what, where, logger)[source]¶

Extracts sources from an archive.

Parameters:Config (product_info) -- The configuration specific to +
Parameters:Config (product_info) – The configuration specific to the product
Returns:True if the product is vcs, else False
@@ -4339,24 +4449,24 @@ like open a browser or an editor, or call a git command

-src.system.cvs_extract(protocol, user, server, base, tag, product, where, logger, checkout=False, environment=None)[source]¶
+src.system.cvs_extract(protocol, user, server, base, tag, product, where, logger, checkout=False, environment=None)[source]¶

Extracts sources from a cvs repository.

Parameters:
    -
  • str (where) -- The path to the archive.
  • -
  • str -- The path where to extract.
  • -
  • Logger (logger) -- The logger instance to use.
  • +
  • str (where) – The path to the archive.
  • +
  • str – The path where to extract.
  • +
  • Logger (logger) – The logger instance to use.
@@ -4373,18 +4483,18 @@ extracting.
-src.system.git_extract(from_what, tag, where, logger, environment=None)[source]¶
+src.system.git_extract(from_what, tag, where, logger, environment=None)[source]¶

Extracts sources from a git repository.

Parameters:
    -
  • str (where) -- The cvs protocol.
  • -
  • str -- The user to be used.
  • -
  • str -- The remote cvs server.
  • -
  • str --

    .

    +
  • str (where) – The cvs protocol.
  • +
  • str – The user to be used.
  • +
  • str – The remote cvs server.
  • +
  • str –

    .

  • -
  • str -- The tag.
  • -
  • str -- The product.
  • -
  • str -- The path where to extract.
  • -
  • Logger (logger) -- The logger instance to use.
  • -
  • boolean (checkout) -- If true use checkout cvs.
  • -
  • src.environment.Environ (environment) -- The environment to source when +
  • str – The tag.
  • +
  • str – The product.
  • +
  • str – The path where to extract.
  • +
  • Logger (logger) – The logger instance to use.
  • +
  • boolean (checkout) – If true use checkout cvs.
  • +
  • src.environment.Environ (environment) – The environment to source when extracting.
@@ -4401,15 +4511,15 @@ extracting.
-src.system.show_in_editor(editor, filePath, logger)[source]¶
+src.system.show_in_editor(editor, filePath, logger)[source]¶

open filePath using editor.

Parameters:
    -
  • str (where) -- The remote git repository.
  • -
  • str -- The tag.
  • -
  • str -- The path where to extract.
  • -
  • Logger (logger) -- The logger instance to use.
  • -
  • src.environment.Environ (environment) -- The environment to source when +
  • str (where) – The remote git repository.
  • +
  • str – The tag.
  • +
  • str – The path where to extract.
  • +
  • Logger (logger) – The logger instance to use.
  • +
  • src.environment.Environ (environment) – The environment to source when extracting.
@@ -4419,20 +4529,20 @@ extracting.
-src.system.svn_extract(user, from_what, tag, where, logger, checkout=False, environment=None)[source]¶
+src.system.svn_extract(user, from_what, tag, where, logger, checkout=False, environment=None)[source]¶

Extracts sources from a svn repository.

Parameters:
    -
  • str (filePath) -- The editor to use.
  • -
  • str -- The path to the file to open.
  • +
  • str (filePath) – The editor to use.
  • +
  • str – The path to the file to open.
@@ -4449,137 +4559,137 @@ extracting.
-

template Module¶

+

template Module¶

-class src.template.MyTemplate(template)[source]¶
-

Bases: string.Template

+class src.template.MyTemplate(template)[source]¶ +

Bases: string.Template

-delimiter = '\xc2\xa4'¶
+delimiter = '\xc2\xa4'¶
-pattern = <_sre.SRE_Pattern object at 0x39fab00>¶
+pattern = <_sre.SRE_Pattern object at 0x37f8420>¶
-src.template.substitute(template_file, subst_dic)[source]¶
+src.template.substitute(template_file, subst_dic)[source]¶
-

test_module Module¶

+

test_module Module¶

-class src.test_module.Test(config, logger, tmp_working_dir, testbase='', grids=None, sessions=None, launcher='', show_desktop=True)[source]¶
+class src.test_module.Test(config, logger, tmp_working_dir, testbase='', grids=None, sessions=None, launcher='', show_desktop=True)[source]¶
-generate_launching_commands()[source]¶
+generate_launching_commands()[source]¶
-generate_script(listTest, script_path, ignoreList)[source]¶
+generate_script(listTest, script_path, ignoreList)[source]¶
-get_test_timeout(test_name, default_value)[source]¶
+get_test_timeout(test_name, default_value)[source]¶
-get_tmp_dir()[source]¶
+get_tmp_dir()[source]¶
-prepare_testbase(test_base_name)[source]¶
+prepare_testbase(test_base_name)[source]¶
-prepare_testbase_from_dir(testbase_name, testbase_dir)[source]¶
+prepare_testbase_from_dir(testbase_name, testbase_dir)[source]¶
-prepare_testbase_from_git(testbase_name, testbase_base, testbase_tag)[source]¶
+prepare_testbase_from_git(testbase_name, testbase_base, testbase_tag)[source]¶
-prepare_testbase_from_svn(user, testbase_name, testbase_base)[source]¶
+prepare_testbase_from_svn(user, testbase_name, testbase_base)[source]¶
-read_results(listTest, has_timed_out)[source]¶
+read_results(listTest, has_timed_out)[source]¶
-run_all_tests()[source]¶
+run_all_tests()[source]¶
-run_grid_tests()[source]¶
+run_grid_tests()[source]¶
-run_script(script_name)[source]¶
+run_script(script_name)[source]¶
-run_session_tests()[source]¶
+run_session_tests()[source]¶
-run_testbase_tests()[source]¶
+run_testbase_tests()[source]¶
-run_tests(listTest, ignoreList)[source]¶
+run_tests(listTest, ignoreList)[source]¶
-search_known_errors(status, test_grid, test_session, test)[source]¶
+search_known_errors(status, test_grid, test_session, test)[source]¶
-write_test_margin(tab)[source]¶
+write_test_margin(tab)[source]¶
-src.test_module.getTmpDirDEFAULT()[source]¶
+src.test_module.getTmpDirDEFAULT()[source]¶
-

xmlManager Module¶

+

xmlManager Module¶

-class src.xmlManager.ReadXmlFile(filePath)[source]¶
-

Bases: object

+class src.xmlManager.ReadXmlFile(filePath)[source]¶ +

Bases: object

Class to manage reading of an xml log file

-getRootAttrib()[source]¶
+getRootAttrib()[source]¶

Get the attibutes of the self.xmlroot

Parameters:
    -
  • str (where) -- The user to be used.
  • -
  • str -- The remote git repository.
  • -
  • str -- The tag.
  • -
  • str -- The path where to extract.
  • -
  • Logger (logger) -- The logger instance to use.
  • -
  • boolean (checkout) -- If true use checkout svn.
  • -
  • src.environment.Environ (environment) -- The environment to source when +
  • str (where) – The user to be used.
  • +
  • str – The remote git repository.
  • +
  • str – The tag.
  • +
  • str – The path where to extract.
  • +
  • Logger (logger) – The logger instance to use.
  • +
  • boolean (checkout) – If true use checkout svn.
  • +
  • src.environment.Environ (environment) – The environment to source when extracting.
@@ -4595,13 +4705,13 @@ extracting.
-get_attrib(node_name)[source]¶
+get_attrib(node_name)[source]¶

Get the attibutes of the node node_name in self.xmlroot

- + @@ -4613,14 +4723,16 @@ extracting.
-get_node_text(node)[source]¶
-

Get the text of the first node that has name -that corresponds to the parameter node

+get_node_text(node)[source]¶ +
+
Get the text of the first node that has name
+
that corresponds to the parameter node
+
Parameters:str (node_name) -- the name of the node
Parameters:str (node_name) – the name of the node
Returns:the attibutes of the node node_name in self.xmlroot
- + @@ -4635,21 +4747,21 @@ that corresponds to the parameter node
-class src.xmlManager.XmlLogFile(filePath, rootname, attrib={})[source]¶
-

Bases: object

+class src.xmlManager.XmlLogFile(filePath, rootname, attrib={})[source]¶ +

Bases: object

Class to manage writing in salomeTools xml log file

-add_simple_node(node_name, text=None, attrib={})[source]¶
+add_simple_node(node_name, text=None, attrib={})[source]¶

Add a node with some attibutes and text to the root node.

Parameters:str (node) -- the name of the node from which get the text
Parameters:str (node) – the name of the node from which get the text
Returns:the text of the first node that has name that corresponds to the parameter node
@@ -4660,15 +4772,15 @@ attribute of the new node
-append_node_attrib(node_name, attrib)[source]¶
+append_node_attrib(node_name, attrib)[source]¶

Append a new attributes to the node that has node_name as name

Parameters:
    -
  • str (text) -- the name of the node to add
  • -
  • str -- the text of the node
  • -
  • dict (attrib) -- the dictionary containing the +
  • str (text) – the name of the node to add
  • +
  • str – the text of the node
  • +
  • dict (attrib) – the dictionary containing the attribute of the new node
@@ -4678,15 +4790,15 @@ attribute of the new node
-append_node_text(node_name, text)[source]¶
+append_node_text(node_name, text)[source]¶

Append a new text to the node that has node_name as name

Parameters:
    -
  • str (node_name) -- The name of the node on which append text
  • -
  • dixt (attrib) -- The attrib to append
  • +
  • str (node_name) – The name of the node on which append text
  • +
  • dixt (attrib) – The attrib to append
@@ -4696,13 +4808,13 @@ attribute of the new node
-write_tree(stylesheet=None, file_path=None)[source]¶
+write_tree(stylesheet=None, file_path=None)[source]¶

Write the xml tree in the log file path. Add the stylesheet if asked.

Parameters:
    -
  • str (text) -- The name of the node on which append text
  • -
  • str -- The text to append
  • +
  • str (text) – The name of the node on which append text
  • +
  • str – The text to append
- +
Parameters:str (stylesheet) -- The stylesheet to apply to the xml file
Parameters:str (stylesheet) – The stylesheet to apply to the xml file
@@ -4712,17 +4824,17 @@ attribute of the new node
-src.xmlManager.add_simple_node(root_node, node_name, text=None, attrib={})[source]¶
+src.xmlManager.add_simple_node(root_node, node_name, text=None, attrib={})[source]¶

Add a node with some attibutes and text to the root node.

@@ -4733,16 +4845,16 @@ attribute of the new node
-src.xmlManager.append_node_attrib(root_node, attrib)[source]¶
+src.xmlManager.append_node_attrib(root_node, attrib)[source]¶

Append a new attributes to the node that has node_name as name

Parameters:
    -
  • etree.Element (root_node) -- the Etree element where to add the new node
  • -
  • str (text) -- the name of the node to add
  • -
  • str -- the text of the node
  • -
  • dict (attrib) -- the dictionary containing the +
  • etree.Element (root_node) – the Etree element where to add the new node
  • +
  • str (text) – the name of the node to add
  • +
  • str – the text of the node
  • +
  • dict (attrib) – the dictionary containing the attribute of the new node
@@ -4752,18 +4864,20 @@ where to append the new attibutes
-src.xmlManager.find_node_by_attrib(xmlroot, name_node, key, value)[source]¶
-

Find the nfirst ode from xmlroot that has name name_node and that has in -its attributes {key : value}. Return the node

+src.xmlManager.find_node_by_attrib(xmlroot, name_node, key, value)[source]¶ +
+
Find the nfirst ode from xmlroot that has name name_node and that has in
+
its attributes {key : value}. Return the node
+
Parameters:
    -
  • etree.Element (root_node) -- the Etree element +
  • etree.Element (root_node) – the Etree element where to append the new attibutes
  • -
  • dixt (attrib) -- The attrib to append
  • +
  • dixt (attrib) – The attrib to append
@@ -4779,16 +4893,16 @@ its attributes {key : value}. Return the node

-src.xmlManager.write_report(filename, xmlroot, stylesheet)[source]¶
+src.xmlManager.write_report(filename, xmlroot, stylesheet)[source]¶

Writes a report file from a XML tree.

Parameters:
    -
  • etree.Element (xmlroot) -- the Etree element where to search
  • -
  • str (value) -- the name of node to search
  • -
  • str -- the key to search
  • -
  • str -- the value to search
  • +
  • etree.Element (xmlroot) – the Etree element where to search
  • +
  • str (value) – the name of node to search
  • +
  • str – the key to search
  • +
  • str – the value to search
@@ -4802,12 +4916,12 @@ its attributes {key : value}. Return the node

-
+ diff --git a/doc/build/html/commands/application.html b/doc/build/html/commands/application.html index 33b9bce..0e987b8 100644 --- a/doc/build/html/commands/application.html +++ b/doc/build/html/commands/application.html @@ -2,30 +2,20 @@ - + - - Command application — salomeTools 5.0.0dev documentation - + Command application — salomeTools 5.0.0dev documentation - - + - - + + + @@ -34,8 +24,7 @@ - - +
@@ -54,31 +43,37 @@ Virtual SALOME applications are used to start SALOME when distribution is needed

Usage¶

  • Create an application:

    -
    sat application <application>
    +
    sat application <application>
    +
    -

    Create the virtual application directory in the salomeTool application directory $APPLICATION.workdir.

    +

    Create the virtual application directory in the salomeTool application directory $APPLICATION.workdir.

  • Give a name to the application:

    -
    sat application <application> --name <my_application_name>
    +
    sat application <application> --name <my_application_name>
    +
    -

    Remark: this option overrides the name given in the virtual_app section of the configuration file $APPLICATION.virtual_app.name.

    +

    Remark: this option overrides the name given in the virtual_app section of the configuration file $APPLICATION.virtual_app.name.

  • Change the directory where the application is created:

    -
    sat application <application> --target <my_application_directory>
    +
    sat application <application> --target <my_application_directory>
    +
  • Set a specific SALOME resources catalog (it will be used for the distribution of components on distant machines):

    -
    sat application <application> --catalog <path_to_catalog>
    +
    sat application <application> --catalog <path_to_catalog>
    +

    Note that the catalog specified will be copied to the application directory.

  • Generate the catalog for a list of machines:

    -
    sat application <application> --gencat machine1,machine2,machine3
    +
    sat application <application> --gencat machine1,machine2,machine3
    +

    This will create a catalog by querying each machine through ssh protocol (memory, number of processor) with ssh.

  • Generate a mesa application (if mesa and llvm are parts of the application). Use this option only if you have to use salome through ssh and have problems with ssh X forwarding of OpengGL modules (like Paravis):

    -
    sat launcher <application> --use_mesa
    +
    sat launcher <application> --use_mesa
    +
@@ -89,7 +84,7 @@ Virtual SALOME applications are used to start SALOME when distribution is needed
  • APPLICATION.virtual_app
    • name : name of the launcher (to replace the default runAppli).
    • -
    • application_name : (optional) the name of the virtual application directory, if missing the default value is $name + _appli.
    • +
    • application_name : (optional) the name of the virtual application directory, if missing the default value is $name + _appli.
@@ -100,7 +95,7 @@ Virtual SALOME applications are used to start SALOME when distribution is needed
-
+ diff --git a/doc/build/html/commands/clean.html b/doc/build/html/commands/clean.html index 23afa33..61bdc22 100644 --- a/doc/build/html/commands/clean.html +++ b/doc/build/html/commands/clean.html @@ -2,30 +2,20 @@ - + - - Command clean — salomeTools 5.0.0dev documentation - + Command clean — salomeTools 5.0.0dev documentation - - + - - + + + @@ -34,8 +24,7 @@ - - +
@@ -47,20 +36,20 @@

Command clean¶

Description¶

-

The clean command removes products in the source, build, or install directories of an application. Theses directories are usually named SOURCES, BUILD, INSTALL.

+

The clean command removes products in the source, build, or install directories of an application. Theses directories are usually named SOURCES, BUILD, INSTALL.

Use the options to define what directories you want to suppress and to set the list of products

Usage¶

  • Clean all previously created build and install directories (example application as SALOME_xx):

    -
    # take care, is long time to restore, sometimes
    +
    # take care, is long time to restore, sometimes
     sat clean SALOME-xx --build --install
     
  • Clean previously created build and install directories, only for products with property is_salome_module:

    -
    sat clean SALOME-xxx --build --install \
    +
    sat clean SALOME-xxx --build --install \
                          --properties is_salome_module:yes
     
    @@ -71,23 +60,23 @@ sat clean SALOME-xx --build --install

    Availables options¶

      -
    • --products : Products to clean.

      +
    • –products : Products to clean.

    • -
    • --properties :

      +
    • –properties :

      Filter the products by their properties.
      -
      Syntax: --properties <property>:<value>
      +
      Syntax: –properties <property>:<value>
    • -
    • --sources : Clean the product source directories.

      +
    • –sources : Clean the product source directories.

    • -
    • --build : Clean the product build directories.

      +
    • –build : Clean the product build directories.

    • -
    • --install : Clean the product install directories.

      +
    • –install : Clean the product install directories.

    • -
    • --all : Clean the product source, build and install directories.

      +
    • –all : Clean the product source, build and install directories.

    • -
    • --sources_without_dev :

      +
    • –sources_without_dev :

      Do not clean the products in development mode,
      (they could have VCS commits pending).
      @@ -106,7 +95,7 @@ sat clean SALOME-xx --build --install
    -
-

This Page

-
- @@ -156,11 +146,11 @@ sat clean SALOME-xx --build --install ©2018, CEA. | - Powered by Sphinx 1.1.3 - & Alabaster + Powered by Sphinx 1.7.3 + & Alabaster 0.7.10 | - Page source
diff --git a/doc/build/html/commands/compile.html b/doc/build/html/commands/compile.html index f94cda7..c3c5d05 100644 --- a/doc/build/html/commands/compile.html +++ b/doc/build/html/commands/compile.html @@ -2,30 +2,20 @@ - + - - Command compile — salomeTools 5.0.0dev documentation - + Command compile — salomeTools 5.0.0dev documentation - - + - - + + + @@ -34,8 +24,7 @@ - - +
@@ -53,58 +42,70 @@

Usage¶

  • Compile a complete application:

    -
    sat compile <application>
    +
    sat compile <application>
    +
  • Compile only some products:

    -
    sat compile <application> --products <product1>,<product2> ...
    +
    sat compile <application> --products <product1>,<product2> ...
    +
  • Use sat -t to duplicate the logs in the terminal (by default the log are stored and displayed with sat log command):

    -
    sat -t compile <application> --products <product1>
    +
    sat -t compile <application> --products <product1>
    +
  • Compile a module and its dependencies:

    -
    sat compile <application> --products med --with_fathers
    +
    sat compile <application> --products med --with_fathers
    +
  • Compile a module and the modules depending on it (for example plugins):

    -
    sat compile <application> --products med --with_children
    +
    sat compile <application> --products med --with_children
    +
  • Clean the build and install directories before starting compilation:

    -
    sat compile <application> --products GEOM  --clean_all
    +
    sat compile <application> --products GEOM  --clean_all
    +

    Note

    -
    a warning will be shown if option --products is missing
    +
    a warning will be shown if option –products is missing
    (as it will clean everything)
  • Clean only the install directories before starting compilation:

    -
    sat compile <application> --clean_install
    +
    sat compile <application> --clean_install
    +
  • Add options for make:

    -
    sat compile <application> --products <product> --make_flags <flags>
    +
    sat compile <application> --products <product> --make_flags <flags>
    +
  • -
  • Use the --check option to execute the unit tests after compilation:

    -
    sat compile <application> --check
    +
  • Use the –check option to execute the unit tests after compilation:

    +
    sat compile <application> --check
    +
  • Remove the build directory after successful compilation (some build directory like qt are big):

    -
    sat compile <application> --products qt --clean_build_after
    +
    sat compile <application> --products qt --clean_build_after
    +
  • Stop the compilation as soon as the compilation of a module fails:

    -
    sat compile <product> --stop_first_fail
    +
    sat compile <product> --stop_first_fail
    +
  • Do not compile, just show if products are installed or not, and where is the installation:

    -
    sat compile <application> --show
    +
    sat compile <application> --show
    +
@@ -116,7 +117,7 @@ The main options are:

  • build_source : the method used to build the product (cmake/autotools/script)
  • -
  • compil_script : the compilation script if build_source is equal to "script"
  • +
  • compil_script : the compilation script if build_source is equal to “script”
  • cmake_options : additional options for cmake.
  • nb_proc : number of jobs to use with make for this product.
@@ -128,7 +129,7 @@ The main options are:

-
+ diff --git a/doc/build/html/commands/config.html b/doc/build/html/commands/config.html index 51b957b..e2d8291 100644 --- a/doc/build/html/commands/config.html +++ b/doc/build/html/commands/config.html @@ -2,30 +2,20 @@ - + - - Command config — salomeTools 5.0.0dev documentation - + Command config — salomeTools 5.0.0dev documentation - - + - - + + + @@ -34,8 +24,7 @@ - - +
@@ -53,34 +42,38 @@ It allows display, manipulation and operation on configuration files

Usage¶

    -
  • Edit the user personal configuration file $HOME/.salomeTools/SAT.pyconf. It is used to store the user personal choices, like the favorite editor, browser, pdf viewer:

    -
    sat config --edit
    +
  • Edit the user personal configuration file $HOME/.salomeTools/SAT.pyconf. It is used to store the user personal choices, like the favorite editor, browser, pdf viewer:

    +
    sat config --edit
    +
  • -
  • List the available applications (they come from the sat projects defined in data/local.pyconf:

    -
    sat config --list
    +
  • List the available applications (they come from the sat projects defined in data/local.pyconf:

    +
    sat config --list
    +
  • Edit the configuration of an application:

    -
    sat config <application> --edit
    +
    sat config <application> --edit
    +
  • Copy an application configuration file into the user personal directory:

    -
    sat config <application> --copy [new_name]
    +
    sat config <application> --copy [new_name]
    +
  • Print the value of a configuration parameter.
    Use the automatic completion to get recursively the parameter names.
    -
    Use --no_label option to get only the value, without label (useful in automatic scripts).
    +
    Use –no_label option to get only the value, without label (useful in automatic scripts).
    Examples (with SALOME-xx as SALOME-8.4.0 ):
    -
    # sat config --value <parameter_path>
    -sat config --value .         # all the configuration
    +
    # sat config --value <parameter_path>
    +sat config --value .         # all the configuration
     sat config --value LOCAL
     sat config --value LOCAL.workdir
     
    -# sat config <application> --value <parameter_path>
    +# sat config <application> --value <parameter_path>
     sat config SALOME-xx --value APPLICATION.workdir
     sat config SALOME-xx --no_label --value APPLICATION.workdir
     
    @@ -92,28 +85,30 @@ sat config SALOME-xx --no_label --value APPLICATION.workdir
    This is a debug mode, useful for developers.
    Prints the parameter path, the source expression if any, and the final value:
    -
    sat config SALOME-xx -g USER
    +
    sat config SALOME-xx -g USER
    +

    Note

    And so, not only for fun, to get all expressions of configuration

    -
    sat config SALOME-xx -g . | grep -e "-->"
    +
    sat config SALOME-xx -g . | grep -e "-->"
     
  • Print the patches that are applied:

    -
    sat config SALOME-xx --show_patchs
    +
    sat config SALOME-xx --show_patchs
    +
  • Get information on a product configuration:

    -
    # sat config <application> --info <product>
    +
  • +
+
# sat config <application> --info <product>
 sat config SALOME-xx --info KERNEL
 sat config SALOME-xx --info qt
 
- -

Some useful configuration pathes¶

@@ -123,8 +118,9 @@ sat config SALOME-xx --info qt
  • USER: To get user preferences (editor, pdf viewer, web browser, default working dir).
  • sat commands:

    -
    sat config SALOME-xx -v PATHS
    -sat config SALOME-xx -v USERS
    +
    sat config SALOME-xx -v PATHS
    +sat config SALOME-xx -v USERS
    +
    @@ -133,7 +129,7 @@ sat config SALOME-xx -v USERS
    -
    + diff --git a/doc/build/html/commands/environ.html b/doc/build/html/commands/environ.html index ddd10ec..7a32af2 100644 --- a/doc/build/html/commands/environ.html +++ b/doc/build/html/commands/environ.html @@ -2,30 +2,20 @@ - + - - Command environ — salomeTools 5.0.0dev documentation - + Command environ — salomeTools 5.0.0dev documentation - - + - - + + + @@ -34,8 +24,7 @@ - - +
    @@ -65,32 +54,34 @@ and saved in some files by sat environ command.

    Usage¶

    • Create the shell environment files of the application:

      -
      sat environ <application>
      +
      sat environ <application>
      +
    • Create the environment files of the application for a given shell. Options are bash, bat (for windows) and cfg (the configuration format used by SALOME):

      -
      sat environ <application> --shell [bash|cfg|all]
      +
      sat environ <application> --shell [bash|cfg|all]
      +
    • -
    • Use a different prefix for the files (default is 'env'):

      -
      # This will create file <prefix>_launch.sh, <prefix>_build.sh
      +
    • Use a different prefix for the files (default is ‘env’):

      +
      # This will create file <prefix>_launch.sh, <prefix>_build.sh
       sat environ <application> --prefix <prefix>
       
    • Use a different target directory for the files:

      -
      # This will create file env_launch.sh, env_build.sh
      -# in the directory corresponding to <path>
      +
      # This will create file env_launch.sh, env_build.sh
      +# in the directory corresponding to <path>
       sat environ <application> --target <path>
       
    • Generate the environment files only with the given products:

      -
      # This will create the environment files only for the given products
      -# and their prerequisites.
      -# It is useful when you want to visualise which environment uses
      -# sat to compile a given product.
      +
      # This will create the environment files only for the given products
      +# and their prerequisites.
      +# It is useful when you want to visualise which environment uses
      +# sat to compile a given product.
       sat environ <application> --product <product1>,<product2>, ...
       
      @@ -101,39 +92,41 @@ sat environ <application> --product <product1>,<product2>, ...

      Configuration¶

      The specification of the environment can be done through several mechanisms.

        -
      1. For salome products (the products with the property is_SALOME_module as yes) the environment is set automatically by sat, in respect with SALOME requirements.
      2. +
      3. For salome products (the products with the property is_SALOME_module as yes) the environment is set automatically by sat, in respect with SALOME requirements.
      4. For other products, the environment is set with the use of the environ section within the pyconf file of the product. The user has two possibilities, either set directly the environment within the section, or specify a python script which wil be used to set the environment programmatically.

      Within the section, the user can define environment variables. He can also modify PATH variables, by appending or prepending directories. -In the following example, we prepend <install_dir>/lib to LD_LIBRARY_PATH (note the left first underscore), append <install_dir>/lib to PYTHONPATH (note the right last underscore), and set LAPACK_ROOT_DIR to <install_dir>:

      -
      environ :
      -{
      -  _LD_LIBRARY_PATH : $install_dir + $VARS.sep + "lib"
      -  PYTHONPATH_ : $install_dir + $VARS.sep + "lib"
      -  LAPACK_ROOT_DIR : $install_dir
      -}
      -
      -

      It is possible to distinguish the build environment from the launch environment: use a subsection called build or launch. In the example below, LD_LIBRARY_PATH and PYTHONPATH are only modified at run time, not at compile time:

      -
      environ :
      -{
      +In the following example, we prepend <install_dir>/lib to LD_LIBRARY_PATH (note the left first underscore), append <install_dir>/lib to PYTHONPATH (note the right last underscore), and set LAPACK_ROOT_DIR to <install_dir>:

      +
      environ :
      +{
      +  _LD_LIBRARY_PATH : $install_dir + $VARS.sep + "lib"
      +  PYTHONPATH_ : $install_dir + $VARS.sep + "lib"
      +  LAPACK_ROOT_DIR : $install_dir
      +}
      +
      +
      +

      It is possible to distinguish the build environment from the launch environment: use a subsection called build or launch. In the example below, LD_LIBRARY_PATH and PYTHONPATH are only modified at run time, not at compile time:

      +
      environ :
      +{
         build :
      -  {
      -    LAPACK_ROOT_DIR : $install_dir
      -  }
      +  {
      +    LAPACK_ROOT_DIR : $install_dir
      +  }
         launch :
      -  {
      -    LAPACK_ROOT_DIR : $install_dir
      -    _LD_LIBRARY_PATH : $install_dir + $VARS.sep + "lib"
      -    PYTHONPATH_ : $install_dir + $VARS.sep + "lib"
      -  }
      -}
      + { + LAPACK_ROOT_DIR : $install_dir + _LD_LIBRARY_PATH : $install_dir + $VARS.sep + "lib" + PYTHONPATH_ : $install_dir + $VARS.sep + "lib" + } +} +
        -
      1. The last possibility is to set the environment with a python script. The script should be provided in the products/env_scripts directory of the sat project, and its name is specified in the environment section with the key environ.env_script:
      2. +
      3. The last possibility is to set the environment with a python script. The script should be provided in the products/env_scripts directory of the sat project, and its name is specified in the environment section with the key environ.env_script:
      -
      environ :
      +
      environ :
       {
      -  env_script : 'lapack.py'
      +  env_script : 'lapack.py'
       }
       
      @@ -143,17 +136,17 @@ Most of the time, the first mode is sufficient.

      The developer implements a handle (as a python method) which is called by sat to set the environment. Here is an example:

      -
      #!/usr/bin/env python
      -#-*- coding:utf-8 -*-
      +
      #!/usr/bin/env python
      +#-*- coding:utf-8 -*-
       
       import os.path
       import platform
       
       def set_env(env, prereq_dir, version):
      -    env.set("TRUST_ROOT_DIR",prereq_dir)
      -    env.prepend('PATH', os.path.join(prereq_dir, 'bin'))
      -    env.prepend('PATH', os.path.join(prereq_dir, 'include'))
      -    env.prepend('LD_LIBRARY_PATH', os.path.join(prereq_dir, 'lib'))
      +    env.set("TRUST_ROOT_DIR",prereq_dir)
      +    env.prepend('PATH', os.path.join(prereq_dir, 'bin'))
      +    env.prepend('PATH', os.path.join(prereq_dir, 'include'))
      +    env.prepend('LD_LIBRARY_PATH', os.path.join(prereq_dir, 'lib'))
           return
       
      @@ -171,7 +164,7 @@ Here is an example:

      -
    -

    This Page

    -
    - @@ -220,11 +214,11 @@ Here is an example:

    ©2018, CEA. | - Powered by Sphinx 1.1.3 - & Alabaster + Powered by Sphinx 1.7.3 + & Alabaster 0.7.10 | - Page source
    diff --git a/doc/build/html/commands/generate.html b/doc/build/html/commands/generate.html index b0d2736..14f3566 100644 --- a/doc/build/html/commands/generate.html +++ b/doc/build/html/commands/generate.html @@ -2,30 +2,20 @@ - + - - Command generate — salomeTools 5.0.0dev documentation - + Command generate — salomeTools 5.0.0dev documentation - - + - - + + + @@ -34,8 +24,7 @@ - - +
    @@ -50,15 +39,16 @@

    The generate command generates and compile SALOME modules from cpp modules using YACSGEN.

    Note

    -

    This command uses YACSGEN to generate the module. It needs to be specified with --yacsgen option, or defined in the product or by the environment variable $YACSGEN_ROOT_DIR.

    +

    This command uses YACSGEN to generate the module. It needs to be specified with –yacsgen option, or defined in the product or by the environment variable $YACSGEN_ROOT_DIR.

    Remarks¶

    • This command will only apply on the CPP modules of the application, those who have both properties:

      -
      cpp : "yes"
      -generate : "yes"
      +
      cpp : "yes"
      +generate : "yes"
      +
    • The cpp module are usually computational components, and the generated module brings the CORBA layer which allows distributing the compononent on remore machines. cpp modules should conform to YACSGEN/hxx2salome requirements (please refer to YACSGEN documentation)

      @@ -69,16 +59,19 @@ generate : "yes"

      Usage¶

      • Generate all the modules of a product:

        -
        sat generate <application>
        +
        sat generate <application>
        +
      • Generate only specific modules:

        -
        sat generate <application> --products <list_of_products>
        +
        sat generate <application> --products <list_of_products>
        +
        -

        Remark: modules which don't have the generate property are ignored.

        +

        Remark: modules which don’t have the generate property are ignored.

      • Use a specific version of YACSGEN:

        -
        sat generate <application> --yacsgen <path_to_yacsgen>
        +
        sat generate <application> --yacsgen <path_to_yacsgen>
        +
      @@ -89,7 +82,7 @@ generate : "yes"
    -
    + diff --git a/doc/build/html/commands/launcher.html b/doc/build/html/commands/launcher.html index c8d7a14..1b3aaf2 100644 --- a/doc/build/html/commands/launcher.html +++ b/doc/build/html/commands/launcher.html @@ -2,30 +2,20 @@ - + - - Command launcher — salomeTools 5.0.0dev documentation - + Command launcher — salomeTools 5.0.0dev documentation - - + - - + + + @@ -34,8 +24,7 @@ - - +
    @@ -53,27 +42,32 @@

    Usage¶

    • Create a launcher:

      -
      sat launcher <application>
      +
      sat launcher <application>
      +
      -

      Generate a launcher in the application directory, i.e $APPLICATION.workdir.

      +

      Generate a launcher in the application directory, i.e $APPLICATION.workdir.

    • -
    • Create a launcher with a given name (default name is APPLICATION.profile.launcher_name)

      -
      sat launcher <application> --name ZeLauncher
      +
    • Create a launcher with a given name (default name is APPLICATION.profile.launcher_name)

      +
      sat launcher <application> --name ZeLauncher
      +

      The launcher will be called ZeLauncher.

    • Set a specific resources catalog:

      -
      sat launcher <application>  --catalog  <path of a salome resources catalog>
      +
      sat launcher <application>  --catalog  <path of a salome resources catalog>
      +

      Note that the catalog specified will be copied to the profile directory.

    • Generate the catalog for a list of machines:

      -
      sat launcher <application> --gencat <list of machines>
      +
      sat launcher <application> --gencat <list of machines>
      +

      This will create a catalog by querying each machine (memory, number of processor) with ssh.

    • Generate a mesa launcher (if mesa and llvm are parts of the application). Use this option only if you have to use salome through ssh and have problems with ssh X forwarding of OpengGL modules (like Paravis):

      -
      sat launcher <application> --use_mesa
      +
      sat launcher <application> --use_mesa
      +
    @@ -95,7 +89,7 @@
    -
    + diff --git a/doc/build/html/commands/log.html b/doc/build/html/commands/log.html index 58cf36f..11da33c 100644 --- a/doc/build/html/commands/log.html +++ b/doc/build/html/commands/log.html @@ -2,30 +2,20 @@ - + - - Command log — salomeTools 5.0.0dev documentation - + Command log — salomeTools 5.0.0dev documentation - - + - - + + + @@ -34,8 +24,7 @@ - - +
    @@ -53,27 +42,33 @@

    Usage¶

    • Show (in a web browser) the log of the commands corresponding to an application:

      -
      sat log <application>
      +
      sat log <application>
      +
    • Show the log for commands that do not use any application:

      -
      sat log
      +
      sat log
      +
    • -
    • The --terminal (or -t) display the log directly in the terminal, through a CLI interactive menu:

      -
      sat log <application> --terminal
      +
    • The –terminal (or -t) display the log directly in the terminal, through a CLI interactive menu:

      +
      sat log <application> --terminal
      +
    • -
    • The --last option displays only the last command:

      -
      sat log <application> --last
      +
    • The –last option displays only the last command:

      +
      sat log <application> --last
      +
    • -
    • To access the last compilation log in terminal mode, use --last_terminal option:

      -
      sat log <application> --last_terminal
      +
    • To access the last compilation log in terminal mode, use –last_terminal option:

      +
      sat log <application> --last_terminal
      +
    • -
    • The --clean (int) option erases the n older log files and print the number of remaining log files:

      -
      sat log <application> --clean 50
      +
    • The –clean (int) option erases the n older log files and print the number of remaining log files:

      +
      sat log <application> --clean 50
      +
    @@ -94,7 +89,7 @@
    -
    + diff --git a/doc/build/html/commands/package.html b/doc/build/html/commands/package.html index a7bca5f..8ef7236 100644 --- a/doc/build/html/commands/package.html +++ b/doc/build/html/commands/package.html @@ -2,30 +2,20 @@ - + - - Command package — salomeTools 5.0.0dev documentation - + Command package — salomeTools 5.0.0dev documentation - - + - - + + + @@ -34,8 +24,7 @@ - - +
    @@ -55,55 +44,61 @@ of SALOME products and prerequisites.

    Note

    By default the package includes the sources of prerequisites and products. -To select a subset use the --without_property or --with_vcs options.

    +To select a subset use the –without_property or –with_vcs options.

    Usage¶

    • Create a package for a product (example as SALOME_xx):

      -
      sat package SALOME_xx
      +
      sat package SALOME_xx
      +
      -

      This command will create an archive named SALOME_xx.tgz -in the working directory (USER.workDir). +

      This command will create an archive named SALOME_xx.tgz +in the working directory (USER.workDir). If the archive already exists, do nothing.

    • Create a package with a specific name:

      -
      sat package SALOME_xx --name YourSpecificName
      +
      sat package SALOME_xx --name YourSpecificName
      +

    Note

    -

    By default, the archive is created in the working directory of the user (USER.workDir).

    -

    If the option --name is used with a path (relative or absolute) it will be used.

    -

    If the option --name is not used and binaries (prerequisites and products) +

    By default, the archive is created in the working directory of the user (USER.workDir).

    +

    If the option –name is used with a path (relative or absolute) it will be used.

    +

    If the option –name is not used and binaries (prerequisites and products) are included in the package, the OS architecture -will be appended to the name (example: SALOME_xx-CO7.tgz).

    +will be appended to the name (example: SALOME_xx-CO7.tgz).

    Examples:

    -
    # Creates SALOME_xx.tgz in $USER.workDir
    -sat package SALOME_xx
    +
    # Creates SALOME_xx.tgz in $USER.workDir
    +sat package SALOME_xx
     
    -# Creates SALOME_xx_<arch>.tgz in $USER.workDir
    -sat package SALOME_xx --binaries
    +# Creates SALOME_xx_<arch>.tgz in $USER.workDir
    +sat package SALOME_xx --binaries
     
    -# Creates MySpecificName.tgz in $USER.workDir
    -sat package SALOME_xx --name MySpecificName
    +# Creates MySpecificName.tgz in $USER.workDir +sat package SALOME_xx --name MySpecificName +
    • Force the creation of the archive (if it already exists):

      -
      sat package SALOME_xx --force
      +
      sat package SALOME_xx --force
      +
    • Include the binaries in the archive (products and prerequisites):

      -
      sat package SALOME_xx --binaries
      +
      sat package SALOME_xx --binaries
      +
      -

      This command will create an archive named SALOME_xx _<arch>.tgz +

      This command will create an archive named SALOME_xx _<arch>.tgz where <arch> is the OS architecture of the machine.

    • Do not delete Version Control System (VCS) informations from the configurations files of the embedded salomeTools:

      -
      sat package SALOME_xx --with_vcs
      +
      sat package SALOME_xx --with_vcs
      +

      The version control systems known by this option are CVS, SVN and Git.

    • @@ -119,7 +114,7 @@ where <arch> is the +
    - @@ -168,11 +164,11 @@ where <arch> is the Sphinx 1.1.3 - & Alabaster + Powered by Sphinx 1.7.3 + & Alabaster 0.7.10 | - Page source
    diff --git a/doc/build/html/commands/prepare.html b/doc/build/html/commands/prepare.html index 50d91a2..ea6379f 100644 --- a/doc/build/html/commands/prepare.html +++ b/doc/build/html/commands/prepare.html @@ -2,30 +2,20 @@ - + - - Command prepare — salomeTools 5.0.0dev documentation - + Command prepare — salomeTools 5.0.0dev documentation - - + - - + + + @@ -34,8 +24,7 @@ - - +
    @@ -78,9 +67,9 @@ without any link to the VCS base. To perform a checkout (svn, cvs) or a git clone (git), you need to declare the product in dev mode in your application configuration: edit the application configuration file (pyconf) and modify the product declaration:

    -
    sat config <application> -e
    -# and edit the product section:
    -#   <product> : {tag : "my_tag", dev : "yes", debug : "yes"}
    +
    sat config <application> -e
    +# and edit the product section:
    +#   <product> : {tag : "my_tag", dev : "yes", debug : "yes"}
     

    The first time you will execute the sat prepare command, @@ -97,21 +86,25 @@ not be altered/removed (Unless you use -f option)

    Usage¶

    • Prepare the sources of a complete application in SOURCES directory (all products):

      -
      sat prepare <application>
      +
      sat prepare <application>
      +
    • Prepare only some modules:

      -
      sat prepare <application>  --products <product1>,<product2> ...
      +
      sat prepare <application>  --products <product1>,<product2> ...
      +
    • -
    • Use --force to force to prepare the products in development mode +

    • Use –force to force to prepare the products in development mode (this will remove the sources and do a new clone/checkout):

      -
      sat prepare <application> --force
      +
      sat prepare <application> --force
      +
    • -
    • Use --force_patch to force to apply patch to the products +

    • Use –force_patch to force to apply patch to the products in development mode (otherwise they are not applied):

      -
      sat prepare <application> --force_patch
      +
      sat prepare <application> --force_patch
      +
    @@ -122,7 +115,7 @@ in development mode (otherwise they are not applied):

    Note

    to verify configuration of a product, and get name of this pyconf files configuration

    -
    sat config <application> --info <product>
    +
    sat config <application> --info <product>
     
    @@ -141,7 +134,7 @@ in development mode (otherwise they are not applied):

    -
    + diff --git a/doc/build/html/configuration.html b/doc/build/html/configuration.html index 24699f3..18c8654 100644 --- a/doc/build/html/configuration.html +++ b/doc/build/html/configuration.html @@ -2,30 +2,20 @@ - + - - Configuration — salomeTools 5.0.0dev documentation - + Configuration — salomeTools 5.0.0dev documentation - - + - - + + + @@ -34,8 +24,7 @@ - - +
    @@ -57,12 +46,12 @@ Then, this object is passed to all command scripts.

  • {} define a dictionary,
  • [] define a list,
  • @ can be used to include a file,
  • -
  • $prefix reference to another parameter (ex: $PRODUCT.name),
  • +
  • $prefix reference to another parameter (ex: $PRODUCT.name),
  • # comments.
  • Note

    -

    in this documentation a reference to a configuration parameter will be noted XXX.YYY.

    +

    in this documentation a reference to a configuration parameter will be noted XXX.YYY.

    @@ -73,8 +62,9 @@ Then, this object is passed to all command scripts.

    This section is dynamically created by salomeTools at run time.
    It contains information about the environment: date, time, OS, architecture etc.
    -
    # to get the current setting
    -sat config --value VARS
    +
    # to get the current setting
    +sat config --value VARS
    +
    @@ -83,8 +73,9 @@ sat config --value VARS
    This section is defined in the product file.
    It contains instructions on how to build a version of SALOME (list of prerequisites-products and versions)
    -
    # to get the current setting
    -sat config SALOME-xx --value PRODUCTS
    +
    # to get the current setting
    +sat config SALOME-xx --value PRODUCTS
    +
    @@ -93,15 +84,16 @@ sat config SALOME-xx --value PRODUCTS
    This section is optional, it is also defined in the product file.
    It gives additional parameters to create an application based on SALOME, as versions of products to use.
    -
    # to get the current setting
    -sat config SALOME-xx --value APPLICATION
    +
    # to get the current setting
    +sat config SALOME-xx --value APPLICATION
    +

    USER section¶

    This section is defined by the user configuration file, -~/.salomeTools/salomeTools.pyconf.

    -

    The USER section defines some parameters (not exhaustive):

    +~/.salomeTools/salomeTools.pyconf.

    +

    The USER section defines some parameters (not exhaustive):

    • workDir :

      @@ -118,8 +110,9 @@ sat config SALOME-xx --value APPLICATION
    • and other user preferences.

    -
    # to get the current setting
    -sat config SALOME-xx --value USER
    +
    # to get the current setting
    +sat config SALOME-xx --value USER
    +
    @@ -129,7 +122,7 @@ sat config SALOME-xx --value USER
    -
    + diff --git a/doc/build/html/genindex.html b/doc/build/html/genindex.html index 2af3b57..7ddb9d8 100644 --- a/doc/build/html/genindex.html +++ b/doc/build/html/genindex.html @@ -1,41 +1,29 @@ - - + - - Index — salomeTools 5.0.0dev documentation - + Index — salomeTools 5.0.0dev documentation - - + - - + + + - - +
    @@ -74,2356 +62,1328 @@

    A

    Parameters:
      -
    • str (stylesheet) -- The path to the file to create
    • -
    • etree.Element (xmlroot) -- the Etree element to write to the file
    • -
    • str -- The stylesheet to add to the begin of the file
    • +
    • str (stylesheet) – The path to the file to create
    • +
    • etree.Element (xmlroot) – the Etree element to write to the file
    • +
    • str – The stylesheet to add to the begin of the file
    - - + +
    - -
    activate_mesa_property() (in module src.__init__) -
    - - -
    add() (src.fileEnviron.LauncherFileEnviron method) -
    - - -
    add_comment() (src.environment.SalomeEnviron method) -
    - -
    - -
    (src.fileEnviron.BatFileEnviron method) -
    - - -
    (src.fileEnviron.FileEnviron method) -
    - - -
    (src.fileEnviron.LauncherFileEnviron method) -
    - - -
    (src.fileEnviron.ScreenEnviron method) -
    - -
    - -
    add_echo() (src.fileEnviron.ContextFileEnviron method) -
    - -
    - -
    (src.fileEnviron.FileEnviron method) -
    - - -
    (src.fileEnviron.LauncherFileEnviron method) -
    - - -
    (src.fileEnviron.ScreenEnviron method) -
    - -
    - -
    add_line() (src.environment.SalomeEnviron method) -
    - -
    - -
    (src.fileEnviron.FileEnviron method) -
    - - -
    (src.fileEnviron.LauncherFileEnviron method) -
    - - -
    (src.fileEnviron.ScreenEnviron method) -
    - -
    - -
    add_link() (src.logger.Logger method) -
    - - -
    add_option() (src.options.Options method) -
    - - -
    add_simple_node() (in module src.xmlManager) -
    - -
    - -
    (src.xmlManager.XmlLogFile method) -
    - -
    - -
    add_warning() (src.environment.SalomeEnviron method) -
    - -
    - -
    (src.fileEnviron.ContextFileEnviron method) -
    - - -
    (src.fileEnviron.FileEnviron method) -
    - - -
    (src.fileEnviron.LauncherFileEnviron method) -
    - - -
    (src.fileEnviron.ScreenEnviron method) -
    - -
    - -
    addElement() (src.pyconf.Reference method) -
    - - -
    addMapping() (src.pyconf.Mapping method) -
    - - -
    addNamespace() (src.pyconf.Config method) -
    - - -
    ANSI_CSI_RE (src.colorama.ansitowin32.AnsiToWin32 attribute) -
    - -
    - -
    ANSI_OSC_RE (src.colorama.ansitowin32.AnsiToWin32 attribute) -
    - - -
    AnsiBack (class in src.colorama.ansi) -
    - - -
    AnsiCodes (class in src.colorama.ansi) -
    - - -
    AnsiCursor (class in src.colorama.ansi) -
    - - -
    AnsiFore (class in src.colorama.ansi) -
    - - -
    AnsiStyle (class in src.colorama.ansi) -
    - - -
    AnsiToWin32 (class in src.colorama.ansitowin32) -
    - - -
    append() (src.environment.Environ method) -
    - -
    - -
    (src.environment.SalomeEnviron method) -
    - - -
    (src.fileEnviron.FileEnviron method) -
    - - -
    (src.fileEnviron.LauncherFileEnviron method) -
    - - -
    (src.fileEnviron.ScreenEnviron method) -
    - - -
    (src.pyconf.Sequence method) -
    - -
    - -
    append_node_attrib() (in module src.xmlManager) -
    - -
    - -
    (src.xmlManager.XmlLogFile method) -
    - -
    - -
    append_node_text() (src.xmlManager.XmlLogFile method) -
    - - -
    append_value() (src.environment.Environ method) -
    - -
    - -
    (src.fileEnviron.ContextFileEnviron method) -
    - - -
    (src.fileEnviron.FileEnviron method) -
    - - -
    (src.fileEnviron.LauncherFileEnviron method) -
    - -
    - -
    archive_extract() (in module src.system) -
    - -

    B

    - - + +
    - -
    BACK() (src.colorama.ansi.AnsiCursor method) -
    - - -
    back() (src.colorama.winterm.WinTerm method) -
    - - -
    base() (src.__init__.Path method) -
    - - -
    BashFileEnviron (class in src.fileEnviron) -
    - - -
    batch() (in module src.fork) -
    - - -
    batch_salome() (in module src.fork) -
    - - -
    BatFileEnviron (class in src.fileEnviron) -
    - -
    - -
    BLACK (src.colorama.ansi.AnsiBack attribute) -
    - -
    - -
    (src.colorama.ansi.AnsiFore attribute) -
    - - -
    (src.colorama.winterm.WinColor attribute) -
    - -
    - -
    BLUE (src.colorama.ansi.AnsiBack attribute) -
    - -
    - -
    (src.colorama.ansi.AnsiFore attribute) -
    - - -
    (src.colorama.winterm.WinColor attribute) -
    - -
    - -
    BRIGHT (src.colorama.ansi.AnsiStyle attribute) -
    - -
    - -
    (src.colorama.winterm.WinStyle attribute) -
    - -
    - -
    BRIGHT_BACKGROUND (src.colorama.winterm.WinStyle attribute) -
    - - -
    build_configure() (src.compilation.Builder method) -
    - - -
    Builder (class in src.compilation) -
    - -

    C

    - - + +
    - -
    call_win32() (src.colorama.ansitowin32.AnsiToWin32 method) -
    - - -
    change_to_launcher() (src.fileEnviron.LauncherFileEnviron method) -
    - - -
    check() (src.compilation.Builder method) -
    - - -
    check_config_exists() (in module src.product) -
    - - -
    check_config_has_application() (in module src.__init__) -
    - - -
    check_config_has_profile() (in module src.__init__) -
    - - -
    check_installation() (in module src.product) -
    - - -
    check_source() (in module src.product) -
    - - -
    chmod() (src.__init__.Path method) -
    - - -
    cleancolor() (in module src.printcolors) -
    - - -
    clear_line() (in module src.colorama.ansi) -
    - - -
    clear_screen() (in module src.colorama.ansi) -
    - - -
    close() (src.debug.OutStream method) -
    - -
    - -
    (src.ElementTree.TreeBuilder method) -
    - - -
    (src.ElementTree.XMLTreeBuilder method) -
    - - -
    (src.pyconf.ConfigInputStream method) -
    - - -
    (src.pyconf.ConfigOutputStream method) -
    - -
    - -
    cmake() (src.compilation.Builder method) -
    - - -
    code_to_chars() (in module src.colorama.ansi) -
    - - -
    colorama_text() (in module src.colorama.initialise) -
    - - -
    command_value() (src.environment.Environ method) -
    - -
    - -
    (src.fileEnviron.BashFileEnviron method) -
    - - -
    (src.fileEnviron.BatFileEnviron method) -
    - - -
    (src.fileEnviron.ContextFileEnviron method) -
    - - -
    (src.fileEnviron.FileEnviron method) -
    - - -
    (src.fileEnviron.LauncherFileEnviron method) -
    - - -
    (src.fileEnviron.ScreenEnviron method) -
    - -
    - -
    Comment() (in module src.ElementTree) -
    - - -
    complete_environment() (src.compilation.Builder method) -
    - - -
    Config (class in src.pyconf) -
    - - -
    Config.Namespace (class in src.pyconf) -
    - -
    - -
    config_has_application() (in module src.__init__) -
    - - -
    ConfigError -
    - - -
    ConfigFormatError -
    - - -
    ConfigInputStream (class in src.pyconf) -
    - - -
    ConfigList (class in src.pyconf) -
    - - -
    ConfigMerger (class in src.pyconf) -
    - - -
    ConfigOutputStream (class in src.pyconf) -
    - - -
    ConfigReader (class in src.pyconf) -
    +
    - -
    ConfigResolutionError -
    +

    D

    + + + +
    - -
    configure() (src.compilation.Builder method) -
    +

    E

    + + + +
    - -
    Container (class in src.pyconf) -
    +

    F

    + + + +
    - -
    ContextFileEnviron (class in src.fileEnviron) -
    +

    G

    + + + +
    - -
    convert_ansi() (src.colorama.ansitowin32.AnsiToWin32 method) -
    +

    H

    + + + +
    - -
    convert_osc() (src.colorama.ansitowin32.AnsiToWin32 method) -
    +

    I

    + + + +
    - -
    copy() (src.__init__.Path method) -
    +

    K

    + + +
    - -
    copydir() (src.__init__.Path method) -
    +

    L

    + + + +
    - -
    copyfile() (src.__init__.Path method) -
    +

    M

    + + + +
    - -
    copylink() (src.__init__.Path method) -
    +

    N

    + + + +
    - -
    cursor_adjust() (src.colorama.winterm.WinTerm method) -
    +

    O

    + + + +
    - -
    cvs_extract() (in module src.system) -
    +

    P

    + + + +
    - -
    CYAN (src.colorama.ansi.AnsiBack attribute) -
    +

    Q

    + + +
    -
    - -
    (src.colorama.ansi.AnsiFore attribute) -
    +

    R

    + + + +
    - -
    (src.colorama.winterm.WinColor attribute) -
    +

    S

    + + + +
    -
    -
    +

    T

    + + +
    -

    D

    +

    U

    - + +
    - -
    data() (src.ElementTree.TreeBuilder method) -
    +
    - -
    date_to_datetime() (in module src.logger) -
    +

    W

    + + + +
    - -
    deepcopy_list() (in module src.__init__) -
    +

    X

    + + + +
    - -
    deepCopyMapping() (in module src.pyconf) -
    - - -
    defaultMergeResolve() (in module src.pyconf) -
    - - -
    defaultStreamOpener() (in module src.pyconf) -
    - - -
    deinit() (in module src.colorama.initialise) -
    - - -
    delimiter (src.template.MyTemplate attribute) -
    - - -
    DIM (src.colorama.ansi.AnsiStyle attribute) -
    - -
    -
    - -
    dir() (src.__init__.Path method) -
    - - -
    do_batch_script_build() (src.compilation.Builder method) -
    - - -
    do_default_build() (src.compilation.Builder method) -
    - - -
    do_python_script_build() (src.compilation.Builder method) -
    - - -
    do_script_build() (src.compilation.Builder method) -
    - - -
    doctype() (src.ElementTree.XMLTreeBuilder method) -
    - - -
    DOWN() (src.colorama.ansi.AnsiCursor method) -
    - - -
    dump() (in module src.ElementTree) -
    - -
    - -
    (src.environment.SalomeEnviron method) -
    - -
    -
    - - -

    E

    - - - -
    - -
    Element() (in module src.ElementTree) -
    - - -
    ElementTree (class in src.ElementTree) -
    - - -
    end() (src.ElementTree.TreeBuilder method) -
    - - -
    end_write() (src.logger.Logger method) -
    - - -
    ensure_path_exists() (in module src.__init__) -
    - - -
    Environ (class in src.environment) -
    - - -
    erase_line() (src.colorama.winterm.WinTerm method) -
    - -
    - -
    erase_screen() (src.colorama.winterm.WinTerm method) -
    - - -
    error() (src.logger.Logger method) -
    - - -
    evaluate() (src.pyconf.Container method) -
    - -
    - -
    (src.pyconf.Expression method) -
    - -
    - -
    exists() (src.__init__.Path method) -
    - - -
    Expression (class in src.pyconf) -
    - - -
    extract_params() (src.colorama.ansitowin32.AnsiToWin32 method) -
    - -
    - -

    F

    - - - -
    - -
    feed() (src.ElementTree.XMLTreeBuilder method) -
    - - -
    FileEnviron (class in src.fileEnviron) -
    - - -
    FileEnvWriter (class in src.environment) -
    - - -
    find() (src.ElementTree.ElementTree method) -
    - - -
    find_file_in_lpath() (in module src.__init__) -
    - - -
    find_node_by_attrib() (in module src.xmlManager) -
    - - -
    findall() (src.ElementTree.ElementTree method) -
    - -
    - -
    findConfig() (src.pyconf.Reference method) -
    - - -
    findtext() (src.ElementTree.ElementTree method) -
    - - -
    finish() (src.environment.SalomeEnviron method) -
    - -
    - -
    (src.fileEnviron.BashFileEnviron method) -
    - - -
    (src.fileEnviron.BatFileEnviron method) -
    - - -
    (src.fileEnviron.ContextFileEnviron method) -
    - - -
    (src.fileEnviron.FileEnviron method) -
    - - -
    (src.fileEnviron.LauncherFileEnviron method) -
    - -
    - -
    flush() (src.logger.Logger method) -
    - -
    - -
    (src.pyconf.ConfigOutputStream method) -
    - -
    - -
    fore() (src.colorama.winterm.WinTerm method) -
    - - -
    FORWARD() (src.colorama.ansi.AnsiCursor method) -
    - - -
    fromstring() (in module src.ElementTree) -
    - -
    - -

    G

    - - - -
    - -
    generate_launching_commands() (src.test_module.Test method) -
    - - -
    generate_script() (src.test_module.Test method) -
    - - -
    get() (src.environment.Environ method) -
    - -
    - -
    (src.environment.SalomeEnviron method) -
    - - -
    (src.fileEnviron.BatFileEnviron method) -
    - - -
    (src.fileEnviron.ContextFileEnviron method) -
    - - -
    (src.fileEnviron.FileEnviron method) -
    - - -
    (src.fileEnviron.LauncherFileEnviron method) -
    - - -
    (src.fileEnviron.ScreenEnviron method) -
    - - -
    (src.pyconf.Mapping method) -
    - -
    - -
    get_attrib() (src.xmlManager.ReadXmlFile method) -
    - - -
    get_attrs() (src.colorama.winterm.WinTerm method) -
    - - -
    get_base_install_dir() (in module src.product) -
    - - -
    get_base_path() (in module src.__init__) -
    - - -
    get_cfg_param() (in module src.__init__) -
    - - -
    get_distrib_version() (in module src.architecture) -
    - - -
    get_distribution() (in module src.architecture) -
    - - -
    get_file_environ() (in module src.fileEnviron) -
    - - -
    get_install_dir() (in module src.product) -
    - - -
    get_launcher_name() (in module src.__init__) -
    - - -
    get_log_path() (in module src.__init__) -
    - - -
    get_names() (src.environment.SalomeEnviron method) -
    - - -
    get_nb_proc() (in module src.architecture) -
    - - -
    get_node_text() (src.xmlManager.ReadXmlFile method) -
    - - -
    get_position() (src.colorama.winterm.WinTerm method) -
    - - -
    get_product_components() (in module src.product) -
    - - -
    get_product_config() (in module src.product) -
    - - -
    get_product_dependencies() (in module src.product) -
    - - -
    get_product_section() (in module src.product) -
    - -
    - -
    get_products_infos() (in module src.product) -
    - - -
    get_property_in_product_cfg() (in module src.__init__) -
    - - -
    get_python_version() (in module src.architecture) -
    - - -
    get_salome_version() (in module src.__init__) -
    - - -
    get_test_timeout() (src.test_module.Test method) -
    - - -
    get_tmp_dir() (src.test_module.Test method) -
    - - -
    get_tmp_filename() (in module src.__init__) -
    - - -
    get_user() (in module src.architecture) -
    - - -
    get_win32_calls() (src.colorama.ansitowin32.AnsiToWin32 method) -
    - - -
    getByPath() (src.pyconf.Config method) -
    - -
    - -
    (src.pyconf.ConfigList method) -
    - -
    - -
    getChar() (src.pyconf.ConfigReader method) -
    - - -
    getiterator() (src.ElementTree.ElementTree method) -
    - - -
    getLocalEnv() (in module src.debug) -
    - - -
    getroot() (src.ElementTree.ElementTree method) -
    - - -
    getRootAttrib() (src.xmlManager.ReadXmlFile method) -
    - - -
    getStrConfigDbg() (in module src.debug) -
    - - -
    getStrConfigStd() (in module src.debug) -
    - - -
    getTmpDirDEFAULT() (in module src.test_module) -
    - - -
    getToken() (src.pyconf.ConfigReader method) -
    - - -
    git_extract() (in module src.system) -
    - - -
    GREEN (src.colorama.ansi.AnsiBack attribute) -
    - -
    - -
    (src.colorama.ansi.AnsiFore attribute) -
    - - -
    (src.colorama.winterm.WinColor attribute) -
    - -
    - -
    GREY (src.colorama.winterm.WinColor attribute) -
    - -
    - -

    H

    - - - -
    - -
    hack_libtool() (src.compilation.Builder method) -
    - - -
    handleMismatch() (src.pyconf.ConfigMerger method) -
    - -
    - -
    handleRemoveReadonly() (in module src.__init__) -
    - -
    - -

    I

    - - - -
    - -
    indent() (in module src.debug) -
    - - -
    init() (in module src.colorama.initialise) -
    - - -
    install() (src.compilation.Builder method) -
    - - -
    InStream (class in src.debug) -
    - - -
    is_a_tty() (in module src.colorama.ansitowin32) -
    - - -
    is_defined() (src.environment.Environ method) -
    - -
    - -
    (src.environment.SalomeEnviron method) -
    - - -
    (src.fileEnviron.FileEnviron method) -
    - - -
    (src.fileEnviron.LauncherFileEnviron method) -
    - - -
    (src.fileEnviron.ScreenEnviron method) -
    - -
    - -
    is_stream_closed() (in module src.colorama.ansitowin32) -
    - - -
    is_windows() (in module src.architecture) -
    - -
    - -
    isdir() (src.__init__.Path method) -
    - - -
    iselement() (in module src.ElementTree) -
    - - -
    isfile() (src.__init__.Path method) -
    - - -
    islink() (src.__init__.Path method) -
    - - -
    isWord() (in module src.pyconf) -
    - - -
    iteritems() (src.pyconf.Mapping method) -
    - - -
    iterkeys() (src.pyconf.Mapping method) -
    - - -
    iterparse (class in src.ElementTree) -
    - -
    - -

    K

    - - -
    - -
    keys() (src.pyconf.Mapping method) -
    - -
    - -

    L

    - - - -
    - -
    launch_command() (in module src.fork) -
    - - -
    LauncherFileEnviron (class in src.fileEnviron) -
    - - -
    LIGHTBLACK_EX (src.colorama.ansi.AnsiBack attribute) -
    - -
    - -
    (src.colorama.ansi.AnsiFore attribute) -
    - -
    - -
    LIGHTBLUE_EX (src.colorama.ansi.AnsiBack attribute) -
    - -
    - -
    (src.colorama.ansi.AnsiFore attribute) -
    - -
    - -
    LIGHTCYAN_EX (src.colorama.ansi.AnsiBack attribute) -
    - -
    - -
    (src.colorama.ansi.AnsiFore attribute) -
    - -
    - -
    LIGHTGREEN_EX (src.colorama.ansi.AnsiBack attribute) -
    - -
    - -
    (src.colorama.ansi.AnsiFore attribute) -
    - -
    - -
    LIGHTMAGENTA_EX (src.colorama.ansi.AnsiBack attribute) -
    - -
    - -
    (src.colorama.ansi.AnsiFore attribute) -
    - -
    - -
    LIGHTRED_EX (src.colorama.ansi.AnsiBack attribute) -
    - -
    - -
    (src.colorama.ansi.AnsiFore attribute) -
    - -
    - -
    LIGHTWHITE_EX (src.colorama.ansi.AnsiBack attribute) -
    - -
    - -
    (src.colorama.ansi.AnsiFore attribute) -
    - -
    - -
    LIGHTYELLOW_EX (src.colorama.ansi.AnsiBack attribute) -
    - -
    - -
    (src.colorama.ansi.AnsiFore attribute) -
    - -
    -
    - -
    list() (src.__init__.Path method) -
    - - -
    list_log_file() (in module src.logger) -
    - - -
    load() (src.pyconf.Config method) -
    - -
    - -
    (src.pyconf.ConfigReader method) -
    - -
    - -
    load_cfg_environment() (src.environment.SalomeEnviron method) -
    - - -
    load_environment() (in module src.environment) -
    - - -
    location() (src.pyconf.ConfigReader method) -
    - - -
    log() (src.compilation.Builder method) -
    - - -
    log_command() (src.compilation.Builder method) -
    - - -
    Logger (class in src.logger) -
    - -
    - -

    M

    - - - -
    - -
    MAGENTA (src.colorama.ansi.AnsiBack attribute) -
    - -
    - -
    (src.colorama.ansi.AnsiFore attribute) -
    - - -
    (src.colorama.winterm.WinColor attribute) -
    - -
    - -
    make() (src.__init__.Path method) -
    - -
    - -
    (src.compilation.Builder method) -
    - -
    - -
    makePath() (in module src.pyconf) -
    - - -
    Mapping (class in src.pyconf) -
    - - -
    match() (src.pyconf.ConfigReader method) -
    - -
    - -
    merge() (src.pyconf.ConfigMerger method) -
    - - -
    merge_dicts() (in module src.__init__) -
    - - -
    mergeMapping() (src.pyconf.ConfigMerger method) -
    - - -
    mergeSequence() (src.pyconf.ConfigMerger method) -
    - - -
    MyTemplate (class in src.template) -
    - -
    - -

    N

    - - - -
    - -
    next() (src.ElementTree.iterparse method) -
    - -
    - -
    (src.pyconf.Sequence.SeqIter method) -
    - -
    -
    - -
    NORMAL (src.colorama.ansi.AnsiStyle attribute) -
    - -
    - -
    (src.colorama.winterm.WinStyle attribute) -
    - -
    -
    - -

    O

    - - - -
    - -
    only_numbers() (in module src.__init__) -
    - - -
    Options (class in src.options) -
    - - -
    OptResult (class in src.options) -
    - -
    - -
    OutStream (class in src.debug) -
    - - -
    overwriteKeys() (src.pyconf.ConfigMerger method) -
    - - -
    overwriteMergeResolve() (in module src.pyconf) -
    - -
    - -

    P

    - - - -
    - -
    parse() (in module src.ElementTree) -
    - -
    - -
    (src.ElementTree.ElementTree method) -
    - -
    - -
    parse_args() (src.options.Options method) -
    - - -
    parse_date() (in module src.__init__) -
    - - -
    parseFactor() (src.pyconf.ConfigReader method) -
    - - -
    parseKeyValuePair() (src.pyconf.ConfigReader method) -
    - - -
    parseMapping() (src.pyconf.ConfigReader method) -
    - - -
    parseMappingBody() (src.pyconf.ConfigReader method) -
    - - -
    parseReference() (src.pyconf.ConfigReader method) -
    - - -
    parseScalar() (src.pyconf.ConfigReader method) -
    - - -
    parseSequence() (src.pyconf.ConfigReader method) -
    - - -
    parseSuffix() (src.pyconf.ConfigReader method) -
    - - -
    parseTerm() (src.pyconf.ConfigReader method) -
    - - -
    parseValue() (src.pyconf.ConfigReader method) -
    - - -
    Path (class in src.__init__) -
    - - -
    pattern (src.template.MyTemplate attribute) -
    - - -
    PI() (in module src.ElementTree) -
    - - -
    pop_debug() (in module src.debug) -
    - - -
    POS() (src.colorama.ansi.AnsiCursor method) -
    - - -
    prepare() (src.compilation.Builder method) -
    - - -
    prepare_testbase() (src.test_module.Test method) -
    - - -
    prepare_testbase_from_dir() (src.test_module.Test method) -
    - - -
    prepare_testbase_from_git() (src.test_module.Test method) -
    - - -
    prepare_testbase_from_svn() (src.test_module.Test method) -
    - - -
    prepend() (src.environment.Environ method) -
    - -
    - -
    (src.environment.SalomeEnviron method) -
    - - -
    (src.fileEnviron.FileEnviron method) -
    - - -
    (src.fileEnviron.LauncherFileEnviron method) -
    - - -
    (src.fileEnviron.ScreenEnviron method) -
    - -
    - -
    prepend_value() (src.environment.Environ method) -
    - -
    - -
    (src.fileEnviron.ContextFileEnviron method) -
    - - -
    (src.fileEnviron.FileEnviron method) -
    - - -
    (src.fileEnviron.LauncherFileEnviron method) -
    - -
    - -
    print_color_map() (in module src.printcolors) -
    - - -
    print_color_range() (in module src.printcolors) -
    - - -
    print_help() (src.options.Options method) -
    - - -
    print_info() (in module src.__init__) -
    - - -
    print_value() (in module src.printcolors) -
    - - -
    printc() (in module src.printcolors) -
    - -
    - -
    printcError() (in module src.printcolors) -
    - - -
    printcHeader() (in module src.printcolors) -
    - - -
    printcHighlight() (in module src.printcolors) -
    - - -
    printcInfo() (in module src.printcolors) -
    - - -
    printcLabel() (in module src.printcolors) -
    - - -
    printcSuccess() (in module src.printcolors) -
    - - -
    printcWarning() (in module src.printcolors) -
    - - -
    ProcessingInstruction() (in module src.ElementTree) -
    - - -
    product_compiles() (in module src.product) -
    - - -
    product_has_env_script() (in module src.product) -
    - - -
    product_has_logo() (in module src.product) -
    - - -
    product_has_patches() (in module src.product) -
    - - -
    product_has_salome_gui() (in module src.product) -
    - - -
    product_has_script() (in module src.product) -
    - - -
    product_is_autotools() (in module src.product) -
    - - -
    product_is_cmake() (in module src.product) -
    - - -
    product_is_cpp() (in module src.product) -
    - - -
    product_is_debug() (in module src.product) -
    - - -
    product_is_dev() (in module src.product) -
    - - -
    product_is_fixed() (in module src.product) -
    - - -
    product_is_generated() (in module src.product) -
    - - -
    product_is_mpi() (in module src.product) -
    - - -
    product_is_native() (in module src.product) -
    - - -
    product_is_salome() (in module src.product) -
    - - -
    product_is_sample() (in module src.product) -
    - - -
    product_is_smesh_plugin() (in module src.product) -
    - - -
    product_is_vcs() (in module src.product) -
    - - -
    push_debug() (in module src.debug) -
    - - -
    put_initial_xml_fields() (src.logger.Logger method) -
    - - -
    put_txt_log_in_appli_log_dir() (src.compilation.Builder method) -
    - -
    - -

    Q

    - - -
    - -
    QName (class in src.ElementTree) -
    - -
    - -

    R

    - - - -
    - -
    read() (src.pyconf.ConfigInputStream method) -
    - - -
    read_config_from_a_file() (in module src.__init__) -
    - - -
    read_results() (src.test_module.Test method) -
    - - -
    readline() (src.pyconf.ConfigInputStream method) -
    - - -
    readlink() (src.__init__.Path method) -
    - - -
    ReadXmlFile (class in src.xmlManager) -
    - - -
    RED (src.colorama.ansi.AnsiBack attribute) -
    - -
    - -
    (src.colorama.ansi.AnsiFore attribute) -
    - - -
    (src.colorama.winterm.WinColor attribute) -
    - -
    - -
    Reference (class in src.pyconf) -
    - - -
    reinit() (in module src.colorama.initialise) -
    - - -
    remove_item_from_list() (in module src.__init__) -
    - - -
    removeNamespace() (src.pyconf.Config method) -
    - - -
    replace_in_file() (in module src.__init__) -
    - - -
    RESET (src.colorama.ansi.AnsiBack attribute) -
    - -
    - -
    (src.colorama.ansi.AnsiFore attribute) -
    - -
    -
    - -
    RESET_ALL (src.colorama.ansi.AnsiStyle attribute) -
    - - -
    reset_all() (in module src.colorama.initialise) -
    - -
    - -
    (src.colorama.ansitowin32.AnsiToWin32 method) -
    - - -
    (src.colorama.winterm.WinTerm method) -
    - -
    - -
    resolve() (src.pyconf.Reference method) -
    - - -
    rm() (src.__init__.Path method) -
    - - -
    run_all_tests() (src.test_module.Test method) -
    - - -
    run_env_script() (src.environment.SalomeEnviron method) -
    - -
    - -
    (src.fileEnviron.ScreenEnviron method) -
    - -
    - -
    run_grid_tests() (src.test_module.Test method) -
    - - -
    run_script() (src.test_module.Test method) -
    - - -
    run_session_tests() (src.test_module.Test method) -
    - - -
    run_simple_env_script() (src.environment.SalomeEnviron method) -
    - - -
    run_testbase_tests() (src.test_module.Test method) -
    - - -
    run_tests() (src.test_module.Test method) -
    - -
    - -

    S

    - - - -
    - -
    SalomeEnviron (class in src.environment) -
    - - -
    SatException -
    - - -
    saveConfigDbg() (in module src.debug) -
    - - -
    saveConfigStd() (in module src.debug) -
    - - -
    ScreenEnviron (class in src.fileEnviron) -
    - - -
    search_known_errors() (src.test_module.Test method) -
    - - -
    Sequence (class in src.pyconf) -
    - - -
    Sequence.SeqIter (class in src.pyconf) -
    - - -
    set() (src.environment.Environ method) -
    - -
    - -
    (src.environment.SalomeEnviron method) -
    - - -
    (src.fileEnviron.BashFileEnviron method) -
    - - -
    (src.fileEnviron.BatFileEnviron method) -
    - - -
    (src.fileEnviron.ContextFileEnviron method) -
    - - -
    (src.fileEnviron.FileEnviron method) -
    - - -
    (src.fileEnviron.LauncherFileEnviron method) -
    - - -
    (src.fileEnviron.ScreenEnviron method) -
    - -
    - -
    set_a_product() (src.environment.SalomeEnviron method) -
    - - -
    set_application_env() (src.environment.SalomeEnviron method) -
    - - -
    set_attrs() (src.colorama.winterm.WinTerm method) -
    - - -
    set_console() (src.colorama.winterm.WinTerm method) -
    - - -
    set_cpp_env() (src.environment.SalomeEnviron method) -
    - - -
    set_cursor_position() (src.colorama.winterm.WinTerm method) -
    - - -
    set_full_environ() (src.environment.SalomeEnviron method) -
    - - -
    set_products() (src.environment.SalomeEnviron method) -
    - - -
    set_python_libdirs() (src.environment.SalomeEnviron method) -
    - - -
    set_salome_generic_product_env() (src.environment.SalomeEnviron method) -
    - - -
    set_salome_minimal_product_env() (src.environment.SalomeEnviron method) -
    - - -
    set_title() (in module src.colorama.ansi) -
    - -
    - -
    (src.colorama.winterm.WinTerm method) -
    - -
    - -
    SetConsoleTextAttribute() (in module src.colorama.win32) -
    - - -
    setPath() (src.pyconf.Container method) -
    - - -
    setStream() (src.pyconf.ConfigReader method) -
    - - -
    Shell (class in src.environment) -
    - - -
    should_wrap() (src.colorama.ansitowin32.AnsiToWin32 method) -
    - - -
    show_command_log() (in module src.logger) -
    - - -
    show_in_editor() (in module src.system) -
    - - -
    show_progress() (in module src.fork) -
    - - -
    smartcopy() (src.__init__.Path method) -
    - - -
    special_path_separator() (in module src.fileEnviron) -
    - -
    - -
    src.__init__ (module) -
    - - -
    src.architecture (module) -
    - - -
    src.colorama (module) -
    - - -
    src.colorama.ansi (module) -
    - - -
    src.colorama.ansitowin32 (module) -
    - - -
    src.colorama.initialise (module) -
    - - -
    src.colorama.win32 (module) -
    - - -
    src.colorama.winterm (module) -
    - - -
    src.compilation (module) -
    - - -
    src.debug (module) -
    - - -
    src.ElementTree (module) -
    - - -
    src.environment (module) -
    - - -
    src.fileEnviron (module) -
    - - -
    src.fork (module) -
    - - -
    src.logger (module) -
    - - -
    src.options (module) -
    - - -
    src.printcolors (module) -
    - - -
    src.product (module) -
    - - -
    src.pyconf (module) -
    - - -
    src.system (module) -
    - - -
    src.template (module) -
    - - -
    src.test_module (module) -
    - - -
    src.xmlManager (module) -
    - - -
    start() (src.ElementTree.TreeBuilder method) -
    - - -
    StreamWrapper (class in src.colorama.ansitowin32) -
    - - -
    style() (src.colorama.winterm.WinTerm method) -
    - - -
    SubElement() (in module src.ElementTree) -
    - - -
    substitute() (in module src.template) -
    - - -
    svn_extract() (in module src.system) -
    - - -
    symlink() (src.__init__.Path method) -
    - -
    - -

    T

    - - - -
    - -
    Test (class in src.test_module) -
    - - -
    timedelta_total_seconds() (in module src.logger) -
    - - -
    tofix() (in module src.debug) -
    - -
    - -
    tostring() (in module src.ElementTree) -
    - - -
    TreeBuilder (class in src.ElementTree) -
    - -
    - -

    U

    - - - -
    - -
    UP() (src.colorama.ansi.AnsiCursor method) -
    - -
    - -
    update_hat_xml() (in module src.logger) -
    - -
    - -

    W

    - - - -
    - -
    WHITE (src.colorama.ansi.AnsiBack attribute) -
    - -
    - -
    (src.colorama.ansi.AnsiFore attribute) -
    - -
    - -
    winapi_test() (in module src.colorama.win32) -
    - - -
    WinColor (class in src.colorama.winterm) -
    - - -
    WinStyle (class in src.colorama.winterm) -
    - - -
    WinTerm (class in src.colorama.winterm) -
    - - -
    wmake() (src.compilation.Builder method) -
    - - -
    wrap_stream() (in module src.colorama.initialise) -
    - - -
    write() (in module src.debug) -
    - -
    - -
    (src.ElementTree.ElementTree method) -
    - - -
    (src.colorama.ansitowin32.AnsiToWin32 method) -
    - - -
    (src.colorama.ansitowin32.StreamWrapper method) -
    - - -
    (src.fileEnviron.ScreenEnviron method) -
    - - -
    (src.logger.Logger method) -
    - - -
    (src.pyconf.ConfigOutputStream method) -
    - -
    - -
    write_and_convert() (src.colorama.ansitowin32.AnsiToWin32 method) -
    - -
    - -
    write_back() (in module src.fork) -
    - - -
    write_cfgForPy_file() (src.environment.FileEnvWriter method) -
    - - -
    write_env_file() (src.environment.FileEnvWriter method) -
    - - -
    write_plain_text() (src.colorama.ansitowin32.AnsiToWin32 method) -
    - - -
    write_report() (in module src.xmlManager) -
    - - -
    write_test_margin() (src.test_module.Test method) -
    - - -
    write_tree() (src.xmlManager.XmlLogFile method) -
    - - -
    writeToStream() (src.pyconf.Container method) -
    - -
    - -
    (src.pyconf.Mapping method) -
    - - -
    (src.pyconf.Sequence method) -
    - -
    - -
    writeValue() (src.pyconf.Container method) -
    - -
    - -

    X

    - - - -
    - -
    XML() (in module src.ElementTree) -
    - - -
    XmlLogFile (class in src.xmlManager) -
    - -
    - -
    XMLTreeBuilder (class in src.ElementTree) -
    - -
    - -

    Y

    - - -
    - -
    YELLOW (src.colorama.ansi.AnsiBack attribute) -
    - -
    - -
    (src.colorama.ansi.AnsiFore attribute) -
    - - -
    (src.colorama.winterm.WinColor attribute) -
    - -
    -
    +

    Y

    + + +
    -
    +