unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Catonano <catonano@gmail.com>
To: Arun Isaac <arunisaac@systemreboot.net>
Cc: 26401@debbugs.gnu.org
Subject: bug#26401: [PATCH] python-tryton (with no modules)
Date: Sat, 20 May 2017 09:39:10 +0200	[thread overview]
Message-ID: <CAJ98PDxsJxcUQuJ_8vh+vGiNJg=jUr+n83HZgC9yufykG7ZEQQ@mail.gmail.com> (raw)
In-Reply-To: <7e6e3d0c.ADsAALmm2EQAAAAAAAAAAAOu6r8AAAACwQwAAAAAAAW9WABZHd6n@mailjet.com>


[-- Attachment #1.1: Type: text/plain, Size: 1025 bytes --]

So, here I am

2017-05-18 19:49 GMT+02:00 Arun Isaac <arunisaac@systemreboot.net>:

>
> Oh, I thought the next genshi release was just around the corner. I
> didn't realize that development was stalled. Ok, then. If other distros
> are using these patches without problems, let's also have python3 genshi
> and relatorio packages.
>
> But, let's build trytond with python2. GNU Health still needs trytond
> 3.8, and trytond 3.8 only supports python2.
>

I though about this a bit more

Tryton is an autonomous framework, it can be used without GNUHealth and
with no relation to it

Someone might want to use it with python3.

I myself could be involved in a project that uses Trytond and has no
relationship whatsoever with GNUHealth.
This should be in september.

When and if I will package GNUHealth, we'll see how to arrange things

It might depend on python2-trytond or I might wait for a newer version that
depends on a current Tryton

So for now I send this as it was, with some corrections.

Please let me know
Thanks

[-- Attachment #1.2: Type: text/html, Size: 1790 bytes --]

[-- Attachment #2: series.patch --]
[-- Type: text/x-patch, Size: 30941 bytes --]

From edca647dd8fdc3680567bffc555ab892499ff3a5 Mon Sep 17 00:00:00 2001
From: Adriano Peluso <catonano@gmail.com>
Date: Tue, 28 Mar 2017 12:25:06 +0200
Subject: [PATCH 1/5] gnu: Add python-sql.

* gnu/packages/python.scm (python-sql, python2-sql): New variables.
---
 gnu/packages/python.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 57a67de41..f1ef53e1a 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -14622,3 +14622,25 @@ substitute for redis.")
 
 (define-public python2-fakeredis
   (package-with-python2 python-fakeredis))
+
+(define-public python-sql
+  (package
+    (name "python-sql")
+    (version "0.8")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri
+             "python-sql"
+             version))
+       (sha256
+        (base32
+         "0xik939sxqfqqbpgcsnfjnws692bjip32khgwhq1ycphfy7df3h2"))))
+    (build-system python-build-system)
+    (home-page "https://python-sql.tryton.org/")
+    (synopsis "Library to write SQL queries")
+    (description "Idiomatic python function calls get transformed in well formed SQL queries.")
+    (license license:bsd-3)))
+
+(define-public python2-sql
+  (package-with-python2 python-sql))
-- 
2.13.0


From 4680a5cca214ca6992bb9bac1db9cda1c7b9be68 Mon Sep 17 00:00:00 2001
From: Adriano Peluso <catonano@gmail.com>
Date: Wed, 5 Apr 2017 15:29:56 +0200
Subject: [PATCH 2/5] gnu: Add python-genshi.

 * gnu/packages/python.scm (python-genshi, python2-genshi): New variables.
 * gnu/packages/patches/python-genshi-Disable-the-speedups-C-extension-on-CPython-3.3-sinc.patct: New file.
 * gnu/packages/patches/python-genshi-stripping-of-unsafe-script-tags-Python-3.4.patch: New file.
 * gnu/packages/patches/python-genshi-isstring-helper.patch: New file.
 * gnu/packages/patches/python-genshi-Add-support-for-Python-3.4-AST-support-for-NameConst.patch: New file.
 * gnu/packages/patches/python-genshi-fixing-the-tests-on-python35.patch: New file.
 * gnu/packages/patches/python-genshi-buildable-on-python27-too.patch: New file.
 * gnu/local.mk (dist_patch_DATA): Add them.
---
 gnu/local.mk                                       |   6 +
 ...-for-Python-3.4-AST-support-for-NameConst.patch | 151 +++++++++++++++++++++
 ...-speedups-C-extension-on-CPython-3.3-sinc.patch |  32 +++++
 .../python-genshi-buildable-on-python27-too.patch  |  25 ++++
 ...ython-genshi-fixing-the-tests-on-python35.patch | 112 +++++++++++++++
 .../patches/python-genshi-isstring-helper.patch    |  37 +++++
 ...tripping-of-unsafe-script-tags-Python-3.4.patch |  51 +++++++
 gnu/packages/python.scm                            |  42 ++++++
 8 files changed, 456 insertions(+)
 create mode 100644 gnu/packages/patches/python-genshi-Add-support-for-Python-3.4-AST-support-for-NameConst.patch
 create mode 100644 gnu/packages/patches/python-genshi-Disable-the-speedups-C-extension-on-CPython-3.3-sinc.patch
 create mode 100644 gnu/packages/patches/python-genshi-buildable-on-python27-too.patch
 create mode 100644 gnu/packages/patches/python-genshi-fixing-the-tests-on-python35.patch
 create mode 100644 gnu/packages/patches/python-genshi-isstring-helper.patch
 create mode 100644 gnu/packages/patches/python-genshi-stripping-of-unsafe-script-tags-Python-3.4.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 04d259df9..676e3fd0c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -930,6 +930,12 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-file-double-encoding-bug.patch	\
   %D%/packages/patches/python-fix-tests.patch			\
   %D%/packages/patches/python-parse-too-many-fields.patch	\
+  %D%/packages/patches/python-genshi-Disable-the-speedups-C-extension-on-CPython-3.3-sinc.patch	\
+  %D%/packages/patches/python-genshi-stripping-of-unsafe-script-tags-Python-3.4.patch	\
+  %D%/packages/patches/python-genshi-isstring-helper.patch	\
+  %D%/packages/patches/python-genshi-Add-support-for-Python-3.4-AST-support-for-NameConst.patch	\
+  %D%/packages/patches/python-genshi-fixing-the-tests-on-python35.patch	\
+  %D%/packages/patches/python-genshi-buildable-on-python27-too.patch	\
   %D%/packages/patches/python2-rdflib-drop-sparqlwrapper.patch	\
   %D%/packages/patches/python-statsmodels-fix-tests.patch	\
   %D%/packages/patches/python-configobj-setuptools.patch	\
