Browse Source

python updates to produce python3 packages

Signed-off-by: basebuilder_pel7x64builder0 <basebuilder@powerel.org>
master
basebuilder_pel7x64builder0 4 years ago
parent
commit
2f8cc33add
  1. 13
      SOURCES/lexer-dot-guess-fix.patch
  2. 25
      SOURCES/python-jinja2-align-jinjaext-with-compatibility-cleanups.patch
  3. 27
      SOURCES/python-jinja2-fix-CVE-2014-0012.patch
  4. 218
      SOURCES/python-jinja2-fix-CVE-2016-10745.patch
  5. 26
      SOURCES/python-jinja2-lambda-to-dict.patch
  6. 302
      SPECS/python-jinja2.spec
  7. 10
      SPECS/python-markupsafe.spec
  8. 10
      SPECS/python-pillow.spec
  9. 216
      SPECS/python-pygments.spec

13
SOURCES/lexer-dot-guess-fix.patch

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
diff --git a/pygments/util.py b/pygments/util.py
index 46c5a12..4710924 100644
--- a/pygments/util.py
+++ b/pygments/util.py
@@ -118,7 +118,7 @@ def make_analysator(f):
return 0.0
try:
return min(1.0, max(0.0, float(rv)))
- except ValueError:
+ except (ValueError, TypeError):
return 0.0
text_analyse.__doc__ = f.__doc__
return staticmethod(text_analyse)

25
SOURCES/python-jinja2-align-jinjaext-with-compatibility-cleanups.patch

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
From 99d0f3165ace0befd9eafd661be6e0c23d5f9ba5 Mon Sep 17 00:00:00 2001
From: Gabi Davar <grizzly.nyo@gmail.com>
Date: Fri, 16 Aug 2013 16:18:35 +0300
Subject: [PATCH] align jinjaext with the rest of the computability cleanups

---
docs/jinjaext.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/jinjaext.py b/docs/jinjaext.py
index 8395a55..3c217f8 100644
--- a/docs/jinjaext.py
+++ b/docs/jinjaext.py
@@ -23,7 +23,7 @@
from pygments.token import Keyword, Name, Comment, String, Error, \
Number, Operator, Generic
from jinja2 import Environment, FileSystemLoader
-from jinja2.utils import next
+from jinja2._compat import next
def parse_rst(state, content_offset, doc):
--
1.8.1.6

