Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0.11: build fails with [-Wincompatible-pointer-types] error #186

Closed
kloczek opened this issue Feb 8, 2024 · 9 comments · Fixed by #214
Closed

2.0.11: build fails with [-Wincompatible-pointer-types] error #186

kloczek opened this issue Feb 8, 2024 · 9 comments · Fixed by #214
Labels

Comments

@kloczek
Copy link

kloczek commented Feb 8, 2024

With new glibc is possible to build with -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS which turns some warnings into errors.

+ cd geventhttpclient-2.0.11
+ ASMFLAGS='-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security'
+ CFLAGS='-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security'
+ CXXFLAGS='-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security'
+ FFLAGS='-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -I/usr/lib64/gfortran/modules'
+ FCFLAGS='-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -I/usr/lib64/gfortran/modules'
+ LDFLAGS='-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--gc-sections -Wl,--as-needed -Wl,--build-id=sha1 -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,pack-relative-relocs -flto=auto -fuse-linker-plugin'
+ RUSTFLAGS='-C codegen-units=1 -C debuginfo=2 -C opt-level=2 -C link-arg=-Wl,--as-needed -C link-arg=-Wl,--build-id=sha1 -C link-arg=-Wl,-z,now -C link-arg=-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -C link-arg=-Wl,-z,pack-relative-relocs -C link-arg=-Wl,-z,relro -C link-arg=-flto=auto --cap-lints=warn'
+ VALAFLAGS=-g
+ CC=/usr/bin/gcc
+ CXX=/usr/bin/g++
+ FC=/usr/bin/gfortran
+ AR=/usr/bin/gcc-ar
+ NM=/usr/bin/gcc-nm
+ RANLIB=/usr/bin/gcc-ranlib
+ export ASMFLAGS CFLAGS CXXFLAGS FFLAGS FCFLAGS LDFLAGS VALAFLAGS CC CXX FC AR NM RANLIB RUSTFLAGS VALAFLAGS
+ PBR_VERSION=2.0.11
+ PDM_BUILD_SCM_VERSION=2.0.11
+ SETUPTOOLS_SCM_PRETEND_VERSION=2.0.11
+ /usr/bin/python3 -sBm build -w --no-isolation
* Getting build dependencies for wheel...
warning: no files found matching '*.h' under directory 'llhttp'
warning: no files found matching '*.c' under directory 'llhttp'
warning: no files found matching 'LICENSE-MIT' under directory 'llhttp'
warning: no previously-included files matching '__pycache__' found anywhere in distribution
warning: no previously-included files matching '*.py[co]' found anywhere in distribution
warning: no files found matching 'LICENSE-MIT'
warning: no files found matching 'CHANGELOG'
* Building wheel...
warning: no files found matching '*.h' under directory 'llhttp'
warning: no files found matching '*.c' under directory 'llhttp'
warning: no files found matching 'LICENSE-MIT' under directory 'llhttp'
warning: no previously-included files matching '__pycache__' found anywhere in distribution
warning: no previously-included files matching '*.py[co]' found anywhere in distribution
warning: no files found matching 'LICENSE-MIT'
warning: no files found matching 'CHANGELOG'
ext/_parser.c: In function ‘on_message_complete’:
ext/_parser.c:48:32: error: passing argument 1 of ‘PyObject_HasAttrString’ from incompatible pointer type [-Wincompatible-pointer-types]
   48 |     if (PyObject_HasAttrString(self, "_on_message_complete")) {
      |                                ^~~~
      |                                |
      |                                PyHTTPResponseParser *
In file included from /usr/include/python3.8/pytime.h:6,
                 from /usr/include/python3.8/Python.h:85,
                 from ext/_parser.c:2:
/usr/include/python3.8/object.h:232:40: note: expected ‘PyObject *’ {aka ‘struct _object *’} but argument is of type ‘PyHTTPResponseParser *’
  232 | PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, const char *);
      |                                        ^~~~~~~~~~
ext/_parser.c:49:53: error: passing argument 1 of ‘PyObject_GetAttrString’ from incompatible pointer type [-Wincompatible-pointer-types]
   49 |         PyObject* callable = PyObject_GetAttrString(self, "_on_message_complete");
      |                                                     ^~~~
      |                                                     |
      |                                                     PyHTTPResponseParser *
/usr/include/python3.8/object.h:230:47: note: expected ‘PyObject *’ {aka ‘struct _object *’} but argument is of type ‘PyHTTPResponseParser *’
  230 | PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, const char *);
      |                                               ^~~~~~~~~~
ext/_parser.c: At top level:
ext/_parser.c:150:5: error: initialization of ‘int (*)(llhttp_t *, const char *, size_t)’ {aka ‘int (*)(struct llhttp__internal_s *, const char *, long unsigned int)’} from incompatible pointer type ‘int (*)(llhttp_t *)’ {aka ‘int (*)(struct llhttp__internal_s *)’} [-Wincompatible-pointer-types]
  150 |     on_headers_complete,
      |     ^~~~~~~~~~~~~~~~~~~
ext/_parser.c:150:5: note: (near initialization for ‘_parser_settings.on_header_field’)
ext/_parser.c:152:5: error: initialization of ‘int (*)(llhttp_t *, const char *, size_t)’ {aka ‘int (*)(struct llhttp__internal_s *, const char *, long unsigned int)’} from incompatible pointer type ‘int (*)(llhttp_t *)’ {aka ‘int (*)(struct llhttp__internal_s *)’} [-Wincompatible-pointer-types]
  152 |     on_message_complete
      |     ^~~~~~~~~~~~~~~~~~~
