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

[Dexter] Remove outdated imp dependency #111833

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

SLTozer
Copy link
Contributor

@SLTozer SLTozer commented Oct 10, 2024

Fixes: #111815

This patch replaces usage of the python imp library, which is deprecated since python3.4 and removed in python3.12, with the importlib library. As part of this update the repeated find_module+load_module pattern is moved into a utility function, since the importlib equivalent is much more verbose.

Fixes: llvm#111815

This patch replaces usage of the python `imp` library, which is deprecated
since python3.4 and removed in python3.12, with the `importlib` library. As
part of this update the repeated find_module+load_module pattern is moved
into a utility function, since the importlib equivalent is much more
verbose.
@SLTozer SLTozer self-assigned this Oct 10, 2024
Copy link
Member

@jmorse jmorse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SLTozer SLTozer merged commit 6779376 into llvm:main Oct 10, 2024
6 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 10, 2024

LLVM Buildbot has detected a new failure on builder cross-project-tests-sie-ubuntu-dwarf5 running on doug-worker-1b while building cross-project-tests at step 6 "test-build-unified-tree-check-cross-project".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/163/builds/6959

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-cross-project) failure: test (failure)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 10, 2024

LLVM Buildbot has detected a new failure on builder cross-project-tests-sie-ubuntu running on doug-worker-1a while building cross-project-tests at step 6 "test-build-unified-tree-check-cross-project".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/181/builds/6664

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-cross-project) failure: test (failure)
******************** TEST 'cross-project-tests :: debuginfo-tests/dexter/feature_tests/subtools/list-debuggers/list-debuggers.test' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 4: "/usr/bin/python3.8" "/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter/dexter.py" list-debuggers | /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/bin/FileCheck /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter/feature_tests/subtools/list-debuggers/list-debuggers.test
+ /usr/bin/python3.8 /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter/dexter.py list-debuggers
+ /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/bin/FileCheck /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter/feature_tests/subtools/list-debuggers/list-debuggers.test


****************************************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 10, 2024

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-sie-win running on sie-win-worker while building cross-project-tests at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/46/builds/6256

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'cross-project-tests :: debuginfo-tests/dexter/feature_tests/commands/penalty/float_range_zero_nonmatch.cpp' FAILED ********************
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 7
clang-cl /Zi /Od Z:\b\llvm-clang-x86_64-sie-win\llvm-project\cross-project-tests\debuginfo-tests\dexter\feature_tests\commands\penalty\float_range_zero_nonmatch.cpp -o Z:\b\llvm-clang-x86_64-sie-win\build\projects\cross-project-tests\debuginfo-tests\dexter\feature_tests\commands\penalty\Output\float_range_zero_nonmatch.cpp.tmp
# executed command: clang-cl /Zi /Od 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\cross-project-tests\debuginfo-tests\dexter\feature_tests\commands\penalty\float_range_zero_nonmatch.cpp' -o 'Z:\b\llvm-clang-x86_64-sie-win\build\projects\cross-project-tests\debuginfo-tests\dexter\feature_tests\commands\penalty\Output\float_range_zero_nonmatch.cpp.tmp'
# RUN: at line 8
not "C:\Program Files\Python310\python.exe" "Z:/b/llvm-clang-x86_64-sie-win/llvm-project/cross-project-tests\debuginfo-tests\dexter\dexter.py" test --fail-lt 1.0 -w --debugger dbgeng --binary Z:\b\llvm-clang-x86_64-sie-win\build\projects\cross-project-tests\debuginfo-tests\dexter\feature_tests\commands\penalty\Output\float_range_zero_nonmatch.cpp.tmp -- Z:\b\llvm-clang-x86_64-sie-win\llvm-project\cross-project-tests\debuginfo-tests\dexter\feature_tests\commands\penalty\float_range_zero_nonmatch.cpp | z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe Z:\b\llvm-clang-x86_64-sie-win\llvm-project\cross-project-tests\debuginfo-tests\dexter\feature_tests\commands\penalty\float_range_zero_nonmatch.cpp
# executed command: not 'C:\Program Files\Python310\python.exe' 'Z:/b/llvm-clang-x86_64-sie-win/llvm-project/cross-project-tests\debuginfo-tests\dexter\dexter.py' test --fail-lt 1.0 -w --debugger dbgeng --binary 'Z:\b\llvm-clang-x86_64-sie-win\build\projects\cross-project-tests\debuginfo-tests\dexter\feature_tests\commands\penalty\Output\float_range_zero_nonmatch.cpp.tmp' -- 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\cross-project-tests\debuginfo-tests\dexter\feature_tests\commands\penalty\float_range_zero_nonmatch.cpp'
# .---command stderr------------
# | 
# | 
# | ****************************************
# | ****************************************
# | ****************************************
# | **                                    **
# | ** This is a bug in DExTer.           **
# | **                                    **
# | **                  Please report it. **
# | **                                    **
# | ****************************************
# | ****************************************
# | ****************************************
# | 
# | system:
# | win32
# | 
# | version:
# | DExTer 1.0.0 [main 6779376ee917279b16e256839d236cfdf8fd9ab9] (https://github.com/llvm/llvm-project.git)
# |   using Python 3.10.5 (tags/v3.10.5:f377153, Jun  6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)]
# | 
# | args:
# | ['c:\\program files\\python310\\python.exe', 'Z:/b/llvm-clang-x86_64-sie-win/llvm-project/cross-project-tests\\debuginfo-tests\\dexter\\dexter.py', 'test', '--fail-lt', '1.0', '-w', '--debugger', 'dbgeng', '--binary', 'Z:\\b\\llvm-clang-x86_64-sie-win\\build\\projects\\cross-project-tests\\debuginfo-tests\\dexter\\feature_tests\\commands\\penalty\\Output\\float_range_zero_nonmatch.cpp.tmp', '--', 'Z:\\b\\llvm-clang-x86_64-sie-win\\llvm-project\\cross-project-tests\\debuginfo-tests\\dexter\\feature_tests\\commands\\penalty\\float_range_zero_nonmatch.cpp']
# | 
# | Traceback (most recent call last):
# |   File "Z:\b\llvm-clang-x86_64-sie-win\llvm-project\cross-project-tests\debuginfo-tests\dexter\dexter.py", line 20, in <module>
# |     return_code = main()
# |   File "Z:\b\llvm-clang-x86_64-sie-win\llvm-project\cross-project-tests\debuginfo-tests\dexter\dex\tools\Main.py", line 203, in main
# |     module = _import_tool_module(tool_name)
# |   File "Z:\b\llvm-clang-x86_64-sie-win\llvm-project\cross-project-tests\debuginfo-tests\dexter\dex\tools\Main.py", line 138, in _import_tool_module
# |     return load_module(tool_name, tools_directory)
# |   File "Z:\b\llvm-clang-x86_64-sie-win\llvm-project\cross-project-tests\debuginfo-tests\dexter\dex\utils\Imports.py", line 7, in load_module
# |     spec = importlib.util.spec_from_file_location(
# | AttributeError: module 'importlib' has no attribute 'util'
# `-----------------------------
# executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe' 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\cross-project-tests\debuginfo-tests\dexter\feature_tests\commands\penalty\float_range_zero_nonmatch.cpp'
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
...

