1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00
pip/pip/utils/setuptools_build.py
Victor Stinner 0bc3cc9bd9 Fix a ResourceWarning in setuptools_build
Running setup.py using SETUPTOOLS_SHIM logs a ResourceWarning on
Python 3 when using python3 -Wd command line option. This change
fixes the warning by close the setup.py file before running it.
2016-06-29 10:28:29 +02:00

8 lines
278 B
Python

# Shim to wrap setup.py invocation with setuptools
SETUPTOOLS_SHIM = (
"import setuptools, tokenize;__file__=%r;"
"f=getattr(tokenize, 'open', open)(__file__);"
"code=f.read().replace('\\r\\n', '\\n');"
"f.close();"
"exec(compile(code, __file__, 'exec'))"
)