-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Intl: Automatically download ICU if requested. Reduce size. Keep --with-intl=none
the default.
#8719
Conversation
seems to work on windows!
|
did some error tests - https://gist.github.com/srl295/d806b1e359dda274b7cc |
57cccf1
to
8a33708
Compare
--with-intl
on by default--with-intl
on by default
# append to existing version (UA) | ||
version = '%s (node.js/configure)' % urllib.URLopener.version | ||
def icu_download(path): | ||
# download ICU, if needed |
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.
Just thinking out loud here: is this the right place to do the download? should it at least be in a separate utility file called by configure
or even not called automatically at all and have configure
complain at you if you haven't downloaded it? Seems slightly code-smelly to have a download taking place in here, but perhaps there are precedents already set inside configure
?
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.
@rvagg didn't see any precedents here. It certainly could be factored out into a separate utility or at least imported function.
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.
@rvagg @trevnorris I guess I could add import tools.downloader
to configure and then create <node>/tools/downloader.py
right? or maybe import downloader from tools
?
Glad to do this. Just don't know what the tradeoffs are time wise as far as v0.12's runway.
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.
I have no idea what "standard protocol" is for downloading external resources. V8 tells you to run make dependencies
if you try to just make
w/o having downloaded the icu bundle. Maybe something similar to that?
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.
@rvagg I split out a module file tools/configure.d/nodedownload.py
( kept general in case there's more factoring done on configure
? ) - let me know how that looks.
@trevnorris seems like if it is on by default we might as well auto download, it seems the most generally user-friendly. You could also include a copy of icu .zip in node's .tgz which would save folks a step.
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.
@tjfontaine Thoughts on how we want to proceed and what solution we want to use?
--with-intl
on by default--with-intl=small-icu
by default
957030f
to
69e3007
Compare
--with-intl=small-icu
by default
Not a huge addition to this conversation, but I managed to get a build of node with Intl support working off of this branch without issue on OSX 10.9.5 |
Is it not possible to put the relevant parts of ICU in the git repository? |
@piscisaureus #7676 (comment) does just that (but doesn't use it yet - soon). |
8a33708
to
8056934
Compare
OK! Note two commits. 5875492 is the tooling, the other is ICU itself. |
--with-intl=small-icu
the default. Embed small ICU. Download if need be.
Just finished testing the latest cut, works as expected! |
Had a discussion w/ @tjfontaine. Here are some key points:
@srl295 You have one additional thing to include I believe. |
8056934
to
83994d7
Compare
--with-intl=small-icu
the default. Embed small ICU. Download if need be.--with-intl=none
the default.
@trevnorris I think this PR is complete as to the above list. I filed srl295/node#10 and srl295/node#11 to capture two other ideas- are they needed/possible in the v0.12 timeframe? I will look at them separately unless they are ship stoppers for #8719 |
83994d7
to
dc2100e
Compare
@trevnorris added a test case in dc2100e |
@srl295 Just to make sure we don't miss it, I created in your own fork a PR that fixes some cross-compiling issues. I'm not sure it's the proper way to fix it though, as I'm not very familiar with gyp. |
7c3ecfa
to
6f6d337
Compare
@misterdjules I will be looking at srl295/node#12 very shortly. Trying to finish the first pending issue first |
5a94979
to
4f14994
Compare
Respond to review comments from @misterdjules: * Remove the prepare-icu-source.sh mechanism for creating an embedded deps/icu-small as per 7cb4aad - it was not currently used and thus deadwood. * Updated README.md to clarify some of the options: that 'none' is the default for --with-intl, and that --with-icu-source works with 'small-icu' * clarified the test-intl.js test case * cleaned up and added documentation in configure and in nodedownload.py
Instead of downloading ICU if missing from `deps/icu`, just print a warning unless either `--download=all` or `--download=icu` is set. Add some generic scaffolding in case other modules end up in the same boat in the future. It's harmless to pass `--download=xyzzy`, so, future proof (at least until some xyzzy dependency is integrated).
build: i18n: Don't auto-download ICU unless --download=all Thanks @trevnorris for taking a look.
``` | ||
|
||
The `small-icu` mode builds | ||
with English-only data. You can add full data at runtime. |
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.
Is it actually supported? I thought it was not currently supported, but that we planned to fix it later.
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.
It's supported, and already landed in v0.12. That's why small icu links
insuch an odd way. If the "icu dir" option/env var is given, node_i18n.cc
doesn't call setcommondata and thus overriding happens (as icu is actually
linked against the stub data ).
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.
Alright, sounds good and thanks for the clarification!
Besides my two latest comments, LGTM. Also, as discussed with @srl295 on IRC, I would like to land this PR sooner rather than later, so that we can have all ICU-related PRs in joyent/node instead of in @srl295's fork. Thus, we'd be able to assign them to the appropriate milestones and have a better idea of what needs to be done and when. |
@tjfontaine @trevnorris This LGTM, and I think we can leave #8914 for later. What's your opinion? |
@misterdjules Agreed. Also, LGTM. |
-1 I am no fan of automatic downloading things as part of a build step (and much less so at runtime). The other thing about the Would it not be possible to only support loading ICU data files, so ICU itself could be distributed on NPM? Or am I missing something here? |
Bert, thanks for writing here. A couple of things. This change actually does not automatically download by default, only doing Secondly, I'm Glad to be on the hook to work with other packagers in how Thirdly, for the record i'd be glad to see "full icu" as the default Fourthly as to "icu via npm" I would just note that this is a v8 feature I'd be glad to discuss more as I'm able. Thanks again for the feedback. |
@srl295 I'm taking some days off from now until January 4th, so I won't be able to do any work or even comment on this PR for a while. @trevnorris @chrisdickinson @tjfontaine @cjihrig @orangemocha Could you please make sure that it's taken care of while I'm away? Thank you! |
I'm off also but monitoring this thread. |
assert.equal(new Intl.NumberFormat(['en']).format(12345.67890), '12,345.679'); | ||
|
||
var collOpts = { sensitivity: 'base', ignorePunctuation: true }; | ||
var coll = new Intl.Collator(['en'], collOpts); |
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.
Whitespace here is botched. Nothing huge. Just need to remember to fix it before it lands.
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. From your other comment, I wont try to fix this, but let it get fixed
when it lands.
Only have a minor nit that should be taken care of by whoever flattens and lands this PR. LGTM. @tjfontaine Any comments? @srl295 Ping back by Friday if there's no more activity and I'll get this landed. |
So basically wait all year? :-( :-) Thanks. Happy new year and I'll ping Friday. |
@srl295 Heh, didn't even take the holiday into consideration. Sorry. |
ping @trevnorris - happy new year! |
@srl295 Thanks. Been testing it out and works great. One question on usability. Do you think |
With this change, `make distclean` will delete these items, which aren't in the source repo: * `icu_config.gypi` * `deps/icu` - the ICU source tree * `deps/icu-tmp` - the temporary download/unpack work area * `deps/icu4c*.tgz deps/icu4c*.zip` - ICU source tarballs
@trevnorris 9828792 causes |
Make "--with-intl=none" the default and add "intl-none" option to vcbuild.bat. If icu data is missing print a warning unless either --download=all or --download=icu is set. If set then automatically download, verify (MD5) and unpack the ICU data if not already available. There's a "list" of URLs being used, but right now only the first is picked up. The logic works something like this: * If there is no directory deps/icu, * If no zip file (currently icu4c-54_1-src.zip), * Download zip file (icu-project.org -> sf.net) * Verify the MD5 sum of the zipfile * If bad, print error and exit * Unpack the zipfile into deps/icu * If deps/icu now exists, use it, else fail with help text Add the configuration option "--with-icu-source=..." Usage: * --with-icu-source=/path/to/my/other/icu * --with-icu-source=/path/to/icu54.zip * --with-icu-source=/path/to/icu54.tgz * --with-icu-source=http://example.com/icu54.tar.bz2 Add the configuration option "--with-icu-locals=...". Allows choosing which locales are used in the "small-icu" case. Example: configure --with-intl=small-icu --with-icu-locales=tlh,grc,nl (Also note that as of this writing, neither Klingon nor Ancient Greek are in upstream CLDR data. Serving suggestion only.) Don't use hard coded ../../out paths on windows. This was suggested by @misterdjules as it causes test failures. With this fix, "out" is no longer created on windows and the following can run properly: python tools/test.py simple Reduce space by about 1MB with ICU 54 (over without this patch). Also trims a few other source files, but only conditional on the exact ICU version used. This is to future-proof - a file that is unneeded now may be needed in future ICUs. Also: * Update distclean to remove icu related files * Refactor some code into tools/configure.d/nodedownload.py * Update docs * Add test PR-URL: #8719 Fixes: #7676 (comment) [trev.norris@gmail.com small change to test's whitespace and logic] Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Thanks much. Squashed and landed in a308395. |
Background: see joyent#7676 of course