aboutsummaryrefslogtreecommitdiffstats
path: root/nikola/winutils.py
diff options
context:
space:
mode:
authorLibravatarAgustin Henze <tin@sluc.org.ar>2015-07-08 07:35:06 -0300
committerLibravatarAgustin Henze <tin@sluc.org.ar>2015-07-08 07:35:06 -0300
commit055d72d76b44b0e627c8a17c48dbecd62e44197b (patch)
treee2c8d5475477c46115461fe9547c1ee797873635 /nikola/winutils.py
parent61f3aad02cd6492cb38e41b66f2ed8ec56e98981 (diff)
parentb0b24795b24ee6809397fbbadf42f31f310a219f (diff)
Merge tag 'upstream/7.6.0'
Upstream version 7.6.0
Diffstat (limited to 'nikola/winutils.py')
-rw-r--r--nikola/winutils.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/nikola/winutils.py b/nikola/winutils.py
index 712de39..8e29f5b 100644
--- a/nikola/winutils.py
+++ b/nikola/winutils.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2014 Roberto Alsina and others.
+# Copyright © 2012-2015 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -29,6 +29,7 @@
from __future__ import print_function, unicode_literals
import os
import shutil
+import io
# don't add imports to nikola code, will be imported in setup.py
@@ -63,9 +64,14 @@ def fix_all_git_symlinked(topdir):
Weakness: if interrupted of fail amidst a directory copy, next run will not
see the missing files.
"""
- with open(topdir + r'\nikola\data\symlinked.txt', 'rb') as f:
- all_bytes = f.read()
- text = all_bytes.decode('utf8')
+ # Determine whether or not symlinks need fixing (they don’t if installing
+ # from a .tar.gz file)
+ with io.open(topdir + r'\nikola\data\symlink-test-link.txt', 'r', encoding='utf-8') as f:
+ text = f.read()
+ if text.startswith("NIKOLA_SYMLINKS=OK"):
+ return -1
+ with io.open(topdir + r'\nikola\data\symlinked.txt', 'r', encoding='utf-8') as f:
+ text = f.read()
# expect each line a relpath from git or zip root,
# smoke test relpaths are relative to git root
if text.startswith('.'):
@@ -86,7 +92,7 @@ def fix_all_git_symlinked(topdir):
continue
# build src path and do some basic validation
- with open(os.path.join(topdir, dst), 'r') as f:
+ with io.open(os.path.join(topdir, dst), 'r', encoding='utf-8') as f:
text = f.read()
dst_dir = os.path.dirname(dst)
try: