mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Convert '.' and '..' to the less magical os.curdir and os.pardir
While I'm cleaning up path manipulation, I might as well make things more semantic.
This commit is contained in:
parent
a5c1fdac58
commit
b59da89e80
10 changed files with 19 additions and 16 deletions
|
|
@ -18,7 +18,7 @@ _TEMPLATES_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
|||
CONF = {
|
||||
'pelican': 'pelican',
|
||||
'pelicanopts': '',
|
||||
'basedir': '.',
|
||||
'basedir': os.curdir,
|
||||
'ftp_host': 'localhost',
|
||||
'ftp_user': 'anonymous',
|
||||
'ftp_target_dir': '/',
|
||||
|
|
@ -146,7 +146,7 @@ def main():
|
|||
parser = argparse.ArgumentParser(
|
||||
description="A kickstarter for Pelican",
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||
parser.add_argument('-p', '--path', default=".",
|
||||
parser.add_argument('-p', '--path', default=os.curdir,
|
||||
help="The path to generate the blog into")
|
||||
parser.add_argument('-t', '--title', metavar="title",
|
||||
help='Set the title of the website')
|
||||
|
|
@ -166,7 +166,8 @@ needed by Pelican.
|
|||
|
||||
'''.format(v=__version__))
|
||||
|
||||
project = os.path.join(os.environ.get('VIRTUAL_ENV', '.'), '.project')
|
||||
project = os.path.join(
|
||||
os.environ.get('VIRTUAL_ENV', os.curdir), '.project')
|
||||
if os.path.isfile(project):
|
||||
CONF['basedir'] = open(project, 'r').read().rstrip("\n")
|
||||
print('Using project associated with current virtual environment.'
|
||||
|
|
|
|||
3
pelican/tools/templates/publishconf.py.in
Normal file → Executable file
3
pelican/tools/templates/publishconf.py.in
Normal file → Executable file
|
|
@ -4,8 +4,9 @@
|
|||
# This file is only used if you use `make publish` or
|
||||
# explicitly specify it as your config file.
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.append('.')
|
||||
sys.path.append(os.curdir)
|
||||
from pelicanconf import *
|
||||
|
||||
SITEURL = '$siteurl'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue