i18n/mki18n.py
changeset 1757 0de89da92ee0
parent 1756 08e4394ff4fb
child 1758 845ca626db09
--- a/i18n/mki18n.py	Wed Aug 16 16:37:45 2017 +0300
+++ b/i18n/mki18n.py	Wed Aug 16 17:27:58 2017 +0300
@@ -336,98 +336,98 @@
 
 
 def fileBaseOf(filename, withPath=0):
-   """fileBaseOf(filename,withPath) ---> string
-
-   Return base name of filename.  The returned string never includes the extension.
-   Use os.path.basename() to return the basename with the extension.  The
-   second argument is optional.  If specified and if set to 'true' (non zero)
-   the string returned contains the full path of the file name.  Otherwise the
-   path is excluded.
-
-   [Example]
-   >>> fn = 'd:/dev/telepath/tvapp/code/test.html'
-   >>> fileBaseOf(fn)
-   'test'
-   >>> fileBaseOf(fn)
-   'test'
-   >>> fileBaseOf(fn,1)
-   'd:/dev/telepath/tvapp/code/test'
-   >>> fileBaseOf(fn,0)
-   'test'
-   >>> fn = 'abcdef'
-   >>> fileBaseOf(fn)
-   'abcdef'
-   >>> fileBaseOf(fn,1)
-   'abcdef'
-   >>> fn = "abcdef."
-   >>> fileBaseOf(fn)
-   'abcdef'
-   >>> fileBaseOf(fn,1)
-   'abcdef'
-   """
-   pos = filename.rfind('.')
-   if pos > 0:
-      filename = filename[:pos]
-   if withPath:
-      return filename
-   else:
-      return os.path.basename(filename)
+    """fileBaseOf(filename,withPath) ---> string
+
+    Return base name of filename.  The returned string never includes the extension.
+    Use os.path.basename() to return the basename with the extension.  The
+    second argument is optional.  If specified and if set to 'true' (non zero)
+    the string returned contains the full path of the file name.  Otherwise the
+    path is excluded.
+
+    [Example]
+    >>> fn = 'd:/dev/telepath/tvapp/code/test.html'
+    >>> fileBaseOf(fn)
+    'test'
+    >>> fileBaseOf(fn)
+    'test'
+    >>> fileBaseOf(fn,1)
+    'd:/dev/telepath/tvapp/code/test'
+    >>> fileBaseOf(fn,0)
+    'test'
+    >>> fn = 'abcdef'
+    >>> fileBaseOf(fn)
+    'abcdef'
+    >>> fileBaseOf(fn,1)
+    'abcdef'
+    >>> fn = "abcdef."
+    >>> fileBaseOf(fn)
+    'abcdef'
+    >>> fileBaseOf(fn,1)
+    'abcdef'
+    """
+    pos = filename.rfind('.')
+    if pos > 0:
+        filename = filename[:pos]
+    if withPath:
+        return filename
+    else:
+        return os.path.basename(filename)
 
 
 def mkdir(directory):
-   """Create a directory (and possibly the entire tree).
-
-   The os.mkdir() will fail to create a directory if one of the
-   directory in the specified path does not exist.  mkdir()
-   solves this problem.  It creates every intermediate directory
-   required to create the final path. Under Unix, the function
-   only supports forward slash separator, but under Windows and MacOS
-   the function supports the forward slash and the OS separator (backslash
-   under windows).
-   """
-
-   # translate the path separators
-   directory = unixpath(directory)
-   # build a list of all directory elements
-   aList = filter(lambda x: len(x) > 0, directory.split('/'))
-   theLen = len(aList)
-   # if the first element is a Windows-style disk drive
-   # concatenate it with the first directory
-   if aList[0].endswith(':'):
-      if theLen > 1:
-         aList[1] = aList[0] + '/' + aList[1]
-         del aList[0]
-         theLen -= 1
-   # if the original directory starts at root,
-   # make sure the first element of the list
-   # starts at root too
-   if directory[0] == '/':
-      aList[0] = '/' + aList[0]
-   # Now iterate through the list, check if the
-   # directory exists and if not create it
-   theDir = ''
-   for i in range(theLen):
-      theDir += aList[i]
-      if not os.path.exists(theDir):
-         os.mkdir(theDir)
-      theDir += '/'
+    """Create a directory (and possibly the entire tree).
+
+    The os.mkdir() will fail to create a directory if one of the
+    directory in the specified path does not exist.  mkdir()
+    solves this problem.  It creates every intermediate directory
+    required to create the final path. Under Unix, the function
+    only supports forward slash separator, but under Windows and MacOS
+    the function supports the forward slash and the OS separator (backslash
+    under windows).
+    """
+
+    # translate the path separators
+    directory = unixpath(directory)
+    # build a list of all directory elements
+    aList = filter(lambda x: len(x) > 0, directory.split('/'))
+    theLen = len(aList)
+    # if the first element is a Windows-style disk drive
+    # concatenate it with the first directory
+    if aList[0].endswith(':'):
+        if theLen > 1:
+            aList[1] = aList[0] + '/' + aList[1]
+            del aList[0]
+            theLen -= 1
+    # if the original directory starts at root,
+    # make sure the first element of the list
+    # starts at root too
+    if directory[0] == '/':
+        aList[0] = '/' + aList[0]
+    # Now iterate through the list, check if the
+    # directory exists and if not create it
+    theDir = ''
+    for i in range(theLen):
+        theDir += aList[i]
+        if not os.path.exists(theDir):
+            os.mkdir(theDir)
+        theDir += '/'
 
 
 def unixpath(thePath):
-   r"""Return a path name that contains Unix separator.
-
-   [Example]
-   >>> unixpath(r"d:\test")
-   'd:/test'
-   >>> unixpath("d:/test/file.txt")
-   'd:/test/file.txt'
-   >>>
-   """
-   thePath = os.path.normpath(thePath)
-   if os.sep == '/':
-      return thePath
-   else:
-      return thePath.replace(os.sep, '/')
+    r"""Return a path name that contains Unix separator.
+
+    [Example]
+    >>> unixpath(r"d:\test")
+    'd:/test'
+    >>> unixpath("d:/test/file.txt")
+    'd:/test/file.txt'
+    >>>
+    """
+    thePath = os.path.normpath(thePath)
+    if os.sep == '/':
+        return thePath
+    else:
+        return thePath.replace(os.sep, '/')
 
 
 # -----------------------------------------------------------------------------