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

custom targets: Don't replace \\ with / #3400

Closed

Conversation

nirbheek
Copy link
Member

This is no longer required since we always use / as the path separator for file arguments on Windows now. The only effect this now has is to mangle the string args people pass to custom targets.

Closes #1564

I verified that gstreamer builds fine even with this removed now. Also modified an existing test for this.

@nirbheek nirbheek added this to the meson-next milestone Apr 13, 2018
@nirbheek nirbheek requested a review from sarum9in April 13, 2018 09:28
# it's fine to always use that for arguments.
# See: https://github.com/mesonbuild/meson/issues/1564
if '\\' in sys.argv[1]:
raise AssertionError('Found \\ in {!r}'.format(sys.argv[1]))
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Found \\ in source argument {!r}

raise AssertionError('Found \\ in {!r}'.format(sys.argv[1]))

if '\\' in sys.argv[2]:
raise AssertionError('Found \\ in {!r}'.format(sys.argv[2]))
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Found \\ in destination argument {!r}

Might save some time debugging later.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense, will change, thanks. Ditto for the other.

@@ -3,4 +3,15 @@
import sys
import shutil

# If either of these use `\` as the path separator, it will cause problems with
Copy link
Contributor

Choose a reason for hiding this comment

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

I would consider adding a TODO comment here saying something like
It is okay to have \ as separator for non-mingw/msys Windows environment, however this test is more strict for simplicity. In that case if later for whatever reason we decide to change it we will have less doubt.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not okay for those either. People do use msys tools while building with msvc, so we cannot change it anywhere.

Copy link
Member Author

Choose a reason for hiding this comment

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

Eventually, if people start reporting bugs about tools that require \ path separators, we will have to think of some way to fix this. It's a hard problem.

output : 'outfile.txt',
build_by_default : true,
command : [copy, '@INPUT@', '@OUTPUT@'])
subdir('sub1')
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is a test requirement to have testfile inside subdir then add a comment explaining why. Otherwise someone will rearrange it later and this will be forgotten. Alternatively (better) consider asserting that there is at least one / in path in copyfile.py.

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted the test to be in a subdir so that there's at least one path separator in @OUTPUT@. Will add a comment.

This is no longer required since we always use `/` as the path
separator for file arguments on Windows now. The only effect this
now has is to mangle the string args people pass to custom targets.

Closes #1564
@nirbheek nirbheek force-pushed the nirbheek/remove-custom-target-backslashes-hack branch from df73a9d to ce9b13a Compare April 13, 2018 12:00
@jpakkane
Copy link
Member

Test failure seems relevant.

@nirbheek
Copy link
Member Author

Hum, turns out we translate \\ to / in other places in the Ninja backend. See commit be61140 for example. That explains why removing that snippet works on the Ninja backend.

So this requires more research, otherwise we're bound to break something.

@nirbheek
Copy link
Member Author

Not planning to work on this anytime soon, and not much code in this branch either.

@nirbheek nirbheek closed this Jul 12, 2020
@nirbheek nirbheek deleted the nirbheek/remove-custom-target-backslashes-hack branch July 12, 2020 09:02
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.

custom_target replaces back-slashes with slashes in the command arguments
3 participants