Skip to content

enh: replace unix2dos with sed #3210

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

Merged

Conversation

Alexandr-Solovev
Copy link
Contributor

@Alexandr-Solovev Alexandr-Solovev commented May 13, 2025

Summary

Replaced usage of unix2dos with sed to remove an external dependency.

Details

The original script relied on dos2unix, which is not always available in all environments by default. This change replaces it with a sed command that achieves the same result (removing carriage return characters), thus improving portability and reducing setup requirements.

Changes

  • Replaced unix2dos
  • Removed the dependency on the unix2dos utility

Motivation

Minimize external dependencies and ensure better cross-platform compatibility.


PR completeness and readability

  • I have reviewed my changes thoroughly before submitting this pull request.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes or created a separate PR with update and provided its number in the description, if necessary.
  • Git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details).
  • I have added a respective label(s) to PR if I have a permission for that.
  • I have resolved any merge conflicts that might occur with the base branch.

Testing

  • I have run it locally and tested the changes extensively.
  • All CI jobs are green or I have provided justification why they aren't.
  • I have extended testing suite if new functionality was introduced in this PR.

Performance

  • I have measured performance for affected algorithms using scikit-learn_bench and provided at least summary table with measured data, if performance change is expected.
  • I have provided justification why performance has changed or why changes are not expected.
  • I have provided justification why quality metrics have changed or why changes are not expected.
  • I have extended benchmarking suite and provided corresponding scikit-learn_bench PR if new measurable functionality was introduced in this PR.

@Alexandr-Solovev
Copy link
Contributor Author

/intelci: run

@Alexandr-Solovev Alexandr-Solovev marked this pull request as ready for review May 14, 2025 15:39
@Alexandr-Solovev
Copy link
Contributor Author

/intelci: run

@Alexandr-Solovev Alexandr-Solovev changed the title enh: check sed enh: replace unix2dos with sed May 15, 2025
@@ -1040,7 +1040,7 @@ $4: $3/$2
$3/$2: $(DIR)/$1 | $3/. ; $(value cpy)
$(if $(filter %.sh %.bat dal,$2),sed -i -e 's/__DAL_MAJOR_BINARY__/$(MAJORBINARY)/' $3/$2)
$(if $(filter %.sh %.bat dal,$2),sed -i -e 's/__DAL_MINOR_BINARY__/$(MINORBINARY)/' $3/$2)
$(if $(OS_is_win),unix2dos $3/$2)
$(if $(OS_is_win),sed -i -n -z -e 's/\r*\n/\r\n/g;p' $3/$2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to worry about it has to work on other systems like macos(some of the sed arg is not supported I think) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

OneDAL currently does not support macOS so no need to worry about it.

Sed is part of most coreutils out there (like GNUs) and is required by POSIX, so even if it doesn't come out of the box on macOS (although I'm pretty sure it does), it can be installed easily afterwards.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I think I misread it: yes, some arguments might indeed be GNU-specific extensions. This needs to be documented.

@Alexandr-Solovev Could you please add a note that this requires the GNU variant of sed if that's the case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its implemented only for if $(OS_is_win), so, I think its not necessary to think about other system support

Copy link
Contributor

Choose a reason for hiding this comment

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

@Alexandr-Solovev I think it's still theoretically possible to install non-GNU sed variants on windows.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think msys2 uses GNU sed.

@david-cortes-intel
Copy link
Contributor

@Alexandr-Solovev Could you please remove the dos2unix requirement and instructions from the INSTALL.md file?

@Alexandr-Solovev
Copy link
Contributor Author

/intelci: run

Copy link
Contributor

@Vika-F Vika-F left a comment

Choose a reason for hiding this comment

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

The scripts contain Windows-style line endings after the change.

@Alexandr-Solovev Alexandr-Solovev merged commit e7b7978 into uxlfoundation:main May 15, 2025
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants