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

Remove sys.exit calls from convert.py #5451

Merged
merged 4 commits into from
Aug 12, 2024

Conversation

beeankha
Copy link
Member

@beeankha beeankha commented Aug 9, 2024

Description

Replacing sys.exit calls in conda_build/convert.py with the new CondaBuildUserError exception for better error handling + updating corresponding unit tests.

The changes in this PR are separated out from work previously done by @kenodegard in #5255
Xref #4209

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@beeankha beeankha requested a review from a team as a code owner August 9, 2024 14:32
@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Aug 9, 2024
@beeankha
Copy link
Member Author

beeankha commented Aug 9, 2024

The sys.exit call in this code block seems to make sense to leave as-is, but I can replace this one as well if everything should be updated to the CondaBuildUserError exception.

    if show_imports:
        imports = retrieve_c_extensions(file_path)
        if len(imports) == 0:
            print("No imports found.")
        else:
            for c_extension in imports:
                print(c_extension)
        sys.exit()

Copy link

codspeed-hq bot commented Aug 9, 2024

CodSpeed Performance Report

Merging #5451 will not alter performance

Comparing beeankha:remove-sys.exit-convert (cd9751d) with main (0a9a8a7)

Summary

✅ 3 untouched benchmarks

@kenodegard
Copy link
Contributor

@beeankha given where conda_convert is called I actually think it should just be a return instead, otherwise calling conda_convert(show_imports=True) in the Python REPL will also exit the REPL

@beeankha beeankha merged commit 7816bc8 into conda:main Aug 12, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed [bot] added once the contributor has signed the CLA
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants