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

Build without yajl 1.x #55

Closed
TinfoilSubmarine opened this issue Jul 1, 2021 · 6 comments
Closed

Build without yajl 1.x #55

TinfoilSubmarine opened this issue Jul 1, 2021 · 6 comments
Labels

Comments

@TinfoilSubmarine
Copy link

Is your feature request related to a problem? Please describe.
I'm working on packaging this project for Void Linux, which doesn't have YAJL 1.x in it's repos. I want to skip/remove this back end, but the only way I've found to do this is to manually remove ijdon/backends/yajl.py and patch out the line that generates tests for the yajl backend.

Describe the solution you'd like
Some sort of build flag (not familiar with Python mofule ecosystem) would be nice, or a way to detect if yajl 1.x is available and not include based on that.

The patch works for now if not.

@rtobar
Copy link

rtobar commented Jul 2, 2021

@AluminumTank when building the package, the lack of yajl 1.X should be irrelevant: if it's not there, there shouldn't be a problem with building and/or installing the package, and/or running the tests. The ijson/backens/yajl.py backend only looks for yajl 1 at runtime.

Are you running into a particular issue, and if so can you provide the details? Otherwise the only advantage of trying to remove the yajl backend at build time is that you'll save a few bytes on installation. I'm not inclined to support such thing; moreover at some point the yajl backend will be removed anyway.

@rtobar
Copy link

rtobar commented Jul 2, 2021

For reference, other distros distribute ijson without removing the yajl backend, even if they don't offer yajl 1.x either, you can have a look at https://repology.org/project/python:ijson/versions.

@TinfoilSubmarine
Copy link
Author

Awesome, thanks for the link. I went and looked at one of the other package's build script and realize that I was using python3 setup.py test rather than python3 -m pytest. Sorry to bother.

@TinfoilSubmarine
Copy link
Author

Also, to not be the "I solved it but didn't provide any details" guy, the error I was encountering was this:

======================================================================
ERROR: yajl (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: yajl
Traceback (most recent call last):
  File "/usr/lib/python3.9/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/ijson-3.1.4/ijson/backends/yajl.py", line 11, in <module>
    yajl = _yajl2_ctypes_common.get_yajl(1)
  File "/builddir/ijson-3.1.4/ijson/backends/_yajl2_ctypes_common.py", line 46, in get_yajl
    yajl = backends.find_yajl_ctypes(version)
  File "/builddir/ijson-3.1.4/ijson/backends/__init__.py", line 42, in find_yajl_ctypes
    require_version(get_yajl_version(yajl), required)
  File "/builddir/ijson-3.1.4/ijson/backends/__init__.py", line 16, in require_version
    raise YAJLImportError('YAJL version %s.x required, found %s.%s.%s' % (required, major, minor, micro))
ijson.backends.YAJLImportError: YAJL version 1.x required, found 2.1.0


----------------------------------------------------------------------
Ran 574 tests in 0.653s

FAILED (errors=1)
Test failed: <unittest.runner.TextTestResult run=574 errors=1 failures=0>
error: Test failed: <unittest.runner.TextTestResult run=574 errors=1 failures=0>
=> ERROR: python3-ijson-3.1.4_1: do_check: 'python3 setup.py ${make_check_target} ${make_check_args}' exited with 1
=> ERROR:   in do_check() at common/build-style/python3-module.sh:40

...which can be avoided by not using the old test entrypoint in setup.py and using pytest instead.

@rtobar
Copy link

rtobar commented Jul 2, 2021

I also run usually with python -munittest discover, which works as well ;)

@TinfoilSubmarine
Copy link
Author

I was working within the confines of one of the build-style scripts in void-packages which defaults to setup.py test if it can't find pytest with no other alternatives as far as I could tell. I figured conforming and not making my build-script a special snowflake was probably the best approach, but good to know there's other alternatives :)

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

No branches or pull requests

2 participants