ext/_parser.c:152:5: note: (near initialization for ‘_parser_settings.on_chunk_extension_name’)
/usr/lib/python3.8/site-packages/setuptools/command/build_py.py:207: _Warning: Package 'geventhttpclient.tests' is absent from the `packages` configuration.
!!

        ********************************************************************************
        ############################
        # Package would be ignored #
        ############################
        Python recognizes 'geventhttpclient.tests' as an importable package[^1],
        but it is absent from setuptools' `packages` configuration.

        This leads to an ambiguous overall configuration. If you want to distribute this
        package, please make sure that 'geventhttpclient.tests' is explicitly added
        to the `packages` configuration field.

        Alternatively, you can also rely on setuptools' discovery methods
        (for example by using `find_namespace_packages(...)`/`find_namespace:`
        instead of `find_packages(...)`/`find:`).

        You can read more about "package discovery" on setuptools documentation page:

        - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

        If you don't want 'geventhttpclient.tests' to be distributed and are
        already explicitly excluding 'geventhttpclient.tests' via
        `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
        you can try to use `exclude_package_data`, or `include-package-data=False` in
        combination with a more fine grained `package-data` configuration.

        You can read more about "package data files" on setuptools documentation page:

        - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


        [^1]: For Python, any directory (with suitable naming) can be imported,
              even if it does not contain any `.py` files.
              On the other hand, currently there is no concept of package data
              directory, all directories are treated like packages.
        ********************************************************************************

!!
  check.warn(importable)
error: command '/usr/bin/gcc' failed with exit code 1

ERROR Backend subprocess exited when trying to invoke build_wheel
@cyberw
Copy link
Collaborator

cyberw commented Feb 9, 2024

PRs welcome.

@ml31415 ml31415 added the bug label Apr 13, 2024
@ml31415
Copy link
Collaborator

ml31415 commented Apr 17, 2024

So if I remove all the special redhat stuff, it seems to build for me.

ASMFLAGS='-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security'
CFLAGS='-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security'
CXXFLAGS='-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security'
FFLAGS='-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -I/usr/lib64/gfortran/modules'
FCFLAGS='-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -I/usr/lib64/gfortran/modules'
LDFLAGS='-Wl,--gc-sections -Wl,--as-needed -Wl,--build-id=sha1 -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto -fuse-linker-plugin'
RUSTFLAGS='-C codegen-units=1 -C debuginfo=2 -C opt-level=2 -C link-arg=-Wl,--as-needed -C link-arg=-Wl,--build-id=sha1 -C link-arg=-Wl,-z,now -C link-arg=-Wl,-z,pack-relative-relocs -C link-arg=-Wl,-z,relro -C link-arg=-flto=auto --cap-lints=warn'
VALAFLAGS=-g
CC=/usr/bin/gcc
CXX=/usr/bin/g++
FC=/usr/bin/gfortran
AR=/usr/bin/gcc-ar
NM=/usr/bin/gcc-nm
RANLIB=/usr/bin/gcc-ranlib
export ASMFLAGS CFLAGS CXXFLAGS FFLAGS FCFLAGS LDFLAGS VALAFLAGS CC CXX FC AR NM RANLIB RUSTFLAGS VALAFLAGS
PBR_VERSION=2.0.11
PDM_BUILD_SCM_VERSION=2.0.11
SETUPTOOLS_SCM_PRETEND_VERSION=2.0.11
python3 -sBm build -w --no-isolation

Gives

* Getting build dependencies for wheel...
warning: no previously-included files matching '__pycache__' found anywhere in distribution
warning: no previously-included files matching '*.py[co]' found anywhere in distribution
warning: no files found matching 'LICENSE.txt'
* Building wheel...
warning: no previously-included files matching '__pycache__' found anywhere in distribution
warning: no previously-included files matching '*.py[co]' found anywhere in distribution
warning: no files found matching 'LICENSE.txt'
/home/michael/.virtualenvs/gevent/lib/python3.11/site-packages/setuptools/command/build_py.py:207: _Warning: Package 'geventhttpclient.tests' is absent from the `packages` configuration.
!!

        ********************************************************************************
        ############################
        # Package would be ignored #
        ############################
        Python recognizes 'geventhttpclient.tests' as an importable package[^1],
        but it is absent from setuptools' `packages` configuration.

        This leads to an ambiguous overall configuration. If you want to distribute this
        package, please make sure that 'geventhttpclient.tests' is explicitly added
        to the `packages` configuration field.

        Alternatively, you can also rely on setuptools' discovery methods
        (for example by using `find_namespace_packages(...)`/`find_namespace:`
        instead of `find_packages(...)`/`find:`).

        You can read more about "package discovery" on setuptools documentation page:

        - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

        If you don't want 'geventhttpclient.tests' to be distributed and are
        already explicitly excluding 'geventhttpclient.tests' via
        `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
        you can try to use `exclude_package_data`, or `include-package-data=False` in
        combination with a more fine grained `package-data` configuration.

        You can read more about "package data files" on setuptools documentation page:

        - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


        [^1]: For Python, any directory (with suitable naming) can be imported,
              even if it does not contain any `.py` files.
              On the other hand, currently there is no concept of package data
              directory, all directories are treated like packages.
        ********************************************************************************

!!
  check.warn(importable)
ext/_parser.c: In function ‘on_message_complete’:
ext/_parser.c:48:32: warning: passing argument 1 of ‘PyObject_HasAttrString’ from incompatible pointer type [-Wincompatible-pointer-types]
   48 |     if (PyObject_HasAttrString(self, "_on_message_complete")) {
      |                                ^~~~
      |                                |
      |                                PyHTTPResponseParser *
In file included from /usr/include/python3.11/Python.h:44,
                 from ext/_parser.c:2:
/usr/include/python3.11/object.h:291:40: note: expected ‘PyObject *’ {aka ‘struct _object *’} but argument is of type ‘PyHTTPResponseParser *’
  291 | PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, const char *);
      |                                        ^~~~~~~~~~
ext/_parser.c:49:53: warning: passing argument 1 of ‘PyObject_GetAttrString’ from incompatible pointer type [-Wincompatible-pointer-types]
   49 |         PyObject* callable = PyObject_GetAttrString(self, "_on_message_complete");
      |                                                     ^~~~
      |                                                     |
      |                                                     PyHTTPResponseParser *
/usr/include/python3.11/object.h:289:47: note: expected ‘PyObject *’ {aka ‘struct _object *’} but argument is of type ‘PyHTTPResponseParser *’
  289 | PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, const char *);
      |                                               ^~~~~~~~~~
