diff --git a/pelican/tools/pelican_quickstart.py b/pelican/tools/pelican_quickstart.py index 7fdaa489..a6045256 100755 --- a/pelican/tools/pelican_quickstart.py +++ b/pelican/tools/pelican_quickstart.py @@ -37,6 +37,7 @@ def _input_compat(prompt): if six.PY3: r = input(prompt) else: + # FIXME: why use this with @decoding_strings? r = raw_input(prompt).decode('utf-8') return r @@ -50,7 +51,10 @@ def decoding_strings(f): out = f(*args, **kwargs) if isinstance(out, six.string_types) and not six.PY3: # todo: make encoding configurable? - return out.decode(sys.stdin.encoding) + if six.PY3: + return out + else: + return out.decode(sys.stdin.encoding) return out return wrapper @@ -243,7 +247,14 @@ needed by Pelican. if mkfile: try: with codecs.open(os.path.join(CONF['basedir'], 'Makefile'), 'w', 'utf-8') as fd: - for line in get_template('Makefile'): + mkfile_template_name = 'Makefile' + py_v = 'PY=python' + if six.PY3: + py_v = 'PY=python3' + template = string.Template(py_v) + fd.write(template.safe_substitute(CONF)) + fd.write('\n') + for line in get_template(mkfile_template_name): template = string.Template(line) fd.write(template.safe_substitute(CONF)) fd.close() @@ -258,7 +269,12 @@ needed by Pelican. conf_shell[key] = value try: with codecs.open(os.path.join(CONF['basedir'], 'develop_server.sh'), 'w', 'utf-8') as fd: - for line in get_template('develop_server.sh'): + lines = list(get_template('develop_server.sh')) + py_v = 'PY=python\n' + if six.PY3: + py_v = 'PY=python3\n' + lines = lines[:4] + [py_v] + lines[4:] + for line in lines: template = string.Template(line) fd.write(template.safe_substitute(conf_shell)) fd.close() diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in index e20fc612..50fe7081 100644 --- a/pelican/tools/templates/Makefile.in +++ b/pelican/tools/templates/Makefile.in @@ -53,7 +53,7 @@ regenerate: clean $$(PELICAN) -r $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS) serve: - cd $$(OUTPUTDIR) && python -m pelican.server + cd $$(OUTPUTDIR) && $(PY) -m pelican.server devserver: $$(BASEDIR)/develop_server.sh restart diff --git a/pelican/tools/templates/develop_server.sh.in b/pelican/tools/templates/develop_server.sh.in index ab81a298..65c54622 100755 --- a/pelican/tools/templates/develop_server.sh.in +++ b/pelican/tools/templates/develop_server.sh.in @@ -65,7 +65,7 @@ function start_up(){ pelican_pid=$$! echo $$pelican_pid > $$PELICAN_PID cd $$OUTPUTDIR - python -m pelican.server & + $PY -m pelican.server & srv_pid=$$! echo $$srv_pid > $$SRV_PID cd $$BASEDIR