[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: TypeError: ord() expected a character, but string of length 3 found (Was: Updated python-uncertainties)



On Fri, Oct 12, 2018 at 06:19:00PM +0200, Piotr Ożarowski wrote:
> [PICCA Frederic-Emmanuel, 2018-10-12]
> > to my opinion, the code is modify in place with 2to3.
> > So the  code on the source after the configuration is already converted to python3.
> > And during the build process, with python2 the code is copied as it in the .pybuild place for python2
> > with python3 we see that the RefactoringTool, does nothing, it means the code is already converted to python3.
> 
> try adding python3-setuptools to Build-Depends

To follow this hint I did:


diff --git a/debian/control b/debian/control
index c66846a..12dfd7d 100644
--- a/debian/control
+++ b/debian/control
@@ -10,10 +10,12 @@ Build-Depends: debhelper (>= 11~),
                python-all,
                python-nose,
                python-numpy,
+               python-setuptools,
                python3-sphinx,
                python3-all,
                python3-nose,
                python3-numpy,
+               python3-setuptools,
                2to3
 Standards-Version: 4.2.1
 Vcs-Browser: https://salsa.debian.org/debian/python-uncertainties
diff --git a/debian/rules b/debian/rules
index 9a27f86..59d4cf5 100755
--- a/debian/rules
+++ b/debian/rules
@@ -17,14 +17,14 @@ override_dh_auto_build:
        dh_auto_build
        PYTHONPATH=`pybuild --print build_dir --interpreter python3` http_proxy='http://127.0.0.1:9/' sphinx-build -N -bhtml doc debian/html
 
-override_dh_auto_test:
+__override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
        # for some very strange reason the RefactoringTool breaks the definions in TO_SUPERSCRIPT
        find . -name core.py -exec sed -i "s/^\([[:space:]]\+0x[0-9a-f]\{2\}: \)'/\1u'/" \{\} \;
        dh_auto_test || true # FIXME: Ignore errors for the moment but at least document these in logs
 endif
 
-override_dh_auto_install:
+__override_dh_auto_install:
        dh_auto_install
        # we need the same means as for the tests again before installing the files
        find debian -name core.py -exec sed -i "s/^\([[:space:]]\+0x[0-9a-f]\{2\}: \)'/\1u'/" \{\} \;



which results in:


PYTHONPATH=`pybuild --print build_dir --interpreter python3` http_proxy='http://127.0.0.1:9/' sphinx-build -N -bhtml doc debian/html
Running Sphinx v1.7.9

Configuration error:
There is a syntax error in your configuration file: invalid syntax (core.py, line 2882)
Did you change the syntax from 2.x to 3.x?
make[1]: *** [debian/rules:18: override_dh_auto_build] Error 2
 

If I try in the pbuilder chroot


/build/uncertainties-3.0.2.github# python3
Python 3.6.7rc1 (default, Sep 27 2018, 09:51:25) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from uncertainties import core
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/build/uncertainties-3.0.2.github/uncertainties/__init__.py", line 224, in <module>
    from .core import *
  File "/build/uncertainties-3.0.2.github/uncertainties/core.py", line 2882
    POSITIVE_DECIMAL_UNSIGNED_OR_NON_FINITE = ur'((\d*)(\.\d*)?|nan|NAN|inf|INF)'
                                                                                ^
SyntaxError: invalid syntax



So this a different issue and I admit that the changes in core.py are
different from the ones without python3-setuptools.  Any hint how I
could solve the latter issue since I'd prefer to ship the package
without the ugly hack?

Kind regards

       Andreas.

-- 
http://fam-tille.de


Reply to: