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:
Justin Mayer 2014-02-08 14:32:58 -08:00
commit a9d1fdae3d
4 changed files with 12 additions and 6 deletions

View file

@ -274,9 +274,9 @@ needed by Pelican.
try:
with codecs.open(os.path.join(CONF['basedir'], 'Makefile'), 'w', 'utf-8') as fd:
mkfile_template_name = 'Makefile'
py_v = 'PY=python'
py_v = 'PY?=python'
if six.PY3:
py_v = 'PY=python3'
py_v = 'PY?=python3'
template = string.Template(py_v)
fd.write(template.safe_substitute(CONF))
fd.write('\n')
@ -296,9 +296,9 @@ needed by Pelican.
try:
with codecs.open(os.path.join(CONF['basedir'], 'develop_server.sh'), 'w', 'utf-8') as fd:
lines = list(get_template('develop_server.sh'))
py_v = 'PY=python\n'
py_v = 'PY=${PY:-python}\n'
if six.PY3:
py_v = 'PY=python3\n'
py_v = 'PY=${PY:-python3}\n'
lines = lines[:4] + [py_v] + lines[4:]
for line in lines:
template = string.Template(line)