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: Mon, 15 May 2017 21:17:46 +0200	[thread overview]
Message-ID: <CAJ98PDw=6r6zaW6ab8dqfpwK0Ce=TC8hBb5qFTiHwP+if9cESw@mail.gmail.com> (raw)
In-Reply-To: <285e9165.AEMAKF1MYlQAAAAAAAAAAAO8YckAAAACwQwAAAAAAAW9WABZEIIR@mailjet.com>


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

2017-05-08 16:33 GMT+02:00 Arun Isaac <arunisaac@systemreboot.net>:

>
> Thanks for the patch set!
>
> I haven't properly tested the package yet. The following are just my
> initial reactions and questions. This patch review will take a few
> iterations. Do bear with me.
>

:-)


>
> > Tryton has modules and without any module packaged, it will do nothing
> >
> > But at least you can launch it and test it, you can use it for packkaging
> > the missing modules.
> >
> > Also a service would be useful. But in order to write a service, the
> server
> > packkage has to be in already.
>
> Agreed.
>
> > This is supposedly the basis for GNUealth, a notable GNU project
>
> GNU Health usually lags behind the latest Tryon, and currently runs on
> Tryton 3.8. We will have to create a package for Tryton 3.8 as
> well. This can just inherit from the latest tryton package, and modify
> only the `version' and `source' fields. Could you do this?
>

Yes, I think I could do it.

Bt if you don't mind I'd liie to delay this.

When and if we'll have the current Tryton thhen we'll see.


>
> > From e42a727312a454aeb19e07cfec6cbb03fe18e183 Mon Sep 17 00:00:00 2001
> > From: humanitiesNerd <catonano@gmail.com>
> > Date: Tue, 28 Mar 2017 12:25:06 +0200
> > Subject: [PATCH 1/5] gnu: Add python-sql python2-sql.
>
> It is enough to mention only python-sql here.
>

done


>
> > * gnu/packages/python.scm (python-sql python2-sql): New variables.
>
> Please put a comma between python-sql and python2-sql.
>

done


