Skip to content

Commit 034363d

Browse files
committed
more updatees for 1.7
1 parent 74187ab commit 034363d

File tree

7 files changed

+54
-14
lines changed

7 files changed

+54
-14
lines changed

.pep8speaks.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
pycodestyle:
2+
max-line-length: 120 # Default is 79 in PEP8
3+
exclude:
4+
- setup.py
5+
- ez_setup.py
6+
- ah_bootstrap.py
7+
- astropy_helpers/
8+
- docs/conf.py
9+
descending_issues_order: True

ablog/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# -*- coding: utf-8 -*-
22
"""ABlog for Sphinx"""
3+
4+
from __future__ import absolute_import, division, print_function
35
import os
46

57
from .blog import Blog, CONFIG

ablog/blog.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
"""Classes for handling posts and archives."""
33

4+
from __future__ import absolute_import, division, print_function
45
import os
56
import re
67
import sys

ablog/commands.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1+
from __future__ import absolute_import, division, print_function
12
import os
23
import sys
34
import glob
45
import ablog
56
import shutil
67
import argparse
8+
from distutils.version import LooseVersion
9+
10+
from sphinx import __version__
711

812
BUILDDIR = '_website'
913
DOCTREES = '.doctrees'
10-
14+
SPHINX_LT_17 = LooseVersion(__version__) < LooseVersion('1.7')
1115

1216
def find_confdir():
1317
"""Return path to current directory or its parent that contains conf.py"""
@@ -139,7 +143,6 @@ def arg_doctrees(func):
139143
def ablog_build(builder=None, sourcedir=None, website=None, doctrees=None,
140144
traceback=False, runpdb=False, allfiles=False, werror=False, verbosity=0,
141145
quiet=False, extra_quiet=False, no_colors=False, **kwargs):
142-
143146
confdir = find_confdir()
144147
conf = read_conf(confdir)
145148
website = (website or
@@ -168,8 +171,14 @@ def ablog_build(builder=None, sourcedir=None, website=None, doctrees=None,
168171
argv.extend(['-N'])
169172
argv.extend([sourcedir, website])
170173

171-
from sphinx import main
172-
main(argv)
174+
if SPHINX_LT_17:
175+
from sphinx import main
176+
main(argv)
177+
else:
178+
from sphinx.cmd.build import main
179+
# srcdir, confdir, outdir, doctreedir, buildername is the order now
180+
argv = []
181+
main(argv)
173182

174183

175184
@arg('-D', dest='deep', action='store_true', default=False,

ablog/post.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
"""post and postlist directives."""
33

4+
from __future__ import absolute_import, division, print_function
45
import os
56
import sys
67
from string import Formatter

ablog/start.py

+27-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
2+
from __future__ import absolute_import, division, print_function
33
import sys
44
import time
55
import datetime
@@ -559,7 +559,10 @@ def ask_user(d):
559559
print(bold('Selected root path: %s' % d['path']))
560560
else:
561561
print('Enter the root path for your blog project.')
562-
do_prompt(d, 'path', 'Root path for your project', '.', is_path)
562+
if SPHINX_LT_17:
563+
do_prompt(d, 'path', 'Root path for your project', '.', is_path)
564+
else:
565+
d['path'] = do_prompt('Root path for your project', '.', is_path)
563566

564567
while path.isfile(path.join(d['path'], 'conf.py')) or \
565568
path.isfile(path.join(d['path'], 'source', 'conf.py')):
@@ -568,8 +571,10 @@ def ask_user(d):
568571
'selected root path.')))
569572
print('ablog start will not overwrite existing Sphinx projects.')
570573
print('')
571-
do_prompt(d, 'path',
572-
'Please enter a new root path (or just Enter to exit)', '', is_path)
574+
if SPHINX_LT_17:
575+
do_prompt(d, 'path','Please enter a new root path (or just Enter to exit)', '', is_path)
576+
else:
577+
d['path'] = do_prompt('Please enter a new root path (or just Enter to exit)', '', is_path)
573578
if not d['path']:
574579
sys.exit(1)
575580

@@ -579,14 +584,20 @@ def ask_user(d):
579584
'including blog archive pages and atom feeds. Later, you can '
580585
'set separate names for different parts of the website in '
581586
'configuration file.'))
582-
do_prompt(d, 'project', 'Project name')
587+
if SPHINX_LT_17:
588+
do_prompt(d, 'project', 'Project name')
589+
else:
590+
d['project'] = do_prompt('Project name')
583591

584592
if 'author' not in d:
585593
print(w('This of author as the copyright holder of the content. '
586594
'If your blog has multiple authors, you might want to enter '
587595
'a team name here. Later, you can specify individual authors '
588596
'using `blog_authors` configuration option.'))
589-
do_prompt(d, 'author', 'Author name(s)')
597+
if SPHINX_LT_17:
598+
do_prompt(d, 'author', 'Author name(s)')
599+
else:
600+
d['author'] = do_prompt('Author name(s)')
590601

591602
d['release'] = d['version'] = ''
592603

@@ -597,16 +608,22 @@ def ask_user(d):
597608
'selected root path.' % (d['master'] + d['suffix']))))
598609
print('ablog-start will not overwrite the existing file.')
599610
print('')
600-
do_prompt(d, 'master', w('Please enter a new file name, or rename the '
601-
'existing file and press Enter'), d['master'])
611+
if SPHINX_LT_17:
612+
do_prompt(d, 'master', w('Please enter a new file name, or rename the '
613+
'existing file and press Enter'), d['master'])
614+
else:
615+
d['master'] = do_prompt(w('Please enter a new file name, or rename the '
616+
'existing file and press Enter'), d['master'])
602617

603618
if 'blog_baseurl' not in d:
604619
print('')
605620
print(w('Please enter the base URL for your project. Blog feeds will '
606621
'be generated relative to this URL. If you don\'t have one yet, '
607622
'you can set it in configuration file later.'))
608-
do_prompt(d, 'blog_baseurl', 'Base URL for your project',
609-
None, lambda x: True)
623+
if SPHINX_LT_17:
624+
do_prompt(d, 'blog_baseurl', 'Base URL for your project', None, lambda x: True)
625+
else:
626+
d['blog_baseurl'] = do_prompt('Base URL for your project', None, lambda x: True)
610627

611628
print('')
612629

docs/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2+
from __future__ import absolute_import, division, print_function
23
import os
34
import sys
45

0 commit comments

Comments
 (0)