File python-Django.spec of Package python-Django

# spec file for package python-Django
# Copyright (c) 2021 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

%global _defaultlicensedir %_defaultdocdir

Name:           python-Django
Version:        1.8.19
Release:        0
Summary:        A high-level Python Web framework
License:        BSD-3-Clause
Group:          Development/Languages/Python
Source2:        %{name}.keyring
Source99:       python-Django-rpmlintrc
#PATCH-FIX-UPSTREAM CVE-2019-3498-Fixed-content-spoof.patch
Patch1:         CVE-2019-3498-Fixed-content-spoof.patch
Patch2:         CVE-2019-6975.patch
Patch3:         CVE-2019-14232-avoid-backtracking-issues.patch
Patch4:         CVE-2019-14233-prevent-excessive-recursion.patch
Patch5:         CVE-2019-14234-prevent-sql-injection.patch
Patch6:         CVE-2019-14235-fix-memory-exhaustion.patch
Patch7:         CVE-2019-12781-trust-ssl-header.patch
Patch8:         CVE-2020-13596.patch
Patch9:         CVE-2020-13254.patch
Patch10:        CVE-2019-19844.patch
Patch11:        CVE-2021-3281.patch
Patch12:        CVE-2021-28658.patch
Patch13:        delegate-os-path-filename-generation-to-storage.patch
Patch14:        CVE-2021-31542.patch
BuildRequires:  fdupes
BuildRequires:  python-devel
BuildRequires:  python-setuptools
Requires:       python-Pillow
Requires:       python-setuptools
Requires:       python-xml
Requires(post): update-alternatives
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Provides:       python-django = %{version}
Obsoletes:      python-django < %{version}
Provides:       python-South = %{version}
Obsoletes:      python-South < %{version}
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
BuildArch:      noarch

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

# 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 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
sed -i "s|\(django/bin/\)|\1-%{py_ver}|"
mv django/bin/{,-%{py_ver}}

python build

python install --prefix=%{_prefix} --root=%{buildroot}
install -D -m 0644 extras/django_bash_completion %{buildroot}%{_sysconfdir}/bash_completion.d/django_bash_completion-%{py_ver}.sh

mv %{buildroot}/%{_bindir}/django-admin{,-%{py_ver}}

mkdir -p %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/
ln -sf %{_sysconfdir}/alternatives/ %{buildroot}/%{_bindir}/
touch %{buildroot}%{_sysconfdir}/alternatives/django-admin
ln -sf %{_sysconfdir}/alternatives/django-admin %{buildroot}/%{_bindir}/django-admin
touch %{buildroot}%{_sysconfdir}/alternatives/
ln -sf %{_sysconfdir}/alternatives/ %{buildroot}%{_sysconfdir}/bash_completion.d/

%fdupes %{buildroot}%{python_sitelib}
# Deduplicating files can generate a RPMLINT warning for pyc mtime
cd %{buildroot}%{python_sitelib}
python -m compileall -d %{python_sitelib} django/conf/locale/

update-alternatives \
    --install %{_bindir}/ %{_bindir}/{py_ver} 20 \
    --slave %{_bindir}/django-admin django-admin %{_bindir}/django-admin-%{py_ver} \
    --slave %{_sysconfdir}/bash_completion.d/ %{_sysconfdir}/bash_completion.d/django_bash_completion-%{py_ver}.sh

if [ $1 -eq 0 ] ; then
    update-alternatives --remove %{_bindir}/{py_ver}

%license LICENSE
%doc README.rst
%ghost %{_sysconfdir}/alternatives/django-admin
%ghost %{_sysconfdir}/alternatives/
%ghost %{_sysconfdir}/alternatives/

openSUSE Build Service is sponsored by