|
1 | 1 | from __future__ import print_function, absolute_import
|
2 | 2 |
|
| 3 | +from importlib import import_module |
| 4 | + |
3 | 5 | from distutils import sysconfig
|
4 | 6 | from distutils import version
|
5 | 7 | from distutils.core import Extension
|
@@ -424,13 +426,20 @@ class SetupPackage(object):
|
424 | 426 |
|
425 | 427 | def check(self):
|
426 | 428 | """
|
427 |
| - Checks whether the dependencies are met. Should raise a |
428 |
| - `CheckFailed` exception if the dependency could not be met, |
429 |
| - otherwise return a string indicating a version number or some |
430 |
| - other message indicating what was found. |
| 429 | + Checks whether the build dependencies are met. Should raise a |
| 430 | + `CheckFailed` exception if the dependency could not be met, otherwise |
| 431 | + return a string indicating a version number or some other message |
| 432 | + indicating what was found. |
431 | 433 | """
|
432 | 434 | pass
|
433 | 435 |
|
| 436 | + def runtime_check(self): |
| 437 | + """ |
| 438 | + True if the runtime dependencies of the backend are met. Assumes that |
| 439 | + the build-time dependencies are met. |
| 440 | + """ |
| 441 | + return True |
| 442 | + |
434 | 443 | def get_packages(self):
|
435 | 444 | """
|
436 | 445 | Get a list of package names to add to the configuration.
|
@@ -1643,6 +1652,16 @@ class BackendTkAgg(OptionalBackendPackage):
|
1643 | 1652 | def check(self):
|
1644 | 1653 | return "installing; run-time loading from Python Tcl / Tk"
|
1645 | 1654 |
|
| 1655 | + def runtime_check(self): |
| 1656 | + """ Checks whether TkAgg runtime dependencies are met |
| 1657 | + """ |
| 1658 | + pkg_name = 'tkinter' if PY3min else 'Tkinter' |
| 1659 | + try: |
| 1660 | + import_module(pkg_name) |
| 1661 | + except ImportError: |
| 1662 | + return False |
| 1663 | + return True |
| 1664 | + |
1646 | 1665 | def get_extension(self):
|
1647 | 1666 | sources = [
|
1648 | 1667 | 'src/py_converters.cpp',
|
|
0 commit comments