'''
Enchant Spelling: Implements spelling backend based on enchant.
'''


import enchant

from kivy.core.spelling import SpellingBase, NoSuchLangError
from kivy.compat import PY2


class SpellingEnchant(SpellingBase):
    '''
    Spelling backend based on the enchant library.
    '''

    def __init__(self, language=None):
        self._language = None
        super(SpellingEnchant, self).__init__(language)

    def select_language(self, language):
        try:
            self._language = enchant.Dict(language)
        except enchant.DictNotFoundError:
            err = 'Enchant Backend: No language for "%s"' % (language, )
            raise NoSuchLangError(err)

    def list_languages(self):
        # Note: We do NOT return enchant.list_dicts because that also returns
        #       the enchant dict objects and not only the language identifiers.
        return enchant.list_languages()

    def check(self, word):
        if not word:
            return None
        return self._language.check(word)

    def suggest(self, fragment):
        suggestions = self._language.suggest(fragment)
        # Don't show suggestions that are invalid
        suggestions = [s for s in suggestions if self.check(s)]
        if PY2:
            suggestions = [s.decode('utf-8') for s in suggestions]
        return suggestions

kivy/core/spelling/spelling_enchant.py
'''
Enchant Spelling
================

Implementation spelling backend based on enchant.

.. warning:: pyenchant doesn't have dedicated build anymore for Windows/x64.
             See https://github.com/kivy/kivy/issues/5816 for more informations
'''


import enchant

from kivy.core.spelling import SpellingBase, NoSuchLangError
from kivy.compat import PY2


class SpellingEnchant(SpellingBase):
    '''
    Spelling backend based on the enchant library.
    '''

    def __init__(self, language=None):
        self._language = None
        super(SpellingEnchant, self).__init__(language)

    def select_language(self, language):
        try:
            self._language = enchant.Dict(language)
        except enchant.DictNotFoundError:
            err = 'Enchant Backend: No language for "%s"' % (language, )
            raise NoSuchLangError(err)

    def list_languages(self):
        # Note: We do NOT return enchant.list_dicts because that also returns
        #       the enchant dict objects and not only the language identifiers.
        return enchant.list_languages()

    def check(self, word):
        if not word:
            return None
        return self._language.check(word)

    def suggest(self, fragment):
        suggestions = self._language.suggest(fragment)
        # Don't show suggestions that are invalid
        suggestions = [s for s in suggestions if self.check(s)]
        if PY2:
            suggestions = [s.decode('utf-8') for s in suggestions]
        return suggestions

kivy/core/spelling/spelling_enchant.py
diff --git a/kivy/core/spelling/spelling_enchant.py b/kivy/core/spelling/spelling_enchant.py
index 6c408fbb59..7fe8f230f5 100644
--- a/kivy/core/spelling/spelling_enchant.py
+++ b/kivy/core/spelling/spelling_enchant.py
@@ -1,5 +1,11 @@
 '''
-Enchant Spelling: Implements spelling backend based on enchant.
+Enchant Spelling
+================
+
+Implementation spelling backend based on enchant.
+
+.. warning:: pyenchant doesn't have dedicated build anymore for Windows/x64.
+             See https://github.com/kivy/kivy/issues/5816 for more informations
 '''
 
 

enchant - ImportError: No module named 'enchant'
<!--
The issue tracker is a tool to address bugs.
Please use the #kivy IRC channel on freenode or Stack Overflow for
support questions, more information at https://git.io/vM1yQ.

Before opening a new issue, make sure you do the following:
    * check that your issue isn't already filed: https://git.io/vM1iE
    * prepare a short, runnable example that reproduces the issue
    * reproduce the problem with the latest development version of Kivy
    * double-check that the issue is indeed a bug and not a support request
-->

### Versions

* Python: 3.5.2
* OS:Windows-10-10.0.17134-SP0
* Kivy:v1.10.0
* Kivy installation method: follow wiki of kivy on github

### Description

