summaryrefslogtreecommitdiffstats
path: root/third_party/python/PyYAML/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/python/PyYAML/setup.py')
-rw-r--r--third_party/python/PyYAML/setup.py46
1 files changed, 32 insertions, 14 deletions
diff --git a/third_party/python/PyYAML/setup.py b/third_party/python/PyYAML/setup.py
index d7476c61c6..65b0ea0e06 100644
--- a/third_party/python/PyYAML/setup.py
+++ b/third_party/python/PyYAML/setup.py
@@ -1,6 +1,6 @@
NAME = 'PyYAML'
-VERSION = '5.4.1'
+VERSION = '6.0.1'
DESCRIPTION = "YAML parser and emitter for Python"
LONG_DESCRIPTION = """\
YAML is a data serialization format designed for human readability
@@ -27,13 +27,13 @@ CLASSIFIERS = [
"Operating System :: OS Independent",
"Programming Language :: Cython",
"Programming Language :: Python",
- "Programming Language :: Python :: 2",
- "Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
@@ -65,11 +65,15 @@ int main(void) {
"""
-import sys, os, os.path, platform, warnings
+import sys, os, os.path, pathlib, platform, shutil, tempfile, warnings
+
+# for newer setuptools, enable the embedded distutils before importing setuptools/distutils to avoid warnings
+os.environ['SETUPTOOLS_USE_DISTUTILS'] = 'local'
-from distutils import log
from setuptools import setup, Command, Distribution as _Distribution, Extension as _Extension
from setuptools.command.build_ext import build_ext as _build_ext
+# NB: distutils imports must remain below setuptools to ensure we use the embedded version
+from distutils import log
from distutils.errors import DistutilsError, CompileError, LinkError, DistutilsPlatformError
with_cython = False
@@ -248,14 +252,28 @@ class test(Command):
def run(self):
build_cmd = self.get_finalized_command('build')
build_cmd.run()
- sys.path.insert(0, build_cmd.build_lib)
- if sys.version_info[0] < 3:
+
+ # running the tests this way can pollute the post-MANIFEST build sources
+ # (see https://github.com/yaml/pyyaml/issues/527#issuecomment-921058344)
+ # until we remove the test command, run tests from an ephemeral copy of the intermediate build sources
+ tempdir = tempfile.TemporaryDirectory(prefix='test_pyyaml')
+
+ try:
+ # have to create a subdir since we don't get dir_exists_ok on copytree until 3.8
+ temp_test_path = pathlib.Path(tempdir.name) / 'pyyaml'
+ shutil.copytree(build_cmd.build_lib, temp_test_path)
+ sys.path.insert(0, str(temp_test_path))
sys.path.insert(0, 'tests/lib')
- else:
- sys.path.insert(0, 'tests/lib3')
- import test_all
- if not test_all.main([]):
- raise DistutilsError("Tests failed")
+
+ import test_all
+ if not test_all.main([]):
+ raise DistutilsError("Tests failed")
+ finally:
+ try:
+ # this can fail under Windows; best-effort cleanup
+ tempdir.cleanup()
+ except Exception:
+ pass
cmdclass = {
@@ -282,7 +300,7 @@ if __name__ == '__main__':
classifiers=CLASSIFIERS,
project_urls=PROJECT_URLS,
- package_dir={'': {2: 'lib', 3: 'lib3'}[sys.version_info[0]]},
+ package_dir={'': 'lib'},
packages=['yaml', '_yaml'],
ext_modules=[
Extension('yaml._yaml', ['yaml/_yaml.pyx'],
@@ -292,5 +310,5 @@ if __name__ == '__main__':
distclass=Distribution,
cmdclass=cmdclass,
- python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*',
+ python_requires='>=3.6',
)