Skip to content

Commit b2f0c68

Browse files
committed
Fix Sphinx warnings in docs. Docs build on Windows
Windows can't run setup.py since it's not a win32 application. Fixing this by importing setup instead of running it in docs/conf.py. Fixing Sphinx warnings (nfsn link text needs to be changed too). Using latest googleanalytics sphinx extension from bitbutcket since the PyPI one is really old. Sphinx warnings are errors again in docs. Can never be in scv.overflow though thanks to tags with nfsn label duplicated.
1 parent 49addae commit b2f0c68

File tree

4 files changed

+49
-48
lines changed

4 files changed

+49
-48
lines changed

docs/conf.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22

33
import os
44
import time
5-
from subprocess import check_output
65

7-
SETUP = os.path.join(os.path.dirname(__file__), '..', 'setup.py')
6+
from setup import NAME, VERSION
87

98

109
# General configuration.
11-
author = check_output([SETUP, '--author']).strip().decode('ascii')
10+
author = '@Robpol86'
1211
copyright = '{}, {}'.format(time.strftime('%Y'), author)
1312
master_doc = 'index'
14-
project = check_output([SETUP, '--name']).strip().decode('ascii')
13+
project = NAME
1514
pygments_style = 'friendly'
16-
release = version = check_output([SETUP, '--version']).strip().decode('ascii')
15+
release = version = VERSION
1716
templates_path = ['_templates']
1817
extensions = list()
1918

docs/nfsn.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
NearlyFreeSpeech.NET
55
====================
66

7-
This guide will go over how to host your built documentation on `NFSN <https://www.nearlyfreespeech.net/>`_. We'll be
8-
using GitHub and Travis CI to actually build the docs and push them to NFSN but any other providers can be substituted.
7+
This guide will go over how to host your built documentation on `NearlyFreeSpeech <https://www.nearlyfreespeech.net/>`_.
8+
We'll be using GitHub and Travis CI to actually build the docs and push them to NFSN but any other providers can be
9+
substituted.
910

1011
We'll be covering two methods of having NFSN host your documentation: using ``rsync`` to transfer HTML files to NFSN and
1112
using a remote git repository hosted on NFSN using ``git init --bare`` and having a git hook export HTML files to the

setup.py

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -73,42 +73,43 @@ def run(cls):
7373
raise SystemExit('Missing/unordered pinned dependencies in tox.ini.')
7474

7575

76-
setup(
77-
author='@Robpol86',
78-
author_email='[email protected]',
79-
classifiers=[
80-
'Development Status :: 5 - Production/Stable',
81-
'Environment :: Console',
82-
'Framework :: Sphinx :: Extension',
83-
'Intended Audience :: Developers',
84-
'License :: OSI Approved :: MIT License',
85-
'Operating System :: MacOS',
86-
'Operating System :: POSIX :: Linux',
87-
'Operating System :: POSIX',
88-
'Programming Language :: Python :: 2.7',
89-
'Programming Language :: Python :: 3.3',
90-
'Programming Language :: Python :: 3.4',
91-
'Programming Language :: Python :: 3.5',
92-
'Programming Language :: Python :: Implementation :: PyPy',
93-
'Topic :: Documentation :: Sphinx',
94-
'Topic :: Software Development :: Documentation',
95-
],
96-
cmdclass=dict(check_version=CheckVersion),
97-
description='Sphinx extension that allows building versioned docs for self-hosting.',
98-
entry_points={'console_scripts': ['sphinx-versioning = sphinxcontrib.versioning.__main__:cli']},
99-
install_requires=INSTALL_REQUIRES,
100-
keywords='sphinx versioning versions version branches tags',
101-
license=LICENSE,
102-
long_description=readme(),
103-
name=NAME,
104-
package_data={'': [
105-
os.path.join('_static', 'banner.css'),
106-
os.path.join('_templates', 'banner.html'),
107-
os.path.join('_templates', 'layout.html'),
108-
os.path.join('_templates', 'versions.html'),
109-
]},
110-
packages=['sphinxcontrib', os.path.join('sphinxcontrib', 'versioning')],
111-
url='https://github.com/Robpol86/' + NAME,
112-
version=VERSION,
113-
zip_safe=False,
114-
)
76+
if __name__ == '__main__':
77+
setup(
78+
author='@Robpol86',
79+
author_email='[email protected]',
80+
classifiers=[
81+
'Development Status :: 5 - Production/Stable',
82+
'Environment :: Console',
83+
'Framework :: Sphinx :: Extension',
84+
'Intended Audience :: Developers',
85+
'License :: OSI Approved :: MIT License',
86+
'Operating System :: MacOS',
87+
'Operating System :: POSIX :: Linux',
88+
'Operating System :: POSIX',
89+
'Programming Language :: Python :: 2.7',
90+
'Programming Language :: Python :: 3.3',
91+
'Programming Language :: Python :: 3.4',
92+
'Programming Language :: Python :: 3.5',
93+
'Programming Language :: Python :: Implementation :: PyPy',
94+
'Topic :: Documentation :: Sphinx',
95+
'Topic :: Software Development :: Documentation',
96+
],
97+
cmdclass=dict(check_version=CheckVersion),
98+
description='Sphinx extension that allows building versioned docs for self-hosting.',
99+
entry_points={'console_scripts': ['sphinx-versioning = sphinxcontrib.versioning.__main__:cli']},
100+
install_requires=INSTALL_REQUIRES,
101+
keywords='sphinx versioning versions version branches tags',
102+
license=LICENSE,
103+
long_description=readme(),
104+
name=NAME,
105+
package_data={'': [
106+
os.path.join('_static', 'banner.css'),
107+
os.path.join('_templates', 'banner.html'),
108+
os.path.join('_templates', 'layout.html'),
109+
os.path.join('_templates', 'versions.html'),
110+
]},
111+
packages=['sphinxcontrib', os.path.join('sphinxcontrib', 'versioning')],
112+
url='https://github.com/Robpol86/' + NAME,
113+
version=VERSION,
114+
zip_safe=False,
115+
)

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ deps =
4040
[testenv:docs]
4141
changedir = {toxinidir}/docs
4242
commands =
43-
sphinx-build -a -E . _build/html
43+
sphinx-build -a -E -W . _build/html
4444
deps =
4545
{[general]install_requires}
4646
sphinx-rtd-theme==0.1.10a0
47-
sphinxcontrib-googleanalytics==0.1
47+
https://bitbucket.org/birkenfeld/sphinx-contrib/get/49d179fdc906.zip#egg=ga&subdirectory=googleanalytics
4848

4949
[testenv:docsV]
5050
commands =

0 commit comments

Comments
 (0)