Successfully built geventhttpclient-2.2.1-cp311-cp311-linux_x86_64.whl

I'm closing this, as it compiles as intended, if not run in this special environment. Otherwise, PRs for running in a hardened environment welcome.

@ml31415 ml31415 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 17, 2024
@kloczek
Copy link
Author

kloczek commented Apr 17, 2024

I'm closing this, as it compiles as intended, if not run in this special environment. Otherwise, PRs for running in a hardened environment welcome.

Again: in your output is clearly visible line

ext/_parser.c:49:53: warning: passing argument 1 of ‘PyObject_GetAttrString’ from incompatible pointer type [-Wincompatible-pointer-types]

If you are not using latest glibc snapshot which is used in my case that warning is not turned into compile time error.
You don't have that error because you are not using latest glibc.
Soon more distros will be using that version and you will see more reports like mine because all distros now are trying to build everything with all possible to enabled generated code protections.

Just please keep your code without at least those warnings (best without any warnings).

@ml31415
Copy link
Collaborator

ml31415 commented Apr 18, 2024

@kloczek a new version is just on the way to pypi. Please check, if this fixes this build issue.

@kloczek
Copy link
Author

kloczek commented Apr 18, 2024

ok one sec 😋

@kloczek
Copy link
Author

kloczek commented Apr 18, 2024

With 2.3.0 pytest cannot pas even scanning units

Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-geventhttpclient-2.3.0-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-geventhttpclient-2.3.0-2.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.10.14, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/tkloczko/rpmbuild/BUILD/geventhttpclient-2.3.0
configfile: pyproject.toml
collected 2 items / 11 errors

========================================================================================== ERRORS ===========================================================================================
___________________________________________________________________________ ERROR collecting tests/test_client.py ___________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/geventhttpclient-2.3.0/tests/test_client.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_client.py:8: in <module>
    from geventhttpclient import __version__
geventhttpclient/__init__.py:5: in <module>
    from geventhttpclient.api import delete, get, head, options, patch, post, put, request
geventhttpclient/api.py:11: in <module>
    import geventhttpclient.requests
geventhttpclient/requests.py:4: in <module>
    from geventhttpclient import useragent
geventhttpclient/useragent.py:15: in <module>
    from geventhttpclient.client import HTTPClient, HTTPClientPool
geventhttpclient/client.py:9: in <module>
    from geventhttpclient.response import HTTPConnectionClosed, HTTPSocketPoolResponse
geventhttpclient/response.py:5: in <module>
    from geventhttpclient._parser import HTTPParseError, HTTPResponseParser
E   ModuleNotFoundError: No module named 'geventhttpclient._parser'
__________________________________________________________________________ ERROR collecting tests/test_headers.py ___________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/geventhttpclient-2.3.0/tests/test_headers.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_headers.py:10: in <module>
    from geventhttpclient.response import HTTPResponse
geventhttpclient/__init__.py:5: in <module>
    from geventhttpclient.api import delete, get, head, options, patch, post, put, request
geventhttpclient/api.py:11: in <module>
    import geventhttpclient.requests
geventhttpclient/requests.py:4: in <module>
    from geventhttpclient import useragent
geventhttpclient/useragent.py:15: in <module>
    from geventhttpclient.client import HTTPClient, HTTPClientPool
geventhttpclient/client.py:9: in <module>
    from geventhttpclient.response import HTTPConnectionClosed, HTTPSocketPoolResponse
geventhttpclient/response.py:5: in <module>
    from geventhttpclient._parser import HTTPParseError, HTTPResponseParser
E   ModuleNotFoundError: No module named 'geventhttpclient._parser'
__________________________________________________________________________ ERROR collecting tests/test_httplib.py ___________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/geventhttpclient-2.3.0/tests/test_httplib.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_httplib.py:6: in <module>
    from geventhttpclient.httplib import HTTPConnection, patched
geventhttpclient/__init__.py:5: in <module>
    from geventhttpclient.api import delete, get, head, options, patch, post, put, request
