Bug ID 1114895
Summary devel:tools:scm/mercurial: Bug hg breaks if Python3 alernative is set
Classification openSUSE
Product openSUSE.org
Version unspecified
Hardware All
OS openSUSE Factory
Status NEW
Severity Major
Priority P5 - None
Component 3rd party software
Assignee wolfgang@rosenauer.org
Reporter pgnet.dev@gmail.com
QA Contact bnc-team-screening@forge.provo.novell.com
Found By ---
Blocker ---

If

    rpm -qa | grep -i mercurial
        mercurial-4.8-lp150.222.1.x86_64
        mercurial-lang-4.8-lp150.222.1.noarch

    python - manual mode
      link best version is /usr/bin/python3
      link currently points to /usr/bin/python3
      link python is /usr/bin/python
    /usr/bin/python2 - priority 1
    /usr/bin/python3 - priority 2

Then

    hg --version
        Traceback (most recent call last):
          File "/usr/bin/hg", line 43, in <module>
            dispatch.run()
          File "/usr/lib64/python3.6/importlib/util.py", line 233, in
__getattribute__
            self.__spec__.loader.exec_module(self)
          File "<frozen importlib._bootstrap_external>", line 678, in
exec_module
          File "<frozen importlib._bootstrap>", line 219, in
_call_with_frames_removed
          File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line
22, in <module>
            from .i18n import _
          File "/usr/lib64/python3.6/importlib/util.py", line 233, in
__getattribute__
            self.__spec__.loader.exec_module(self)
          File "/usr/lib64/python2.7/site-packages/mercurial/i18n.py", line
104, in <module>
            if _plain():
          File "/usr/lib64/python2.7/site-packages/mercurial/i18n.py", line 98,
in _plain
            if ('HGPLAIN' not in encoding.environ
          File "/usr/lib64/python3.6/importlib/util.py", line 233, in
__getattribute__
            self.__spec__.loader.exec_module(self)
          File "/usr/lib64/python2.7/site-packages/mercurial/encoding.py", line
24, in <module>
            charencode = policy.importmod(r'charencode')
          File "/usr/lib64/python2.7/site-packages/mercurial/policy.py", line
101, in importmod
            mod = _importfrom(pn, mn)
          File "/usr/lib64/python2.7/site-packages/mercurial/policy.py", line
57, in _importfrom
            pkg = __import__(pkgname, globals(), fakelocals, [modname],
level=1)
          File "/usr/lib64/python3.6/importlib/util.py", line 274, in
create_module
            return self.loader.create_module(spec)
        ImportError: dynamic module does not define module export function
(PyInit_parsers)

>From site,

    https://www.mercurial-scm.org/wiki/

    SupportedPythonVersions

        Python_3.x_support

        Python 3.x has no relation to Windows Unicode filename support, see
EncodingStrategy.

        Mercurial is actively being ported to Python 3. As of Mercurial 4.3,
some commands work on Python 3. However, Python 3 is not yet a supported
platform.

        Mercurial will never support Python 3.0 to 3.4 because of missing
support for the % operator on bytestrings (bytes in Python 3).


Fixable with a script change with no user intervention,

    perl -pi -e 's|(^#!/usr/bin/python)$|${1}2|g' $( which hg )
    hg --version
        Mercurial Distributed SCM (version 4.8)

or, with,

    alias hg='/usr/bin/python2 /usr/bin/hg'


You are receiving this mail because: