Skip to content

Commit

Permalink
Merge pull request #163 from nyergler/nyergler--fix-sphinx-dev
Browse files Browse the repository at this point in the history
Fix ImportError of copy_static_entry (removed since Sphinx-2.0)
  • Loading branch information
nyergler committed Aug 1, 2019
2 parents ac4535d + bfc3b1a commit ea690dd
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
33 changes: 19 additions & 14 deletions .travis.yml
Expand Up @@ -6,27 +6,32 @@ python:
- "3.7"

env:
- SPHINX_SPEC='~=1.7.0'
- SPHINX_SPEC='~=1.8.0'
- SPHINX_SPEC='~=2.0.0'
- SPHINX_SPEC='~=2.1.0'
- SPHINX_SPEC='sphinx~=1.7.0'
- SPHINX_SPEC='sphinx~=1.8.0'
- SPHINX_SPEC='sphinx~=2.0.0'
- SPHINX_SPEC='sphinx~=2.1.0'
# latest release
- SPHINX_SPEC=''
- SPHINX_SPEC='sphinx'
# master branch (in development)
- SPHINX_SPEC='git+https://github.com/sphinx-doc/sphinx.git#egg=Sphinx'

matrix:
# exclude non Python2 compatible Sphinx versions
exclude:
- python:
"2.7"
env:
SPHINX_SPEC='~=2.0.0'
- python:
"2.7"
env:
SPHINX_SPEC='~=2.1.0'
- python: "2.7"
env: SPHINX_SPEC='sphinx~=2.0.0'
- python: "2.7"
env: SPHINX_SPEC='sphinx~=2.1.0'
- python: "2.7"
env: SPHINX_SPEC='sphinx'
- python: "2.7"
env: SPHINX_SPEC='git+https://github.com/sphinx-doc/sphinx.git#egg=Sphinx'

allow_failures:
- env: SPHINX_SPEC='git+https://github.com/sphinx-doc/sphinx.git#egg=Sphinx'

install:
- pip install coveralls sphinx_rtd_theme "sphinx${SPHINX_SPEC:-}"
- pip install coveralls sphinx_rtd_theme "${SPHINX_SPEC}"
- python setup.py install

script:
Expand Down
13 changes: 10 additions & 3 deletions src/hieroglyph/builder.py
Expand Up @@ -10,7 +10,11 @@
StandaloneHTMLBuilder,
DirectoryHTMLBuilder,
)
from sphinx.util import copy_static_entry
try:
from sphinx.util.fileutil import copy_asset_file
except ImportError:
copy_asset_file = None
from sphinx.util import copy_static_entry

from hieroglyph import writer
from hieroglyph import directives
Expand Down Expand Up @@ -174,13 +178,16 @@ def copy_static_files(self):
ctx = self.globalcontext.copy()
ctx.update(self.indexer.context_for_searchtool())

staticdir = os.path.join(self.outdir, '_static')
for theme in self._additional_themes[1:]:

themeentries = [os.path.join(themepath, 'static')
for themepath in theme.get_theme_dirs()[::-1]]
for entry in themeentries:
copy_static_entry(entry, os.path.join(self.outdir, '_static'),
self, ctx)
if copy_asset_entry:
copy_asset_entry(entry, staticdir, ctx)
else:
copy_static_entry(entry, staticdir, self, ctx)

return result

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -11,7 +11,7 @@ deps =
sphinx18: Sphinx~=1.8.0
sphinx20: Sphinx~=2.0.0
sphinx21: Sphinx~=2.1.0
sphinxtip: git+https://github.com/sphinx-doc/sphinx.git#egg=Sphinx-dev
sphinxtip: git+https://github.com/sphinx-doc/sphinx.git#egg=Sphinx
whitelist_externals=
rake
bundle
Expand Down

0 comments on commit ea690dd

Please sign in to comment.