Salome HOME
rename level into verbose, and set verbose 0 to silent option
[tools/sat.git] / src / system.py
index 98b2d3d3baa518a3c1ed7aeabbf4735ae4d44b99..1969bacaa22c914738a333cadc5cfb8607252b38 100644 (file)
@@ -50,9 +50,17 @@ def show_in_editor(editor, filePath, logger):
         logger.write(printcolors.printcError(_("Unable to edit file %s\n") 
                                              % filePath), 1)
 
-##
-# Extracts sources from a git repository.
+
 def git_extract(from_what, tag, where, logger):
+    '''Extracts sources from a git repository.
+    
+    :param from_what str: The remote git repository.
+    :param tag str: The tag.
+    :param where str: The path where to extract.
+    :param logger Logger: The logger instance to use.
+    :return: True if the extraction is successful
+    :rtype: boolean
+    '''
     if not where.exists():
         where.make()
     if tag == "master" or tag == "HEAD":
@@ -64,7 +72,10 @@ def git_extract(from_what, tag, where, logger):
         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 }
+        command = command % {'remote': from_what, 
+                             'tag': tag, 
+                             'where': str(where), 
+                             'where_git': where_git }
 
     logger.write(command + "\n", 5)
 
@@ -75,6 +86,14 @@ def git_extract(from_what, tag, where, logger):
     return (res == 0)
 
 def archive_extract(from_what, where, logger):
+    '''Extracts sources from an archive.
+    
+    :param from_what str: The path to the archive.
+    :param where str: The path where to extract.
+    :param logger Logger: The logger instance to use.
+    :return: True if the extraction is successful
+    :rtype: boolean
+    '''
     try:
         archive = tarfile.open(from_what)
         for i in archive.getmembers():
@@ -86,6 +105,20 @@ def archive_extract(from_what, where, logger):
 
 def cvs_extract(protocol, user, server, base, tag, product, where,
                 logger, checkout=False):
+    '''Extracts sources from a cvs repository.
+    
+    :param protocol str: The cvs protocol.
+    :param user str: The user to be used.
+    :param server str: The remote cvs server.
+    :param base str: .
+    :param tag str: The tag.
+    :param product str: The product.
+    :param where str: The path where to extract.
+    :param logger Logger: The logger instance to use.
+    :param checkout boolean: If true use checkout cvs.
+    :return: True if the extraction is successful
+    :rtype: boolean
+    '''
 
     opttag = ''
     if tag is not None and len(tag) > 0:
@@ -119,6 +152,17 @@ def cvs_extract(protocol, user, server, base, tag, product, where,
     return (res == 0)
 
 def svn_extract(user, from_what, tag, where, logger, checkout=False):
+    '''Extracts sources from a svn repository.
+    
+    :param user str: The user to be used.
+    :param from_what str: The remote git repository.
+    :param tag str: The tag.
+    :param where str: The path where to extract.
+    :param logger Logger: The logger instance to use.
+    :param checkout boolean: If true use checkout svn.
+    :return: True if the extraction is successful
+    :rtype: boolean
+    '''
     if not where.exists():
         where.make()