Try to build an app on windows, I'll encounter the problem "No module named 'enchant'"
so I search everwhere I can only to find out that the maintainer have gave up on supporting pyenchant for windows x64 + python3.5 ([here](https://github.com/rfk/pyenchant/issues/42))
So I need to know is there any way to fix this for win10x64+python35

PS: this will not affect the function for my current build, it runs normally, but it is still a potential problem for further development ....

### Code and Logs

```build log
PS G:\Projects\LANRemoteController\LANRemoteController> python3 -m PyInstaller .\server.spec
3730 INFO: PyInstaller: 3.3.1
3730 INFO: Python: 3.5.2
3730 INFO: Platform: Windows-10-10.0.17134-SP0
3730 INFO: UPX is not available.
[INFO   ] [Logger      ] Record log in C:\Users\Administrator\.kivy\logs\kivy_18-06-21_7.txt
4246 INFO: [Logger      ] Record log in C:\Users\Administrator\.kivy\logs\kivy_18-06-21_7.txt
[INFO   ] [Kivy        ] v1.10.0
4246 INFO: [Kivy        ] v1.10.0
[INFO   ] [Python      ] v3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)]
4261 INFO: [Python      ] v3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)]
4261 INFO: Extending PYTHONPATH with paths
['G:\\Projects\\LANRemoteController\\LANRemoteController',
 'G:\\Projects\\LANRemoteController\\LANRemoteController']
4261 INFO: checking Analysis
4386 INFO: Building because inputs changed
4386 INFO: Initializing module dependency graph...
4465 INFO: Initializing module graph hooks...
4543 INFO: Analyzing base_library.zip ...
11617 INFO: running Analysis out00-Analysis.toc
13446 INFO: Caching module hooks...
13539 INFO: Analyzing Server\ServerUI.py
18071 INFO: Loading module hooks...
18071 INFO: Loading module hook "hook-kivy.py"...
[INFO   ] [Factory     ] 194 symbols loaded
18290 INFO: [Factory     ] 194 symbols loaded
[INFO   ] [Logger      ] Record log in C:\Users\Administrator\.kivy\logs\kivy_18-06-21_8.txt
[INFO   ] [Kivy        ] v1.10.0
[INFO   ] [Python      ] v3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)]
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[INFO   ] [Logger      ] Record log in C:\Users\Administrator\.kivy\logs\kivy_18-06-21_9.txt
[INFO   ] [Kivy        ] v1.10.0
[INFO   ] [Python      ] v3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)]
[INFO   ] [AudioGstplayer] Using Gstreamer 1.10.2.0
[INFO   ] [Audio       ] Providers: audio_gstplayer, audio_sdl2 (audio_ffpyplayer ignored)
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[INFO   ] [Camera      ] Provider: opencv
[INFO   ] [Clipboard   ] Provider: winctypes
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [OSC         ] using <thread> for socket
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] GLEW initialization succeeded
[INFO   ] [GL          ] Backend used <glew>
[INFO   ] [GL          ] OpenGL version <b'4.6.0 NVIDIA 390.77'>
[INFO   ] [GL          ] OpenGL vendor <b'NVIDIA Corporation'>
[INFO   ] [GL          ] OpenGL renderer <b'GeForce GTX 970/PCIe/SSE2'>
[INFO   ] [GL          ] OpenGL parsed version: 4, 6
[INFO   ] [GL          ] Shading version <b'4.60 NVIDIA'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <32>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard allowed, single mode, docked
[CRITICAL] [Spelling    ] Unable to find any valuable Spelling provider.
enchant - ImportError: No module named 'enchant'
  File "F:\Develop\Python35\lib\site-packages\kivy\core\__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)
  File "F:\Develop\Python35\lib\site-packages\kivy\core\spelling\spelling_enchant.py", line 6, in <module>
    import enchant

[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [VideoGstplayer] Using Gstreamer 1.10.2.0
[INFO   ] [Video       ] Provider: gstplayer
33203 WARNING: Hidden import "fired." not found!
33797 WARNING: Hidden import "34" not found!
33797 WARNING: Hidden import "Analysing..." not found!
33797 WARNING: Hidden import "files" not found!
35141 WARNING: Hidden import "log" not found!
35234 WARNING: Hidden import "Purge" not found!
35297 WARNING: Hidden import "finished!" not found!
38000 INFO: Processing pre-find module path hook   distutils
45919 INFO: Processing pre-find module path hook   site
45935 INFO: site: retargeting to fake-dir 'F:\\Develop\\Python35\\lib\\site-packages\\PyInstaller\\fake-modules'
53387 INFO: Excluding import 'twisted'
53392 INFO:   Removing import of twisted from module kivy.support
53394 INFO: Import to be excluded not found: '_tkinter'
53395 INFO: Import to be excluded not found: 'tkinter'
53395 INFO: Loading module hook "hook-sysconfig.py"...
53478 INFO: Loading module hook "hook-xml.dom.domreg.py"...
53489 INFO: Loading module hook "hook-pydoc.py"...
53514 INFO: Loading module hook "hook-lib2to3.py"...
53736 INFO: Loading module hook "hook-xml.py"...
53740 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
53744 INFO: Loading module hook "hook-distutils.py"...
53764 INFO: Loading module hook "hook-setuptools.py"...
53826 INFO: Loading module hook "hook-docutils.py"...
60180 INFO: Loading module hook "hook-cv2.py"...
60203 INFO: Loading module hook "hook-pygments.py"...
63610 INFO: Loading module hook "hook-pkg_resources.py"...
64177 INFO: Processing pre-safe import module hook   win32com
64400 INFO: Loading module hook "hook-numpy.core.py"...
64494 INFO: Loading module hook "hook-encodings.py"...
64569 INFO: Loading module hook "hook-pywintypes.py"...
64748 INFO: Loading module hook "hook-win32com.py"...
65425 INFO: Loading module hook "hook-pythoncom.py"...
65662 INFO: Looking for ctypes DLLs
65721 INFO: Analyzing run-time hooks ...
65728 INFO: Including run-time hook 'pyi_rth_kivy.py'
65732 INFO: Including run-time hook 'pyi_rth_pkgres.py'
65767 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
65788 INFO: Including run-time hook 'pyi_rth_gstreamer.py'
65796 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
65821 INFO: Looking for dynamic libraries
80778 INFO: Looking for eggs
80778 INFO: Using Python library F:\Develop\Python35\python35.dll
80793 INFO: Found binding redirects:
[]
80809 INFO: Warnings written to G:\Projects\LANRemoteController\LANRemoteController\build\server\warnserver.txt
80965 INFO: Graph cross-reference written to G:\Projects\LANRemoteController\LANRemoteController\build\server\xref-server.html
81059 INFO: checking PYZ
81074 INFO: Building because toc changed
81074 INFO: Building PYZ (ZlibArchive) G:\Projects\LANRemoteController\LANRemoteController\build\server\out00-PYZ.pyz
82788 INFO: Building PYZ (ZlibArchive) G:\Projects\LANRemoteController\LANRemoteController\build\server\out00-PYZ.pyz completed successfully.
82819 INFO: checking PKG
82819 INFO: Building because G:\Projects\LANRemoteController\LANRemoteController\build\server\out00-PYZ.pyz changed
82819 INFO: Building PKG (CArchive) out00-PKG.pkg
83022 INFO: Building PKG (CArchive) out00-PKG.pkg completed successfully.
83022 INFO: Bootloader F:\Develop\Python35\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
83022 INFO: checking EXE
83022 INFO: Building because manifest changed
83022 INFO: Building EXE from out00-EXE.toc
83085 INFO: Appending archive to EXE G:\Projects\LANRemoteController\LANRemoteController\build\server\server.exe
83335 INFO: Building EXE from out00-EXE.toc completed successfully.
83335 INFO: checking Tree
83335 INFO: Building Tree because out00-Tree.toc is non existent
83335 INFO: Building Tree out00-Tree.toc
83366 INFO: checking Tree
83366 INFO: Building Tree because out01-Tree.toc is non existent
83366 INFO: Building Tree out01-Tree.toc
83382 INFO: checking COLLECT
WARNING: The output directory "G:\Projects\LANRemoteController\LANRemoteController\dist\server" and ALL ITS CONTENTS will be REMOVED! Continue? (y/n)y
134948 INFO: Removing dir G:\Projects\LANRemoteController\LANRemoteController\dist\server
135183 INFO: Building COLLECT out00-COLLECT.toc
136730 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\cv2.cv2.pyd
136730 INFO: Updating resource type 24 name 2 language 1033
137402 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\numpy.core.multiarray.pyd
137402 INFO: Updating resource type 24 name 2 language 1033
137464 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\numpy.core.umath.pyd
137464 INFO: Updating resource type 24 name 2 language 1033
137511 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\numpy.core.multiarray_tests.pyd
137511 INFO: Updating resource type 24 name 2 language 1033
137574 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\numpy.random.mtrand.pyd
137574 INFO: Updating resource type 24 name 2 language 1033
137605 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\numpy.fft.fftpack_lite.pyd
137605 INFO: Updating resource type 24 name 2 language 1033
137636 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\numpy.linalg._umath_linalg.pyd
137636 INFO: Updating resource type 24 name 2 language 1033
137683 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\numpy.linalg.lapack_lite.pyd
137683 INFO: Updating resource type 24 name 2 language 1033
141453 INFO: Building COLLECT out00-COLLECT.toc completed successfully.
```