@SLTozer
Copy link
Contributor Author

SLTozer commented Oct 10, 2024

Looks like the slightly non-standard importing of ComInterface doesn't quite play nicely with this change; should hopefully be a simple modification to fix.

SLTozer added a commit to SLTozer/llvm-project that referenced this pull request Oct 10, 2024
Fixes issue added by: llvm#111833

Following the previous commit that changed how Dexter imports modules, the
ComInterface module import became broken. This is because it had a different
directory structure to other modules, where we want to import single file
rather than a dir containing a __init__.py. For this case, an optional extra
arg has been added to load_module allowing a filename to be specified,
letting us import ComInterface.py directly and fixing the issue.
SLTozer added a commit that referenced this pull request Oct 10, 2024
Fixes issue added by: #111833

Following the previous commit that changed how Dexter imports modules,
the ComInterface module import became broken. This is because it had a
different directory structure to other modules, where we want to import
single file rather than a dir containing a __init__.py. For this case,
an optional extra arg has been added to load_module allowing a filename
to be specified, letting us import ComInterface.py directly and fixing
the issue.
DanielCChen pushed a commit to DanielCChen/llvm-project that referenced this pull request Oct 16, 2024
Fixes: llvm#111815

This patch replaces usage of the python `imp` library, which is
deprecated since python3.4 and removed in python3.12, with the
`importlib` library. As part of this update the repeated
find_module+load_module pattern is moved into a utility function, since
the importlib equivalent is much more verbose.
DanielCChen pushed a commit to DanielCChen/llvm-project that referenced this pull request Oct 16, 2024
…1850)

Fixes issue added by: llvm#111833

Following the previous commit that changed how Dexter imports modules,
the ComInterface module import became broken. This is because it had a
different directory structure to other modules, where we want to import
single file rather than a dir containing a __init__.py. For this case,
an optional extra arg has been added to load_module allowing a filename
to be specified, letting us import ComInterface.py directly and fixing
the issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dexter relies on the imp package that was removed from Python 3.12
3 participants