geventhttpclient/api.py:11: in <module>
    import geventhttpclient.requests
geventhttpclient/requests.py:4: in <module>
    from geventhttpclient import useragent
geventhttpclient/useragent.py:15: in <module>
    from geventhttpclient.client import HTTPClient, HTTPClientPool
geventhttpclient/client.py:9: in <module>
    from geventhttpclient.response import HTTPConnectionClosed, HTTPSocketPoolResponse
geventhttpclient/response.py:5: in <module>
    from geventhttpclient._parser import HTTPParseError, HTTPResponseParser
E   ModuleNotFoundError: No module named 'geventhttpclient._parser'
__________________________________________________________________________ ERROR collecting tests/test_httplib2.py __________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/geventhttpclient-2.3.0/tests/test_httplib2.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_httplib2.py:4: in <module>
    import geventhttpclient.httplib
geventhttpclient/__init__.py:5: in <module>
    from geventhttpclient.api import delete, get, head, options, patch, post, put, request
geventhttpclient/api.py:11: in <module>
    import geventhttpclient.requests
geventhttpclient/requests.py:4: in <module>
    from geventhttpclient import useragent
geventhttpclient/useragent.py:15: in <module>
    from geventhttpclient.client import HTTPClient, HTTPClientPool
geventhttpclient/client.py:9: in <module>
    from geventhttpclient.response import HTTPConnectionClosed, HTTPSocketPoolResponse
geventhttpclient/response.py:5: in <module>
    from geventhttpclient._parser import HTTPParseError, HTTPResponseParser
E   ModuleNotFoundError: No module named 'geventhttpclient._parser'
_________________________________________________________________________ ERROR collecting tests/test_keep_alive.py _________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/geventhttpclient-2.3.0/tests/test_keep_alive.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_keep_alive.py:3: in <module>
    from geventhttpclient._parser import HTTPParseError
geventhttpclient/__init__.py:5: in <module>
    from geventhttpclient.api import delete, get, head, options, patch, post, put, request
geventhttpclient/api.py:11: in <module>
    import geventhttpclient.requests
geventhttpclient/requests.py:4: in <module>
    from geventhttpclient import useragent
geventhttpclient/useragent.py:15: in <module>
    from geventhttpclient.client import HTTPClient, HTTPClientPool
geventhttpclient/client.py:9: in <module>
    from geventhttpclient.response import HTTPConnectionClosed, HTTPSocketPoolResponse
geventhttpclient/response.py:5: in <module>
    from geventhttpclient._parser import HTTPParseError, HTTPResponseParser
E   ModuleNotFoundError: No module named 'geventhttpclient._parser'
______________________________________________________________________ ERROR collecting tests/test_network_failures.py ______________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/geventhttpclient-2.3.0/tests/test_network_failures.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_network_failures.py:7: in <module>
    from geventhttpclient.client import CRLF, HTTPClient
geventhttpclient/__init__.py:5: in <module>
    from geventhttpclient.api import delete, get, head, options, patch, post, put, request
geventhttpclient/api.py:11: in <module>
    import geventhttpclient.requests
geventhttpclient/requests.py:4: in <module>
    from geventhttpclient import useragent
geventhttpclient/useragent.py:15: in <module>
    from geventhttpclient.client import HTTPClient, HTTPClientPool
geventhttpclient/client.py:9: in <module>
    from geventhttpclient.response import HTTPConnectionClosed, HTTPSocketPoolResponse
geventhttpclient/response.py:5: in <module>
    from geventhttpclient._parser import HTTPParseError, HTTPResponseParser
E   ModuleNotFoundError: No module named 'geventhttpclient._parser'
___________________________________________________________________________ ERROR collecting tests/test_parser.py ___________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/geventhttpclient-2.3.0/tests/test_parser.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_parser.py:8: in <module>
    from geventhttpclient.response import HTTPResponse
geventhttpclient/__init__.py:5: in <module>
    from geventhttpclient.api import delete, get, head, options, patch, post, put, request
geventhttpclient/api.py:11: in <module>
    import geventhttpclient.requests
geventhttpclient/requests.py:4: in <module>
    from geventhttpclient import useragent
geventhttpclient/useragent.py:15: in <module>
    from geventhttpclient.client import HTTPClient, HTTPClientPool
geventhttpclient/client.py:9: in <module>
    from geventhttpclient.response import HTTPConnectionClosed, HTTPSocketPoolResponse
geventhttpclient/response.py:5: in <module>
    from geventhttpclient._parser import HTTPParseError, HTTPResponseParser
E   ModuleNotFoundError: No module named 'geventhttpclient._parser'
__________________________________________________________________________ ERROR collecting tests/test_requests.py __________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/geventhttpclient-2.3.0/tests/test_requests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_requests.py:4: in <module>
    from geventhttpclient.requests import Session
geventhttpclient/__init__.py:5: in <module>
    from geventhttpclient.api import delete, get, head, options, patch, post, put, request
geventhttpclient/api.py:11: in <module>
    import geventhttpclient.requests
geventhttpclient/requests.py:4: in <module>
    from geventhttpclient import useragent
geventhttpclient/useragent.py:15: in <module>
    from geventhttpclient.client import HTTPClient, HTTPClientPool
geventhttpclient/client.py:9: in <module>
    from geventhttpclient.response import HTTPConnectionClosed, HTTPSocketPoolResponse
geventhttpclient/response.py:5: in <module>
    from geventhttpclient._parser import HTTPParseError, HTTPResponseParser
E   ModuleNotFoundError: No module named 'geventhttpclient._parser'
____________________________________________________________________________ ERROR collecting tests/test_ssl.py _____________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/geventhttpclient-2.3.0/tests/test_ssl.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_ssl.py:16: in <module>
    from geventhttpclient import HTTPClient
geventhttpclient/__init__.py:5: in <module>
    from geventhttpclient.api import delete, get, head, options, patch, post, put, request
geventhttpclient/api.py:11: in <module>
    import geventhttpclient.requests
geventhttpclient/requests.py:4: in <module>
    from geventhttpclient import useragent
geventhttpclient/useragent.py:15: in <module>
    from geventhttpclient.client import HTTPClient, HTTPClientPool
geventhttpclient/client.py:9: in <module>
    from geventhttpclient.response import HTTPConnectionClosed, HTTPSocketPoolResponse
geventhttpclient/response.py:5: in <module>
    from geventhttpclient._parser import HTTPParseError, HTTPResponseParser
E   ModuleNotFoundError: No module named 'geventhttpclient._parser'
____________________________________________________________________________ ERROR collecting tests/test_url.py _____________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/geventhttpclient-2.3.0/tests/test_url.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_url.py:3: in <module>
    from geventhttpclient.url import URL
geventhttpclient/__init__.py:5: in <module>
    from geventhttpclient.api import delete, get, head, options, patch, post, put, request
geventhttpclient/api.py:11: in <module>
    import geventhttpclient.requests
geventhttpclient/requests.py:4: in <module>
    from geventhttpclient import useragent
geventhttpclient/useragent.py:15: in <module>
    from geventhttpclient.client import HTTPClient, HTTPClientPool
geventhttpclient/client.py:9: in <module>
    from geventhttpclient.response import HTTPConnectionClosed, HTTPSocketPoolResponse
geventhttpclient/response.py:5: in <module>
    from geventhttpclient._parser import HTTPParseError, HTTPResponseParser
E   ModuleNotFoundError: No module named 'geventhttpclient._parser'
_________________________________________________________________________ ERROR collecting tests/test_useragent.py __________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/geventhttpclient-2.3.0/tests/test_useragent.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_useragent.py:6: in <module>
    from geventhttpclient.useragent import BadStatusCode, UserAgent
geventhttpclient/__init__.py:5: in <module>
    from geventhttpclient.api import delete, get, head, options, patch, post, put, request
geventhttpclient/api.py:11: in <module>
    import geventhttpclient.requests
geventhttpclient/requests.py:4: in <module>
    from geventhttpclient import useragent
