Commit a5ce8175 authored by Kirill Smelkov's avatar Kirill Smelkov

golang: Prepare path for libgolang.dll before importing _golang

Else it fails to import on Windows:

    collecting ... 05c8:err:module:import_dll Library libgolang.dll (which is needed by L"Z:\\home\\kirr\\src\\tools\\go\\pygo-win\\pygolang\\golang\\_golang.cp310-win_amd64.pyd") not found
    collected 0 items / 1 error

    =========================================================== ERRORS ===========================================================
    ___________________________________________ ERROR collecting golang/golang_test.py ___________________________________
    ImportError while importing test module 'Z:\home\kirr\src\tools\go\pygo-win\pygolang\golang\golang_test.py'.
    Hint: make sure your test modules/packages have valid Python names.
    Traceback:
    C:\Program Files\Python310\lib\importlib\__init__.py:126: in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
    golang\__init__.py:45: in <module>
        from golang._golang import _pysys_exc_clear as _sys_exc_clear
    E   ImportError: DLL load failed while importing _golang: Модуль не найден.

We need to increase required setuptools_dso version because dylink_prepare_dso
and generation of *_dsoinfo.py modules was done after setuptools_dso 2.
parent 0b97e0a8
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2018-2022 Nexedi SA and Contributors. # Copyright (C) 2018-2023 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
...@@ -42,6 +42,9 @@ from golang._gopath import gimport # make gimport available from golang ...@@ -42,6 +42,9 @@ from golang._gopath import gimport # make gimport available from golang
import inspect, sys import inspect, sys
import decorator, six import decorator, six
import setuptools_dso
setuptools_dso.dylink_prepare_dso('golang.runtime.libgolang')
from golang._golang import _pysys_exc_clear as _sys_exc_clear from golang._golang import _pysys_exc_clear as _sys_exc_clear
# @func is a necessary decorator for functions for selected golang features to work. # @func is a necessary decorator for functions for selected golang features to work.
......
[build-system] [build-system]
requires = ["setuptools", "wheel", "setuptools_dso >= 1.7", "cython", "gevent"] requires = ["setuptools", "wheel", "setuptools_dso >= 2.7", "cython", "gevent"]
...@@ -152,7 +152,7 @@ class develop(XInstallGPython, _develop): ...@@ -152,7 +152,7 @@ class develop(XInstallGPython, _develop):
# requirements of packages under "golang." namespace # requirements of packages under "golang." namespace
R = { R = {
'cmd.pybench': {'pytest'}, 'cmd.pybench': {'pytest'},
'pyx.build': {'setuptools', 'wheel', 'cython', 'setuptools_dso >= 1.7'}, 'pyx.build': {'setuptools', 'wheel', 'cython', 'setuptools_dso >= 2.7'},
'x.perf.benchlib': {'numpy'}, 'x.perf.benchlib': {'numpy'},
} }
# TODO generate `a.b -> a`, e.g. x.perf = join(x.perf.*); x = join(x.*) # TODO generate `a.b -> a`, e.g. x.perf = join(x.perf.*); x = join(x.*)
...@@ -313,6 +313,8 @@ setup( ...@@ -313,6 +313,8 @@ setup(
include_package_data = True, include_package_data = True,
install_requires = ['gevent', 'six', 'decorator', 'Importing;python_version<="2.7"', install_requires = ['gevent', 'six', 'decorator', 'Importing;python_version<="2.7"',
# only runtime part: for dylink_prepare_dso
'setuptools_dso >= 2.7',
# pyx.build -> setuptools_dso uses multiprocessing # pyx.build -> setuptools_dso uses multiprocessing
# FIXME geventmp fails on python2, but setuptools_dso # FIXME geventmp fails on python2, but setuptools_dso
# uses multiprocessing only on Python3, so for now we # uses multiprocessing only on Python3, so for now we
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment