|
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
|
@@ -402,13 +404,20 @@ class SetupPackage(object):
|
402 | 404 |
|
403 | 405 | def check(self):
|
404 | 406 | """
|
405 |
| - Checks whether the dependencies are met. Should raise a |
406 |
| - `CheckFailed` exception if the dependency could not be met, |
407 |
| - otherwise return a string indicating a version number or some |
408 |
| - other message indicating what was found. |
| 407 | + Checks whether the build dependencies are met. Should raise a |
| 408 | + `CheckFailed` exception if the dependency could not be met, otherwise |
| 409 | + return a string indicating a version number or some other message |
| 410 | + indicating what was found. |
409 | 411 | """
|
410 | 412 | pass
|
411 | 413 |
|
| 414 | + def runtime_check(self): |
| 415 | + """ |
| 416 | + True if the runtime dependencies of the backend are met. Assumes that |
| 417 | + the build-time dependencies are met. |
| 418 | + """ |
| 419 | + return True |
| 420 | + |
412 | 421 | def get_packages(self):
|
413 | 422 | """
|
414 | 423 | Get a list of package names to add to the configuration.
|
@@ -1519,6 +1528,16 @@ class BackendTkAgg(OptionalBackendPackage):
|
1519 | 1528 | def check(self):
|
1520 | 1529 | return "installing; run-time loading from Python Tcl / Tk"
|
1521 | 1530 |
|
| 1531 | + def runtime_check(self): |
| 1532 | + """ Checks whether TkAgg runtime dependencies are met |
| 1533 | + """ |
| 1534 | + pkg_name = 'tkinter' if PY3min else 'Tkinter' |
| 1535 | + try: |
| 1536 | + import_module(pkg_name) |
| 1537 | + except ImportError: |
| 1538 | + return False |
| 1539 | + return True |
| 1540 | + |
1522 | 1541 | def get_extension(self):
|
1523 | 1542 | sources = [
|
1524 | 1543 | 'src/py_converters.cpp',
|
|
0 commit comments