From 25e8e0651792d38f0408d9cd3cf13860976572c6 Mon Sep 17 00:00:00 2001 From: Automatic Build System Date: Fri, 5 Jan 2024 16:55:02 +0100 Subject: [PATCH] rebuilt by autoport with build requirements: python3-devel>=3.11.5-3mamba [release 6.0.1-2mamba;Fri Sep 29 2023] --- README.md | 9 + python-yaml--cython-3.0.2.patch | 293 ++++++++++++++++++++++++++++++++ python-yaml.spec | 106 ++++++++++++ 3 files changed, 408 insertions(+) create mode 100644 python-yaml--cython-3.0.2.patch create mode 100644 python-yaml.spec diff --git a/README.md b/README.md index 25f2946..15b636e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,11 @@ # python-yaml +YAML parser and emitter for python: + * a complete YAML 1.1 parser. In particular, Python-YAML can parse all examples from the specification. The parsing algorithm is simple enough to be a reference for YAML parser implementors. + * Unicode support including UTF-8/UTF-16 input/output and \u escape sequences. + * low-level event-based parser and emitter API (like SAX). + * high-level API for serializing and deserializing native Python objects (like DOM or pickle). + * support for all types from the YAML types repository. A simple extension API is provided. + * both pure-Python and fast LibYAML-based parsers and emitters. + * relatively sensible error messages. + diff --git a/python-yaml--cython-3.0.2.patch b/python-yaml--cython-3.0.2.patch new file mode 100644 index 0000000..aad33df --- /dev/null +++ b/python-yaml--cython-3.0.2.patch @@ -0,0 +1,293 @@ +From 6ee5f07061e53e98b6b8a76c0d1555fdc1399397 Mon Sep 17 00:00:00 2001 +From: Thomas A Caswell +Date: Mon, 24 Jan 2022 18:39:55 -0500 +Subject: [PATCH] WIP: Attempt to get pyyaml to build with cython 3.0 + +This is cribbed from h5py's setup_build.py. + +While this works and the tests pass, it drops a lot of the configuration that +used to be possible / support for other Pythons / setting the include path / +... +--- + setup.py | 236 ++++++++++++++++++++----------------------------------- + 1 file changed, 86 insertions(+), 150 deletions(-) + +diff --git a/setup.py b/setup.py +index 944e7fa2..6be43400 100644 +--- a/setup.py ++++ b/setup.py +@@ -66,23 +66,29 @@ + + + import sys, os, os.path, pathlib, platform, shutil, tempfile, warnings +- ++import os.path as op + # for newer setuptools, enable the embedded distutils before importing setuptools/distutils to avoid warnings +-os.environ['SETUPTOOLS_USE_DISTUTILS'] = 'local' ++os.environ["SETUPTOOLS_USE_DISTUTILS"] = "local" + +-from setuptools import setup, Command, Distribution as _Distribution, Extension as _Extension ++from setuptools import setup, Command, Distribution, 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 ++from distutils.errors import ( ++ DistutilsError, ++ CompileError, ++ LinkError, ++ DistutilsPlatformError, ++) + + with_cython = False +-if 'sdist' in sys.argv or os.environ.get('PYYAML_FORCE_CYTHON') == '1': ++if "sdist" in sys.argv or os.environ.get("PYYAML_FORCE_CYTHON") == "1": + # we need cython here + with_cython = True + try: +- from Cython.Distutils.extension import Extension as _Extension +- from Cython.Distutils import build_ext as _build_ext ++ import Cython # noqa ++ + with_cython = True + except ImportError: + if with_cython: +@@ -96,147 +102,82 @@ + + # on Windows, disable wheel generation warning noise + windows_ignore_warnings = [ +-"Unknown distribution option: 'python_requires'", +-"Config variable 'Py_DEBUG' is unset", +-"Config variable 'WITH_PYMALLOC' is unset", +-"Config variable 'Py_UNICODE_SIZE' is unset", +-"Cython directive 'language_level' not set" ++ "Unknown distribution option: 'python_requires'", ++ "Config variable 'Py_DEBUG' is unset", ++ "Config variable 'WITH_PYMALLOC' is unset", ++ "Config variable 'Py_UNICODE_SIZE' is unset", ++ "Cython directive 'language_level' not set", + ] + +-if platform.system() == 'Windows': ++if platform.system() == "Windows": + for w in windows_ignore_warnings: +- warnings.filterwarnings('ignore', w) +- +- +-class Distribution(_Distribution): +- def __init__(self, attrs=None): +- _Distribution.__init__(self, attrs) +- if not self.ext_modules: +- return +- for idx in range(len(self.ext_modules)-1, -1, -1): +- ext = self.ext_modules[idx] +- if not isinstance(ext, Extension): +- continue +- setattr(self, ext.attr_name, None) +- self.global_options = [ +- (ext.option_name, None, +- "include %s (default if %s is available)" +- % (ext.feature_description, ext.feature_name)), +- (ext.neg_option_name, None, +- "exclude %s" % ext.feature_description), +- ] + self.global_options +- self.negative_opt = self.negative_opt.copy() +- self.negative_opt[ext.neg_option_name] = ext.option_name +- +- def has_ext_modules(self): +- if not self.ext_modules: +- return False +- for ext in self.ext_modules: +- with_ext = self.ext_status(ext) +- if with_ext is None or with_ext: +- return True +- return False +- +- def ext_status(self, ext): +- implementation = platform.python_implementation() +- if implementation not in ['CPython', 'PyPy']: +- return False +- if isinstance(ext, Extension): +- # the "build by default" behavior is implemented by this returning None +- with_ext = getattr(self, ext.attr_name) or os.environ.get('PYYAML_FORCE_{0}'.format(ext.feature_name.upper())) +- try: +- with_ext = int(with_ext) # attempt coerce envvar to int +- except TypeError: +- pass +- return with_ext +- else: +- return True +- +- +-class Extension(_Extension): +- +- def __init__(self, name, sources, feature_name, feature_description, +- feature_check, **kwds): +- if not with_cython: +- for filename in sources[:]: +- base, ext = os.path.splitext(filename) +- if ext == '.pyx': +- sources.remove(filename) +- sources.append('%s.c' % base) +- _Extension.__init__(self, name, sources, **kwds) +- self.feature_name = feature_name +- self.feature_description = feature_description +- self.feature_check = feature_check +- self.attr_name = 'with_' + feature_name.replace('-', '_') +- self.option_name = 'with-' + feature_name +- self.neg_option_name = 'without-' + feature_name ++ warnings.filterwarnings("ignore", w) ++ ++ ++COMPILER_SETTINGS = { ++ "libraries": ["yaml"], ++ "include_dirs": ["yaml"], ++ "library_dirs": [], ++ "define_macros": [], ++} ++ ++MODULES = ["_yaml"] ++EXTRA_LIBRARIES = {} ++EXTRA_SRC = {} ++ ++ ++def localpath(*args): ++ return op.abspath(op.join(op.dirname(__file__), *args)) + + + class build_ext(_build_ext): ++ @staticmethod ++ def _make_extensions(): ++ """Produce a list of Extension instances which can be passed to ++ cythonize(). ++ ++ This is the point at which custom directories, MPI options, etc. ++ enter the build process. ++ """ ++ settings = COMPILER_SETTINGS.copy() ++ ++ # TODO: should this only be done on UNIX? ++ if os.name != "nt": ++ settings["runtime_library_dirs"] = settings["library_dirs"] ++ ++ def make_extension(module): ++ sources = [localpath("yaml", module + ".pyx")] + EXTRA_SRC.get(module, []) ++ settings["libraries"] += EXTRA_LIBRARIES.get(module, []) ++ print(("yaml." + module, sources, settings)) ++ ext = Extension("yaml." + module, sources, **settings) ++ ext._needs_stub = False ++ return ext ++ ++ return [make_extension(m) for m in MODULES] + + def run(self): +- optional = True +- disabled = True +- for ext in self.extensions: +- with_ext = self.distribution.ext_status(ext) +- if with_ext is None: +- disabled = False +- elif with_ext: +- optional = False +- disabled = False +- break +- if disabled: +- return +- try: +- _build_ext.run(self) +- except DistutilsPlatformError: +- exc = sys.exc_info()[1] +- if optional: +- log.warn(str(exc)) +- log.warn("skipping build_ext") +- else: +- raise +- +- def get_source_files(self): +- self.check_extensions_list(self.extensions) +- filenames = [] +- for ext in self.extensions: +- if with_cython: +- self.cython_sources(ext.sources, ext) +- for filename in ext.sources: +- filenames.append(filename) +- base = os.path.splitext(filename)[0] +- for ext in ['c', 'h', 'pyx', 'pxd']: +- filename = '%s.%s' % (base, ext) +- if filename not in filenames and os.path.isfile(filename): +- filenames.append(filename) +- return filenames +- +- def get_outputs(self): +- self.check_extensions_list(self.extensions) +- outputs = [] +- for ext in self.extensions: +- fullname = self.get_ext_fullname(ext.name) +- filename = os.path.join(self.build_lib, +- self.get_ext_filename(fullname)) +- if os.path.isfile(filename): +- outputs.append(filename) +- return outputs +- +- def build_extensions(self): +- self.check_extensions_list(self.extensions) +- for ext in self.extensions: +- with_ext = self.distribution.ext_status(ext) +- if with_ext is not None and not with_ext: +- continue +- if with_cython: +- ext.sources = self.cython_sources(ext.sources, ext) +- try: +- self.build_extension(ext) +- except (CompileError, LinkError): +- if with_ext is not None: +- raise +- log.warn("Error compiling module, falling back to pure Python") ++ """Distutils calls this method to run the command""" ++ ++ from Cython.Build import cythonize ++ ++ # This allows ccache to recognise the files when pip builds in a temp ++ # directory. It speeds up repeatedly running tests through tox with ++ # ccache configured (CC="ccache gcc"). It should have no effect if ++ # ccache is not in use. ++ os.environ["CCACHE_BASEDIR"] = op.dirname(op.abspath(__file__)) ++ os.environ["CCACHE_NOHASHDIR"] = "1" ++ ++ # Run Cython ++ print("Executing cythonize()") ++ self.extensions = cythonize( ++ self._make_extensions(), force=self.force, language_level=3 ++ ) ++ ++ print(self.extensions) ++ for ex in self.extensions: ++ ex._needs_stub = False ++ # Perform the build ++ super().run() + + + class test(Command): +@@ -299,16 +240,11 @@ def run(self): + download_url=DOWNLOAD_URL, + classifiers=CLASSIFIERS, + project_urls=PROJECT_URLS, +- +- package_dir={'': 'lib'}, +- packages=['yaml', '_yaml'], +- ext_modules=[ +- Extension('yaml._yaml', ['yaml/_yaml.pyx'], +- 'libyaml', "LibYAML bindings", LIBYAML_CHECK, +- libraries=['yaml']), +- ], +- ++ package_dir={"": "lib"}, ++ packages=["yaml", "_yaml"], ++ # To trick build into running build_ext ++ ext_modules=[Extension("yaml.x", ["x.c"])], + distclass=Distribution, + cmdclass=cmdclass, +- python_requires='>=3.6', ++ python_requires=">=3.6", + ) diff --git a/python-yaml.spec b/python-yaml.spec new file mode 100644 index 0000000..81dbf9c --- /dev/null +++ b/python-yaml.spec @@ -0,0 +1,106 @@ +%define pkgname %(echo %name | cut -d- -f2- | tr - _) +Name: python-yaml +Version: 6.0.1 +Release: 2mamba +Summary: YAML parser and emitter for Python +Group: System/Libraries/Python +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: https://pyyaml.org/wiki/PyYAML +Source: http://pypi.debian.net/PyYAML/PyYAML-%{version}.tar.gz +Patch0: python-yaml--cython-3.0.2.patch +License: MIT +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: libpython311-devel +BuildRequires: libyaml-devel +## AUTOBUILDREQ-END +BuildRequires: python3-devel >= 3.11.5-3mamba + + +%description +YAML parser and emitter for python: + * a complete YAML 1.1 parser. In particular, Python-YAML can parse all examples from the specification. The parsing algorithm is simple enough to be a reference for YAML parser implementors. + * Unicode support including UTF-8/UTF-16 input/output and \u escape sequences. + * low-level event-based parser and emitter API (like SAX). + * high-level API for serializing and deserializing native Python objects (like DOM or pickle). + * support for all types from the YAML types repository. A simple extension API is provided. + * both pure-Python and fast LibYAML-based parsers and emitters. + * relatively sensible error messages. + +%if 0%{?with_pyver} +%define py_requires_append \ +Provides: PyYAML-%{?with_pyver} \ +Obsoletes: PyYAML-%{?with_pyver} < 6.0.1-2mamba +%pyver_package +%endif + +%prep +%setup -q -n PyYAML-%{version} +# FIXME: Work in progress patch from upstream pull requests +%patch 0 -p1 -b .cython-3.0.2 +sed -i "s|Cython<3.0|Cython|" pyproject.toml + +%build +CFLAGS="%{optflags}" %{__python} -m build --no-isolation --wheel --config-setting=--with-libyaml + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%{__python} -m installer --destdir=%{buildroot} dist/*.whl + +#%if "%{?with_pyver}" != "3" +## Rename any conflicting file outside of python site packages tree +#for f in %{_bindir}/pdm; do +# mv %{buildroot}${f}{,-%{?pyappend}} +#done +#%endif + +%files %{?pyappend} +%defattr(-,root,root) +%dir %{python_sitearch}/PyYAML-%{version}.dist-info +%{python_sitearch}/PyYAML-%{version}.dist-info/* +%dir %{python_sitearch}/%{pkgname} +%{python_sitearch}/%{pkgname}/* +%dir %{python_sitearch}/_%{pkgname} +%{python_sitearch}/_%{pkgname}/* + +%changelog +* Fri Sep 29 2023 Automatic Build System 6.0.1-2mamba +- rebuilt by autoport with build requirements: python3-devel>=3.11.5-3mamba + +* Tue Jul 18 2023 Automatic Build System 6.0.1-1mamba +- automatic version update by autodist + +* Fri Jun 24 2022 Automatic Build System 6.0-1mamba +- automatic version update by autodist + +* Sun Apr 03 2022 Silvan Calarco 5.4.1-3mamba +- rebuilt with python 3.10 + +* Sun May 09 2021 Silvan Calarco 5.4.1-2mamba +- rebuilt with distdeps + +* Sun Feb 21 2021 Automatic Build System 5.4.1-1mamba +- automatic version update by autodist + +* Wed Sep 09 2020 Automatic Build System 5.3.1-1mamba +- automatic update by autodist + +* Fri Aug 09 2019 Silvan Calarco 5.1.2-1mamba +- update to 5.1.2 + +* Thu Sep 06 2018 Silvan Calarco 3.13-1mamba +- update to 3.13 + +* Sun Sep 18 2016 Automatic Build System 3.12-1mamba +- automatic update by autodist + +* Wed Apr 02 2014 Automatic Build System 3.11-1mamba +- automatic update by autodist + +* Thu Nov 22 2012 Automatic Build System 3.10-1mamba +- automatic version update by autodist + +* Sun Nov 15 2009 Ercole 'ercolinux' Carpanetto 3.09-1mamba +- package created by autospec