sphinx-contrib / sphinx-pretty-searchresults

Sphinx: pretty search results is an extension for the Sphinx documentation tool. To display search results, Sphinx is fetching the source files of search hits and rendering excerpts in raw markup. This extension removes the markup from these source files (during build time), so the search results look decent.
https://pypi.python.org/pypi/sphinxprettysearchresults
MIT License
22 stars 5 forks source link

Extension throws exception when build 3 times #14

Closed ArtFlag closed 7 years ago

ArtFlag commented 7 years ago

Hi,

The extension does the job, and thanks for that 👍 , but breaks the build when I run make html 3 times in a row.

Exception occurred:
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 292, in move
    raise Error, "Destination path '%s' already exists" % real_dst
Error: Destination path '/Users/artflag/repositories/documentation/build/html/_raw_sources/_sources' already exists

The workaround is to run make clean when the error pops-up.

Here is the full content of the log file:

# Sphinx version: 1.6.2
# Python version: 2.7.10 (CPython)
# Docutils version: 0.13.1 release
# Jinja2 version: 2.9.6
# Last messages:
#   loading pickled environment...
#   done
#   building [mo]: targets for 0 po files that are out of date
#   building [html]: targets for 0 source files that are out of date
#   updating environment:
#   0 added, 0 changed, 0 removed
#   looking for now-outdated files...
#   none found
#   no targets are out of date.
#   build succeeded.
# Loaded extensions:
#   sphinxprettysearchresults (unknown version) from /Library/Python/2.7/site-packages/sphinxprettysearchresults/__init__.pyc
#   sphinx.ext.todo (1.6.2) from /Library/Python/2.7/site-packages/sphinx/ext/todo.pyc
#   alabaster (0.7.10) from /Library/Python/2.7/site-packages/alabaster/__init__.pyc
#   sphinx.ext.ifconfig (1.6.2) from /Library/Python/2.7/site-packages/sphinx/ext/ifconfig.pyc
#   sphinxcontrib.fulltoc (unknown version) from /Library/Python/2.7/site-packages/sphinxcontrib/fulltoc.pyc
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/sphinx/cmdline.py", line 306, in main
    app.build(opts.force_all, filenames)
  File "/Library/Python/2.7/site-packages/sphinx/application.py", line 357, in build
    self.emit('build-finished', None)
  File "/Library/Python/2.7/site-packages/sphinx/application.py", line 489, in emit
    return self.events.emit(event, self, *args)
  File "/Library/Python/2.7/site-packages/sphinx/events.py", line 79, in emit
    results.append(callback(*args))
  File "/Library/Python/2.7/site-packages/sphinxprettysearchresults/__init__.py", line 48, in build_search_snippets
    clean_txts(app.config.language, app.srcdir, app.outdir, source_suffix, app.config.use_old_search_snippets)
  File "/Library/Python/2.7/site-packages/sphinxprettysearchresults/__init__.py", line 22, in clean_txts
    shutil.move(sources_path, outdir + '/_raw_sources')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 292, in move
    raise Error, "Destination path '%s' already exists" % real_dst
Error: Destination path '/Users/artflag/repositories/documentation/build/html/_raw_sources/_sources' already exists

Could you provide a fix for that?

Thank you!

TimKam commented 7 years ago

Thanks for reporting this issue. I can reproduce it and will fix it asap.

TimKam commented 7 years ago

Fixed