27
SOURCES/python-jinja2-fix-CVE-2014-0012.patch

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
diff --git a/jinja2/bccache.py b/jinja2/bccache.py
index 09ff845..c31a905 100644
--- a/jinja2/bccache.py
+++ b/jinja2/bccache.py
@@ -16,6 +16,7 @@
"""
from os import path, listdir
import os
+import stat
import sys
import errno
import marshal
@@ -230,6 +231,14 @@ class FileSystemBytecodeCache(BytecodeCache):
if e.errno != errno.EEXIST:
raise
+ if os.lstat(actual_dir).st_uid != os.getuid():
+ raise RuntimeError('Someone else owns temp directory with your '
+ 'uid. You need to explicitly provide another.')
+
+ if stat.S_IMODE(os.lstat(actual_dir).st_mode) != 448:
+ raise RuntimeError('Bad permission flags on temp directory, '
+ 'shoud be 0700. You need to fix this.')
+
return actual_dir
def _get_cache_filename(self, bucket):

218
SOURCES/python-jinja2-fix-CVE-2016-10745.patch

@ -0,0 +1,218 @@ @@ -0,0 +1,218 @@
diff --git a/jinja2/nodes.py b/jinja2/nodes.py
index c5697e6..9465943 100644
--- a/jinja2/nodes.py
+++ b/jinja2/nodes.py
@@ -599,7 +599,7 @@ class Call(Expr):
def as_const(self, eval_ctx=None):
eval_ctx = get_eval_context(self, eval_ctx)
- if eval_ctx.volatile:
+ if eval_ctx.volatile or eval_ctx.environment.sandboxed:
raise Impossible()
obj = self.node.as_const(eval_ctx)
diff --git a/jinja2/sandbox.py b/jinja2/sandbox.py
index da479c1..7e31a7a 100644
--- a/jinja2/sandbox.py
+++ b/jinja2/sandbox.py
@@ -12,12 +12,19 @@
:copyright: (c) 2010 by the Jinja Team.
:license: BSD.
"""
+import types
import operator
+from collections import Mapping
from jinja2.environment import Environment
from jinja2.exceptions import SecurityError
from jinja2._compat import string_types, function_type, method_type, \
- traceback_type, code_type, frame_type, generator_type, PY2
+ traceback_type, code_type, frame_type, generator_type, text_type, PY2
+from jinja2.utils import Markup
+has_format = False
+if hasattr(text_type, 'format'):
+ from string import Formatter
+ has_format = True
#: maximum number of items a range may produce
MAX_RANGE = 100000
@@ -32,6 +39,12 @@ UNSAFE_METHOD_ATTRIBUTES = set(['im_class', 'im_func', 'im_self'])
#: unsafe generator attirbutes.
UNSAFE_GENERATOR_ATTRIBUTES = set(['gi_frame', 'gi_code'])
+#: unsafe attributes on coroutines
+UNSAFE_COROUTINE_ATTRIBUTES = set(['cr_frame', 'cr_code'])
+
+#: unsafe attributes on async generators
+UNSAFE_ASYNC_GENERATOR_ATTRIBUTES = set(['ag_code', 'ag_frame'])
+
# On versions > python 2 the special attributes on functions are gone,
# but they remain on methods and generators for whatever reason.
if not PY2:
@@ -92,6 +105,79 @@ _mutable_spec = (
]))
)
+# Bundled EscapeFormatter class from markupsafe >= 0.21 which is used by
+# jinja2 for fixing CVE-2016-10745
+# Copyright 2010 Pallets
+# BSD 3-Clause License
+# https://github.com/pallets/markupsafe/blob/79ee6ce0ed93c6da73512f069d7db866d955df04/LICENSE.rst
+if hasattr(text_type, "format"):
+
+ class EscapeFormatter(Formatter):
+ def __init__(self, escape):
+ self.escape = escape
+
+ def format_field(self, value, format_spec):
+ if hasattr(value, "__html_format__"):
+ rv = value.__html_format__(format_spec)
+ elif hasattr(value, "__html__"):
+ if format_spec:
+ raise ValueError(
+ "Format specifier {0} given, but {1} does not"
+ " define __html_format__. A class that defines"
+ " __html__ must define __html_format__ to work"
+ " with format specifiers.".format(format_spec, type(value))
+ )
+ rv = value.__html__()
+ else:
+ # We need to make sure the format spec is unicode here as
+ # otherwise the wrong callback methods are invoked. For
+ # instance a byte string there would invoke __str__ and
+ # not __unicode__.
+ rv = Formatter.format_field(self, value, text_type(format_spec))
+ return text_type(self.escape(rv))
+
+class _MagicFormatMapping(Mapping):
+ """This class implements a dummy wrapper to fix a bug in the Python
+ standard library for string formatting.
+
+ See http://bugs.python.org/issue13598 for information about why
+ this is necessary.
+ """
+
+ def __init__(self, args, kwargs):
+ self._args = args
+ self._kwargs = kwargs
+ self._last_index = 0
+
+ def __getitem__(self, key):
+ if key == '':
+ idx = self._last_index
+ self._last_index += 1
+ try:
+ return self._args[idx]
+ except LookupError:
+ pass
+ key = str(idx)
+ return self._kwargs[key]
+
+ def __iter__(self):
+ return iter(self._kwargs)
+
+ def __len__(self):
+ return len(self._kwargs)
+
+
+def inspect_format_method(callable):
+ if not has_format:
+ return None
+ if not isinstance(callable, (types.MethodType,
+ types.BuiltinMethodType)) or \
+ callable.__name__ != 'format':
+ return None
+ obj = callable.__self__
+ if isinstance(obj, string_types):
+ return obj
+
def safe_range(*args):
"""A range that can't generate ranges with a length of more than
@@ -146,6 +232,12 @@ def is_internal_attribute(obj, attr):
elif isinstance(obj, generator_type):
if attr in UNSAFE_GENERATOR_ATTRIBUTES:
return True
+ elif hasattr(types, 'CoroutineType') and isinstance(obj, types.CoroutineType):
+ if attr in UNSAFE_COROUTINE_ATTRIBUTES:
+ return True
+ elif hasattr(types, 'AsyncGeneratorType') and isinstance(obj, types.AsyncGeneratorType):
+ if attri in UNSAFE_ASYNC_GENERATOR_ATTRIBUTES:
+ return True
return attr.startswith('__')
@@ -184,8 +276,8 @@ class SandboxedEnvironment(Environment):
attributes or functions are safe to access.
If the template tries to access insecure code a :exc:`SecurityError` is
- raised. However also other exceptions may occour during the rendering so
- the caller has to ensure that all exceptions are catched.
+ raised. However also other exceptions may occur during the rendering so
+ the caller has to ensure that all exceptions are caught.
"""
sandboxed = True
@@ -347,8 +439,24 @@ class SandboxedEnvironment(Environment):
obj.__class__.__name__
), name=attribute, obj=obj, exc=SecurityError)
+ def format_string(self, s, args, kwargs):
+ """If a format call is detected, then this is routed through this
+ method so that our safety sandbox can be used for it.
+ """
+ if isinstance(s, Markup):
+ formatter = SandboxedEscapeFormatter(self, s.escape)
+ else:
+ formatter = SandboxedFormatter(self)
+ kwargs = _MagicFormatMapping(args, kwargs)
+ rv = formatter.vformat(s, args, kwargs)
+ return type(s)(rv)
+
def call(__self, __context, __obj, *args, **kwargs):
"""Call an object from sandboxed code."""
+ fmt = inspect_format_method(__obj)
+ if fmt is not None:
+ return __self.format_string(fmt, args, kwargs)
+
# the double prefixes are to avoid double keyword argument
# errors when proxying the call.
if not __self.is_safe_callable(__obj):
@@ -366,3 +474,37 @@ class ImmutableSandboxedEnvironment(SandboxedEnvironment):
if not SandboxedEnvironment.is_safe_attribute(self, obj, attr, value):
return False
return not modifies_known_mutable(obj, attr)
+
+
+if has_format:
+ # This really is not a public API apparenlty.
+ try:
+ from _string import formatter_field_name_split
+ except ImportError:
+ def formatter_field_name_split(field_name):
+ return field_name._formatter_field_name_split()
+
+ class SandboxedFormatterMixin(object):
+
+ def __init__(self, env):
+ self._env = env
+
+ def get_field(self, field_name, args, kwargs):
+ first, rest = formatter_field_name_split(field_name)
+ obj = self.get_value(first, args, kwargs)
+ for is_attr, i in rest:
+ if is_attr:
+ obj = self._env.getattr(obj, i)
+ else:
+ obj = self._env.getitem(obj, i)
+ return obj, first
+
+ class SandboxedFormatter(SandboxedFormatterMixin, Formatter):
+ def __init__(self, env):
+ SandboxedFormatterMixin.__init__(self, env)
+ Formatter.__init__(self)
+
+ class SandboxedEscapeFormatter(SandboxedFormatterMixin, EscapeFormatter):
+ def __init__(self, env, escape):
+ SandboxedFormatterMixin.__init__(self, env)
+ EscapeFormatter.__init__(self, escape)

