Browse Source

python updates

Signed-off-by: basebuilder_pel7ppc64lebuilder0 <basebuilder@powerel.org>
master
basebuilder_pel7ppc64lebuilder0 1 year ago
parent
commit
9e40e85432
  1. 15
      SOURCES/README.md
  2. 2
      SOURCES/config-5.4.211-ppc64le
  3. 4
      SOURCES/pyproject_buildrequires.py
  4. 102
      SOURCES/pyproject_save_files.py
  5. 42
      SOURCES/pyproject_save_files_test_data.yaml
  6. 79
      SPECS/pyproject-rpm-macros.spec
  7. 162
      SPECS/python-cffi.spec
  8. 781
      SPECS/python-pillow.spec
  9. 280
      SPECS/python-ply.spec
  10. 174
      SPECS/python-pycparser.spec
  11. 2
      SPECS/python-six.spec
  12. 4
      SPECS/python3-pip.spec
  13. 1099
      SPECS/python3-setuptools.spec
  14. 2
      SPECS/python3.spec

15
SOURCES/README.md

@ -140,7 +140,7 @@ such plugins will be BuildRequired as well. @@ -140,7 +140,7 @@ such plugins will be BuildRequired as well.
Not all plugins are guaranteed to play well with [tox-current-env],
in worst case, patch/sed the requirement out from the tox configuration.

Note that both `-x` and `-t` imply `-r`,
Note that neither `-x` or `-t` can be used with `-R`,
because runtime dependencies are always required for testing.
You can only use those options if the build backend supports the [prepare-metadata-for-build-wheel hook],
or together with `-w`.
@ -152,12 +152,16 @@ or together with `-w`. @@ -152,12 +152,16 @@ or together with `-w`.
Additionally to generated requirements you can supply multiple file names to `%pyproject_buildrequires` macro.
Dependencies will be loaded from them:

%pyproject_buildrequires -r requirements/tests.in requirements/docs.in requirements/dev.in
%pyproject_buildrequires requirements/tests.in requirements/docs.in requirements/dev.in

For packages not using build system you can use `-N` to entirely skip automatical
generation of requirements and install requirements only from manually specified files.
`-N` option cannot be used in combination with other options mentioned above
(`-r`, `-w`, `-e`, `-t`, `-x`).
`-N` option implies `-R` and cannot be used in combination with other options mentioned above
(`-w`, `-e`, `-t`, `-x`).

The `%pyproject_buildrequires` macro also accepts the `-r` flag for backward compatibility;
it means "include runtime dependencies" which has been the default since version 0-53.


Running tox based tests
-----------------------
@ -244,7 +248,7 @@ However, in Fedora packages, always list executables explicitly to avoid uninten @@ -244,7 +248,7 @@ However, in Fedora packages, always list executables explicitly to avoid uninten

`%pyproject_save_files` can automatically mark license files with `%license` macro
and language (`*.mo`) files with `%lang` macro and appropriate language code.
Only license files declared via [PEP 639] `License-Field` field are detected.
Only license files declared via [PEP 639] `License-File` field are detected.
[PEP 639] is still a draft and can be changed in the future.

Note that `%pyproject_save_files` uses data from the [RECORD file](https://www.python.org/dev/peps/pep-0627/).
@ -265,6 +269,7 @@ If `%pyproject_save_files` is not used, calling `%pyproject_check_import` will f @@ -265,6 +269,7 @@ If `%pyproject_save_files` is not used, calling `%pyproject_check_import` will f
When `%pyproject_save_files` is invoked,
it creates a list of all valid and public (i.e. not starting with `_`)
importable module names found in the package.
Each top-level module name matches at least one of the globs provided as an argument to `%pyproject_save_files`.
This list is then usable by `%pyproject_check_import` which performs an import check for each listed module.
When a module fails to import, the build fails.


2
SOURCES/config-5.4.211-ppc64le

@ -6810,7 +6810,7 @@ CONFIG_QCOM_HIDMA=m @@ -6810,7 +6810,7 @@ CONFIG_QCOM_HIDMA=m
CONFIG_DW_DMAC_CORE=m
CONFIG_DW_DMAC=m
CONFIG_DW_DMAC_PCI=m
CONFIG_DW_EDMA=y
CONFIG_DW_EDMA=n
CONFIG_DW_EDMA_PCIE=m

#

4
SOURCES/pyproject_buildrequires.py

@ -100,7 +100,7 @@ class Requirements: @@ -100,7 +100,7 @@ class Requirements:
return [{'extra': e} for e in sorted(self.extras)]
return [{'extra': ''}]

def evaluate_all_environamnets(self, requirement):
def evaluate_all_environments(self, requirement):
for marker_env in self.marker_envs:
if requirement.marker.evaluate(environment=marker_env):
return True
@ -126,7 +126,7 @@ class Requirements: @@ -126,7 +126,7 @@ class Requirements:

name = canonicalize_name(requirement.name)
if (requirement.marker is not None and
not self.evaluate_all_environamnets(requirement)):
not self.evaluate_all_environments(requirement)):
print_err(f'Ignoring alien requirement:', requirement_str)
return


102
SOURCES/pyproject_save_files.py

@ -286,6 +286,36 @@ def module_names_from_path(path): @@ -286,6 +286,36 @@ def module_names_from_path(path):
return {'.'.join(parts[:x+1]) for x in range(len(parts))}


def is_license_file(path, license_files, license_directories):
"""
Check if the given BuildrootPath path matches any of the "License-File" entries.
The path is considered matched when resolved from any of the license_directories
matches string-wise what is stored in any "License-File" entry (license_files).

Examples:
>>> site_packages = BuildrootPath('/usr/lib/python3.12/site-packages')
>>> distinfo = site_packages / 'foo-1.0.dist-info'
>>> license_directories = [distinfo / 'licenses', distinfo]
>>> license_files = ['LICENSE.txt', 'AUTHORS.md']
>>> is_license_file(distinfo / 'AUTHORS.md', license_files, license_directories)
True
>>> is_license_file(distinfo / 'licenses/LICENSE.txt', license_files, license_directories)
True
>>> # we don't match based on directory only
>>> is_license_file(distinfo / 'licenses/COPYING', license_files, license_directories)
False
>>> is_license_file(site_packages / 'foo/LICENSE.txt', license_files, license_directories)
False
"""
if not license_files or not license_directories:
return False
for license_dir in license_directories:
if (path.is_relative_to(license_dir) and
str(path.relative_to(license_dir)) in license_files):
return True
return False


def classify_paths(
record_path, parsed_record_content, metadata, sitedirs, python_version, prefix
):
@ -311,10 +341,17 @@ def classify_paths( @@ -311,10 +341,17 @@ def classify_paths(
"other": {"files": []}, # regular %file entries we could not parse :(
}

license_files = metadata.get_all('License-File')
license_directory = distinfo / 'licenses' # See PEP 369 "Root License Directory"
# setuptools was the first known build backend to implement License-File.
# Unfortunately they don't put licenses to the license directory (yet):
# https://github.com/pypa/setuptools/issues/3596
# Hence, we check licenses in both licenses and dist-info
license_directories = (license_directory, distinfo)

# In RECORDs generated by pip, there are no directories, only files.
# The example RECORD from PEP 376 does not contain directories either.
# Hence, we'll only assume files, but TODO get it officially documented.
license_files = metadata.get_all('License-File')
for path in parsed_record_content:
if path.suffix == ".pyc":
# we handle bytecode separately
@ -325,7 +362,7 @@ def classify_paths( @@ -325,7 +362,7 @@ def classify_paths(
# RECORD and REQUESTED files are removed in %pyproject_install
# See PEP 627
continue
if license_files and str(path.relative_to(distinfo)) in license_files:
if is_license_file(path, license_files, license_directories):
paths["metadata"]["licenses"].append(path)
else:
paths["metadata"]["files"].append(path)
@ -485,6 +522,12 @@ def generate_file_list(paths_dict, module_globs, include_others=False): @@ -485,6 +522,12 @@ def generate_file_list(paths_dict, module_globs, include_others=False):
done_modules.add(name)
done_globs.add(glob)

# Users using '*' don't care about the files in the package, so it's ok
# not to fail the build when no modules are detected
# There can be legitimate reasons to create a package without Python modules
if not modules and fnmatch.fnmatchcase("", glob):
done_globs.add(glob)

missed = module_globs - done_globs
if missed:
missed_text = ", ".join(sorted(missed))
@ -493,6 +536,50 @@ def generate_file_list(paths_dict, module_globs, include_others=False): @@ -493,6 +536,50 @@ def generate_file_list(paths_dict, module_globs, include_others=False):
return sorted(files)


def generate_module_list(paths_dict, module_globs):
"""
This function takes the paths_dict created by the classify_paths() function and
reads the modules names from it.
It filters those whose top-level module names match any of the provided module_globs.

Returns list with matching qualified module names.

Examples:

>>> generate_module_list({'module_names': {'foo', 'foo.bar', 'baz'}}, {'foo'})
['foo', 'foo.bar']

>>> generate_module_list({'module_names': {'foo', 'foo.bar', 'baz'}}, {'*foo'})
['foo', 'foo.bar']

>>> generate_module_list({'module_names': {'foo', 'foo.bar', 'baz'}}, {'foo', 'baz'})
['baz', 'foo', 'foo.bar']

>>> generate_module_list({'module_names': {'foo', 'foo.bar', 'baz'}}, {'*'})
['baz', 'foo', 'foo.bar']

>>> generate_module_list({'module_names': {'foo', 'foo.bar', 'baz'}}, {'bar'})
[]

Submodules aren't discovered:

>>> generate_module_list({'module_names': {'foo', 'foo.bar', 'baz'}}, {'*bar'})
[]
"""

module_names = paths_dict['module_names']
filtered_module_names = set()

for glob in module_globs:
for name in module_names:
# Match the top-level part of the qualified name, eg. 'foo.bar.baz' -> 'foo'
top_level_name = name.split('.')[0]
if fnmatch.fnmatchcase(top_level_name, glob):
filtered_module_names.add(name)

return sorted(filtered_module_names)


def parse_varargs(varargs):
"""
Parse varargs from the %pyproject_save_files macro
@ -621,7 +708,7 @@ def pyproject_save_files_and_modules(buildroot, sitelib, sitearch, python_versio @@ -621,7 +708,7 @@ def pyproject_save_files_and_modules(buildroot, sitelib, sitearch, python_versio
parsed_records = load_parsed_record(pyproject_record)

final_file_list = []
all_module_names = set()
final_module_list = []

for record_path, files in parsed_records.items():
metadata = dist_metadata(buildroot, record_path)
@ -632,12 +719,11 @@ def pyproject_save_files_and_modules(buildroot, sitelib, sitearch, python_versio @@ -632,12 +719,11 @@ def pyproject_save_files_and_modules(buildroot, sitelib, sitearch, python_versio
final_file_list.extend(
generate_file_list(paths_dict, globs, include_auto)
)
all_module_names.update(paths_dict["module_names"])

# Sort values, so they are always checked in the same order
all_module_names = sorted(all_module_names)
final_module_list.extend(
generate_module_list(paths_dict, globs)
)

return final_file_list, all_module_names
return final_file_list, final_module_list


def main(cli_args):

42
SOURCES/pyproject_save_files_test_data.yaml

@ -409,6 +409,22 @@ classified: @@ -409,6 +409,22 @@ classified:
other:
files:
- /usr/lib/python3.7/site-packages/zope.event-4.4-py3.7-nspkg.pth
comic2pdf:
metadata:
dirs:
- /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info
docs: []
files:
- /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/METADATA
- /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/WHEEL
- /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/entry_points.txt
- /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/top_level.txt
- /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/zip-safe
licenses: []
modules: []
other:
files:
- /usr/bin/comic2pdf.py
django:
metadata:
dirs:
@ -7739,7 +7755,6 @@ dumped: @@ -7739,7 +7755,6 @@ dumped:
- ipykernel.tests.utils
- ipykernel.trio_runner
- ipykernel.zmqshell
- ipykernel_launcher
- - zope
- zope
- - '%dir /usr/lib/python3.7/site-packages/zope'
@ -7764,6 +7779,16 @@ dumped: @@ -7764,6 +7779,16 @@ dumped:
- zope.event
- zope.event.classhandler
- zope.event.tests
- - comic2pdf
- '*'
- - '%dir /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info'
- /usr/bin/comic2pdf.py
- /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/METADATA
- /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/WHEEL
- /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/entry_points.txt
- /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/top_level.txt
- /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/zip-safe
- []
- - django
- django
- - '%dir /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info'
@ -15458,8 +15483,8 @@ metadata: @@ -15458,8 +15483,8 @@ metadata:
content: |
Name: Django
Version: 3.0.7
License-File: licenses/LICENSE
License-File: licenses/LICENSE.python
License-File: LICENSE
License-File: LICENSE.python
Whatever: False data

records:
@ -15745,6 +15770,17 @@ records: @@ -15745,6 +15770,17 @@ records:
zope/event/classhandler.py,sha256=CEx6issKWSia0Wruob_jIQI2EfYX45krokoTHyVsJFQ,1816
zope/event/tests.py,sha256=bvEzvOmPoQETMqYiqsR9EeVsC8Dzy-HOclfpQFVjDhE,1871

comic2pdf:
path: /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/RECORD
content: |
../../../bin/comic2pdf.py,sha256=ad0XbWxj2fzn_oYi1h-usY8jsxAvfpYA1aaify1Ym88,3266
comic2pdf-3.1.0.dist-info/METADATA,sha256=qMVNbSPY02NdWfGex5yWNxoK1d96ereES-XoKxshVEA,3195
comic2pdf-3.1.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
comic2pdf-3.1.0.dist-info/entry_points.txt,sha256=uORK0FJD-i46W74x2mNHfloSPS4QElN3-Y0vKQZ7svw,46
comic2pdf-3.1.0.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
comic2pdf-3.1.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
comic2pdf-3.1.0.dist-info/RECORD,,

django:
path: /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info/RECORD
content: |

79
SPECS/pyproject-rpm-macros.spec

@ -1,10 +1,8 @@ @@ -1,10 +1,8 @@
%define _rpmmacrodir /usr/lib/rpm/macros.d/

Name: pyproject-rpm-macros
Summary: RPM macros for PEP 517 Python packages
License: MIT

%bcond_with tests
%bcond_without tests

# The idea is to follow the spirit of semver
# Given version X.Y.Z:
@ -12,7 +10,7 @@ License: MIT @@ -12,7 +10,7 @@ License: MIT
# Increment Y and reset Z when new macros or features are added
# Increment Z when this is a bugfix or a cosmetic change
# Dropping support for EOL Fedoras is *not* considered a breaking change
Version: 1.3.2
Version: 1.4.0
Release: 1%{?dist}

# Macro files
@ -47,24 +45,27 @@ URL: https://src.fedoraproject.org/rpms/pyproject-rpm-macros @@ -47,24 +45,27 @@ URL: https://src.fedoraproject.org/rpms/pyproject-rpm-macros
BuildArch: noarch

%if %{with tests}
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pyyaml)
BuildRequires: python3dist(packaging)
BuildRequires: python3dist(pip)
BuildRequires: python3dist(setuptools)
BuildRequires: python3dist(tox-current-env) >= 0.0.6
BuildRequires: python3dist(wheel)
#BuildRequires: (python3dist(toml) if python3-devel < 3.11)
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pyyaml)
BuildRequires: python3dist(packaging)
BuildRequires: python3dist(pip)
BuildRequires: python3dist(setuptools)
BuildRequires: python3dist(tox-current-env) >= 0.0.6
BuildRequires: python3dist(wheel)
BuildRequires: python3dist(toml)
%endif

# We build on top of those:
Requires: python-rpm-macros
Requires: python-srpm-macros
Requires: python3-rpm-macros
BuildRequires: python-rpm-macros
BuildRequires: python-srpm-macros
BuildRequires: python3-rpm-macros
Requires: python-rpm-macros
Requires: python-srpm-macros
Requires: python3-rpm-macros

# We use the following tools outside of coreutils
Requires: /usr/bin/find
Requires: /usr/bin/sed
Requires: /usr/bin/find
Requires: /usr/bin/sed

%description
These macros allow projects that follow the Python packaging specifications
@ -93,19 +94,19 @@ cp -p %{sources} . @@ -93,19 +94,19 @@ cp -p %{sources} .
%install
mkdir -p %{buildroot}%{_rpmmacrodir}
mkdir -p %{buildroot}%{_rpmconfigdir}/redhat
install -m 644 macros.pyproject %{buildroot}%{_rpmmacrodir}/
install -m 644 pyproject_buildrequires.py %{buildroot}%{_rpmconfigdir}/redhat/
install -m 644 pyproject_convert.py %{buildroot}%{_rpmconfigdir}/redhat/
install -m 644 pyproject_save_files.py %{buildroot}%{_rpmconfigdir}/redhat/
install -m 644 pyproject_preprocess_record.py %{buildroot}%{_rpmconfigdir}/redhat/
install -m 644 pyproject_construct_toxenv.py %{buildroot}%{_rpmconfigdir}/redhat/
install -m 644 pyproject_requirements_txt.py %{buildroot}%{_rpmconfigdir}/redhat/
install -m 644 pyproject_wheel.py %{buildroot}%{_rpmconfigdir}/redhat/
install -pm 644 macros.pyproject %{buildroot}%{_rpmmacrodir}/
install -pm 644 pyproject_buildrequires.py %{buildroot}%{_rpmconfigdir}/redhat/
install -pm 644 pyproject_convert.py %{buildroot}%{_rpmconfigdir}/redhat/
install -pm 644 pyproject_save_files.py %{buildroot}%{_rpmconfigdir}/redhat/
install -pm 644 pyproject_preprocess_record.py %{buildroot}%{_rpmconfigdir}/redhat/
install -pm 644 pyproject_construct_toxenv.py %{buildroot}%{_rpmconfigdir}/redhat/
install -pm 644 pyproject_requirements_txt.py %{buildroot}%{_rpmconfigdir}/redhat/
install -pm 644 pyproject_wheel.py %{buildroot}%{_rpmconfigdir}/redhat/

%if %{with tests}
%check
export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856356
%{python3} -m pytest -vv --doctest-modules
%pytest -vv --doctest-modules

# brp-compress is provided as an argument to get the right directory macro expansion
%{python3} compare_mandata.py -f %{_rpmconfigdir}/brp-compress
@ -114,18 +115,34 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 @@ -114,18 +115,34 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856

%files
%{_rpmmacrodir}/macros.pyproject
%{_rpmconfigdir}/redhat/pyproject_buildrequires.py*
%{_rpmconfigdir}/redhat/pyproject_buildrequires.py
%{_rpmconfigdir}/redhat/pyproject_convert.py*
%{_rpmconfigdir}/redhat/pyproject_save_files.py*
%{_rpmconfigdir}/redhat/pyproject_preprocess_record.py*
%{_rpmconfigdir}/redhat/pyproject_save_files.py
%{_rpmconfigdir}/redhat/pyproject_preprocess_record.py
%{_rpmconfigdir}/redhat/pyproject_construct_toxenv.py*
%{_rpmconfigdir}/redhat/pyproject_requirements_txt.py*
%{_rpmconfigdir}/redhat/pyproject_wheel.py*
%{_rpmconfigdir}/redhat/pyproject_requirements_txt.py
%{_rpmconfigdir}/redhat/pyproject_wheel.py

%doc README.md
%license LICENSE

%changelog
* Mon Sep 19 2022 Python Maint <python-maint@redhat.com> - 1.4.0-1
- %%pyproject_save_files: Support License-Files installed into the *Root License Directory* from PEP 369
- Fixes: rhbz#2127946
- %%pyproject_check_import: Import only the modules whose top-level names
match any of the globs provided to %%pyproject_save_files
- Fixes: rhbz#2127958

* Tue Aug 30 2022 Otto Liljalaakso <otto.liljalaakso@iki.fi> - 1.3.4-1
- Fix typo in internal function name

* Tue Aug 09 2022 Karolina Surma <ksurma@redhat.com> - 1.3.3-1
- Don't fail %%pyproject_save_files '*' if no modules are detected

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Wed Jun 15 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 1.3.2-1
- Update %%pyproject_build_lib to support setuptools 62.1.0 and later
- Fixes: rhbz#2097158

162
SPECS/python-cffi.spec

@ -1,49 +1,39 @@ @@ -1,49 +1,39 @@
Name: python-cffi
Version: 1.12.2
Release: 1%{?dist}
%global general_version 1.15.1
Version: %{general_version}%{?prerel:~%{prerel}}
Release: 3%{?dist}
Summary: Foreign Function Interface for Python to call C code
License: MIT
URL: https://cffi.readthedocs.org/
Source0: %{pypi_source cffi}
Source: https://foss.heptapod.net/pypy/cffi/-/archive/v%{version}/cffi-v%{version}.tar.bz2

# Adjust tests for a last minute Python 3.11 change in the traceback format
Patch0: https://foss.heptapod.net/pypy/cffi/-/merge_requests/113.patch

# Drop usage of the deprecated py.test package
Patch1: https://foss.heptapod.net/pypy/cffi/-/merge_requests/115.patch
# Drop usage of the deprecated py.code package
Patch2: https://foss.heptapod.net/pypy/cffi/-/merge_requests/116.patch

BuildRequires: make
BuildRequires: libffi-devel
BuildRequires: gcc

# For tests:
BuildRequires: gcc-c++

%?python_enable_dependency_generator

%description
Foreign Function Interface for Python, providing a convenient and
reliable way of calling existing C code from Python. The interface is
based on LuaJIT’s FFI.

%package -n python2-cffi
Summary: Foreign Function Interface for Python 3 to call C code
BuildRequires: python2-pytest
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python2-Cython
BuildRequires: python2-pycparser
BuildRequires: python2-pytest
%{?python_provide:%python_provide python2-cffi}

%description -n python2-cffi
Foreign Function Interface for Python, providing a convenient and
reliable way of calling existing C code from Python. The interface is
based on LuaJIT’s FFI.

%package -n python3-cffi
Summary: Foreign Function Interface for Python 3 to call C code
BuildRequires: python3-sphinx
BuildRequires: python3-pytest
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-Cython
BuildRequires: python3-pycparser
BuildRequires: python3-pytest
%{?python_provide:%python_provide python3-cffi}

%description -n python3-cffi
Foreign Function Interface for Python, providing a convenient and
@ -58,42 +48,138 @@ BuildArch: noarch @@ -58,42 +48,138 @@ BuildArch: noarch
Documentation for CFFI, the Foreign Function Interface for Python.

%prep
%autosetup -n cffi-%{version}
%autosetup -p1 -n cffi-v%{general_version}%{?prerel}

%build
%py2_build
%py3_build
%{__python3} setup.py build

#cd doc
#make SPHINXBUILD=sphinx-build-3 html
#rm build/html/.buildinfo

%install
%py2_install
%py3_install
%{__python3} setup.py install --optimize=2 --root=%{buildroot}

%check
PYTHONPATH=%{buildroot}%{python2_sitearch} %{__python2} -m pytest c/ testing/
PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} -m pytest c/ testing/

%files -n python2-cffi
%doc PKG-INFO
%license LICENSE
%{python2_sitearch}/cffi/
%{python2_sitearch}/_cffi_backend.so
%{python2_sitearch}/cffi-%{version}-py%{python2_version}.egg-info/

%files -n python3-cffi
%doc PKG-INFO
%doc README.md
%license LICENSE
%{python3_sitearch}/cffi/
%{python3_sitearch}/_cffi_backend.*.so
%{python3_sitearch}/cffi-%{version}-py%{python3_version}.egg-info/
%{python3_sitearch}/cffi-%{general_version}%{?prerel}-py%{python3_version}.egg-info/

%files doc
#%doc doc/build/html

%changelog
* Mon Nov 14 2022 Miro Hrončok <mhroncok@redhat.com> - 1.15.1-3
- Fix build with pytest 7.2
- Fixes: rhbz#2142063

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.15.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Fri Jul 15 2022 Miro Hrončok <mhroncok@redhat.com> - 1.15.1-1
- Adjust tests for a last minute Python 3.11 change in the traceback format

* Mon Jul 11 2022 Lumír Balhar <lbalhar@redhat.com> - 1.15.1-0
- Update to 1.15.1
Resolves: rhbz#2102824

* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 1.15.0-6
- Rebuilt for Python 3.11

* Wed Mar 30 2022 Miro Hrončok <mhroncok@redhat.com> - 1.15.0-5
- Fix alignment issue on ppc64le
- Fixes: rhbz#2046865

* Wed Feb 02 2022 Tomáš Hrnčiar <thrnciar@redhat.com> - 1.15.0-4
- Backport patch to fix compatibility with Python 3.11
- Fixes: rhbz#2040165

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.15.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Sat Jan 08 2022 Miro Hrončok <mhroncok@redhat.com> - 1.15.0-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/LIBFFI34

* Tue Dec 21 2021 Lumír Balhar <lbalhar@redhat.com> - 1.15.0-1
- Update to 1.15.0
Resolves: rhbz#2013760

* Thu Oct 07 2021 Tomáš Hrnčiar <thrnciar@redhat.com> - 1.15.0~rc2-1
- Update to 1.15.0rc2
Resolves: rhbz#2007006

* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.14.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Fri Jul 09 2021 Lumír Balhar <lbalhar@redhat.com> - 1.14.6-1
- Update to 1.14.6
Resolves: rhbz#1980622

* Wed Jun 02 2021 Python Maint <python-maint@redhat.com> - 1.14.5-2
- Rebuilt for Python 3.10

* Fri Feb 12 2021 Lumír Balhar <lbalhar@redhat.com> - 1.14.5-1
- Update to 1.14.5
Resolves: rhbz#1927933

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.14.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Thu Nov 19 2020 Joel Capitao <jcapitao@redhat.com> - 1.14.3-1
- Update to 1.14.3

* Tue Sep 08 2020 Lumír Balhar <lbalhar@redhat.com> - 1.14.2-1
- Update to 1.14.2 (#1869032)

* Fri Aug 14 2020 Miro Hrončok <mhroncok@redhat.com> - 1.14.1-1
- Update to 1.14.1
- Fixes: rhbz#1860698
- Fixes: rhbz#1865276

* Sat May 23 2020 Miro Hrončok <mhroncok@redhat.com> - 1.14.0-2
- Rebuilt for Python 3.9

* Mon Feb 10 2020 Lumír Balhar <lbalhar@redhat.com> - 1.14.0
- Update to 1.14.0 (#1800646)

* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.13.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Mon Nov 18 2019 Lumír Balhar <lbalhar@redhat.com> - 1.13.2-1
- Update to 1.13.2 (#1768219)

* Mon Oct 21 2019 Miro Hrončok <mhroncok@redhat.com> - 1.13.1-1
- Update to 1.13.1 (#1763767)

* Tue Oct 15 2019 Miro Hrončok <mhroncok@redhat.com> - 1.13.0-1
- Update to 1.13.0 (#1761757)

* Sun Oct 13 2019 Miro Hrončok <mhroncok@redhat.com> - 1.12.3-5
- Subpackage python2-cffi has been removed
See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal

* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.12.3-4
- Rebuilt for Python 3.8.0rc1 (#1748018)

* Mon Aug 26 2019 Miro Hrončok <mhroncok@redhat.com> - 1.12.3-3
- Reduce Python 2 build dependencies

* Fri Aug 16 2019 Miro Hrončok <mhroncok@redhat.com> - 1.12.3-2
- Rebuilt for Python 3.8

* Thu Jul 25 2019 Miro Hrončok <mhroncok@redhat.com> - 1.12.3-1
- Update to 1.12.3 (#1701577)
- https://cffi.readthedocs.io/en/latest/whatsnew.html#v1-12-3

* Mon Jul 15 2019 Petr Viktorin <pviktori@redhat.com> - 1.12.2-2
- Remove unused build dependency on Cython
- Remove duplicate build dependency on pytest

* Wed Mar 27 2019 Miro Hrončok <mhroncok@redhat.com> - 1.12.2-1
- Update to 1.12.2 (#1677888)


781
SPECS/python-pillow.spec

@ -1,75 +1,144 @@ @@ -1,75 +1,144 @@
%global py2_incdir %{_includedir}/python%{python_version}
%global py3_incdir %{_includedir}/python%{python3_version}

%global name3 python3-pillow
%global with_python3 1

# Refer to the comment for Source0 below on how to obtain the source tarball
# The saved file has format python-imaging-Pillow-$version-$ahead-g$shortcommit.tar.gz
%global commit d1c6db88d4dee462c6bbf4e22555e3ddd410d06a
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global ahead 105

# If ahead is 0, the tarball corresponds to a release version, otherwise to a git snapshot
%if %{ahead} > 0
%global snap .git%{shortcommit}
%endif

Name: python-pillow
Version: 2.0.0
Release: 20%{?snap}%{?dist}
%global py3_incdir %(python3 -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())')
%global py3_libbuilddir %(python3 -c 'import sys; import sysconfig; print("lib.{p}-{v[0]}.{v[1]}".format(p=sysconfig.get_platform(), v=sys.version_info))')

%global srcname pillow
# bootstrap building docs (pillow is required by docutils, docutils are
# required by sphinx; pillow build-requires sphinx)
%global with_docs 0

Name: python-%{srcname}
Version: 5.1.1
Release: 18%{?dist}
Summary: Python image processing library

# License: see http://www.pythonware.com/products/pil/license.htm
License: MIT
URL: http://python-pillow.github.io/
Source0: https://github.com/python-pillow/Pillow/archive/%{version}/Pillow-%{version}.tar.gz
Patch0: 0001-Fix-potential-un-terminated-buffer-problem-CWE-120.patch
Patch1: 0002-Fix-potential-leaked-storage-issues-CWE-772.patch
Patch2: 0003-Fix-dereferencing-type-punned-pointer.patch
# Combined fixes for CVE-2020-5312 improperly restricted operations on memory buffer in libImaging/PcxDecode.c
# https://bugzilla.redhat.com/show_bug.cgi?id=1789533
# https://github.com/python-pillow/Pillow/commit/93b22b846e0269ee9594ff71a72bec02d2bea8fd
# and for CVE-2019-16865 reading specially crafted image files leads to allocation of large amounts of memory and denial of service
# https://bugzilla.redhat.com/show_bug.cgi?id=1774066
# https://github.com/python-pillow/Pillow/commit/cc16025e234b7a7a4dd3a86d2fdc0980698db9cc
# https://github.com/python-pillow/Pillow/commit/b36c1bc943d554ba223086c7efb502d080f73905
# https://github.com/python-pillow/Pillow/commit/f228d0ccbf6bf9392d7fcd51356ef2cfda80c75a
# https://github.com/python-pillow/Pillow/commit/b9693a51c99c260bd66d1affeeab4a226cf7e5a5
Patch3: CVE-2020-5312_CVE-2019-16865.patch
# Fix for CVE-2020-5311 - out-of-bounds write in expandrow in libImaging/SgiRleDecode.c
# https://bugzilla.redhat.com/show_bug.cgi?id=1789535
# https://github.com/python-pillow/Pillow/commit/a79b65c47c7dc6fe623aadf09aa6192fc54548f3
Patch4: CVE-2020-5311.patch
# CVE-2020-5313 out-of-bounds read in ImagingFliDecode when loading FLI images
# Upstream fix: https://github.com/python-pillow/Pillow/commit/a09acd0decd8a87ccce939d5ff65dab59e7d365b?patch
# Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=1789532
Patch5: CVE-2020-5313.patch
# CVE-2020-11538 out-of-bounds reads/writes in the parsing of SGI image files in expandrow/expandrow2
# Upstream fix: https://github.com/python-pillow/Pillow/pull/4504/
# Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=1852814
Patch6: CVE-2020-11538.patch
# CVE-2020-35653 decoding a crafted PCX file could result in buffer over-read
# Note that there is a wrong CVE number in the commit msg
# Upstream fix: https://github.com/python-pillow/Pillow/commit/2f409261eb1228e166868f8f0b5da5cda52e55bf
# Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=1915432
Patch7: CVE-2020-35653.patch
# CVE-2020-35655 decoding crafted SGI RLE image files could result in buffer over-read
# Upstream fix: https://github.com/python-pillow/Pillow/commit/120eea2e4547a7d1826afdf01563035844f0b7d5
# Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2020-35653
Patch8: CVE-2020-35655.patch
# CVE-2021-25290 negative-offset memcpy with an invalid size in TiffDecode.c
# Upstream fix: https://github.com/python-pillow/Pillow/commit/86f02f7c70862a0954bfe8133736d352db978eaa
# Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=1934685
Patch9: CVE-2021-25290.patch
# CVE-2021-25292 backtracking regex in PDF parser could be used as a DOS attack
# Upstream fix: https://github.com/python-pillow/Pillow/commit/3bce145966374dd39ce58a6fc0083f8d1890719c
# Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2021-25292
Patch10: CVE-2021-25292.patch
# CVE-2021-25293 out-of-bounds read in SGIRleDecode.c
# Upstream fix: https://github.com/python-pillow/Pillow/commit/4853e522bddbec66022c0915b9a56255d0188bf9
# Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2021-25293
Patch11: CVE-2021-25293.patch
# CVE-2021-27921 reported size of a contained image is not properly checked for a BLP container
# CVE-2021-27922 reported size of a contained image is not properly checked for an ICNS container
# CVE-2021-27923 reported size of a contained image is not properly checked for an ICO container
# Upstream fix: https://github.com/python-pillow/Pillow/commit/480f6819b592d7f07b9a9a52a7656c10bbe07442
# Tracking bugs:
# - https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2021-27921
# - https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2021-27922
# - https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2021-27923
Patch12: CVE-2021-27921_27922_27923.patch
# CVE-2021-25288 and 25287 out-of-bounds read in J2kDecode in j2ku_gray_i and j2ku_graya_la
# Upstream fixes this patch combines:
# - Original fix for the CVEs: https://github.com/python-pillow/Pillow/commit/3bf5eddb89afdf690eceaa52bc4d3546ba9a5f87
# - Older commit the fix is based on: https://github.com/python-pillow/Pillow/commit/cf6da6b79080a8c16984102fdc85f7ce28dca613
# Tracking bugs:
# - https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2021-25287
# - https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2021-25288
Patch13: CVE-2021-25287_25288.patch
# CVE-2021-28675 DoS in PsdImagePlugin
# Upstream fix: https://github.com/python-pillow/Pillow/commit/22e9bee4ef225c0edbb9323f94c26cee0c623497
# Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2021-28675
Patch14: CVE-2021-28675.patch
# CVE-2021-28676 infinite loop in FliDecode.c can lead to DoS
# Upstream fix: https://github.com/python-pillow/Pillow/commit/bb6c11fb889e6c11b0ee122b828132ee763b5856
# Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2021-28676
Patch15: CVE-2021-28676.patch
# CVE-2021-28677 DoS in the open phase via a malicious EPS file
# Upstream fix: https://github.com/python-pillow/Pillow/commit/5a5e6db0abf4e7a638fb1b3408c4e495a096cb92
# Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2021-28677
Patch16: CVE-2021-28677.patch
# CVE-2021-28678 improper check in BlpImagePlugin can lead to DoS
# Upstream fix: https://github.com/python-pillow/Pillow/commit/496245aa4365d0827390bd0b6fbd11287453b3a1
# Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2021-28678
Patch17: CVE-2021-28678.patch
# CVE-2021-34552: buffer overflow in Convert.c because it allow an attacker to pass
# controlled parameters directly into a convert function
# Upstream fix: https://github.com/python-pillow/Pillow/pull/5567
# Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=1982378
Patch18: CVE-2021-34552.patch
# CVE-2022-22817: PIL.ImageMath.eval allows evaluation of arbitrary expressions
# Upstream fixes:
# https://github.com/python-pillow/Pillow/commit/8531b01d6cdf0b70f256f93092caa2a5d91afc11
# https://github.com/python-pillow/Pillow/commit/f84ab3bb8a0a196a52e8a76bebed2853362629de
# Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=2042527
Patch19: CVE-2022-22817.patch
# CVE-2022-22815 python-pillow: improperly initializes ImagePath.Path in path_getbbox() in path.c
# CVE-2022-22816 python-pillow: buffer over-read during initialization of ImagePath.Path in path_getbbox() in path.c
# Upstream fix: https://github.com/python-pillow/Pillow/commit/5543e4e2d409cd9e409bc64cdc77be0af007a31f
# Memory issue fix: https://github.com/python-pillow/Pillow/pull/5958
# Tracking bugs:
# https://bugzilla.redhat.com/show_bug.cgi?id=2042511
# https://bugzilla.redhat.com/show_bug.cgi?id=2042522
Patch20: CVE-2022-22815_CVE-2022-22816.patch

# Obtain the tarball for a certain commit via:
# wget --content-disposition https://github.com/python-imaging/Pillow/tarball/$commit
Source0: https://github.com/python-imaging/Pillow/tarball/%{commit}/python-imaging-Pillow-%{version}-%{ahead}-g%{shortcommit}.tar.gz

# Add s390* and ppc* archs
Patch0: python-pillow-archs.patch
# Fix test hardcoded for little-endian
Patch1: python-pillow_endian.patch
Patch2: python-pillow-2.0.0_bytearray.patch
Patch3: python-pillow-2.0.0_memleaks.patch

BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: tkinter
BuildRequires: tk-devel
BuildRequires: python-sphinx
BuildRequires: libjpeg-devel
BuildRequires: zlib-devel
BuildRequires: freetype-devel
BuildRequires: sane-backends-devel
# Don't build with webp support on s390* and ppc* archs
# see bug #962091 and #1127230
%ifnarch s390 s390x ppc ppc64
BuildRequires: gcc
BuildRequires: ghostscript
BuildRequires: lcms2-devel
BuildRequires: libjpeg-devel
BuildRequires: libtiff-devel
BuildRequires: libwebp-devel
%endif
BuildRequires: PyQt4
BuildRequires: numpy
BuildRequires: openjpeg2-devel
BuildRequires: tk-devel
BuildRequires: zlib-devel

%if %{with_python3}
BuildRequires: python3-cffi
BuildRequires: python3-devel
BuildRequires: python3-numpy
BuildRequires: python3-setuptools
%if 0%{?with_docs}
BuildRequires: python3-sphinx
BuildRequires: python3-sphinx_rtd_theme
%endif # with_docs
BuildRequires: python3-tkinter
BuildRequires: python3-PyQt4
BuildRequires: python3-numpy
%endif

Provides: python-imaging = %{version}-%{release}
Obsoletes: python-imaging <= 1.1.7-12
# For EpsImagePlugin.py
Requires: ghostscript

%if %{with_python3}
Provides: python3-imaging = %{version}-%{release}
%endif

#%filter_provides_in %{python_sitearch}
#%filter_provides_in %{python3_sitearch}
#%filter_setup
%global __provides_exclude_from ^%{python3_sitearch}/PIL/.*\\.so$

%description
Python image processing library, fork of the Python Imaging Library (PIL)
@ -77,315 +146,435 @@ Python image processing library, fork of the Python Imaging Library (PIL) @@ -77,315 +146,435 @@ Python image processing library, fork of the Python Imaging Library (PIL)
This library provides extensive file format support, an efficient
internal representation, and powerful image processing capabilities.

There are five subpackages: tk (tk interface), qt (PIL image wrapper for Qt),
sane (scanning devices interface), devel (development) and doc (documentation).
There are these subpackages: tk (tk interface),
devel (development) and doc (documentation).


%package devel
Summary: Development files for %{name}
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python-devel, libjpeg-devel, zlib-devel
Provides: python-imaging-devel = %{version}-%{release}
Obsoletes: python-imaging-devel <= 1.1.7-12
%package -n python3-%{srcname}
Summary: Python 3 image processing library
%{?python_provide:%python_provide python3-%{srcname}}
Provides: python3-imaging = %{version}-%{release}
# For MicImagePlugin.py, FpxImagePlugin.py

%description devel
Development files for %{name}.
%description -n python3-%{srcname}
Python image processing library, fork of the Python Imaging Library (PIL)

This library provides extensive file format support, an efficient
internal representation, and powerful image processing capabilities.

%package doc
Summary: Documentation for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release}
There are these subpackages: tk (tk interface),
devel (development) and doc (documentation).


%package -n python3-%{srcname}-devel
Summary: Development files for %{srcname}
Requires: python3-devel, libjpeg-devel, zlib-devel
Requires: python3-%{srcname}%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python3-%{srcname}-devel}
Provides: python3-imaging-devel = %{version}-%{release}

%description doc
Documentation for %{name}.
%description -n python3-%{srcname}-devel
Development files for %{srcname}.


%package sane
Summary: Python module for using scanners
Group: System Environment/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
Provides: python-imaging-sane = %{version}-%{release}
Obsoletes: python-imaging-sane <= 1.1.7-12
%package -n python3-%{srcname}-doc
Summary: Documentation for %{srcname}
BuildArch: noarch
Requires: python3-%{srcname} = %{version}-%{release}
%{?python_provide:%python_provide python3-%{srcname}-doc}
Provides: python3-imaging-doc = %{version}-%{release}

%description sane
This package contains the sane module for Python which provides access to
various raster scanning devices such as flatbed scanners and digital cameras.
%description -n python3-%{srcname}-doc
Documentation for %{srcname}.


%package tk
Summary: Tk interface for %{name}
Group: System Environment/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: tkinter
Provides: python-imaging-tk = %{version}-%{release}
Obsoletes: python-imaging-tk <= 1.1.7-12
%package -n python3-%{srcname}-tk
Summary: Tk interface for %{srcname}
Requires: python3-tkinter
Requires: python3-%{srcname}%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python3-%{srcname}-tk}
Provides: python3-imaging-tk = %{version}-%{release}

%description tk
%description -n python3-%{srcname}-tk
Tk interface for %{name}.

%package qt
Summary: PIL image wrapper for Qt
Group: System Environment/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: PyQt4
Provides: python-imaging-qt = %{version}-%{release}

%description qt
PIL image wrapper for Qt.
%prep
%autosetup -p1 -n Pillow-%{version}


%if %{with_python3}
%package -n %{name3}
Summary: Python 3 image processing library
%build
%py3_build

%description -n %{name3}
%{_description}
%if 0%{?with_docs}
PYTHONPATH=$PWD/build/%py3_libbuilddir make -C docs html BUILDDIR=_build_py3 SPHINXBUILD=sphinx-build-%python3_version
rm -f docs/_build_py3/html/.buildinfo
%endif # with_docs


%package -n %{name3}-devel
Summary: Development files for %{name3}
Group: Development/Libraries
Requires: %{name3}%{?_isa} = %{version}-%{release}
Requires: python3-devel, libjpeg-devel, zlib-devel
%install
install -d %{buildroot}/%{py3_incdir}/Imaging
install -m 644 src/libImaging/*.h %{buildroot}/%{py3_incdir}/Imaging
%py3_install

%description -n %{name3}-devel
Development files for %{name3}.

%check
ln -s $PWD/Images $PWD/build/%py3_libbuilddir/Images
cp -R $PWD/Tests $PWD/build/%py3_libbuilddir/Tests
cp -R $PWD/selftest.py $PWD/build/%py3_libbuilddir/selftest.py
pushd build/%py3_libbuilddir
PYTHONPATH=$PWD %{__python3} selftest.py
popd

%package -n %{name3}-doc
Summary: Documentation for %{name3}
Group: Documentation
Requires: %{name3} = %{version}-%{release}

%description -n %{name3}-doc
Documentation for %{name3}.
%files -n python3-%{srcname}
%doc README.rst CHANGES.rst
%license docs/COPYING
%{python3_sitearch}/*
# These are in subpackages
%exclude %{python3_sitearch}/PIL/_imagingtk*
%exclude %{python3_sitearch}/PIL/ImageTk*
%exclude %{python3_sitearch}/PIL/SpiderImagePlugin*
%exclude %{python3_sitearch}/PIL/ImageQt*
%exclude %{python3_sitearch}/PIL/__pycache__/ImageTk*
%exclude %{python3_sitearch}/PIL/__pycache__/SpiderImagePlugin*
%exclude %{python3_sitearch}/PIL/__pycache__/ImageQt*

%files -n python3-%{srcname}-devel
%{py3_incdir}/Imaging/

%package -n %{name3}-sane
Summary: Python module for using scanners
Group: System Environment/Libraries
Requires: %{name3}%{?_isa} = %{version}-%{release}
%files -n python3-%{srcname}-doc
%if 0%{?with_docs}
%doc docs/_build_py3/html
%endif # with_docs

%description -n %{name3}-sane
This package contains the sane module for Python which provides access to
various raster scanning devices such as flatbed scanners and digital cameras.
%files -n python3-%{srcname}-tk
%{python3_sitearch}/PIL/_imagingtk*
%{python3_sitearch}/PIL/ImageTk*
%{python3_sitearch}/PIL/SpiderImagePlugin*
%{python3_sitearch}/PIL/__pycache__/ImageTk*
%{python3_sitearch}/PIL/__pycache__/SpiderImagePlugin*


%package -n %{name3}-tk
Summary: Tk interface for %{name3}
Group: System Environment/Libraries
Requires: %{name3}%{?_isa} = %{version}-%{release}
Requires: tkinter
%changelog
* Fri Feb 11 2022 Charalampos Stratakis <cstratak@redhat.com> - 5.1.1-18
- Fixup for CVE-2022-22817
- Security fixes for CVE-2022-22815, CVE-2022-22816
Resolves: rhbz#2042522

%description -n %{name3}-tk
Tk interface for %{name3}.
* Fri Feb 04 2022 Charalampos Stratakis <cstratak@redhat.com> - 5.1.1-17
- Fix for CVE-2022-22817
Resolves: rhbz#2042527

%package -n %{name3}-qt
Summary: PIL image wrapper for Qt
Group: System Environment/Libraries
Obsoletes: %{name3} <= 2.0.0-5.git93a488e8
Requires: %{name3}%{?_isa} = %{version}-%{release}
Requires: python3-PyQt4
* Mon Aug 02 2021 Charalampos Stratakis <cstratak@redhat.com> - 5.1.1-16
- Fix for CVE-2021-34552
Resolves: rhbz#1982378

%description -n %{name3}-qt
PIL image wrapper for Qt.
* Mon Jun 14 2021 Lumír Balhar <lbalhar@redhat.com> - 5.1.1-15
- Fixes for CVE-2021-25288, CVE-2021-25287, CVE-2021-28675, CVE-2021-28676,
CVE-2021-28677 and CVE-2021-28678
Resolves: rhbz#1958231, rhbz#1958226, rhbz#1958240, rhbz#1958252, rhbz#1958257, rhbz#1958263

%endif
* Fri Apr 09 2021 Lumír Balhar <lbalhar@redhat.com> - 5.1.1-14
- Fixes for CVE-2021-25290, CVE-2021-25292, CVE-2021-25293, CVE-2021-27921
CVE-2021-27922, and CVE-2021-27923
Resolves: rhbz#1934685 rhbz#1934699 rhbz#1934705 rhbz#1935384 rhbz#1935396 rhbz#1935401

* Thu Feb 18 2021 Lumír Balhar <lbalhar@redhat.com> - 5.1.1-13
- Fixes for CVE-2020-35653 and CVE-2020-35655
Resolves: rhbz#1915420 rhbz#1915432

%prep
%setup -q -n python-imaging-Pillow-%{shortcommit}
%patch0 -p1 -b .archs
%patch1 -p1 -b .endian
%patch2 -p1 -b .byte_array
%patch3 -p1 -b .memleaks
* Mon Jul 13 2020 Lumír Balhar <lbalhar@redhat.com> - 5.1.1-12
- Fix for CVE-2020-11538
Resolves: rhbz#1852814

%if %{with_python3}
# Create Python 3 source tree
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
* Wed Mar 04 2020 Lumír Balhar <lbalhar@redhat.com> - 5.1.1-11
- Fix for CVE-2020-5313
Resolves: rhbz#1789532

* Mon Feb 17 2020 Lumír Balhar <lbalhar@redhat.com> - 5.1.1-10
- Bump and rebuild for gating to deliver CVE fixes
Resolves: rhbz#1789535

%build
# Build Python 2 modules
find -name '*.py' | xargs sed -i '1s|^#!.*python|#!%{__python}|'
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
* Mon Feb 17 2020 Lumír Balhar <lbalhar@redhat.com> - 5.1.1-9
- Fix for CVE-2020-5311 - out-of-bounds write in expandrow
Resolves: rhbz#1789535

pushd Sane
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
popd
* Fri Feb 14 2020 Lumír Balhar <lbalhar@redhat.com> - 5.1.1-8
- Combined fixes for CVE-2020-5312 and CVE-2019-16865
Resolves: rhbz#1789533
Resolves: rhbz#1774066

pushd docs
#PYTHONPATH=$PWD/.. make html
rm -f _build/html/.buildinfo
popd
* Tue Nov 27 2018 Lumír Balhar <lbalhar@redhat.com> - 5.1.1-7
- Add upstream patch to solve build-time warning
- Move patches to dist-git
- Resolves: rhbz#1639348

%if %{with_python3}
# Build Python 3 modules
pushd %{py3dir}
find -name '*.py' | xargs sed -i '1s|^#!.*python|#!%{__python3}|'
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
* Mon Oct 15 2018 Lumír Balhar <lbalhar@redhat.com> - 5.1.1-6
- Add patches to fix issues found by static code analysis
- Resolves: rhbz#1602669

pushd Sane
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
popd
* Wed Jun 27 2018 Petr Viktorin <pviktori@redhat.com> - 5.1.1-5
- Correct dependency on python3-tkinter

pushd docs
#PYTHONPATH=$PWD/.. make html
rm -f _build/html/.buildinfo
popd
popd
%endif
* Tue Jun 19 2018 Petr Viktorin <pviktori@redhat.com> - 5.1.1-4
- Drop dependency on python3-olefile (breaking MicImagePlugin.py, FpxImagePlugin)

* Thu Jun 14 2018 Petr Viktorin <pviktori@redhat.com> - 5.1.1-3
- Remove the Python 2 subpackage
- Remove the libimagequant dependency
The imagequant library was only used to support a non-default image
quantization mode.

%install
rm -rf $RPM_BUILD_ROOT

# Install Python 2 modules
install -d $RPM_BUILD_ROOT/%{py2_incdir}/Imaging
install -m 644 libImaging/*.h $RPM_BUILD_ROOT/%{py2_incdir}/Imaging
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
pushd Sane
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
popd
* Thu May 31 2018 Petr Viktorin <pviktori@redhat.com> - 5.1.1-2
- Remove the python2 version of docs
- Remove Qt subpackages
- Drop dependency on python2-olefile (breaking MicImagePlugin.py, FpxImagePlugin)

%if %{with_python3}
# Install Python 3 modules
pushd %{py3dir}
install -d $RPM_BUILD_ROOT/%{py3_incdir}/Imaging
install -m 644 libImaging/*.h $RPM_BUILD_ROOT/%{py3_incdir}/Imaging
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
pushd Sane
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
popd
popd
%endif
* Wed Apr 25 2018 Sandro Mani <manisandro@gmail.com> - 5.1.1-1
- Update to 5.1.1

# The scripts are packaged in %%doc
rm -rf $RPM_BUILD_ROOT%{_bindir}
* Thu Apr 05 2018 Sandro Mani <manisandro@gmail.com> - 5.1.0-1
- Update to 5.1.0

* Wed Mar 07 2018 Sandro Mani <manisandro@gmail.com> - 5.0.0-3
- Add missing BR: gcc

%check
# Check Python 2 modules
ln -s $PWD/Images $RPM_BUILD_ROOT%{python_sitearch}/Images
ln -s $PWD/Tests $RPM_BUILD_ROOT%{python_sitearch}/Tests
ln -s $PWD/selftest.py $RPM_BUILD_ROOT%{python_sitearch}/selftest.py
pushd $RPM_BUILD_ROOT%{python_sitearch}
%{__python} selftest.py
%{__python} Tests/run.py
popd
rm $RPM_BUILD_ROOT%{python_sitearch}/Images
rm $RPM_BUILD_ROOT%{python_sitearch}/Tests
rm $RPM_BUILD_ROOT%{python_sitearch}/selftest.py*

%if %{with_python3}
# Check Python 3 modules
pushd %{py3dir}
ln -s $PWD/Images $RPM_BUILD_ROOT%{python3_sitearch}/Images
ln -s $PWD/Tests $RPM_BUILD_ROOT%{python3_sitearch}/Tests
ln -s $PWD/selftest.py $RPM_BUILD_ROOT%{python3_sitearch}/selftest.py
pushd $RPM_BUILD_ROOT%{python3_sitearch}
%{__python3} selftest.py
%{__python3} Tests/run.py
popd
rm $RPM_BUILD_ROOT%{python3_sitearch}/Images
rm $RPM_BUILD_ROOT%{python3_sitearch}/Tests
rm $RPM_BUILD_ROOT%{python3_sitearch}/selftest.py*
popd
%endif
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Wed Jan 03 2018 Sandro Mani <manisandro@gmail.com> - 5.0.0-1
- Update to 5.0.0

%files
%doc README.rst docs/HISTORY.txt COPYING
%{python_sitearch}/*
# These are in subpackages
%exclude %{python_sitearch}/*sane*
%exclude %{python_sitearch}/_imagingtk*
%exclude %{python_sitearch}/PIL/ImageTk*
%exclude %{python_sitearch}/PIL/SpiderImagePlugin*
%exclude %{python_sitearch}/PIL/ImageQt*
* Tue Oct 03 2017 Sandro Mani <manisandro@gmail.com> - 4.3.0-1
- Update to 4.3.0

%files devel
%{py2_incdir}/Imaging/
* Tue Sep 05 2017 Troy Dawson <tdawson@redhat.com> - 4.2.1-5
- Cleanup spec file conditionals

%files doc
#%doc Scripts Images docs/_build/html
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4.2.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

%files sane
%doc Sane/CHANGES Sane/demo*.py Sane/sanedoc.txt
%{python_sitearch}/*sane*
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4.2.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

%files tk
%{python_sitearch}/_imagingtk*
%{python_sitearch}/PIL/ImageTk*
%{python_sitearch}/PIL/SpiderImagePlugin*
* Fri Jul 07 2017 Igor Gnatenko <ignatenko@redhat.com> - 4.2.1-2
- Rebuild due to bug in RPM (RHBZ #1468476)

%files qt
%{python_sitearch}/PIL/ImageQt*
* Thu Jul 06 2017 Sandro Mani <manisandro@gmail.com> - 4.2.1-1
- Update to 4.2.1

%if %{with_python3}
%files -n %{name3}
%doc README.rst docs/HISTORY.txt COPYING
%{python3_sitearch}/*
# These are in subpackages
%exclude %{python3_sitearch}/*sane*
%exclude %{python3_sitearch}/_imagingtk*
%exclude %{python3_sitearch}/PIL/ImageTk*
%exclude %{python3_sitearch}/PIL/SpiderImagePlugin*
%exclude %{python3_sitearch}/PIL/ImageQt*
* Sat Jul 01 2017 Sandro Mani <manisandro@gmail.com> - 4.2.0-1
- Update to 4.2.0

%files -n %{name3}-devel
%{py3_incdir}/Imaging/
* Fri Apr 28 2017 Sandro Mani <manisandro@gmail.com> - 4.1.1-1
- Update to 4.1.1

%files -n %{name3}-doc
#%doc Scripts Images docs/_build/html
* Wed Apr 05 2017 Sandro Mani <manisandro@gmail.com> - 4.1.0-1
- Update to 4.1.0

%files -n %{name3}-sane
%doc Sane/CHANGES Sane/demo*.py Sane/sanedoc.txt
%{python3_sitearch}/*sane*
* Wed Feb 15 2017 Sandro Mani <manisandro@gmail.com> - 4.0.0-3
- Fix some __pycache__ files in wrong subpackage (#1422606)

%files -n %{name3}-tk
%{python3_sitearch}/_imagingtk*
%{python3_sitearch}/PIL/ImageTk*
%{python3_sitearch}/PIL/SpiderImagePlugin*
* Wed Feb 01 2017 Sandro Mani <manisandro@gmail.com> - 4.0.0-2
- Rebuild (libwebp)

%files -n %{name3}-qt
%{python3_sitearch}/PIL/ImageQt*
* Tue Jan 03 2017 Sandro Mani <manisandro@gmail.com> - 4.0.0-1
- Update to 4.0.0

%endif
* Mon Dec 12 2016 Miro Hrončok <mhroncok@redhat.com> - 3.4.2-3
- Enable docs build

%changelog
* Mon Oct 06 2014 Michal Minar <miminar@redhat.com> 2.0.0-19gitd1c6db8
- Reenabled webp support on little endian archs.
* Mon Dec 12 2016 Miro Hrončok <mhroncok@redhat.com> - 3.4.2-2
- Rebuild for Python 3.6

* Wed Oct 19 2016 Sandro Mani <manisandro@gmail.com> - 3.4.2-1
- Update to 3.4.2

* Tue Oct 04 2016 Sandro Mani <manisandro@gmail.com> - 3.4.1-1
- Update to 3.4.1

* Mon Oct 03 2016 Sandro Mani <manisandro@gmail.com> - 3.4.0-1
- Update to 3.4.0

* Thu Aug 18 2016 Sandro Mani <manisandro@gmail.com> - 3.3.1-1
- Update to 3.3.1

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.3.0-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Sat Jul 02 2016 Sandro Mani <manisandro@gmail.com> - 3.3.0-1
- Update to 3.3.0
- Modernize spec

* Fri Apr 01 2016 Sandro Mani <manisandro@gmail.com> - 3.2.0-1
- Update to 3.2.0

* Wed Feb 10 2016 Sandro Mani <manisandro@gmail.com> - 3.1.1-3
- Fix broken python3-pillow package description

* Sun Feb 07 2016 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 3.1.1-2
- Fix provides

* Thu Feb 04 2016 Sandro Mani <manisandro@gmail.com> - 3.1.1-1
- Update to 3.1.1
- Fixes CVE-2016-0740, CVE-2016-0775

* Mon Jan 11 2016 Toshio Kuratomi <toshio@fedoraproject.org> - 3.1.0-2
- Fix executable files in doc package bringing in python 2 for the python3 doc
packages

* Mon Jan 04 2016 Sandro Mani <manisandro@gmail.com> - 3.1.0-1
- Update to 3.1.0

* Tue Dec 29 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 3.0.0-5
- Build with docs

* Mon Dec 28 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 3.0.0-4
- Rebuilt for libwebp soname bump

* Wed Oct 14 2015 Robert Kuska <rkuska@redhat.com> - 3.0.0-3
- Rebuilt for Python3.5 rebuild with docs

* Tue Oct 13 2015 Robert Kuska <rkuska@redhat.com> - 3.0.0-2
- Rebuilt for Python3.5 rebuild without docs

* Fri Oct 02 2015 Sandro Mani <manisandro@gmail.com> - 3.0.0-1
- Update to 3.0.0

* Wed Jul 29 2015 Sandro Mani <manisandro@gmail.com> - 2.9.0-2
- Fix python3-pillow-tk Requires: tkinter -> python3-tkinter (#1248085)

* Thu Jul 02 2015 Sandro Mani <manisandro@gmail.com> - 2.9.0-1
- Update to 2.9.0

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.8.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Mon Jun 08 2015 Sandro Mani <manisandro@gmail.com> - 2.8.2-1
- Update to 2.8.2

* Thu Apr 02 2015 Sandro Mani <manisandro@gmail.com> - 2.8.1-1
- Update to 2.8.1

* Wed Apr 01 2015 Sandro Mani <manisandro@gmail.com> - 2.8.0-1
- Update to 2.8.0

* Mon Jan 12 2015 Sandro Mani <manisandro@gmail.com> - 2.7.0-1
- Update to 2.7.0
- Drop sane subpackage, is in python-sane now
- Fix python3 headers directory
- Drop Obsoletes: python3-pillow on python3-pillow-qt

* Mon Oct 13 2014 Sandro Mani <manisandro@gmail.com> - 2.6.1-1
- Update to 2.6.1

* Thu Oct 02 2014 Sandro Mani <manisandro@gmail.com> - 2.6.0-1
- Update to 2.6.0

* Wed Aug 20 2014 Sandro Mani <manisandro@gmail.com> - 2.5.3-3
- Rebuilding again to resolve transient build error that caused BZ#1131723

* Tue Aug 19 2014 Stephen Gallagher <sgallagh@redhat.com> - 2.5.3-2
- Rebuilding to resolve transient build error that caused BZ#1131723

* Tue Aug 19 2014 Sandro Mani <manisandro@gmail.com> - 2.5.3-1
- Update to 2.5.3 (Fix CVE-2014-3598, a DOS in the Jpeg2KImagePlugin)

* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Wed Aug 13 2014 Sandro Mani <manisandro@gmail.com> - 2.5.2-1
- Update to 2.5.2 (Fix CVE-2014-3589, a DOS in the IcnsImagePlugin)

* Sat Jul 26 2014 Sandro Mani <manisandro@gmail.com> - 2.5.1-2
- Reenable jpeg2k tests on big endian arches

* Tue Jul 15 2014 Sandro Mani <manisandro@gmail.com> - 2.5.1-1
- Update to 2.5.1

* Wed Jul 02 2014 Sandro Mani <manisandro@gmail.com> - 2.5.0-1
- Update to 2.5.0

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.0-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed May 28 2014 Sandro Mani <manisandro@gmail.com> - 2.4.0-10
- Rebuild with docs enabled
- Update python-pillow_openjpeg-2.1.0.patch

* Tue May 27 2014 Sandro Mani <manisandro@gmail.com> - 2.4.0-9
- Rebuild against openjpeg-2.1.0

* Fri May 23 2014 Dan Horák <dan[at]danny.cz> - 2.4.0-8
- skip jpeg2k tests on big endian arches (#1100762)

* Wed May 21 2014 Jaroslav Škarvada <jskarvad@redhat.com> - 2.4.0-7
- Rebuilt for https://fedoraproject.org/wiki/Changes/f21tcl86

* Tue May 13 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 2.4.0-6
- Set with_docs to 1 to build docs.

* Tue May 13 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 2.4.0-5
- Bootstrap building sphinx docs because of circular dependency with sphinx.

* Fri May 9 2014 Orion Poplawski <orion@cora.nwra.com> - 2.4.0-4
- Rebuild for Python 3.4

* Tue Apr 22 2014 Sandro Mani <manisandro@gmail.com> - 2.4.0-3
- Add patch: Have the tempfile use a suffix with a dot

* Thu Apr 17 2014 Sandro Mani <manisandro@gmail.com> - 2.4.0-2
- Enable Jpeg2000 support
- Enable webp support also on s390* archs, bug #962091 is now fixed
- Add upstream patch for ghostscript detection

* Wed Apr 02 2014 Sandro Mani <manisandro@gmail.com> - 2.4.0-1
- Update to 2.4.0

* Wed Mar 19 2014 Sandro Mani <manisandro@gmail.com> - 2.3.1-1
- Update to 2.3.1 (Fix insecure use of tempfile.mktemp (CVE-2014-1932 CVE-2014-1933))

* Thu Mar 13 2014 Jakub Dorňák <jdornak@redhat.com> - 2.3.0-5
- python-pillow does not provide python3-imaging
(python3-pillow does)

* Tue Jan 07 2014 Sandro Mani <manisandro@gmail.com> - 2.3.0-4
- Add missing ghostscript Requires and BuildRequires

* Mon Jan 06 2014 Sandro Mani <manisandro@gmail.com> - 2.3.0-3
- Remove python-pillow_help-theme.patch, add python-sphinx-theme-better BR

* Sun Jan 05 2014 Sandro Mani <manisandro@gmail.com> - 2.3.0-2
- Rebuild with docs enabled
- Change lcms BR to lcms2

* Mon Aug 18 2014 Michal Minar <miminar@redhat.com> 2.0.0-18gitd1c6db8
- Disabled webp support on ppc64le due to #962091 and #1127230.
- Updated URL.
* Thu Jan 02 2014 Sandro Mani <manisandro@gmail.com> - 2.3.0-1
- Update to 2.3.0
- Build with doc disabled to break circular python-pillow -> python-sphinx -> python pillow dependency

* Fri Feb 21 2014 Michal Minar <miminar@redhat.com> 2.0.0-17gitd1c6db8
- Wiped out some memory leaks.
* Wed Oct 23 2013 Sandro Mani <manisandro@gmail.com> - 2.2.1-2
- Backport fix for decoding tiffs with correct byteorder, fixes rhbz#1019656

* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 2.0.0-15.gitd1c6db8
- Mass rebuild 2014-01-24
* Wed Oct 02 2013 Sandro Mani <manisandro@gmail.com> - 2.2.1-1
- Update to 2.2.1
- Really enable webp on ppc, but leave disabled on s390

* Tue Jan 14 2014 Michal Minar <miminar@redhat.com> 2.0.0-14gitd1c6db8
- Fixed memory corruption.
- Resolves: rhbz#1001122
* Thu Aug 29 2013 Sandro Mani <manisandro@gmail.com> - 2.1.0-4
- Add patch to fix incorrect PyArg_ParseTuple tuple signature, fixes rhbz#962091 and rhbz#988767.
- Renable webp support on bigendian arches

* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 2.0.0-13.gitd1c6db8
- Mass rebuild 2013-12-27
* Wed Aug 28 2013 Sandro Mani <manisandro@gmail.com> - 2.1.0-3
- Add patch to fix memory corruption caused by invalid palette size, see rhbz#1001122

* Mon Jul 29 2013 Roman Rakus <rrakus@redhat.com> - 2.0.0-12
- Mark doc subpackage arch dependent. Docs are built depending on supported
features, which are different across archs.
Resolves: rhbz#987839
* Tue Jul 30 2013 Karsten Hopp <karsten@redhat.com> 2.1.0-2
- Build without webp support on ppc* archs (#988767)

* Wed Jul 24 2013 Roman Rakus <rrakus@redhat.com> - 2.0.0-11
- Drop lcms support
Resolves: rhbz#987839
* Wed Jul 03 2013 Sandro Mani <manisandro@gmail.com> - 2.1.0-1
- Update to 2.1.0
- Run tests in builddir, not installroot
- Build python3-pillow docs with python3
- python-pillow_endian.patch upstreamed

* Mon May 13 2013 Roman Rakus <rrakus@redhat.com> - 2.0.0-10
- Build without webp support on s390* archs

280
SPECS/python-ply.spec

@ -1,124 +1,216 @@ @@ -1,124 +1,216 @@
%global with_python3 1
#%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}

Name: python-ply
Summary: Python Lex-Yacc
Version: 3.4
Release: 11%{?dist}
License: BSD
Group: System Environment/Libraries
URL: http://www.dabeaz.com/ply/
Source0: http://www.dabeaz.com/ply/ply-%{version}.tar.gz
Patch0: 0001-Replace-md5-in-signature-calculation.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python-devel

%if 0%{?with_python3}
BuildRequires: /usr/bin/2to3
BuildRequires: python3-devel
%endif # if with_python3
%global modname ply

%bcond_without tests

Name: python-%{modname}
Summary: Python Lex-Yacc
Version: 3.11
Release: 9%{?dist}
License: BSD
URL: http://www.dabeaz.com/ply/
Source0: http://www.dabeaz.com/ply/%{modname}-%{version}.tar.gz
BuildArch: noarch

%description
PLY is a straightforward lex/yacc implementation. Here is a list of its
PLY is a straightforward lex/yacc implementation. Here is a list of its
essential features:
* It is implemented entirely in Python.
* It uses LR-parsing which is reasonably efficient and well suited for larger
* It uses LR-parsing which is reasonably efficient and well suited for larger
grammars.
* PLY provides most of the standard lex/yacc features including support
for empty productions, precedence rules, error recovery, and support
* PLY provides most of the standard lex/yacc features including support
for empty productions, precedence rules, error recovery, and support
for ambiguous grammars.
* PLY is straightforward to use and provides very extensive error checking.
* PLY doesn't try to do anything more or less than provide the basic lex/yacc
functionality. In other words, it's not a large parsing framework or a
component of some larger system.
* PLY doesn't try to do anything more or less than provide the basic lex/yacc
functionality. In other words, it's not a large parsing framework or a
component of some larger system.

%if 0%{?with_python3}
%package -n python3-ply
%package -n python3-%{modname}
Summary: Python Lex-Yacc
Group: System Environment/Libraries
Requires: python3-setuptools
%{?python_provide:%python_provide python3-%{modname}}
BuildRequires: python3-devel
BuildRequires: python3-setuptools

%description -n python3-ply
PLY is a straightforward lex/yacc implementation. Here is a list of its
%description -n python3-%{modname}
PLY is a straightforward lex/yacc implementation. Here is a list of its
essential features:
* It is implemented entirely in Python.
* It uses LR-parsing which is reasonably efficient and well suited for larger
* It uses LR-parsing which is reasonably efficient and well suited for larger
grammars.
* PLY provides most of the standard lex/yacc features including support
for empty productions, precedence rules, error recovery, and support
* PLY provides most of the standard lex/yacc features including support
for empty productions, precedence rules, error recovery, and support
for ambiguous grammars.
* PLY is straightforward to use and provides very extensive error checking.
* PLY doesn't try to do anything more or less than provide the basic lex/yacc
functionality. In other words, it's not a large parsing framework or a
* PLY doesn't try to do anything more or less than provide the basic lex/yacc
functionality. In other words, it's not a large parsing framework or a
component of some larger system.
%endif # with_python3

Python 3 version.

%prep
%setup -q -n ply-%{version}
%patch0 -p0
sed -i 's|/usr/local/bin/python|/usr/bin/python|g' example/yply/yply.py
chmod -x example/yply/yply.py example/newclasscalc/calc.py example/classcalc/calc.py example/cleanup.sh

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!/usr/bin/python|#!%{__python3}|'

# The README states: "You should not convert PLY using
# 2to3--it is not necessary and may in fact break the implementation."
#
# However, one of the example files contains python 2 "print" syntax, which
# lead to syntax errors during byte-compilation
#
# So we fix this file with 2to3:
pushd %{py3dir}
2to3 --write --nobackups ply/cpp.py
popd
%endif # with_python3
%autosetup -n %{modname}-%{version}
find example/ -type f -executable -exec chmod -x {} ';'
find example/ -type f -name '*.py' -exec sed -i \
-e '1{\@^#!/usr/bin/env python@d}' -e '1{\@^#!/usr/local/bin/python@d}' \
{} ';'
rm -rf *.egg-info

%build
%{__python} setup.py build
%py3_build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
%install
%py3_install

%if %{with tests}
%check
pushd test
./cleanup.sh
%{__python3} testlex.py
%{__python3} testyacc.py
popd
%endif # with_python3
%endif

%install
rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
%files -n python3-%{modname}
%doc CHANGES README.md
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/%{modname}-%{version}-*.egg-info/

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
popd
%endif # with_python3
%changelog
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.11-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

%clean
rm -rf $RPM_BUILD_ROOT
* Sat May 23 2020 Miro Hrončok <mhroncok@redhat.com> - 3.11-8
- Rebuilt for Python 3.9

%files
%defattr(-,root,root,-)
%doc CHANGES README example/
%{python_sitelib}/ply/
%{python_sitelib}/ply*.egg-info
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.11-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

%if 0%{?with_python3}
%files -n python3-ply
%defattr(-,root,root,-)
%doc CHANGES README example/
%{python3_sitelib}/ply/
%{python3_sitelib}/ply*.egg-info
%endif # with_python3
* Sun Oct 20 2019 Miro Hrončok <mhroncok@redhat.com> - 3.11-6
- Subpackage python2-ply has been removed
See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal

%changelog
* Tue Mar 7 2017 Stanislav Laznicka <slaznick@redhat.com> 3.4-11
- Replace md5 in signature calculation in order to allow use in FIPS
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 3.11-5
- Rebuilt for Python 3.8.0rc1 (#1748018)

* Thu Aug 15 2019 Miro Hrončok <mhroncok@redhat.com> - 3.11-4
- Rebuilt for Python 3.8

* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.11-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.11-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Jan 11 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.11-1
- Update to 3.11

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.9-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Fri Jun 15 2018 Miro Hrončok <mhroncok@redhat.com> - 3.9-7
- Rebuilt for Python 3.7

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.9-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Wed Sep 27 2017 Troy Dawson <tdawson@redhat.com> - 3.9-5
- Cleanup spec file conditionals

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.9-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.9-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Fri Dec 09 2016 Charalampos Stratakis <cstratak@redhat.com> - 3.9-2
- Rebuild for Python 3.6

* Tue Nov 8 2016 Orion Poplawski <orion@cora.nwra.com> - 3.9-1
- Update to 3.9

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.8-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Sun Apr 10 2016 Igor Gnatenko <ignatenko@redhat.com> - 3.8-1
- Update to 3.8
- Follow new packaging guidelines
- Run tests

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Oct 13 2015 Robert Kuska <rkuska@redhat.com> - 3.6-3
- Rebuilt for Python3.5 rebuild

* Tue Aug 18 2015 Stephen Gallagher <sgallagh@redhat.com> 3.6-2
- Fixes for chromium and SlimIt
- Resolves: rhbz#1242929
- Resolves: rhbz#1254372

* Tue Jul 14 2015 Stephen Gallagher <sgallagh@redhat.com> 3.6-1
- Update to latest ply 3.6 for Python 3 fixes

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.4-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.4-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Mon May 12 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 3.4-6
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Sat Aug 04 2012 David Malcolm <dmalcolm@redhat.com> - 3.4-3
- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Mon Mar 19 2012 Tom Callaway <spot@fedoraproject.org> - 3.4-1
- update to 3.4

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Wed Aug 25 2010 Thomas Spura <tomspur@fedoraproject.org> - 3.3-4
- update to most recent python packaging guidelines
- rebuild with python3.2
http://lists.fedoraproject.org/pipermail/devel/2010-August/141368.html

* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 3.3-3
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Sat Apr 3 2010 David Malcolm <dmalcolm@redhat.com> - 3.3-2
- add python3-ply subpackage

* Mon Oct 19 2009 Tom "spot" Callaway <tcallawa@redhat.com> - 3.3-1
- update to 3.3

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Wed Apr 22 2009 Tom "spot" Callaway <tcallawa@redhat.com> 3.2-1
- update to 3.2, license change to BSD

* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 2.5-2
- Rebuild for Python 2.6

* Fri Oct 17 2008 Tom "spot" Callaway <tcallawa@redhat.com> 2.5-1
- update to 2.5

* Fri Jun 12 2015 Martin Kosek <mkosek@redhat.com> 3.4-10
- Increase Release number to get a clean upgrade path from EPEL 7
* Mon Mar 24 2008 Tom "spot" Callaway <tcallawa@redhat.com> 0.2.3-2
- add example dir as doc

* Mon Sep 8 2014 Petr Vobornik <pvoborni@redhat.com> 3.4-1
- Initial package for RHEL 7
* Sat Mar 15 2008 Tom "spot" Callaway <tcallawa@redhat.com> 0.2.3-1
- Initial package for Fedora

174
SPECS/python-pycparser.spec

@ -1,115 +1,159 @@ @@ -1,115 +1,159 @@
%global with_python3 1
%bcond_without tests

Name: python-pycparser
Summary: C parser and AST generator written in Python
Version: 2.14
Version: 2.20
Release: 1%{?dist}
License: BSD
Group: System Environment/Libraries
URL: http://github.com/eliben/pycparser
Source0: http://github.com/eliben/pycparser/archive/release_v%{version}.tar.gz
Source0: %{url}/archive/release_v%{version}.tar.gz
Source1: pycparser-0.91.1-remove-relative-sys-path.py

Patch100: pycparser-2.10-ply.patch
# This is Fedora-specific; I don't think we should request upstream to
# remove embedded libraries from their distribuution, when we can remove
# them during packaging.
# It also ensures that pycparser uses the same YACC __tabversion__ as ply
# package to prevent "yacc table file version is out of date" problem.
Patch100: pycparser-unbundle-ply.patch

BuildArch: noarch

BuildRequires: python2-devel python-setuptools
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-ply

# for unit tests
BuildRequires: dos2unix
BuildRequires: python-ply

%if 0%{?with_python3}
BuildRequires: python3-devel python3-setuptools
# for unit tests
BuildRequires: python3-ply
%endif # if with_python3

Requires: python-ply
%if %{with tests}
BuildRequires: cpp
%endif

%description
pycparser is a complete parser for the C language, written in pure Python.
It is a module designed to be easily integrated into applications that
need to parse C source code.

%if 0%{?with_python3}
%package -n python3-pycparser
Summary: C parser and AST generator written in Python
Group: System Environment/Libraries
Requires: python3-ply
Summary: %{summary}
%{?python_provide:%python_provide python3-pycparser}

%description -n python3-pycparser
pycparser is a complete parser for the C language, written in pure Python.
It is a module designed to be easily integrated into applications that
need to parse C source code.
%endif # if with_python3

%prep
%setup -q -n pycparser-release_v%{version}
%patch100 -p1 -F5 -b .ply
%autosetup -p1 -n pycparser-release_v%{version}

# remove embedded copy of ply
rm -rf pycparser/ply

# examples
%{__python} %{SOURCE1} examples
dos2unix LICENSE
rm -r pycparser/ply

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!/usr/bin/python|#!%{__python3}|'
%endif # with_python3
# Remove relative sys.path from the examples
%{__python3} %{SOURCE1} examples

%build
%{__python} setup.py build
pushd build/lib/pycparser
%{__python} _build_tables.py
popd

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
%py3_build
pushd build/lib/pycparser
%{__python3} _build_tables.py
popd
popd
%endif # with_python3

%install
%{__python} setup.py install --skip-build --root %{buildroot}

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3
%py3_install

%check
%{__python} tests/all_tests.py

%if 0%{?with_python3}
%{__python3} tests/all_tests.py
pushd %{py3dir}
popd
%endif # with_python3
%if %{with tests}
%{__python3} tests/all_tests.py
%endif
%files
%doc examples LICENSE
%{python_sitelib}/pycparser/
%{python_sitelib}/pycparser-*.egg-info

%if 0%{?with_python3}
%files -n python3-pycparser
%license LICENSE
%doc examples
%{python3_sitelib}/pycparser/
%{python3_sitelib}/pycparser-*.egg-info
%endif # with_python3
%{python3_sitelib}/pycparser-*.egg-info/

%changelog
* Fri Jun 05 2020 Miro Hrončok <mhroncok@redhat.com> - 2.20-1
- Update to 2.20 (#1810349)

* Sat May 23 2020 Miro Hrončok <mhroncok@redhat.com> - 2.19-3
- Rebuilt for Python 3.9

* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.19-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Fri Nov 08 2019 Lumír Balhar <lbalhar@redhat.com> - 2.19-1
- New usptream version 2.19

* Sun Oct 20 2019 Miro Hrončok <mhroncok@redhat.com> - 2.14-23
- Subpackage python2-ply has been removed
See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal

* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 2.14-22
- Rebuilt for Python 3.8.0rc1 (#1748018)

* Thu Aug 15 2019 Miro Hrončok <mhroncok@redhat.com> - 2.14-21
- Rebuilt for Python 3.8

* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.14-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Mon Jun 10 2019 Marcel Plch <mplch@redhat.com> - 2.14-19
- Avoid invalid unicode escape sequences in Py3.8

* Tue Feb 26 2019 Christian Heimes <cheimes@redhat.com> - 2.14-18
- Add build dependency on cpp for unit tests
- Add dependency on python-ply version to prevent "yacc table file version is out of date"
- Fixes RHBZ#1668230

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.14-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.14-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Fri Jun 15 2018 Miro Hrončok <mhroncok@redhat.com> - 2.14-15
- Rebuilt for Python 3.7

* Mon Feb 12 2018 Iryna Shcherbina <ishcherb@redhat.com> - 2.14-14
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.14-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Wed Sep 27 2017 Troy Dawson <tdawson@redhat.com> - 2.14-12
- Cleanup spec file conditionals

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.14-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.14-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Fri Jan 6 2017 Orion Poplawski <orion@cora.nwra.com> - 2.14-9
- Ship python2-pycparser
- Modernize spec

* Fri Dec 09 2016 Charalampos Stratakis <cstratak@redhat.com> - 2.14-8
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.14-7
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Fri Jul 8 2016 Tom Callaway <spot@fedoraproject.org> - 2.14-6
- rebuild to update yacctab.py

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.14-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Oct 13 2015 Robert Kuska <rkuska@redhat.com> - 2.14-4
- Rebuilt for Python3.5 rebuild

* Tue Jul 14 2015 Stephen Gallagher <sgallagh@redhat.com> - 2.14-3
- Rebuild alongside python-ply 3.6

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.14-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Tue Jun 09 2015 Nathaniel McCallum <npmccallum@redhat.com> - 2.14-1
- Update to 2.14


2
SPECS/python-six.spec

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@

Name: python-six
Version: 1.9.0
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Python 2 and 3 compatibility utilities

Group: Development/Languages

4
SPECS/python3-pip.spec

@ -368,12 +368,12 @@ pytest_k='not completion and @@ -368,12 +368,12 @@ pytest_k='not completion and
%doc README.rst
%license %{python3_sitelib}/pip-%{upstream_version}.dist-info/LICENSE.txt
%if %{with doc}
%{_mandir}/man1/pip.*
%exclude %{_mandir}/man1/pip.*
%{_mandir}/man1/pip-*.*
%{_mandir}/man1/pip3.*
%{_mandir}/man1/pip3-*.*
%endif
%{_bindir}/pip
%exclude %{_bindir}/pip
%{_bindir}/pip3
%{_bindir}/pip-3
%{_bindir}/pip%{python3_version}

1099
SPECS/python3-setuptools.spec

File diff suppressed because it is too large Load Diff

2
SPECS/python3.spec

@ -238,6 +238,8 @@ BuildRequires: python3-pip-wheel @@ -238,6 +238,8 @@ BuildRequires: python3-pip-wheel
BuildRequires: python%{pybasever}
%endif

Obsoletes: system-python-libs >= 3.6

# =======================
# Source code and patches
# =======================

Loading…
Cancel
Save