geventhttpclient/useragent.py:15: in <module>
    from geventhttpclient.client import HTTPClient, HTTPClientPool
geventhttpclient/client.py:9: in <module>
    from geventhttpclient.response import HTTPConnectionClosed, HTTPSocketPoolResponse
geventhttpclient/response.py:5: in <module>
    from geventhttpclient._parser import HTTPParseError, HTTPResponseParser
E   ModuleNotFoundError: No module named 'geventhttpclient._parser'
================================================================================== short test summary info ==================================================================================
ERROR tests/test_client.py
ERROR tests/test_headers.py
ERROR tests/test_httplib.py
ERROR tests/test_httplib2.py
ERROR tests/test_keep_alive.py
ERROR tests/test_network_failures.py
ERROR tests/test_parser.py
ERROR tests/test_requests.py
ERROR tests/test_ssl.py
ERROR tests/test_url.py
ERROR tests/test_useragent.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 11 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
==================================================================================== 11 errors in 0.92s =====================================================================================

And in </install/prefix> all seem is OK

[tkloczko@pers-jacek SPECS]$ ls /home/tkloczko/rpmbuild/BUILDROOT/python-geventhttpclient-2.3.0-2.fc37.x86_64/usr/lib64/python3.10/site-packages/geventhttpclient/ -l
total 132
-rw-r--r-- 1 tkloczko tkloczko   359 Apr 18 13:48 __init__.py
drwxr-xr-x 1 tkloczko tkloczko  1156 Apr 18 13:48 __pycache__
-rwxr-xr-x 1 tkloczko tkloczko 16720 Apr 18 13:48 _parser.cpython-310-x86_64-linux-gnu.so
-rw-r--r-- 1 tkloczko tkloczko  6340 Apr 18 13:48 api.py
-rw-r--r-- 1 tkloczko tkloczko 10669 Apr 18 13:48 client.py
-rw-r--r-- 1 tkloczko tkloczko  7984 Apr 18 13:48 connectionpool.py
-rw-r--r-- 1 tkloczko tkloczko 10184 Apr 18 13:48 header.py
-rw-r--r-- 1 tkloczko tkloczko  7136 Apr 18 13:48 httplib.py
-rw-r--r-- 1 tkloczko tkloczko  1751 Apr 18 13:48 httplib2.py
-rw-r--r-- 1 tkloczko tkloczko  9159 Apr 18 13:48 requests.py
-rw-r--r-- 1 tkloczko tkloczko  8414 Apr 18 13:48 response.py
-rw-r--r-- 1 tkloczko tkloczko  4846 Apr 18 13:48 url.py
-rw-r--r-- 1 tkloczko tkloczko 21629 Apr 18 13:48 useragent.py

@ml31415
Copy link
Collaborator

ml31415 commented Apr 18, 2024

pip install -e., then the tests should run.

@kloczek
Copy link
Author

kloczek commented Apr 18, 2024

That would be a little unusual step because all module metadata are present in </install/prefix>

[tkloczko@pers-jacek SPECS]$ ls /home/tkloczko/rpmbuild/BUILDROOT/python-geventhttpclient-2.3.0-2.fc37.x86_64/usr/lib64/python3.10/site-packages/geventhttpclient-2.3.0.dist-info/ -l
total 28
-rw-r--r-- 1 tkloczko tkloczko 1131 Apr 18 13:48 LICENSE-MIT
-rw-r--r-- 1 tkloczko tkloczko 9742 Apr 18 13:48 METADATA
-rw-r--r-- 1 tkloczko tkloczko 1479 Apr 18 13:48 RECORD
-rw-r--r-- 1 tkloczko tkloczko  105 Apr 18 13:48 WHEEL
-rw-r--r-- 1 tkloczko tkloczko   17 Apr 18 13:48 top_level.txt

Humble Q: why that step is needed? 🤔

@ml31415
Copy link
Collaborator

ml31415 commented Apr 18, 2024

Humble answer: The new build tools don't allow --inplace builds anymore. So the .so files need to get in the right place in an extra step. Haven't figured out how to fix that more elegantly yet :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants