• Kirill Smelkov's avatar
    *: Replace imp with importlib on py3 · 68f384a9
    Kirill Smelkov authored
    @Qubitium notes (https://github.com/navytux/pygolang/issues/1):
    
        Python 3.12 no longer support the imp module (fully deprecated) with note to use importlib as replacement.
    
        Please support python 3.12 by migrating from imp code to importlib. Thanks.
    
    and indeed, even trying to build pygolang fails on py3.12:
    
        (py312.venv) kirr@deca:~/src/tools/go/pygolang-master$ python setup.py build_ext -i
        Traceback (most recent call last):
          File "/home/kirr/src/tools/go/pygolang-master/setup.py", line 40, in <module>
            exec(readfile('trun'), trun)
          File "<string>", line 41, in <module>
        ModuleNotFoundError: No module named 'imp'
    
    -> Rework the code to use importlib instead, but keep using imp on py2
    where there is practically no importlib functionality.
    
    /reported-by @Qubitium (github)
    /reviewed-by @jerome
    /reviewed-on !23
    68f384a9
_gopath.py 3.74 KB