diff --git a/gnu/packages/patches/python-genshi-Add-support-for-Python-3.4-AST-support-for-NameConst.patch b/gnu/packages/patches/python-genshi-Add-support-for-Python-3.4-AST-support-for-NameConst.patch
new file mode 100644
index 000000000..4e40c1daa
--- /dev/null
+++ b/gnu/packages/patches/python-genshi-Add-support-for-Python-3.4-AST-support-for-NameConst.patch
@@ -0,0 +1,151 @@
+From 86b98a11559da7d1b21dc9b4c6b10511b9095bc4 Mon Sep 17 00:00:00 2001
+From: Simon Cross <hodgestar@gmail.com>
+Date: Sun, 16 Feb 2014 18:46:15 +0000
+Subject: [PATCH 05/16] Add support for Python 3.4 AST (support for
+ NameConstants and changes to existing to arguments node attributes).
+
+---
+ genshi/template/astutil.py | 31 ++++++++++++++++++++++++++++---
+ genshi/template/eval.py    | 34 +++++++++++++++++++---------------
+ 2 files changed, 47 insertions(+), 18 deletions(-)
+
+diff --git a/genshi/template/astutil.py b/genshi/template/astutil.py
+index a4c21c8..a3946b4 100644
+--- a/genshi/template/astutil.py
++++ b/genshi/template/astutil.py
+@@ -21,7 +21,7 @@ else:
+     def parse(source, mode):
+         return compile(source, '', mode, _ast.PyCF_ONLY_AST)
+ 
+-from genshi.compat import IS_PYTHON2
++from genshi.compat import IS_PYTHON2, isstring
+ 
+ __docformat__ = 'restructuredtext en'
+ 
+@@ -103,8 +103,13 @@ class ASTCodeGenerator(object):
+         self._new_line()
+         return self.visit(node.body)
+ 
++    # Python < 3.4
+     # arguments = (expr* args, identifier? vararg,
+     #              identifier? kwarg, expr* defaults)
++    #
++    # Python >= 3.4
++    # arguments = (arg* args, arg? vararg, arg* kwonlyargs, expr* kw_defaults,
++    #              arg? kwarg, expr* defaults)
+     def visit_arguments(self, node):
+         first = True
+         no_default_count = len(node.args) - len(node.defaults)
+@@ -122,13 +127,21 @@ class ASTCodeGenerator(object):
+                 self._write(', ')
+             else:
+                 first = False
+-            self._write('*' + node.vararg)
++            self._write('*')
++            if isstring(node.vararg):
++                self._write(node.vararg)
++            else:
++                self.visit(node.vararg)
+         if getattr(node, 'kwarg', None):
+             if not first:
+                 self._write(', ')
+             else:
+                 first = False
+-            self._write('**' + node.kwarg)
++            self._write('**')
++            if isstring(node.kwarg):
++                self._write(node.kwarg)
++            else:
++                self.visit(node.kwarg)
+ 
+     if not IS_PYTHON2:
+         # In Python 3 arguments get a special node
+@@ -724,6 +737,17 @@ class ASTCodeGenerator(object):
+     def visit_Name(self, node):
+         self._write(node.id)
+ 
++    # NameConstant(singleton value)
++    def visit_NameConstant(self, node):
++        if node.value is None:
++            self._write('None')
++        elif node.value is True:
++            self._write('True')
++        elif node.value is False:
++            self._write('False')
++        else:
++            raise Exception("Unknown NameConstant %r" % (node.value,))
++
+     # List(expr* elts, expr_context ctx)
+     def visit_List(self, node):
+         self._write('[')
+@@ -829,6 +853,7 @@ class ASTTransformer(object):
+     visit_Attribute = _clone
+     visit_Subscript = _clone
+     visit_Name = _clone
++    visit_NameConstant = _clone
+     visit_List = _clone
+     visit_Tuple = _clone
+ 
+diff --git a/genshi/template/eval.py b/genshi/template/eval.py
+index 89aec49..de4bc86 100644
+--- a/genshi/template/eval.py
++++ b/genshi/template/eval.py
+@@ -24,7 +24,8 @@ from genshi.template.astutil import ASTTransformer, ASTCodeGenerator, \
+ from genshi.template.base import TemplateRuntimeError
+ from genshi.util import flatten
+ 
+-from genshi.compat import get_code_params, build_code_chunk, IS_PYTHON2
++from genshi.compat import get_code_params, build_code_chunk, isstring, \
++                          IS_PYTHON2
+ 
+ __all__ = ['Code', 'Expression', 'Suite', 'LenientLookup', 'StrictLookup',
+            'Undefined', 'UndefinedError']
+@@ -495,28 +496,31 @@ class TemplateASTTransformer(ASTTransformer):
+     def __init__(self):
+         self.locals = [CONSTANTS]
+ 
++    def _process(self, names, node):
++        if not IS_PYTHON2 and isinstance(node, _ast.arg):
++            names.add(node.arg)
++        elif isstring(node):
++            names.add(node)
++        elif isinstance(node, _ast.Name):
++            names.add(node.id)
++        elif isinstance(node, _ast.alias):
++            names.add(node.asname or node.name)
++        elif isinstance(node, _ast.Tuple):
++            for elt in node.elts:
++                self._process(names, elt)
++
+     def _extract_names(self, node):
+         names = set()
+-        def _process(node):
+-            if not IS_PYTHON2 and isinstance(node, _ast.arg):
+-                names.add(node.arg)
+-            if isinstance(node, _ast.Name):
+-                names.add(node.id)
+-            elif isinstance(node, _ast.alias):
+-                names.add(node.asname or node.name)
+-            elif isinstance(node, _ast.Tuple):
+-                for elt in node.elts:
+-                    _process(elt)
+         if hasattr(node, 'args'):
+             for arg in node.args:
+-                _process(arg)
++                self._process(names, arg)
+             if hasattr(node, 'vararg'):
+-                names.add(node.vararg)
++                self._process(names, node.vararg)
+             if hasattr(node, 'kwarg'):
+-                names.add(node.kwarg)
++                self._process(names, node.kwarg)
+         elif hasattr(node, 'names'):
+             for elt in node.names:
+-                _process(elt)
++                self._process(names, elt)
+         return names
+ 
+     def visit_Str(self, node):
+-- 
+2.12.0
+
diff --git a/gnu/packages/patches/python-genshi-Disable-the-speedups-C-extension-on-CPython-3.3-sinc.patch b/gnu/packages/patches/python-genshi-Disable-the-speedups-C-extension-on-CPython-3.3-sinc.patch
new file mode 100644
index 000000000..c25c3bd7a
--- /dev/null
+++ b/gnu/packages/patches/python-genshi-Disable-the-speedups-C-extension-on-CPython-3.3-sinc.patch
@@ -0,0 +1,32 @@
+From cef2c8df44166195e1705638f9f17033a4943bb7 Mon Sep 17 00:00:00 2001
+From: Simon Cross <hodgestar@gmail.com>
+Date: Sun, 16 Feb 2014 18:32:21 +0000
+Subject: [PATCH 02/15] Disable the speedups C extension on CPython >= 3.3
+ since Genshi doesn't support the new Unicode C API yet.
+
+---
+ setup.py | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index 123a2cb..a3d748c 100755
+--- a/setup.py
++++ b/setup.py
+@@ -65,9 +65,13 @@ available.""")
+ 
+ 
+ if Feature:
++    # Optional C extension module for speeding up Genshi:
++    # Not activated by default on:
++    # - PyPy (where it harms performance)
++    # - CPython >= 3.3 (the new Unicode C API is not supported yet)
+     speedups = Feature(
+         "optional C speed-enhancements",
+-        standard = not is_pypy,
++        standard = not is_pypy and sys.version_info < (3, 3),
+         ext_modules = [
+             Extension('genshi._speedups', ['genshi/_speedups.c']),
+         ],
+-- 
+2.12.0
+
diff --git a/gnu/packages/patches/python-genshi-buildable-on-python27-too.patch b/gnu/packages/patches/python-genshi-buildable-on-python27-too.patch
new file mode 100644
index 000000000..13289fbe8
--- /dev/null
+++ b/gnu/packages/patches/python-genshi-buildable-on-python27-too.patch
@@ -0,0 +1,25 @@
+From 32bfaa7cc1c736fd62fcbb6414de9498dc20ed07 Mon Sep 17 00:00:00 2001
+From: Adriano Peluso <catonano@gmail.com>
+Date: Wed, 5 Apr 2017 15:13:06 +0200
+Subject: [PATCH 2/2] buildable on python27 too
+
+---
+ genshi/template/directives.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/genshi/template/directives.py b/genshi/template/directives.py
+index 6fd0f28..1f70ef6 100644
+--- a/genshi/template/directives.py
++++ b/genshi/template/directives.py
+@@ -266,7 +266,7 @@ class DefDirective(Directive):
+         if isinstance(ast, _ast.Call):
+             self.name = ast.func.id
+             for arg in ast.args:
+-                if isinstance(arg, _ast.Starred):
++                if hasattr(_ast, 'Starred') and isinstance(arg, _ast.Starred):
+                     # Python 3.5+
+                     self.star_args = arg.value.id
+                 else:
+-- 
+2.12.0
+
diff --git a/gnu/packages/patches/python-genshi-fixing-the-tests-on-python35.patch b/gnu/packages/patches/python-genshi-fixing-the-tests-on-python35.patch
new file mode 100644
index 000000000..f1905e7cf
--- /dev/null
+++ b/gnu/packages/patches/python-genshi-fixing-the-tests-on-python35.patch
@@ -0,0 +1,112 @@
+From ce796ad4bae5c47011876778674ad036357febdf Mon Sep 17 00:00:00 2001
+From: Adriano Peluso <catonano@gmail.com>
+Date: Wed, 5 Apr 2017 15:10:06 +0200
+Subject: [PATCH 1/2] fixing the tests on python35
+
+---
+ genshi/filters/i18n.py        |  6 ++++--
+ genshi/template/astutil.py    | 14 +++++++++++---
+ genshi/template/directives.py | 20 ++++++++++++++------
+ genshi/template/eval.py       |  5 +++++
+ 4 files changed, 34 insertions(+), 11 deletions(-)
+
+diff --git a/genshi/filters/i18n.py b/genshi/filters/i18n.py
+index 526fda4..5387fcf 100644
+--- a/genshi/filters/i18n.py
++++ b/genshi/filters/i18n.py
+@@ -1194,8 +1194,10 @@ def extract_from_code(code, gettext_functions):
+                 elif arg:
+                     strings.append(None)
+             [_add(arg) for arg in node.args]
+-            _add(node.starargs)
+-            _add(node.kwargs)
++            if hasattr(node, 'starargs'):
++                _add(node.starargs)
++            if hasattr(node, 'kwargs'):
++                _add(node.kwargs)
+             if len(strings) == 1:
+                 strings = strings[0]
+             else:
+diff --git a/genshi/template/astutil.py b/genshi/template/astutil.py
+index f4e1edd..e561846 100644
+--- a/genshi/template/astutil.py
++++ b/genshi/template/astutil.py
+@@ -151,6 +151,10 @@ class ASTCodeGenerator(object):
+         def visit_arg(self, node):
+             self._write(node.arg)
+ 
++    def visit_Starred(self, node):
++        self._write('*')
++        self.visit(node.value)
++
+     # FunctionDef(identifier name, arguments args,
+     #                           stmt* body, expr* decorator_list)
+     def visit_FunctionDef(self, node):
+@@ -664,9 +668,13 @@ class ASTCodeGenerator(object):
+             if not first:
+                 self._write(', ')
+             first = False
+-            # keyword = (identifier arg, expr value)
+-            self._write(keyword.arg)
+-            self._write('=')
++            if not keyword.arg:
++                # Python 3.5+ star-star args
++                self._write('**')
++            else:
++                # keyword = (identifier arg, expr value)
++                self._write(keyword.arg)
++                self._write('=')
+             self.visit(keyword.value)
+         if getattr(node, 'starargs', None):
+             if not first:
+diff --git a/genshi/template/directives.py b/genshi/template/directives.py
+index 7301c2d..6fd0f28 100644
+--- a/genshi/template/directives.py
++++ b/genshi/template/directives.py
+@@ -266,13 +266,21 @@ class DefDirective(Directive):
+         if isinstance(ast, _ast.Call):
+             self.name = ast.func.id
+             for arg in ast.args:
+-                # only names
+-                self.args.append(arg.id)
++                if isinstance(arg, _ast.Starred):
++                    # Python 3.5+
++                    self.star_args = arg.value.id
++                else:
++                    # only names
++                    self.args.append(arg.id)
+             for kwd in ast.keywords:
+-                self.args.append(kwd.arg)
+-                exp = Expression(kwd.value, template.filepath,
+-                                 lineno, lookup=template.lookup)
+-                self.defaults[kwd.arg] = exp
++                if kwd.arg is None:
++                    # Python 3.5+
++                    self.dstar_args = kwd.value.id
++                else:
++                    self.args.append(kwd.arg)
++                    exp = Expression(kwd.value, template.filepath,
++                                     lineno, lookup=template.lookup)
++                    self.defaults[kwd.arg] = exp
+             if getattr(ast, 'starargs', None):
+                 self.star_args = ast.starargs.id
+             if getattr(ast, 'kwargs', None):
+diff --git a/genshi/template/eval.py b/genshi/template/eval.py
+index d378419..81644a7 100644
+--- a/genshi/template/eval.py
++++ b/genshi/template/eval.py
+@@ -600,6 +600,11 @@ class TemplateASTTransformer(ASTTransformer):
+         finally:
+             self.locals.pop()
+ 
++    # Only used in Python 3.5+
++    def visit_Starred(self, node):
++        node.value = self.visit(node.value)
++        return node
++
+     def visit_Name(self, node):
+         # If the name refers to a local inside a lambda, list comprehension, or
+         # generator expression, leave it alone
+-- 
+2.12.0
+
diff --git a/gnu/packages/patches/python-genshi-isstring-helper.patch b/gnu/packages/patches/python-genshi-isstring-helper.patch
new file mode 100644
index 000000000..4f6c19bba
--- /dev/null
+++ b/gnu/packages/patches/python-genshi-isstring-helper.patch
@@ -0,0 +1,37 @@
+From cc5e07284f44cdd9beec178c69070a53f55d1323 Mon Sep 17 00:00:00 2001
+From: Simon Cross <hodgestar@gmail.com>
+Date: Sun, 16 Feb 2014 18:43:20 +0000
+Subject: [PATCH 03/15] Add isstring helper.
+
+---
+ genshi/compat.py | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/genshi/compat.py b/genshi/compat.py
+index 9787325..6574e39 100644
+--- a/genshi/compat.py
++++ b/genshi/compat.py
+@@ -35,6 +35,15 @@ else:
+                 'Python 2 compatibility function. Not usable in Python 3.')
+ 
+ 
++# We need to test if an object is an instance of a string type in places
++
++if IS_PYTHON2:
++    def isstring(obj):
++        return isinstance(obj, basestring)
++else:
++    def isstring(obj):
++        return isinstance(obj, str)
++
+ # We need to differentiate between StringIO and BytesIO in places
+ 
+ if IS_PYTHON2:
+@@ -112,4 +121,3 @@ except NameError:
+             if not x:
+                 return False
+         return True
+-
+-- 
+2.12.0
+
diff --git a/gnu/packages/patches/python-genshi-stripping-of-unsafe-script-tags-Python-3.4.patch b/gnu/packages/patches/python-genshi-stripping-of-unsafe-script-tags-Python-3.4.patch
new file mode 100644
index 000000000..29951a614
--- /dev/null
+++ b/gnu/packages/patches/python-genshi-stripping-of-unsafe-script-tags-Python-3.4.patch
@@ -0,0 +1,51 @@
+From 0769be04c3891ae5c724c6779ba13d1d0f53b4ae Mon Sep 17 00:00:00 2001
+From: Simon Cross <hodgestar@gmail.com>
+Date: Sun, 16 Feb 2014 18:25:17 +0000
+Subject: [PATCH 01/15] Also allow stripping of unsafe script tags (Python 3.4
+ parses the second example as a tag whose name is script&xyz).
+
+---
+ genshi/filters/tests/test_html.py | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/genshi/filters/tests/test_html.py b/genshi/filters/tests/test_html.py
+index 0c6cfe1..45ec0da 100644
+--- a/genshi/filters/tests/test_html.py
++++ b/genshi/filters/tests/test_html.py
+@@ -368,12 +368,16 @@ def StyleSanitizer():
+ 
+ class HTMLSanitizerTestCase(unittest.TestCase):
+ 
+-    def assert_parse_error_or_equal(self, expected, exploit):
++    def assert_parse_error_or_equal(self, expected, exploit,
++                                    allow_strip=False):
+         try:
+             html = HTML(exploit)
+         except ParseError:
+             return
+-        self.assertEquals(expected, (html | HTMLSanitizer()).render())
++        sanitized_html = (html | HTMLSanitizer()).render()
++        if not sanitized_html and allow_strip:
++            return
++        self.assertEquals(expected, sanitized_html)
+ 
+     def test_sanitize_unchanged(self):
+         html = HTML(u'<a href="#">fo<br />o</a>')
+@@ -416,10 +420,12 @@ class HTMLSanitizerTestCase(unittest.TestCase):
+         html = HTML(u'<SCRIPT SRC="http://example.com/"></SCRIPT>')
+         self.assertEquals('', (html | HTMLSanitizer()).render())
+         src = u'<SCR\0IPT>alert("foo")</SCR\0IPT>'
+-        self.assert_parse_error_or_equal('&lt;SCR\x00IPT&gt;alert("foo")', src)
++        self.assert_parse_error_or_equal('&lt;SCR\x00IPT&gt;alert("foo")', src,
++                                         allow_strip=True)
+         src = u'<SCRIPT&XYZ SRC="http://example.com/"></SCRIPT>'
+         self.assert_parse_error_or_equal('&lt;SCRIPT&amp;XYZ; '
+-                                         'SRC="http://example.com/"&gt;', src)
++                                         'SRC="http://example.com/"&gt;', src,
++                                         allow_strip=True)
+ 
+     def test_sanitize_remove_onclick_attr(self):
+         html = HTML(u'<div onclick=\'alert("foo")\' />')
+-- 
+2.12.0
+
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index f1ef53e1a..898fef153 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -14644,3 +14644,45 @@ substitute for redis.")
 
 (define-public python2-sql
   (package-with-python2 python-sql))
+
+(define-public python-genshi
+  (package
+    (name "python-genshi")
+    (version "0.7")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://ftp.edgewall.org/pub/genshi/Genshi-"
+             version
+             ".tar.gz"))
+       (patches
+        (search-patches
+         ;; The first 4 patches are in the master branch upstream.
+         ;; see this as a reference https://genshi.edgewall.org/ticket/582
+         ;; The last 2 are NOT in any branch.
+         ;; They were sent as attachments to a ticket opened at
+         ;; https://genshi.edgewall.org/ticket/602#no1
+         "python-genshi-stripping-of-unsafe-script-tags-Python-3.4.patch"
+         "python-genshi-Disable-the-speedups-C-extension-on-CPython-3.3-sinc.patch"
+         "python-genshi-isstring-helper.patch"
+         "python-genshi-Add-support-for-Python-3.4-AST-support-for-NameConst.patch"
+         "python-genshi-fixing-the-tests-on-python35.patch"
+         "python-genshi-buildable-on-python27-too.patch"))
+       (sha256
+        (base32
+         "0lkkbp6fbwzv0zda5iqc21rr7rdldkwh3hfabfjl9i4bwq14858x"))))
+    (build-system python-build-system)
+    (home-page "https://genshi.edgewall.org/")
+    (synopsis "Toolkit for generation of output for the web")
+    (description "Genshi is a Python library that provides
+an integrated set of components for parsing, generating, and processing HTML, XML
+or other textual content for output generation on the web")
+    (license license:bsd-3)))
+
+;; the linter here claims that patch file names
+;; should start with the package name.
+;; In this case the patches are inherited from
+;; python-genshi without the "2"
+(define-public python2-genshi
+  (package-with-python2 python-genshi))
-- 
2.13.0


From 01c83c390865628b8889262ee59e0b460bd85328 Mon Sep 17 00:00:00 2001
From: Adriano Peluso <catonano@gmail.com>
Date: Sat, 20 May 2017 09:19:00 +0200
Subject: [PATCH 3/5] gnu: Add relatorio.

* gnu/packages/python.scm (python-relatorio, python2-relatorio): New variables.
---
 gnu/packages/python.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 898fef153..3268dcc85 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -14686,3 +14686,30 @@ or other textual content for output generation on the web")
 ;; python-genshi without the "2"
 (define-public python2-genshi
   (package-with-python2 python-genshi))
+
+(define-public python-relatorio
+  (package
+    (name "python-relatorio")
+    (version "0.6.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "relatorio" version))
+       (sha256
+        (base32
+         "0lincq79mzgazwd9gh41dybjh9c3n87r83pl8nk3j79aihyfk84z"))))
+    (propagated-inputs
+     `(("lxml" ,python-lxml)
+       ("genshi" ,python-genshi)))
+    (build-system python-build-system)
+    (home-page "https://relatorio.tryton.org/")
+    (synopsis "Templating library able to output odt and pdf files")
+    (description
+     "Relatorio is a templating library which
+provides a way to easily output several kinds of files
+(odt, ods, png, svg, …).  Support for more filetypes can be
+easily added by creating plugins for them.")
+    (license license:lgpl3)))
+
+(define-public python2-relatorio
+  (package-with-python2 python-relatorio))
-- 
2.13.0


From 603e00c231ea889293e159c7543f2ef40f6c7b81 Mon Sep 17 00:00:00 2001
From: Adriano Peluso <catonano@gmail.com>
Date: Sat, 20 May 2017 08:21:31 +0200
Subject: [PATCH 4/5] gnu: Add trytond.

* gnu/packages/tryton.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Register it.
* gnu/packages/tryton.scm (trytond, python2-trytond): New variables.
---
 gnu/local.mk            |  1 +
 gnu/packages/tryton.scm | 78 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+)
 create mode 100644 gnu/packages/tryton.scm

diff --git a/gnu/local.mk b/gnu/local.mk
index 676e3fd0c..1eb9f5bfa 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -321,6 +321,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/protobuf.scm			\
   %D%/packages/pv.scm				\
   %D%/packages/python.scm			\
+  %D%/packages/tryton.scm			\
   %D%/packages/qemu.scm				\
   %D%/packages/qt.scm				\
   %D%/packages/ragel.scm			\
diff --git a/gnu/packages/tryton.scm b/gnu/packages/tryton.scm
new file mode 100644
index 000000000..856ed6f3a
--- /dev/null
+++ b/gnu/packages/tryton.scm
@@ -0,0 +1,78 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Adriano Peluso <catonano@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+;;;
+;;; Copyright © 2017 Adriano Peluso <catonano@gmail.com>
+
+(define-module (gnu packages tryton)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix build-system python)
+  #:use-module (gnu packages gtk)  
+  )
+
+(define-public trytond
+  (package
+    (name "trytond")
+    (version "4.4.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://downloads.tryton.org/4.4/trytond-"
+             version ".tar.gz"))
+       (sha256
+        (base32
+         "0f5xh4s8xr01rrz63accrz8lpsni0dfsjrnl4h3widrgz6ds2fr6"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'preparations
+                     (lambda* _
+                       ;; this is used in the tests
+                       (setenv "DB_NAME" ":memory:"))))))
+    (inputs
+     `(("python-polib" ,python-polib)
+       ("python-dateutil" ,python-dateutil)
+       ("python-werkzeug" ,python-werkzeug)
+       ("python-wrapt" ,python-wrapt)
+       ("python-sql" ,python-sql)
+       ("python-genshi" ,python-genshi)
+       ("python-relatorio" ,python-relatorio)
+       ("python-lxml" ,python-lxml)
+       ;; there's no python-mysql in Guix right now
+       ;; so psycopg (postgresql) only for now
+       ("python-psycopg" ,python-psycopg2)))
+    (native-inputs
+     ;; this is used in the tests
+     `(("python-mock" ,python-mock)))
+    (home-page "http://www.tryton.org/")
+    (synopsis "Server component of Tryton")
+    (description
+   "The server of the Tryton application platform.
+A three-tiers high-level general purpose application platform
+written in Python and use Postgresql as main database engine.
+It is the core base of an Open Source ERP.
+It provides modularity, scalability and security.")
+    (license license:gpl3)))
+
+(define-public python2-trytond
+  (package-with-python2 trytond))
-- 
2.13.0


From 4e0dbe38855b115749f5deb278d7a6d64d978e99 Mon Sep 17 00:00:00 2001
From: Adriano Peluso <catonano@gmail.com>
Date: Sat, 20 May 2017 08:32:08 +0200
Subject: [PATCH 5/5] gnu: Add tryton.

* gnu/packages/tryton.scm (tryton): New variable.
---
 gnu/packages/tryton.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/tryton.scm b/gnu/packages/tryton.scm
index 856ed6f3a..eb923f889 100644
--- a/gnu/packages/tryton.scm
+++ b/gnu/packages/tryton.scm
@@ -76,3 +76,33 @@ It provides modularity, scalability and security.")
 
 (define-public python2-trytond
   (package-with-python2 trytond))
+
+;; this depends on pygtk that is available or python@2 only
+(define-public tryton
+  (package
+    (name "tryton")
+    (version "4.4.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://downloads.tryton.org/4.4/tryton-"
+             version ".tar.gz"))
+       (sha256
+        (base32
+         "1lklcz5fs6rkrd7z2m2f5gz4fdwzkgnhg2hyvzp20kdsvi33bq2j"))))
+    (arguments
+     `(#:python ,python-2))
+    (inputs
+     `(("python-chardet" ,python2-chardet)
+       ("python-dateutil" ,python2-dateutil)
+       ("python2-pygtk" ,python2-pygtk)))
+    (build-system python-build-system)
+    (home-page "http://www.tryton.org/")
+    (synopsis "Client component of Tryton")
+    (description "The client of the Tryton application platform.
+A three-tiers high-level general purpose application platform
+written in Python and use Postgresql as main database engine.
+It is the core base of an Open Source ERP.
+It provides modularity, scalability and security.")
+    (license license:gpl3)))
-- 
2.13.0


  parent reply	other threads:[~2017-05-20  7:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-08 12:17 bug#26401: [PATCH] python-tryton (with no modules) Catonano
2017-05-08 14:33 ` Arun Isaac
2017-05-15  6:39   ` Catonano
2017-05-15 13:19     ` Arun Isaac
2017-05-15 19:17   ` Catonano
2017-05-16 17:12     ` Arun Isaac
     [not found]     ` <c3fa946d.AEMAKXA0lrIAAAAAAAAAAAOu6r8AAAACwQwAAAAAAAW9WABZGzM6@mailjet.com>
2017-05-16 18:36       ` Catonano
2017-05-16 18:41       ` Catonano
2017-05-17  5:54         ` Arun Isaac
     [not found]         ` <4d3632b9.AEEAKq6kKpkAAAAAAAAAAAOu6r8AAAACwQwAAAAAAAW9WABZG-Wd@mailjet.com>
2017-05-17  7:45           ` Catonano
2017-05-18 17:49             ` Arun Isaac
     [not found]             ` <7e6e3d0c.ADsAALmm2EQAAAAAAAAAAAOu6r8AAAACwQwAAAAAAAW9WABZHd6n@mailjet.com>
2017-05-18 18:03               ` Catonano
2017-05-20  7:39               ` Catonano [this message]
2017-05-22 21:13                 ` Arun Isaac
2017-05-27 14:21                 ` Arun Isaac
     [not found]                 ` <57fa2a94.AEMAKvi84IwAAAAAAAAAAAOu6r8AAAACwQwAAAAAAAW9WABZKYuO@mailjet.com>
2017-05-27 14:38                   ` Catonano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ98PDxsJxcUQuJ_8vh+vGiNJg=jUr+n83HZgC9yufykG7ZEQQ@mail.gmail.com' \
    --to=catonano@gmail.com \
    --cc=26401@debbugs.gnu.org \
    --cc=arunisaac@systemreboot.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).