mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
allows pelican-themes symlink command to use relative paths not beginning with a dot
This commit is contained in:
parent
c60e0d03fb
commit
6662949d22
3 changed files with 26 additions and 1 deletions
1
pelican/tests/TestTheme/theme/a.html
Normal file
1
pelican/tests/TestTheme/theme/a.html
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
this is a test
|
||||||
24
pelican/tests/test_pelican_themes.py
Normal file
24
pelican/tests/test_pelican_themes.py
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals, print_function
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from pelican.tools.pelican_themes import symlink, _THEMES_PATH
|
||||||
|
from pelican.tests.support import LoggedTestCase
|
||||||
|
|
||||||
|
CURRENT_DIR_REL = os.path.dirname(__file__)
|
||||||
|
THEME_TARGET_PATH = os.path.join(_THEMES_PATH, "theme")
|
||||||
|
|
||||||
|
class TestPelicanThemes(LoggedTestCase):
|
||||||
|
# testing for pelican-themes commands.
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(TestPelicanThemes, self).setUp()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
super(TestPelicanThemes, self).tearDown()
|
||||||
|
os.remove(THEME_TARGET_PATH)
|
||||||
|
|
||||||
|
def test_symlink_relative(self):
|
||||||
|
symlink(os.path.join(CURRENT_DIR_REL, "TestTheme/theme/"))
|
||||||
|
self.assertTrue(os.path.exists(THEME_TARGET_PATH))
|
||||||
|
|
@ -214,7 +214,7 @@ def symlink(path, v=False):
|
||||||
if v:
|
if v:
|
||||||
print("Linking `{p}' to `{t}' ...".format(p=path, t=theme_path))
|
print("Linking `{p}' to `{t}' ...".format(p=path, t=theme_path))
|
||||||
try:
|
try:
|
||||||
os.symlink(path, theme_path)
|
os.symlink(os.path.abspath(path), theme_path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
err("Cannot link `{p}' to `{t}':\n{e}".format(p=path, t=theme_path, e=str(e)))
|
err("Cannot link `{p}' to `{t}':\n{e}".format(p=path, t=theme_path, e=str(e)))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue