mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Dont remove the output folder if it's the source one ;)
This commit is contained in:
parent
01b6d8eb44
commit
9a51102f29
2 changed files with 4 additions and 2 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from pelican.utils import clean_output_dir
|
|
||||||
from pelican.generators import Generator
|
from pelican.generators import Generator
|
||||||
from pelican.processors import (ArticlesProcessor, PagesProcessor,
|
from pelican.processors import (ArticlesProcessor, PagesProcessor,
|
||||||
StaticProcessor, PdfProcessor)
|
StaticProcessor, PdfProcessor)
|
||||||
|
|
@ -30,7 +29,6 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
generator = Generator(args.settings, args.path, args.theme,
|
generator = Generator(args.settings, args.path, args.theme,
|
||||||
args.output, markup)
|
args.output, markup)
|
||||||
clean_output_dir(generator.output_path)
|
|
||||||
|
|
||||||
processors = [ArticlesProcessor, PagesProcessor, StaticProcessor]
|
processors = [ArticlesProcessor, PagesProcessor, StaticProcessor]
|
||||||
if generator.settings['PDF_PROCESSOR']:
|
if generator.settings['PDF_PROCESSOR']:
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ from jinja2.exceptions import TemplateNotFound
|
||||||
from feedgenerator import Atom1Feed
|
from feedgenerator import Atom1Feed
|
||||||
|
|
||||||
from pelican.settings import read_settings
|
from pelican.settings import read_settings
|
||||||
|
from pelican.utils import clean_output_dir
|
||||||
|
|
||||||
_TEMPLATES = ('index', 'tag', 'tags', 'article', 'category', 'categories',
|
_TEMPLATES = ('index', 'tag', 'tags', 'article', 'category', 'categories',
|
||||||
'archives', 'page')
|
'archives', 'page')
|
||||||
|
|
@ -52,6 +53,9 @@ class Generator(object):
|
||||||
if hasattr(p, 'preprocess'):
|
if hasattr(p, 'preprocess'):
|
||||||
p.preprocess(context, self)
|
p.preprocess(context, self)
|
||||||
|
|
||||||
|
if self.output_path not in os.path.realpath(self.path):
|
||||||
|
clean_output_dir(self.output_path)
|
||||||
|
|
||||||
for p in processors:
|
for p in processors:
|
||||||
p.process(context, self)
|
p.process(context, self)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue