From 032cd636116a821d20a590d87afa99626de9bff6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 17 May 2014 23:42:35 -0400 Subject: Patch globals in a function. This technique bypasses the linter warnings about the names not being present, and allows for better documentation. --- setuptools/depends.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'setuptools/depends.py') diff --git a/setuptools/depends.py b/setuptools/depends.py index 49fb8b37..e87ef3f3 100644 --- a/setuptools/depends.py +++ b/setuptools/depends.py @@ -197,8 +197,19 @@ def extract_constant(code, symbol, default=-1): else: const = default -if sys.platform.startswith('java') or sys.platform == 'cli': - # XXX it'd be better to test assertions about bytecode instead... - del extract_constant, get_module_constant - __all__.remove('extract_constant') - __all__.remove('get_module_constant') + +def _update_globals(): + """ + Patch the globals to remove the objects not available on some platforms. + + XXX it'd be better to test assertions about bytecode instead. + """ + + if not sys.platform.startswith('java') and sys.platform != 'cli': + return + incompatible = 'extract_constant', 'get_module_constant' + for name in incompatible: + del globals()[name] + __all__.remove(name) + +_update_globals() -- cgit v1.2.1