# Monkey patch "English" language regular expression so we could
# search for package names as well
import re
-from sphinx.search.en import SearchEnglish
-SearchEnglish._word_re = re.compile(r'[-.\w]+(?u)')
+word_re = re.compile(r'[-.\w]+(?u)')
+
+import sphinx.search
+# older versions (before 1.1.3, 1.0.7 for sure) had no language
+# customizations
+if hasattr(sphinx.search, 'word_re'):
+ sphinx.search.word_re = word_re
+else:
+ from sphinx.search.en import SearchEnglish
+ SearchEnglish._word_re = word_re
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.