aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/depends.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-05-17 23:42:35 -0400
committerJason R. Coombs <jaraco@jaraco.com>2014-05-17 23:42:35 -0400
commit032cd636116a821d20a590d87afa99626de9bff6 (patch)
tree7952e32b8426146d114620fda5b2c34e1b3359e0 /setuptools/depends.py
parentac86a30d6f4bc4ed403ea668d4a904d8ae933850 (diff)
downloadexternal_python_setuptools-032cd636116a821d20a590d87afa99626de9bff6.tar.gz
external_python_setuptools-032cd636116a821d20a590d87afa99626de9bff6.tar.bz2
external_python_setuptools-032cd636116a821d20a590d87afa99626de9bff6.zip
Patch globals in a function. This technique bypasses the linter warnings about the names not being present, and allows for better documentation.
Diffstat (limited to 'setuptools/depends.py')
-rw-r--r--setuptools/depends.py21
1 files changed, 16 insertions, 5 deletions
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()