Skip to content

Add quotes to preprocessor path on export #5199

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
merged 2 commits into from
Oct 5, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/export/gnuarmeclipse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def create_jinja_ctx(self):
opts['ld']['system_libraries'] = self.system_libraries
opts['ld']['script'] = join(id.capitalize(),
"linker-script-%s.ld" % id)
opts['cpp_cmd'] = " ".join(toolchain.preproc)
opts['cpp_cmd'] = "".join('"{}"'.format(toolchain.preproc[0])) + " " + " ".join(toolchain.preproc[1:])
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the join call to something that is not a list. Please limit lines to 80 characters.

This should be:

opts['cpp_cmd'] = '"{}" {}'.format(toolchain.preproc[0], 
                                   " ".join(toolchain.preproc[1:]))

Copy link
Contributor

@theotherjimmy theotherjimmy Sep 26, 2017

Choose a reason for hiding this comment

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

Upon further thinking, I think we should just use the filename. So:

opts['cpp_cmd'] = '{} {}'.format(basename(toolchain.preproc[0]), 
                                 " ".join(toolchain.preproc[1:]))

or

opts['cpp_cmd'] = " ".join(basename(toolchain.preproc[0]) +
                           toolchain.preproc[1:])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay i have removed the first join that was not okay. But sorry your changes are not correct.

  1. basename is the filename only so that did not solve the issue at all.
  2. you removed the '"{}"'.form... this is the important part of the fix. ...

So I have updated my PR I do not see any easier Solution. Also I do not understand why 80 chars only because have you looked on line 429 as an example the line has 111 chars :-)

cheers

Copy link
Contributor

Choose a reason for hiding this comment

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

basename is the filename only so that did not solve the issue at all.

That's the point. When we run this exporter on the website, you have no path information to use, so we have to make an assumption. I'm suggesting that we unify these behaviors.

you removed the '"{}"'.form... this is the important part of the fix. ...

Not if you invoke the command with not preceding path. There should be no spaces in the path if it's only arm-none-eabi-cpp.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also I do not understand why 80 chars only because have you looked on line 429 as an example the line has 111 chars :-)

I'm trying not to add formatting work for later.


# Unique IDs used in multiple places.
# Those used only once are implemented with {{u.id}}.
Expand Down