Skip to content

Make the enable-ansi-support dependency Windows-specific#89

Merged
dominikwilkowski merged 1 commit into
dominikwilkowski:releasedfrom
musicinmybrain:conditional-enable-ansi-support
Oct 16, 2025
Merged

Make the enable-ansi-support dependency Windows-specific#89
dominikwilkowski merged 1 commit into
dominikwilkowski:releasedfrom
musicinmybrain:conditional-enable-ansi-support

Conversation

@musicinmybrain

Copy link
Copy Markdown
Contributor

Avoid unnecessarily compiling enable-ansi-support on non-Windows platforms.

@dominikwilkowski

Copy link
Copy Markdown
Owner

Interesting. I would have thought since the crate itself is fenced for just windows platforms this wasn't necessary?
https://github.com/sunshowers-code/enable-ansi-support/blob/main/src/lib.rs#L55
Are you seeing a difference with your code changes?

@musicinmybrain

Copy link
Copy Markdown
Contributor Author

Interesting. I would have thought since the crate itself is fenced for just windows platforms this wasn't necessary? https://github.com/sunshowers-code/enable-ansi-support/blob/main/src/lib.rs#L55 Are you seeing a difference with your code changes?

For an “online” cargo build, there isn’t much difference. As you noted, the body of the enable_ansi_support() function is trivial and has no effect on non-Windows platforms, and it’s likely to be optimized out completely in release builds. The enable_ansi_support crate still has to be downloaded and compiled unnecessarily, but this is only a small build-time cost.

What motivated me to suggest this change is the existence of a rust-cfonts package in Fedora, where we package Rust libraries individually in their own source packages and build applications using those packaged libraries. (I think Debian does the same thing.) Without this PR, we would by default need to add a rust-enable_ansi_support package to Fedora in order to satisfy the dependency, which would be wasted effort given that the crate does nothing on Linux. Instead of doing that, we have been carrying a downstream patch to remove enable_ansi_support and the code that used it, https://src.fedoraproject.org/rpms/rust-cfonts/blob/2330dbb9c9225d02c955e6e3702ff82311a40964/f/remove-enable-ansi-support.patch. This was working fine, but I realized that by conditionalizing the dependency as proposed in this PR, I could offer this upstream, and if the PR was merged, no patch would be required at all for future releases. This would make things just a little bit easier on our end, and support our explicit desire to stay as close to upstream as possible in our packages.

In the end, it’s your choice. If you don’t like the conditionalization, we can continue to carry a patch downstream with no great hardship.

@dominikwilkowski

Copy link
Copy Markdown
Owner

Ohhh nice. That makes it clear, thank you. Will merge this now. I don't think you need me to release it anytime soon hey.

@dominikwilkowski dominikwilkowski merged commit 1fd8919 into dominikwilkowski:released Oct 16, 2025
26 checks passed
@musicinmybrain

Copy link
Copy Markdown
Contributor Author

Ohhh nice. That makes it clear, thank you. Will merge this now. I don't think you need me to release it anytime soon hey.

Correct, I’ll be perfectly happy for this to wind up in the next release whenever it naturally happens. Thanks for taking the time to ask questions and consider this!

@dominikwilkowski

Copy link
Copy Markdown
Owner

And thank you for contributing and caring. :)

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.

2 participants