>
> > +(define-public python-sql
> > +  (package
> > +    (name "python-sql")
> > +    (version "0.8")
>
> The latest version of python-sql is 0.9.
>

updated


>
> > +       (uri (pypi-uri
> > +             "python-sql"
> > +             version))
>
> Could you put these on the same line?
>

done


>
> > +(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"))
>
> Please put version ".tar.gz" on the same line.
>

done


>
> > +       (patches
> > +        (search-patches
> > +         ;; The first 4 patches are in the master branch upstream.
> > +         ;; see this as a reference https://genshi.edgewall.org/ti
> cket/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.p
> atch"
> > +         "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"))
>
> Why do we need these patches? Is the release tarball not sufficient?
>

No, the current tarball is not suficient.
Genshi builds with python 3.3 only. With python 3.4 and 3.5 it doesn't
build.

This is mainly due to a change in thhe C API so a part of Genshi tat was
written in C has to be re-written adgering to the new API

The authors claim to need more time to do this.

The Genshi issue tracker reports all this infomration, I linked the
relevant issues in the comments

Admittedly I don't understand what these patches do. They're too entrenched
in the Genshi code base

I shamelessly copied them from the Fedora package definition
See here
http://pkgs.fedoraproject.org/cgit/rpms/python-genshi.git/snapshot/python-genshi-f25.tar.gz

I understand that they made an effort to make their Genshi package
compatible with pythhon 3.4 too and that is not necessary or Guix

But it's too complicated for me to excise the support for python 3.4


>
> > +    (propagated-inputs
> > +     `(("lxml" ,python2-lxml)
> > +       ("genshi" ,python2-genshi)))
>
> Please put the full names of these inputs -- I mean "python-lxml"
> instead of "lxml", "python-genshi" instead of "genshi", and so on.
>

done


>
> > +(define-public python-trytond
> > +  (package
> > +    (name "python-trytond")
>
> As far as I understand, trytond is an application, not a python
> library. Only python libraries should have the "python-" prefix.


Oh, I didn't know this. Thanks


> So,
> this package would just be called "trytond".
>

done


>
> > +    (version "4.2.3")
>
> The latest version of tryton is 4.4.
>

updated


>
> > +    (source
> > +     (origin
> > +       (method url-fetch)
> > +       (uri (pypi-uri
> > +             "trytond"
> > +             version
> > +             ".tar.gz"))
>
> We should use the tarballs available on the tryton website.
> https://downloads.tryton.org/4.4/


done


>
>
> > +    (arguments
> > +     `(#:phases
> > +       (modify-phases %standard-phases
> > +         (add-before 'check 'preparations
> > +                     (lambda* _
> > +                       ;; this is used in the tests
> > +                       (setenv "DB_NAME" ":memory:"))))))
>
> Though this is shorter, I think it would be clearer to replace the
> `check' phase altogether.
>

mmm I'm not sure I can do this.
I don't know much about setuptools, eggs and the such
The check phase of the python build system is quite articulated, I don't
feel like messing with it

Feel free to rearrange this yourself as you see fit.



>
> > +    (propagated-inputs
> > +     `(("polib" ,python-polib)
> > +       ("dateutil" ,python-dateutil)
> > +       ("werkzeug" ,python-werkzeug)
> > +       ("wrapt" ,python-wrapt)
> > +       ("python-sql" ,python-sql)
> > +       ("genshi" ,python-genshi)
> > +       ("relatorio" ,python-relatorio)
> > +       ("lxml" ,python-lxml)
> > +       ;; there's no pyton-mysql in Guix right now
> > +       ;; so psycopg (postgresql) only for now
> > +       ("psycopg" ,python-psycopg2)))
>
> If trytond is only an application, these can just be `inputs', not
> `propagated-inputs'. For applications, the python build system wraps the
> executables with the correct PYTHONPATH environment variable.
>

Right, thanks.
Done



>
> > +  (license license:lgpl3)))
>
> Tryton is GPL3.
>

fixed


>
> > +(define-public python2-trytond
> > +  (package-with-python2 python-trytond))
>
> No need for python2-trytond if trytond is just an application.
>

erased


