summaryrefslogtreecommitdiff
path: root/sphinx/util/osutil.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/util/osutil.py')
-rw-r--r--sphinx/util/osutil.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/sphinx/util/osutil.py b/sphinx/util/osutil.py
index beab38cb..464e56ed 100644
--- a/sphinx/util/osutil.py
+++ b/sphinx/util/osutil.py
@@ -11,6 +11,7 @@
import os
import re
+import sys
import time
import errno
import shutil
@@ -58,8 +59,8 @@ def ensuredir(path):
def walk(top, topdown=True, followlinks=False):
- """
- Backport of os.walk from 2.6, where the followlinks argument was added.
+ """Backport of os.walk from 2.6, where the *followlinks* argument was
+ added.
"""
names = os.listdir(top)
@@ -124,7 +125,10 @@ no_fn_re = re.compile(r'[^a-zA-Z0-9_-]')
def make_filename(string):
return no_fn_re.sub('', string)
-
-def ustrftime(format, *args):
- # strftime for unicode strings
- return time.strftime(unicode(format).encode('utf-8'), *args).decode('utf-8')
+if sys.version_info < (3, 0):
+ def ustrftime(format, *args):
+ # strftime for unicode strings
+ return time.strftime(unicode(format).encode('utf-8'), *args) \
+ .decode('utf-8')
+else:
+ ustrftime = time.strftime