Commit 09a1a171 authored by Xavier Thompson's avatar Xavier Thompson

[fix] Ignore setuptools deprecation warnings

The testing framework, some individual tests and 'buildout:develop'
call python setup.py <command> manually, which is deprecated by
setuptools. Depending on the setuptools version, suppress the
warning for now to avoid polluting the logs.
parent 2fd5dab9
......@@ -48,16 +48,20 @@ from contextlib import closing
from setuptools.package_index import distros_for_location, URL_SCHEME
import csv
from setuptools import __version__ as setuptools_version
setuptools_version = pkg_resources.parse_version(setuptools_version)
try:
from setuptools.wheel import Wheel # This is the important import
from setuptools import __version__ as setuptools_version
# Now we need to check if we have at least 38.2.3 for namespace support.
SETUPTOOLS_SUPPORTS_WHEELS = (
pkg_resources.parse_version(setuptools_version) >=
pkg_resources.parse_version('38.2.3'))
setuptools_version >= pkg_resources.parse_version('38.2.3'))
except ImportError:
SETUPTOOLS_SUPPORTS_WHEELS = False
SETUPTOOLS_IGNORE_WARNINGS = (
setuptools_version >= pkg_resources.parse_version('67.7.0'))
BIN_SCRIPTS = 'Scripts' if WINDOWS else 'bin'
......@@ -1230,7 +1234,11 @@ def develop(setup, dest,
if log_level < logging.DEBUG:
logger.debug("in: %r\n%s", directory, ' '.join(args))
call_subprocess(args)
if SETUPTOOLS_IGNORE_WARNINGS:
env = dict(os.environ, PYTHONWARNINGS='ignore')
else:
env=None
call_subprocess(args, env=env)
_detect_distutils_scripts(tmp3)
return _copyeggs(tmp3, dest, '.egg-link', undo)
......
......@@ -166,12 +166,14 @@ def _runsetup(setup, *args):
args = list(args)
args.insert(0, '-q')
here = os.getcwd()
ignore_warnings = zc.buildout.easy_install.SETUPTOOLS_IGNORE_WARNINGS
try:
os.chdir(os.path.dirname(setup))
zc.buildout.easy_install.call_subprocess(
[sys.executable, setup] + args,
env=dict(os.environ,
PYTHONPATH=zc.buildout.easy_install.pip_pythonpath,
PYTHONWARNINGS='ignore' if ignore_warnings else ''
),
)
if os.path.exists('build'):
......
......@@ -30,10 +30,11 @@ To illustrate this, we'll create a package in a sample buildout:
... author_email="bob@foo.com",
... )
... """)
We can use the buildout command to generate the hello egg:
>>> print_(system(buildout +' setup hello -q bdist_egg'), end='')
>>> print_(system(buildout +' setup hello -q bdist_egg',
... env={'PYTHONWARNINGS':'ignore'}), end='')
Running setup script 'hello/setup.py'.
zip_safe flag not set; analyzing archive contents...
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment