File python-Django1.spec of Package python-Django1

#
# spec file for package python-Django1
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define oldpython python
%if %{python3_version_nodots} > 34
%define skip_python3 1
%endif
Name:           python-Django1
Version:        1.11.29
Release:        0
Summary:        A high-level Python Web framework
License:        BSD-3-Clause
Group:          Development/Languages/Python
URL:            http://www.djangoproject.com
Source:         https://www.djangoproject.com/m/releases/1.11/Django-%{version}.tar.gz
Source1:        https://www.djangoproject.com/m/pgp/Django-%{version}.checksum.txt#/Django-%{version}.tar.gz.checksums.txt
Source2:        %{name}.keyring
Source99:       python-Django1-rpmlintrc
Patch1:         CVE-2020-13596.patch
Patch2:         CVE-2020-13254.patch
Patch3:         CVE-2021-3281.patch
Patch4:         CVE-2021-23336.patch
Patch5:         CVE-2021-28658.patch
Patch6:         CVE-2021-31542.patch
Patch7:         CVE-2021-33203.patch
Patch8:         CVE-2021-33571.patch
Patch9:         CVE-2021-45116.patch
Patch10:        CVE-2021-45115.patch
Patch11:        CVE-2021-45452.patch
Patch12:        CVE-2022-22818.patch
Patch13:        CVE-2022-23833.patch
Patch14:        CVE-2022-28346.patch
Patch15:        CVE-2022-34265.patch
# PATCH-FIX-UPSTREAM CVE-2023-24580-DOS_file_upload.patch bsc#1208082 mcepl@suse.com
# prevent DOS in file uploads
Patch16:        CVE-2023-24580-DOS_file_upload.patch
# PATCH-FIX-UPSTREAM CVE-2023-36053.patch bsc#1212742
Patch17:        CVE-2023-36053.patch
Patch18:        CVE-2023-41164.patch
# PATCH-FIX-UPSTREAM CVE-2023-43665.patch bsc#1215978
Patch19:        CVE-2023-43665.patch
Patch20:        CVE-2024-24680.patch
BuildRequires:  %{python_module base}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Requires:       python-Pillow
Requires:       python-pytz
Requires:       python-setuptools
Requires:       python-xml
Requires(post): update-alternatives
Requires(preun): update-alternatives
Recommends:     python-bcrypt
Provides:       python-Django = %{version}
Obsoletes:      python-Django < %{version}
Provides:       python-South = %{version}
Obsoletes:      python-South < %{version}
BuildArch:      noarch
%ifpython2
Obsoletes:      %{oldpython}-Django < %{version}
Provides:       %{oldpython}-Django = %{version}
Obsoletes:      %{oldpython}-django < %{version}
Provides:       %{oldpython}-django = %{version}
Obsoletes:      %{oldpython}-South < %{version}
Provides:       %{oldpython}-South = %{version}
%endif
%python_subpackages

%description
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.

%prep
# The publisher doesn't sign the source tarball, but a signatures file containing multiple hashes.
# Verify hashes in that file against source tarball.
echo "`grep -e '^[0-9a-f]\{32\}  Django-%{version}.tar.gz' %{SOURCE1} | cut -c1-32`  %{SOURCE0}" | md5sum -c
echo "`grep -e '^[0-9a-f]\{40\}  Django-%{version}.tar.gz' %{SOURCE1} | cut -c1-40`  %{SOURCE0}" | sha1sum -c
echo "`grep -e '^[0-9a-f]\{64\}  Django-%{version}.tar.gz' %{SOURCE1} | cut -c1-64`  %{SOURCE0}" | sha256sum -c

%setup -q -n Django-%{version}
%patch1 -p 1
%patch2 -p 1
%patch3 -p 1
%patch4 -p 1
%patch5 -p 1
%patch6 -p 1
%patch7 -p 1
%patch8 -p 1
%patch9 -p 1
%patch10 -p 1
%patch11 -p 1
%patch12 -p 1
%patch13 -p 1
%patch14 -p 1
%patch15 -p 1
%patch16 -p 1
%patch17 -p 1
%patch18 -p 1
%patch19 -p 1
%patch20 -p 1

%build
%python_build

%install
%python_install

%python_clone -a %{buildroot}%{_bindir}/django-admin.py
%python_clone -a %{buildroot}%{_bindir}/django-admin

%{python_expand install -D -m 0644 extras/django_bash_completion %{buildroot}%{_datadir}/bash-completion/completions/django_bash_completion-%{$python_bin_suffix}.sh
pushd %{buildroot}%{$python_sitelib}
chmod a-x django/contrib/admin/static/admin/js/vendor/xregexp/xregexp.js
# Fix wrong-script-interpreter
sed -i "s|^#!%{_bindir}/env python$|#!%{__$python}|" django/bin/django-admin.py
sed -i "s|^#!%{_bindir}/env python$|#!%{__$python}|" django/conf/project_template/manage.py-tpl
%fdupes .
# Deduplicating files can generate a RPMLINT warning for pyc mtime
$python -m compileall -d %{$python_sitelib} django/bin/
$python -O -m compileall -d %{$python_sitelib} django/bin/
$python -m compileall -d %{$python_sitelib} django/conf/project_template/
$python -O -m compileall -d %{$python_sitelib} django/conf/project_template/
$python -m compileall -d %{$python_sitelib} django/conf/locale/
$python -O -m compileall -d %{$python_sitelib} django/conf/locale/
$python -m compileall -d %{$python_sitelib} django/conf/locale/ru/
$python -O -m compileall -d %{$python_sitelib} django/conf/locale/ru/
%fdupes django/bin/
popd
}

%post
%{python_install_alternative django-admin.py django-admin}

%preun
%python_uninstall_alternative django-admin

%files %{python_files}
%license LICENSE
%doc AUTHORS README.rst
%python_alternative %{_bindir}/django-admin
%python_alternative %{_bindir}/django-admin.py
%{_datadir}/bash-completion/completions/django_bash_completion-%{python_bin_suffix}.sh
%{python_sitelib}/django
%{python_sitelib}/Django-%{version}-py*.egg-info

%changelog
openSUSE Build Service is sponsored by