mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
PY and PELICAN env variable overrides for Make
This allows the user to set PY and/or PELICAN environment variable overrides, which will be respected by the Makefile and devserver.sh. If, for example, the default Python on your system were Python 3 and you wanted to run Make with Python 2, using bash you could run `PY=python2 make`. Refs #915.
This commit is contained in:
parent
9b36437d97
commit
a9d1fdae3d
4 changed files with 12 additions and 6 deletions
|
|
@ -271,6 +271,12 @@ use rsync over ssh::
|
||||||
|
|
||||||
That's it! Your site should now be live.
|
That's it! Your site should now be live.
|
||||||
|
|
||||||
|
(The default ``Makefile`` and ``devserver.sh`` scripts use the ``python`` and
|
||||||
|
``pelican`` executables to complete its tasks. If you want to use different
|
||||||
|
executables, such as ``python3``, you can set the ``PY`` and ``PELICAN``
|
||||||
|
environment variables, respectively, to override the default executable names.)
|
||||||
|
|
||||||
|
|
||||||
Writing content using Pelican
|
Writing content using Pelican
|
||||||
=============================
|
=============================
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -274,9 +274,9 @@ needed by Pelican.
|
||||||
try:
|
try:
|
||||||
with codecs.open(os.path.join(CONF['basedir'], 'Makefile'), 'w', 'utf-8') as fd:
|
with codecs.open(os.path.join(CONF['basedir'], 'Makefile'), 'w', 'utf-8') as fd:
|
||||||
mkfile_template_name = 'Makefile'
|
mkfile_template_name = 'Makefile'
|
||||||
py_v = 'PY=python'
|
py_v = 'PY?=python'
|
||||||
if six.PY3:
|
if six.PY3:
|
||||||
py_v = 'PY=python3'
|
py_v = 'PY?=python3'
|
||||||
template = string.Template(py_v)
|
template = string.Template(py_v)
|
||||||
fd.write(template.safe_substitute(CONF))
|
fd.write(template.safe_substitute(CONF))
|
||||||
fd.write('\n')
|
fd.write('\n')
|
||||||
|
|
@ -296,9 +296,9 @@ needed by Pelican.
|
||||||
try:
|
try:
|
||||||
with codecs.open(os.path.join(CONF['basedir'], 'develop_server.sh'), 'w', 'utf-8') as fd:
|
with codecs.open(os.path.join(CONF['basedir'], 'develop_server.sh'), 'w', 'utf-8') as fd:
|
||||||
lines = list(get_template('develop_server.sh'))
|
lines = list(get_template('develop_server.sh'))
|
||||||
py_v = 'PY=python\n'
|
py_v = 'PY=${PY:-python}\n'
|
||||||
if six.PY3:
|
if six.PY3:
|
||||||
py_v = 'PY=python3\n'
|
py_v = 'PY=${PY:-python3}\n'
|
||||||
lines = lines[:4] + [py_v] + lines[4:]
|
lines = lines[:4] + [py_v] + lines[4:]
|
||||||
for line in lines:
|
for line in lines:
|
||||||
template = string.Template(line)
|
template = string.Template(line)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
PELICAN=$pelican
|
PELICAN?=$pelican
|
||||||
PELICANOPTS=$pelicanopts
|
PELICANOPTS=$pelicanopts
|
||||||
|
|
||||||
BASEDIR=$$(CURDIR)
|
BASEDIR=$$(CURDIR)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
##
|
##
|
||||||
# This section should match your Makefile
|
# This section should match your Makefile
|
||||||
##
|
##
|
||||||
PELICAN=$pelican
|
PELICAN=$${PELICAN:-$pelican}
|
||||||
PELICANOPTS=$pelicanopts
|
PELICANOPTS=$pelicanopts
|
||||||
|
|
||||||
BASEDIR=$$(pwd)
|
BASEDIR=$$(pwd)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue