Skip to content

Commit f8e71bf

Browse files
authored
Don't require npm to build from source (#1039)
1 parent 85f23c9 commit f8e71bf

File tree

6 files changed

+51
-55
lines changed

6 files changed

+51
-55
lines changed

.readthedocs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
version: 2
22

33
python:
4-
version: 3
4+
version: 3.8
55
install:
66
- requirements: docs/requirements.txt
7+
- method: pip
8+
path: .
79

810
sphinx:
911
configuration: docs/conf.py

docs/contributing.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,17 @@ To release a new version of the theme, core team will take the following steps:
101101
#. Update the changelog (``docs/changelog.rst``) with the version information.
102102
#. Run ``python setup.py update_translations`` to compile new translation files
103103
and update Transifex.
104-
#. Run ``python setup.py build`` to rebuild all the theme assets and the Python
104+
#. Run ``python setup.py build_assets`` to rebuild all the theme assets and the Python
105105
package.
106106
#. Commit these changes.
107107
#. Tag the release in git: ``git tag $NEW_VERSION``.
108108
#. Push the tag to GitHub: ``git push --tags origin``.
109109
#. Upload the package to PyPI:
110110

111-
.. code:: console
111+
.. code:: console
112112
113-
$ rm -rf dist/
114-
$ python setup.py sdist bdist_wheel
115-
$ twine upload --sign --identity [email protected] dist/*
113+
$ rm -rf dist/
114+
$ python setup.py sdist bdist_wheel
115+
$ twine upload --sign --identity [email protected] dist/*
116116
117117
.. _PEP440: https://www.python.org/dev/peps/pep-0440/

docs/installing.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,20 @@ In your ``conf.py`` file:
2323
2424
2525
.. note::
26-
Adding this theme as an extension is what enables localization of theme
27-
strings in your translated output. If these strings are not translated in
28-
your output, either we lack the localized strings for your locale, or you
29-
are using an old version of the theme.
26+
27+
Adding this theme as an extension is what enables localization of theme
28+
strings in your translated output. If these strings are not translated in
29+
your output, either we lack the localized strings for your locale, or you
30+
are using an old version of the theme.
3031

3132
Via Git or Download
3233
===================
3334

35+
.. warning::
36+
37+
Installing directly from the repo is deprecated.
38+
Static assets won't be included in the repo in a future release.
39+
3440
Symlink or subtree the ``sphinx_rtd_theme/sphinx_rtd_theme`` repository into your documentation at
3541
``docs/_themes/sphinx_rtd_theme`` then add the following two settings to your Sphinx
3642
``conf.py`` file:

package-lock.json

Lines changed: 11 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

setup.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
# -*- coding: utf-8 -*-
2-
"""`sphinx_rtd_theme` lives on `Github`_.
3-
4-
.. _github: https://github.com/readthedocs/sphinx_rtd_theme
5-
6-
"""
72

3+
import distutils.cmd
84
import os
95
import subprocess
10-
import distutils.cmd
11-
import setuptools.command.build_py
126
from io import open
7+
138
from setuptools import setup
149

1510

16-
class WebpackBuildCommand(setuptools.command.build_py.build_py):
11+
class WebpackBuildCommand(distutils.cmd.Command):
12+
13+
description = "Generate static assets"
14+
15+
user_options = []
1716

18-
"""Prefix Python build with Webpack asset build"""
17+
def initialize_options(self):
18+
pass
19+
20+
def finalize_options(self):
21+
pass
1922

2023
def run(self):
2124
if not 'CI' in os.environ and not 'TOX_ENV_NAME' in os.environ:
2225
subprocess.run(['npm', 'install'], check=True)
2326
subprocess.run(['node_modules/.bin/webpack', '--config', 'webpack.prod.js'], check=True)
24-
setuptools.command.build_py.build_py.run(self)
2527

2628

2729
class WebpackDevelopCommand(distutils.cmd.Command):
@@ -95,7 +97,7 @@ def run(self):
9597
cmdclass={
9698
'update_translations': UpdateTranslationsCommand,
9799
'transifex': TransifexCommand,
98-
'build_py': WebpackBuildCommand,
100+
'build_assets': WebpackBuildCommand,
99101
'watch': WebpackDevelopCommand,
100102
},
101103
zip_safe=False,
@@ -137,12 +139,17 @@ def run(self):
137139
'Intended Audience :: Developers',
138140
'Programming Language :: Python :: 2.7',
139141
'Programming Language :: Python :: 3',
140-
'Programming Language :: Python :: 3.3',
141-
'Programming Language :: Python :: 3.4',
142-
'Programming Language :: Python :: 3.5',
143142
'Programming Language :: Python :: 3.6',
143+
'Programming Language :: Python :: 3.7',
144+
'Programming Language :: Python :: 3.8',
145+
'Programming Language :: Python :: 3.9',
144146
'Operating System :: OS Independent',
145147
'Topic :: Documentation',
146148
'Topic :: Software Development :: Documentation',
147149
],
150+
project_urls={
151+
'Homepage': 'https://sphinx-rtd-theme.readthedocs.io/',
152+
'Source Code': 'https://github.com/readthedocs/sphinx_rtd_theme',
153+
'Issue Tracker': 'https://github.com/readthedocs/sphinx_rtd_theme/issues',
154+
},
148155
)

sphinx_rtd_theme/static/css/theme.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)