>
> > +;; this depends on pygtk that is available or python@2 only
> > +(define-public python2-tryton
> > +  (package
> > +    (name "python2-tryton")
> > +    (version "4.2.4")
>
> Latest version if 4.4
>

updated


>
> > +       (uri (pypi-uri
> > +             "tryton"
> > +             version
> > +             ".tar.gz"))
>
> We should use the tarballs available on the tryton website.
> https://downloads.tryton.org/4.4/


done


>
>
> > +    (propagated-inputs
> > +     `(("chardet" ,python2-chardet)
> > +       ("dateutil" ,python2-dateutil)
> > +       ("pygtk" ,python2-pygtk)))
>
> For an application, these can just be `inputs'.
>

done

Ok, so this is the first iteration.
I'm ready or the next one 😎

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

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

From ffa984ecdfc0c786b09ebb99b635faffb5378f4a 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 2e95052780cef66ded0119e0ef2046c6b5c5a31b Mon Sep 17 00:00:00 2001
From: humanitiesNerd <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                            |  75 ++++++++++
 8 files changed, 489 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 28a283ab7..7ae12c18c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -922,6 +922,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: humanitiesNerd <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: humanitiesNerd <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..14cecfcb1 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -14644,3 +14644,78 @@ 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))
+
+
+;; this package depends on python-genshi that
+;; can be buit only with python-2
+;; so providing a python33 version of this
+;; is difficult
+(define-public python2-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" ,python2-lxml)
+       ("genshi" ,python2-genshi)))
+    (arguments
+     `(#:python ,python-2))
+    ;; because relatorio depends on python-genshi
+    ;; that can be built with python-2 only
+    (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)))
-- 
2.13.0


From 0eb5261eb2d696a30d5a7304dd4dc1692c14ac61 Mon Sep 17 00:00:00 2001
From: humanitiesNerd <catonano@gmail.com>
Date: Wed, 5 Apr 2017 16:06:06 +0200
Subject: [PATCH 3/5]  gnu Add: python-relatorio.

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

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 14cecfcb1..3268dcc85 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -14687,12 +14687,7 @@ or other textual content for output generation on the web")
 (define-public python2-genshi
   (package-with-python2 python-genshi))
 
-
-;; this package depends on python-genshi that
-;; can be buit only with python-2
-;; so providing a python33 version of this
-;; is difficult
-(define-public python2-relatorio
+(define-public python-relatorio
   (package
     (name "python-relatorio")
     (version "0.6.4")
@@ -14704,12 +14699,8 @@ or other textual content for output generation on the web")
         (base32
          "0lincq79mzgazwd9gh41dybjh9c3n87r83pl8nk3j79aihyfk84z"))))
     (propagated-inputs
-     `(("lxml" ,python2-lxml)
-       ("genshi" ,python2-genshi)))
-    (arguments
-     `(#:python ,python-2))
-    ;; because relatorio depends on python-genshi
-    ;; that can be built with python-2 only
+     `(("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")
@@ -14719,3 +14710,6 @@ 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 b71cd2bd664e530dfabb3e558db15934f0ec204a Mon Sep 17 00:00:00 2001
From: humanitiesNerd <catonano@gmail.com>
Date: Thu, 6 Apr 2017 09:37:59 +0200
Subject: [PATCH 4/5] gnu: Add python-trytond.

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

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 3268dcc85..0c5ff6517 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -14713,3 +14713,53 @@ easily added by creating plugins for them.")
 
 (define-public python2-relatorio
   (package-with-python2 python-relatorio))
+
+(define-public python-trytond
+  (package
+    (name "python-trytond")
+    (version "4.2.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri
+             "trytond"
+             version
+             ".tar.gz"))
+       (sha256
+        (base32
+         "1w9bc0qck9k1vzk1xvry3vb70mibaxipp229naym2fnwi282jlh5"))))
+    (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:"))))))
+    (propagated-inputs
+     `(("polib" ,python-polib)
+       ("dateutil" ,python-dateutil)
+       ("werkzeug" ,python-werkzeug)
+       ("wrapt" ,python-wrapt)
+       ("python-sql" ,python-sql)
+       ("genshi" ,python-genshi)
+       ("relatorio" ,python-relatorio)
+       ("lxml" ,python-lxml)
+       ;; there's no pyton-mysql in Guix right now
+       ;; so psycopg (postgresql) only for now
+       ("psycopg" ,python-psycopg2)))
+    (native-inputs
+     ;; this is used in the tests
+     `(("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:lgpl3)))
+
+(define-public python2-trytond
+  (package-with-python2 python-trytond))
-- 
2.13.0


From 48493cad90eac1d807fc6f3d7011ccc811c713a0 Mon Sep 17 00:00:00 2001
From: humanitiesNerd <catonano@gmail.com>
Date: Thu, 6 Apr 2017 22:17:11 +0200
Subject: [PATCH 5/5] gnu: Add python2-tryton.

* gnu/packages/python.scm (python2-tryton): New variable.
---
 gnu/packages/python.scm | 82 ++++++++++++++++++++++++++++++++-----------------
 1 file changed, 53 insertions(+), 29 deletions(-)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 0c5ff6517..ac1061014 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -14626,16 +14626,15 @@ substitute for redis.")
 (define-public python-sql
   (package
     (name "python-sql")
-    (version "0.8")
+    (version "0.9")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri
-             "python-sql"
-             version))
+             "python-sql" version))
        (sha256
         (base32
-         "0xik939sxqfqqbpgcsnfjnws692bjip32khgwhq1ycphfy7df3h2"))))
+         "0p6kaqj02vz0habmdx37zjk6hjxdfm8aw737zs059vvpr70ird87"))))
     (build-system python-build-system)
     (home-page "https://python-sql.tryton.org/")
     (synopsis "Library to write SQL queries")
@@ -14654,8 +14653,7 @@ substitute for redis.")
        (method url-fetch)
        (uri (string-append
              "https://ftp.edgewall.org/pub/genshi/Genshi-"
-             version
-             ".tar.gz"))
+             version ".tar.gz"))
        (patches
         (search-patches
          ;; The first 4 patches are in the master branch upstream.
@@ -14699,8 +14697,8 @@ or other textual content for output generation on the web")
         (base32
          "0lincq79mzgazwd9gh41dybjh9c3n87r83pl8nk3j79aihyfk84z"))))
     (propagated-inputs
-     `(("lxml" ,python-lxml)
-       ("genshi" ,python-genshi)))
+     `(("python-lxml" ,python-lxml)
+       ("python-genshi" ,python-genshi)))
     (build-system python-build-system)
     (home-page "https://relatorio.tryton.org/")
     (synopsis "Templating library able to output odt and pdf files")
@@ -14714,20 +14712,19 @@ easily added by creating plugins for them.")
 (define-public python2-relatorio
   (package-with-python2 python-relatorio))
 
-(define-public python-trytond
+(define-public trytond
   (package
-    (name "python-trytond")
-    (version "4.2.3")
+    (name "trytond")
+    (version "4.4.0")
     (source
      (origin
        (method url-fetch)
-       (uri (pypi-uri
-             "trytond"
-             version
-             ".tar.gz"))
+       (uri (string-append
+             "https://downloads.tryton.org/4.4/trytond-"
+             version ".tar.gz"))
        (sha256
         (base32
-         "1w9bc0qck9k1vzk1xvry3vb70mibaxipp229naym2fnwi282jlh5"))))
+         "0f5xh4s8xr01rrz63accrz8lpsni0dfsjrnl4h3widrgz6ds2fr6"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
@@ -14736,21 +14733,21 @@ easily added by creating plugins for them.")
                      (lambda* _
                        ;; this is used in the tests
                        (setenv "DB_NAME" ":memory:"))))))
-    (propagated-inputs
-     `(("polib" ,python-polib)
-       ("dateutil" ,python-dateutil)
-       ("werkzeug" ,python-werkzeug)
-       ("wrapt" ,python-wrapt)
+    (inputs
+     `(("python-polib" ,python-polib)
+       ("python-dateutil" ,python-dateutil)
+       ("python-werkzeug" ,python-werkzeug)
+       ("python-wrapt" ,python-wrapt)
        ("python-sql" ,python-sql)
-       ("genshi" ,python-genshi)
-       ("relatorio" ,python-relatorio)
-       ("lxml" ,python-lxml)
+       ("python-genshi" ,python-genshi)
+       ("python-relatorio" ,python-relatorio)
+       ("python-lxml" ,python-lxml)
        ;; there's no pyton-mysql in Guix right now
        ;; so psycopg (postgresql) only for now
-       ("psycopg" ,python-psycopg2)))
+       ("pyton-psycopg" ,python-psycopg2)))
     (native-inputs
      ;; this is used in the tests
-     `(("mock" ,python-mock)))
+     `(("python-mock" ,python-mock)))
     (home-page "http://www.tryton.org/")
     (synopsis "Server component of Tryton")
     (description
@@ -14759,7 +14756,34 @@ 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:lgpl3)))
+  (license license:gpl3)))
 
-(define-public python2-trytond
-  (package-with-python2 python-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)
+       ("pyton-dateutil" ,python2-dateutil)
+       ("pyton2-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-15 19:19 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 [this message]
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
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='CAJ98PDw=6r6zaW6ab8dqfpwK0Ce=TC8hBb5qFTiHwP+if9cESw@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).