26
SOURCES/python-jinja2-lambda-to-dict.patch

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
From 6179c02c91800d220de03006117afa5e6d60f0f6 Mon Sep 17 00:00:00 2001
From: Peter Harris <pete.alex.harris@gmail.com>
Date: Fri, 23 Jan 2015 10:12:10 +0000
Subject: [PATCH] Replace lambda for 'dict' in with dict itself

lambda **kw: kw is not equivalent to the dict constructor. It is much less useful.
In particular it doesn't accept a sequence of pairs.
Why not put dict itself into the DEFAULT_NAMESPACE?
Principle of least surprise, etc.
---
jinja2/defaults.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jinja2/defaults.py b/jinja2/defaults.py
index a27cb80c..3717a722 100644
--- a/jinja2/defaults.py
+++ b/jinja2/defaults.py
@@ -32,7 +32,7 @@
from jinja2.tests import TESTS as DEFAULT_TESTS
DEFAULT_NAMESPACE = {
'range': range_type,
- 'dict': lambda **kw: kw,
+ 'dict': dict,
'lipsum': generate_lorem_ipsum,
'cycler': Cycler,
'joiner': Joiner

302
SPECS/python-jinja2.spec

@ -0,0 +1,302 @@ @@ -0,0 +1,302 @@
%global with_python3 1
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%{!?python3_sitelib: %global python3_sitelib %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}

# Enable building without docs to avoid a circular dependency between this
# and python-sphinx:
%global with_docs 0

Name: python-jinja2
Version: 2.7.2
Release: 4%{?dist}
Summary: General purpose template engine
Group: Development/Languages
License: BSD
URL: http://jinja.pocoo.org/
Source0: http://pypi.python.org/packages/source/J/Jinja2/Jinja2-%{version}.tar.gz

Patch1: %{name}-align-jinjaext-with-compatibility-cleanups.patch

# Patch for CVE-2014-0012, see https://bugzilla.redhat.com/show_bug.cgi?id=1051421
# for discussion (not yet sent upstream)
Patch2: python-jinja2-fix-CVE-2014-0012.patch

# Replace lambda for 'dict' with dict itself to support all dict constructors
# Backported from Jinja2 2.8
# https://github.com/pallets/jinja/commit/6179c02c91800d220de03006117afa5e6d60f0f6
# https://bugzilla.redhat.com/show_bug.cgi?id=1697237
Patch3: python-jinja2-lambda-to-dict.patch

# Fix CVE-2016-10745
# Also bundling the EscapeFormatter class from markupsafe >= 0.21, as we don't ship
# that version in RHEL7 and it's required for the CVE fix
# https://github.com/pallets/jinja/commit/9b53045c34e61013dc8f09b7e52a555fa16bed16
# https://bugzilla.redhat.com/show_bug.cgi?id=1701309
Patch4: python-jinja2-fix-CVE-2016-10745.patch

BuildArch: noarch
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: python-markupsafe
%if 0%{?with_docs}
BuildRequires: python-sphinx
%endif # with_docs
Requires: python-babel >= 0.8
Requires: python-markupsafe
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-markupsafe
%endif # with_python3

Provides: python2-jinja2 = %{version}-%{release}

%description
Jinja2 is a template engine written in pure Python. It provides a
Django inspired non-XML syntax but supports inline expressions and an
optional sandboxed environment.

If you have any exposure to other text-based template languages, such
as Smarty or Django, you should feel right at home with Jinja2. It's
both designer and developer friendly by sticking to Python's
principles and adding functionality useful for templating
environments.


%if 0%{?with_python3}
%package -n python3-jinja2
Summary: General purpose template engine
Group: Development/Languages
Requires: python3-markupsafe
# babel isn't py3k ready yet, and is only a weak dependency
#Requires: python3-babel >= 0.8


%description -n python3-jinja2
Jinja2 is a template engine written in pure Python. It provides a
Django inspired non-XML syntax but supports inline expressions and an
optional sandboxed environment.

If you have any exposure to other text-based template languages, such
as Smarty or Django, you should feel right at home with Jinja2. It's
both designer and developer friendly by sticking to Python's
principles and adding functionality useful for templating
environments.
%endif # with_python3


%prep
%setup -q -n Jinja2-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1

# cleanup
find . -name '*.pyo' -o -name '*.pyc' -delete

# fix EOL
sed -i 's|\r$||g' LICENSE

%if 0%{?with_python3}
cp -a . %{py3dir}
%endif # with_python3


%build
%{__python} setup.py build

# for now, we build docs using Python 2.x and use that for both
# packages.
%if 0%{?with_docs}
make -C docs html PYTHONPATH=$(pwd)
%endif # with_docs

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3


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

# remove hidden file
rm -rf docs/_build/html/.buildinfo

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


%check
make test


%if 0%{?with_python3}
pushd %{py3dir}
make test
popd
%endif # with_python3


%files
%doc AUTHORS CHANGES
%license LICENSE
%if 0%{?with_docs}
%doc docs/_build/html
%endif # with_docs
%doc ext
%doc examples
%{python2_sitelib}/*
%exclude %{python2_sitelib}/jinja2/_debugsupport.c


%if 0%{?with_python3}
%files -n python3-jinja2
%doc AUTHORS CHANGES LICENSE
%if 0%{?with_docs}
%doc docs/_build/html
%endif # with_docs
%doc ext
%doc examples
%{python3_sitelib}/*
%exclude %{python3_sitelib}/jinja2/_debugsupport.c
%endif # with_python3


%changelog
* Thu May 02 2019 Charalampos Stratakis <cstratak@redhat.com> - 2.7.2-4
- Fix for CVE-2016-10745
Resolves: rhbz#1701309

* Wed Apr 10 2019 Miro Hrončok <mhroncok@redhat.com> - 2.7.2-3
- Replace lambda for 'dict' with dict itself to support all dict constructors
Resolves: rhbz#1697237

* Tue Jan 28 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 2.7.2-2
- Fix CVE-2014-0012.
Resolves: rhbz#1051427

* Wed Jan 15 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 2.7.2-1
- Reverted flawed patch for #1051427 (this reintroduces #1052102).
- Spec cleanup (removed rhel < 7 specific stuff).
- Update to 2.7.2.
Resolves: rhbz#1052777

* Tue Jan 14 2014 Tomas Radej <tradej@redhat.com> - 2.6-8
- Using secure tmp dir
- Replaced tabs with spaces
Resolves: rhbz#1051427

* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 2.6-7
- Mass rebuild 2013-12-27

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

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

* Fri Aug 3 2012 David Malcolm <dmalcolm@redhat.com> - 2.6-4
- remove rhel logic from with_python3 conditional

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

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

* Mon Jul 25 2011 Thomas Moschny <thomas.moschny@gmx.de> - 2.6-1
- Update to 2.6.

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

* Tue Jan 18 2011 Thomas Moschny <thomas.moschny@gmx.de> - 2.5.5-3
- Re-enable html doc generation.
- Remove conditional for F-12 and below.
- Do not silently fail the testsuite for with py3k.

* Mon Nov 1 2010 Michel Salim <salimma@fedoraproject.org> - 2.5.5-2
- Move python3 runtime requirements to python3 subpackage

* Wed Oct 27 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.5.5-1
- Update to 2.5.5.

* Wed Aug 25 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.5.2-4
- Revert to previous behavior: fail the build on failed test.
- Rebuild for Python 3.2.

* Wed Aug 25 2010 Dan Horák <dan[at]danny.cz> - 2.5.2-3
- %%ifnarch doesn't work on noarch package so don't fail the build on failed tests

* Wed Aug 25 2010 Dan Horák <dan[at]danny.cz> - 2.5.2-2
- disable the testsuite on s390(x)

* Thu Aug 19 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.5.2-1
- Update to upstream version 2.5.2.
- Package depends on python-markupsafe and is noarch now.

* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 2.5-4
- add explicit build-requirement on python-setuptools
- fix doc disablement for python3 subpackage

* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 2.5-3
- support disabling documentation in the build to break a circular build-time
dependency with python-sphinx; disable docs for now

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

* Tue Jul 13 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.5-1
- Update to upstream version 2.5.
- Create python3 subpackage.
- Minor specfile fixes.
- Add examples directory.
- Thanks to Gareth Armstrong for additional hints.

* Wed Apr 21 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.4.1-1
- Update to 2.4.1.

* Tue Apr 13 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.4-1
- Update to 2.4.

* Tue Feb 23 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.3.1-1
- Update to 2.3.1.
- Docs are built using Sphinx now.
- Run the testsuite.

* Sat Sep 19 2009 Thomas Moschny <thomas.moschny@gmx.de> - 2.2.1-1
- Update to 2.2.1, mainly a bugfix release.
- Remove patch no longer needed.
- Remove conditional for FC-8.
- Compilation of speedup module has to be explicitly requested now.

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

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

* Sat Jan 10 2009 Thomas Moschny <thomas.moschny@gmx.de> - 2.1.1-1
- Update to 2.1.1 (bugfix release).

* Thu Dec 18 2008 Thomas Moschny <thomas.moschny@gmx.de> - 2.1-1
- Update to 2.1, which fixes a number of bugs.
See http://jinja.pocoo.org/2/documentation/changelog#version-2-1.

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

* Tue Jul 22 2008 Thomas Moschny <thomas.moschny@gmx.de> - 2.0-2
- Use rpm buildroot macro instead of RPM_BUILD_ROOT.

* Sun Jul 20 2008 Thomas Moschny <thomas.moschny@gmx.de> - 2.0-1
- Upstream released 2.0.

* Sun Jun 29 2008 Thomas Moschny <thomas.moschny@gmx.de> - 2.0-0.1.rc1
- Modified specfile from the existing python-jinja package.

10
SPECS/python-markupsafe.spec

@ -1,8 +1,6 @@ @@ -1,8 +1,6 @@
%if 0%{?fedora} > 12
%global with_python3 1
%else
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif
%{!?python3_sitearch: %global python3_sitearch %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}

Name: python-markupsafe
Version: 0.11
@ -12,7 +10,7 @@ Summary: Implements a XML/HTML/XHTML Markup safe string for Python @@ -12,7 +10,7 @@ Summary: Implements a XML/HTML/XHTML Markup safe string for Python
Group: Development/Languages
License: BSD
URL: http://pypi.python.org/pypi/MarkupSafe
Source0: http://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-%{version}.tar.gz
Source0: https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: python-devel python-setuptools-devel
@ -57,13 +55,13 @@ popd @@ -57,13 +55,13 @@ popd

%install
rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
%{__python} setup.py install -O2 --skip-build --root $RPM_BUILD_ROOT
# C code errantly gets installed
rm $RPM_BUILD_ROOT/%{python_sitearch}/markupsafe/*.c

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
%{__python3} setup.py install -O2 --skip-build --root $RPM_BUILD_ROOT
rm $RPM_BUILD_ROOT/%{python3_sitearch}/markupsafe/*.c
popd
%endif # with_python3

10
SPECS/python-pillow.spec

@ -2,13 +2,7 @@ @@ -2,13 +2,7 @@
%global py3_incdir %{_includedir}/python%{python3_version}

%global name3 python3-pillow

# RHEL-7 doesn't have python 3
%if 0%{?rhel} == 7
%global with_python3 1
%else
%global with_python3 1
%endif
%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
@ -202,7 +196,7 @@ PIL image wrapper for Qt. @@ -202,7 +196,7 @@ PIL image wrapper for Qt.


%prep
%setup -q -n python-pillow-Pillow-%{shortcommit}
%setup -q -n python-imaging-Pillow-%{shortcommit}
%patch0 -p1 -b .archs
%patch1 -p1 -b .endian
%patch2 -p1 -b .byte_array

216
SPECS/python-pygments.spec

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

%global upstream_name Pygments

Name: python-pygments
Version: 1.4
Release: 10%{?dist}
Summary: Syntax highlighting engine written in Python
Group: Development/Libraries
License: BSD
URL: http://pygments.org/
Source0: http://pypi.python.org/packages/source/P/%{upstream_name}/%{upstream_name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
# Patch for fixing a traceback when trying to guess
# a lexer starting with a dot.
# Fixed upstream:
# https://bitbucket.org/birkenfeld/pygments-main/issues/618/typeerror-when-guessing-the-lexer-of-a
Patch0: lexer-dot-guess-fix.patch
BuildArch: noarch
BuildRequires: python2-devel >= 2.4, python-setuptools, python-nose
BuildRequires: python3-devel, python3-setuptools
Requires: python-setuptools, python-imaging


%description
Pygments is a generic syntax highlighter for general use in all kinds
of software such as forum systems, wikis or other applications that
need to prettify source code. Highlights are:

* a wide range of common languages and markup formats is supported
* special attention is paid to details that increase highlighting
quality
* support for new languages and formats are added easily; most
languages use a simple regex-based lexing mechanism
* a number of output formats is available, among them HTML, RTF,
LaTeX and ANSI sequences
* it is usable as a command-line tool and as a library
* ... and it highlights even Brainf*ck!


%package -n python3-pygments
Summary: Syntax highlighting engine written in Python 3
Group: Development/Libraries
Requires: python3-setuptools, python3-pillow
%description -n python3-pygments
Pygments is a generic syntax highlighter for general use in all kinds
of software such as forum systems, wikis or other applications that
need to prettify source code. Highlights are:

* a wide range of common languages and markup formats is supported
* special attention is paid to details that increase highlighting
quality
* support for new languages and formats are added easily; most
languages use a simple regex-based lexing mechanism
* a number of output formats is available, among them HTML, RTF,
LaTeX and ANSI sequences
* it is usable as a command-line tool and as a library
* ... and it highlights even Brainf*ck!


%prep
%setup -q -n Pygments-%{version}
%patch0 -p1

rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'


%build
%{__python} setup.py build
%{__sed} -i 's/\r//' LICENSE

pushd %{py3dir}
%{__python3} setup.py build
popd


%install
rm -rf $RPM_BUILD_ROOT

pushd %{py3dir}
%{__python3} setup.py install -O2 --skip-build --root $RPM_BUILD_ROOT
popd

%{__python} setup.py install -O2 --skip-build --root $RPM_BUILD_ROOT

pushd docs
install -d %{buildroot}%{_mandir}/man1
mv pygmentize.1 $RPM_BUILD_ROOT%{_mandir}/man1/pygmentize.1
mv build html
mv src reST
popd


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc AUTHORS CHANGES docs/html docs/reST LICENSE TODO
# For noarch packages: sitelib
%{python_sitelib}/*
%{_bindir}/pygmentize
%lang(en) %{_mandir}/man1/pygmentize.1.gz

%files -n python3-pygments
%defattr(-,root,root,-)
%doc AUTHORS CHANGES docs/html docs/reST LICENSE TODO
%{python3_sitelib}/*


%changelog
* Wed Feb 01 2017 Charalampos Stratakis <cstratak@redhat.com> - 1.4-10
- Fix traceback when trying to guess a lexer starting with a dot
Resolves: rhbz#1413594

* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 1.4-9
- Mass rebuild 2013-12-27

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

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

* Fri Aug 3 2012 David Malcolm <dmalcolm@redhat.com> - 1.4-6
- remove rhel logic from with_python3 conditional

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

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

* Tue Sep 13 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 1.4-3
- Really enable the python3 unittests.
- Fix python26 byte compilation (thanks to Jeffrey Ness)

* Sat Sep 10 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 1.4-2
- Fix python main package having dependencies for the python2.6 subpackage
- Fix places that used the default python instead of python26
- Attempt to make byte compilation more robust in case we add python3 to EPEL5
- Run unittests on python3 in F15+

* Fri Jun 24 2011 Steve Milner <smilner@fedoraproject.org> - 1.4-1
- update for upstream release
- Add python2.6 support done by Steve Traylen <steve.traylen@cern.ch>. BZ#662755.

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

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

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

* Thu May 6 2010 Gareth Armstrong <gareth.armstrong@hp.com> - 1.3.1-5
- Enforce that Pygments requires Python 2.4 or later via an explicit BR
- Minor tweaks to spec file
- Deliver html and reST doc files to specifically named directories
- Align description with that of http://pygments.org/
- Add %%check section for Python2 and add BR on python-nose

* Fri Apr 23 2010 Steve 'Ashcrow' Milner <me@stevemilner.org> - 1.3.1-4
- switched with_python3 back to 1

* Fri Apr 23 2010 David Malcolm <dmalcolm@redhat.com> - 1.3.1-3
- add python3 subpackage (BZ#537244), ignoring soft-dep on imaging for now

* Sat Apr 13 2010 Steve 'Ashcrow' Milner <me@stevemilner.org> - 1.3.1-2
- added python-imaging as a dependency per BZ#581663.

* Sat Mar 6 2010 Steve 'Ashcrow' Milner <me@stevemilner.org> - 1.3.1-1
- Updated for release.

* Tue Sep 29 2009 Steve 'Ashcrow' Milner <me@stevemilner.org> - 1.1.1-1
- Updated for release.

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

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

* Sun Dec 21 2008 Steve 'Ashcrow' Milner <me@stevemilner.org> - 1.0-3
- Updated for release.

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

* Fri Nov 27 2008 Steve 'Ashcrow' Milner <me@stevemilner.org> - 1.0-1
- Updated for upstream 1.0.

* Sun Sep 14 2008 Steve 'Ashcrow' Milner <me@stevemilner.org> - 0.11.1-1
- Updated for upstream 0.11.

* Mon Jul 21 2008 Steve 'Ashcrow' Milner <me@stevemilner.org> - 0.10-1
- Updated for upstream 0.10.

* Thu Nov 29 2007 Steve 'Ashcrow' Milner <me@stevemilner.org> - 0.9-2
- Added python-setuptools as a Requires per bz#403601.

* Mon Nov 12 2007 Steve 'Ashcrow' Milner <me@stevemilner.org> - 0.9-1
- Updated for upstream 0.9.

* Thu Aug 17 2007 Steve 'Ashcrow' Milner <me@stevemilner.org> - 0.8.1-2
- Removed the dos2unix build dependency.

* Thu Jun 28 2007 Steve 'Ashcrow' Milner <me@stevemilner.org> - 0.8.1-1
- Initial packaging for Fedora.
Loading…
Cancel
Save