KenKundert / emborg

Interactive command line interface to Borg Backup
GNU General Public License v3.0
94 stars 8 forks source link

Unable to run tests in 1.29 #56

Closed adhawkins closed 2 years ago

adhawkins commented 2 years ago

Trying to package up 1.29 for alpine, and running in to the following error when running the tests:

____________________ ERROR collecting tests/test_emborg.py _____________________
ImportError while importing test module '/home/builder/aports/community/emborg/src/emborg-1.29/tests/test_emborg.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_emborg.py:15: in <module>
    from shlib import Run, cd, cp, cwd, ln, lsf, mkdir, rm, set_prefs, touch
/usr/lib/python3.10/site-packages/shlib/__init__.py:5: in <module>
    from .shlib import (
E   ImportError: cannot import name 'brace_expand' from 'shlib.shlib' (/usr/lib/python3.10/site-packages/shlib/shlib.py)
=========================== short test summary info ============================

I can successfully build and test 1.28, so am pretty sure that my build is Ok. There don't seem to be any new dependencies in emborg, and shlib doesn't seem to have changed since the release that's being installed in alpine.

Any suggestions?

KenKundert commented 2 years ago

emborg does not actually use brace_expand(), which requires the braceexpand package, so I have modified shlib to defer the importing of braceexpand to the point where it is actually needed. That would allow emborg to run even if braceexpand is not installed. However, if properly installed, shlib should bring in braceexpand as a dependency. Not sure why that is not happening for you. As a work-around, you can simply install braceexpand or re-install shlib. If you need me to, I can release an updated shlib that makes braceexpand truly optional, but I don't think that will help you as I don't think you are currently downloading an up-to-date version of shlib.

adhawkins commented 2 years ago

It's possible I don't have the dependencies set correctly for the shlib package on Alpine (I maintain that too). Will double check. Thanks for the response.

adhawkins commented 2 years ago

I've had a look at this, and the shlibs package does depend on braceexpand, and the braceexpand package is being installed during the build. However, I still get the error about shlibs not being able to find braceexpand.

I don't think it's worth changing shlibs to work around this, it's almost certainly something I'm doing wrong. Just can't understand why with an identical build definition (with the exception of using a 1.29 tarball instead of a 1.28) I get this error.

Appreciate any suggestions.

adhawkins commented 2 years ago

Ok, I've just tried building it with a different build system (the one Alpine itself actually uses to validate each package) and it builds successfully. It's obviously some strange issue with the other build system (also an official Alpine one). I think you can ignore this for now, I'll bounce it towards the Alpine guys and see if that gets any resolution.

KenKundert commented 2 years ago

Is there a chance that shlib is being installed into a different version of Python. This kind of thing just happened to me when I switched from Python 3.9 to Python 3.10.

adhawkins commented 2 years ago

That shouldn't be happening. The build process uses a docker container, installs all the pre-requisite packages, and then builds the package concerned.

I'm as sure as I can be that this isn't an issue with emborg itself. Will update if and when I get a resolution.

adhawkins commented 2 years ago

Ok, all seems to be sorted now. I had some local versions of my packages on my build machine, and it seemed that these were causing the issue. I've now deleted them and the build completes successfully. 1,29 has now been merged into Alpine Edge.

KenKundert commented 2 years ago

Thank Andy. I really appreciate that you maintain Emborg for Alpine.