mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Update pelican_quickstart.py
Have pelican_quickstart generate a requirements.txt
This commit is contained in:
parent
940d4534a1
commit
c01eb8e6ef
1 changed files with 14 additions and 3 deletions
|
|
@ -8,9 +8,9 @@ import locale
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from jinja2 import Environment, FileSystemLoader
|
import pkg_resources
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
|
from jinja2 import Environment, FileSystemLoader
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import readline # NOQA
|
import readline # NOQA
|
||||||
|
|
@ -19,6 +19,7 @@ except ImportError:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import tzlocal
|
import tzlocal
|
||||||
|
|
||||||
_DEFAULT_TIMEZONE = tzlocal.get_localzone().zone
|
_DEFAULT_TIMEZONE = tzlocal.get_localzone().zone
|
||||||
except ImportError:
|
except ImportError:
|
||||||
_DEFAULT_TIMEZONE = 'Europe/Paris'
|
_DEFAULT_TIMEZONE = 'Europe/Paris'
|
||||||
|
|
@ -45,7 +46,6 @@ _jinja_env = Environment(
|
||||||
trim_blocks=True,
|
trim_blocks=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
_GITHUB_PAGES_BRANCHES = {
|
_GITHUB_PAGES_BRANCHES = {
|
||||||
'personal': 'master',
|
'personal': 'master',
|
||||||
'project': 'gh-pages'
|
'project': 'gh-pages'
|
||||||
|
|
@ -111,6 +111,7 @@ def decoding_strings(f):
|
||||||
else:
|
else:
|
||||||
return out.decode(sys.stdin.encoding)
|
return out.decode(sys.stdin.encoding)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -189,6 +190,14 @@ def ask(question, answer=str_compat, default=None, length=None):
|
||||||
'Argument `answer` must be str_compat, bool, or integer')
|
'Argument `answer` must be str_compat, bool, or integer')
|
||||||
|
|
||||||
|
|
||||||
|
def write_requirements_txt():
|
||||||
|
distribution = pkg_resources.working_set.by_key['pelican']
|
||||||
|
with open(os.path.join(CONF['basedir'], 'requirements.txt'), 'w') as f:
|
||||||
|
f.write('{}\n'.format(distribution.as_requirement()))
|
||||||
|
for dependency in sorted(distribution.requires()):
|
||||||
|
f.write('{}\n'.format(dependency))
|
||||||
|
|
||||||
|
|
||||||
def ask_timezone(question, default, tzurl):
|
def ask_timezone(question, default, tzurl):
|
||||||
"""Prompt for time zone and validate input"""
|
"""Prompt for time zone and validate input"""
|
||||||
lower_tz = [tz.lower() for tz in pytz.all_timezones]
|
lower_tz = [tz.lower() for tz in pytz.all_timezones]
|
||||||
|
|
@ -362,6 +371,8 @@ needed by Pelican.
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print('Error: {0}'.format(e))
|
print('Error: {0}'.format(e))
|
||||||
|
|
||||||
|
write_requirements_txt()
|
||||||
|
|
||||||
if automation:
|
if automation:
|
||||||
try:
|
try:
|
||||||
with codecs.open(os.path.join(CONF['basedir'], 'tasks.py'),
|
with codecs.open(os.path.join(CONF['basedir'], 'tasks.py'),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue