1
0
Fork 0
forked from github/pelican

Merge pull request #1083 from bmcorser/bmcorser/fix-utils-copy

Fix `utils.copy` behaviour
This commit is contained in:
Alexis Metaireau 2013-09-16 02:01:46 -07:00
commit 76e47e5198
2 changed files with 18 additions and 0 deletions

View file

@ -112,3 +112,18 @@ class TestPelican(LoggedTestCase):
for file in ['wow!', 'boom!', 'bap!', 'zap!']:
self.assertTrue(os.path.exists(os.path.join(extra_path, file)))
def test_theme_static_paths_copy_single_file(self):
# the same thing with a specified set of settings should work
settings = read_settings(path=SAMPLE_CONFIG, override={
'PATH': INPUT_PATH,
'OUTPUT_PATH': self.temp_path,
'THEME_STATIC_PATHS': [os.path.join(SAMPLES_PATH, 'theme_standard')]
})
pelican = Pelican(settings=settings)
mute(True)(pelican.run)()
theme_output = os.path.join(self.temp_path, 'theme')
for file in ['a_stylesheet', 'a_template']:
self.assertTrue(os.path.exists(os.path.join(theme_output, file)))

View file

@ -273,6 +273,9 @@ def copy(path, source, destination, destination_path=None):
destination_ = os.path.abspath(
os.path.expanduser(os.path.join(destination, destination_path)))
if not os.path.exists(destination_):
os.makedirs(destination_)
def recurse(source, destination):
for entry in os.listdir(source):
entry_path = os.path.join(source, entry)