mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Set followlinks=True in copy utility. Fixes #1785
This commit is contained in:
parent
a2852da3e7
commit
b2866b2630
2 changed files with 18 additions and 1 deletions
|
|
@ -461,6 +461,9 @@ class TestCopy(unittest.TestCase):
|
|||
self.assertTrue(os.path.exists(path),
|
||||
'Directory does not exist: %s' % path)
|
||||
|
||||
def _create_symlink(self, path, *name):
|
||||
os.symlink(path, os.path.join(self.root_dir, *name))
|
||||
|
||||
def test_copy_file_same_path(self):
|
||||
self._create_file('a.txt')
|
||||
utils.copy(os.path.join(self.root_dir, 'a.txt'),
|
||||
|
|
@ -517,6 +520,20 @@ class TestCopy(unittest.TestCase):
|
|||
self._exist_dir('b0', 'b1', 'b2', 'b3', 'b')
|
||||
self._exist_file('b0', 'b1', 'b2', 'b3', 'b', 'a.txt')
|
||||
|
||||
def test_copy_symlink(self):
|
||||
self._create_dir('f')
|
||||
self._create_dir('q')
|
||||
self._create_dir('q', 'r')
|
||||
self._create_file('q', 'r', 'f.txt')
|
||||
sympathy = os.path.join(self.root_dir, 'q')
|
||||
self._create_symlink(sympathy, 'f', 'q')
|
||||
utils.copy(os.path.join(self.root_dir, 'f'),
|
||||
os.path.join(self.root_dir, 'm'))
|
||||
self._exist_dir('m')
|
||||
self._exist_dir('m', 'q')
|
||||
self._exist_dir('m', 'q', 'r')
|
||||
self._exist_file('m', 'q', 'r', 'f.txt')
|
||||
|
||||
|
||||
class TestDateFormatter(unittest.TestCase):
|
||||
'''Tests that the output of DateFormatter jinja filter is same as
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ def copy(source, destination, ignores=None):
|
|||
source_, destination_)
|
||||
return
|
||||
|
||||
for src_dir, subdirs, others in os.walk(source_):
|
||||
for src_dir, subdirs, others in os.walk(source_, followlinks=True):
|
||||
dst_dir = os.path.join(destination_,
|
||||
os.path.relpath(src_dir, source_))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue