-
Notifications
You must be signed in to change notification settings - Fork 63
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
Migrate highlighter and entities generator to Python 3 #227
Conversation
f6b7e47
to
40181a7
Compare
CI is failing, I think because of this part: https://travis-ci.org/github/whatwg/html-build/builds/689576444#L2199
I think that’s because the wattsi build script expects to be run from within a clone of the wattsi repo, and the wattsi directory the CI is building wattsi from is apparently not a git clone? |
I don't think that's it. That's just trying to figure out the Wattsi version number, and always happens on Docker or on CI (because if you put a .git directory into a Docker container bad things happen). You can see the same error in the previous successful build at https://travis-ci.org/github/whatwg/html-build/builds/686853995#L2250. Since it's failing between the |
I think this is working now. The missing step was to pip install the highlighter package, since it now gets is dependencies (like widlparser) from pip, instead of vendoring them. I also had to rejigger some of the base image stuff since I sent tabatkins/highlighter#18 which should land first. Then, we might want to consider pip installing the highlighter itself (instead of git cloning it and pip installing the local folder), if @tabatkins does a publish. |
Latest code has been published 👍 |
@tabatkins dumb question, but if I do |
Not a dumb question: you can't. I'll need to add a command for that. ^_^ |
(FYI, Travis is failing because my Python 3.8 stuff is conflicting with the JDK stuff. I'll fix it!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes thus far LGTM
All right, just pushed a (breaking) change to pypi. The command for invoking the highlighter manually is now |
This also updates the install process for the highlighter to pull from pip.
29a918a
to
eea5915
Compare
Alright, this seems to work. I think I tested all of the following configurations, although another round of testing would be appreciated:
I decided to go back to python 3.7, i.e. the Python that is default-available on Debian's apt-get repository. Raising the bar to 3.8 adds pain for both our CI and potentially our users, for no gain at the present. If we find features in 3.8 that we want, we can revisit this decision. |
eea5915
to
918c88d
Compare
build.sh
Outdated
if [[ "$LOCAL_WATTSI" == "true" ]]; then | ||
HIGHLIGHT_SERVER_ARGS=() | ||
$QUIET && HIGHLIGHT_SERVER_ARGS+=( --quiet ) | ||
bs-highlighter-server "${HIGHLIGHT_SERVER_ARGS[@]}" & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bs-highlighter-server "${HIGHLIGHT_SERVER_ARGS[@]}" & | |
bs-highlighter-server ${HIGHLIGHT_SERVER_ARGS[@]+"${HIGHLIGHT_SERVER_ARGS[@]}"} & |
For non-quiet builds, without using the ${HIGHLIGHT_SERVER_ARGS[@]+"${HIGHLIGHT_SERVER_ARGS[@]}"
expression, the build fails in my environment (and I would think in anybody else’s too…) — because we’re using set -o nounset
(aka set -u
), and so we get the following error :
./build.sh: line 665: HIGHLIGHT_SERVER_ARGS[@]: unbound variable
${HIGHLIGHT_SERVER_ARGS[@]+"${HIGHLIGHT_SERVER_ARGS[@]}"}
means “Expand the HIGHLIGHT_SERVER_ARGS[@]
variable only if it’s not unset”.
"${HIGHLIGHT_SERVER_ARGS[@]}"
by itself means “Unconditionally try to expand the HIGHLIGHT_SERVER_ARGS[@]
variable, even if it’s unset.
If we weren’t using set -o nounset
, then bs-highlighter-server "${HIGHLIGHT_SERVER_ARGS[@]}"
would work fine too. But because we are using set -o nounset
, then if HIGHLIGHT_SERVER_ARGS[@]
is unset, it fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very interesting. It did not fail on my environment (both Windows Git Bash and Debian 10 via Windows Subsystem for Linux). I guess the idea is that empty arrays count as "unset"?
Why do we not need to do a similar thing for UNZIP_ARGS
on line 638?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's because this was fixed in recent (2016+) Bash versions? https://stackoverflow.com/a/39687362/3191
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's because this was fixed in recent (2016+) Bash versions? https://stackoverflow.com/a/39687362/3191
Yeah, probably so. I know the bash that ships in macOS is quite old.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very interesting. It did not fail on my environment (both Windows Git Bash and Debian 10 via Windows Subsystem for Linux). I guess the idea is that empty arrays count as "unset"?
Yes, to sh and bash they do at least.
Why do we not need to do a similar thing for
UNZIP_ARGS
on line 638?
I think we do need to do a similar thing with that too. I guess the only reason none of us has run into it causing a failure is that none of us has run the build script with the verbose switch since whenever it was that set -o nounset
was added to the script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I'll push a separate commit that adds that, although I'll want to rearrange and squash it before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, actually I ended up force-pushing, because I realized I had messed up the commit message for the third commit anyway. PTAL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we not need to do a similar thing for
UNZIP_ARGS
on line 638?I think we do need to do a similar thing with that too.
Actually, I think I misspoke about that. Line 639 is what matters, because that’s where UNZIP_ARGS
is actually referenced. And when it’s referenced there, it’s always going to have been assigned/set — because line 638 adds "$HTML_TEMP/wattsi-output.zip" -d "$2"
to its value unconditionally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, that makes sense! Force-pushed to undo that line (and remove the discussion of it from the commit message).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, that makes sense! Force-pushed to undo that line (and remove the discussion of it from the commit message).
ah, OK — re-pulled now and will review and test it again to be sure
918c88d
to
42f42d7
Compare
In particular, this only attempts to install and start the server if local Wattsi is in use. As part of this, we no longer check for the existence and version of Wattsi each time before we invoke it, but instead only once.
42f42d7
to
89852f5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed and tested — LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK yep, reviewed again and re-tested and still LGTM
Fixes #220