Re: Uses langdefs.py to create language list for create-weblinks-itexi.py (issue 4951047)
- Original Message - From: To: ; Cc: ; Sent: Wednesday, September 14, 2011 8:49 PM Subject: Re: Uses langdefs.py to create language list for create-weblinks-itexi.py (issue 4951047) LGTM, go ahead and push. http://codereview.appspot.com/4951047/ Pushed as a04d1cb5153717523cdafe23faeb2166571603da -- Phil Holmes ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Uses langdefs.py to create language list for create-weblinks-itexi.py (issue 4951047)
LGTM, go ahead and push. http://codereview.appspot.com/4951047/ ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Uses langdefs.py to create language list for create-weblinks-itexi.py (issue 4951047)
I hope the final version of the patch that removes language definitions from website.make and uses langdefs.py for all language definition. http://codereview.appspot.com/4951047/ ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Uses langdefs.py to create language list for create-weblinks-itexi.py (issue 4951047)
On Tue, Sep 13, 2011 at 04:42:16PM +0100, Phil Holmes wrote: > The problem is - how to return WEB_LANGS for the web-build, but > LANGUAGES for the doc build? My patch does this by using something > like this in website.make: > > WEB_LANGS = python langdefs.py web Um. I was just expecting you to define WEB_LANGS = on line 78 of langdefs.py ? I might have missed something (since nobody actually understands all parts of the build system), but surely that would be sufficient? I must admit that I'm really confused about what we're trying to do here, or how far along that path we've gotten (if at all!). Translators wanting to experiment can just change WEB_LANGS themselves (but not commit that change). No trickery is needed in website.make because that's only ever used for building the website without "make doc". Cheers, - Graham ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Uses langdefs.py to create language list for create-weblinks-itexi.py (issue 4951047)
- Original Message - From: To: ; Cc: ; Sent: Monday, September 05, 2011 7:10 PM Subject: Re: Uses langdefs.py to create language list for create-weblinks-itexi.py (issue 4951047) LTGM, not tested, but I'm willing to put it up and just see if anything breaks. My only qualm is that this takes lang.LANGAUGES, instead of defining a WEB_LANGUAGES. At the moment they're the same, but somebody might come in to do a new translation, and we don't want to enable that on the website until it's complete. But I'm content to cross that bridge when we come to it. http://codereview.appspot.com/4951047/ I've reduced the reply-to list, because this is not really a review comment but a request for suggestions. I've got a patch that does this. However, there is an issue I want to check about how it can be done. At present, langdefs is called in 2 ways: from python, by including langdefs.py, and then by using the objects created in the module; and from make, simply by saying something like LANGS = python langdefs.py. The latter syntax is provided for in langdefs because of these lines: if __name__ == '__main__': print ' '.join ([l.code for l in LANGUAGES if l.enabled and l.code != 'en']) The problem is - how to return WEB_LANGS for the web-build, but LANGUAGES for the doc build? My patch does this by using something like this in website.make: WEB_LANGS = python langdefs.py web In other words, using an argument to langdefs. langdefs is modified to check whether it has an argument, and that argument is "web" and if so it returns WEB_LANGS. I can't think of a better way of doing this, but it seems a bit hacky. Can anyone else propose a better way? Thanks. -- Phil Holmes ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Uses langdefs.py to create language list for create-weblinks-itexi.py (issue 4951047)
LTGM, not tested, but I'm willing to put it up and just see if anything breaks. My only qualm is that this takes lang.LANGAUGES, instead of defining a WEB_LANGUAGES. At the moment they're the same, but somebody might come in to do a new translation, and we don't want to enable that on the website until it's complete. But I'm content to cross that bridge when we come to it. http://codereview.appspot.com/4951047/ ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Uses langdefs.py to create language list for create-weblinks-itexi.py (issue 4951047)
Updated patch to use Jan's syntax. Please review. http://codereview.appspot.com/4951047/ ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Uses langdefs.py to create language list for create-weblinks-itexi.py (issue 4951047)
On 2011/09/02 06:25:59, jan.nieuwenhuizen wrote: If that works, then why not have +import langdefs +langs = [i.code if i.code != 'en' else '' for i in langdefs.LANGUAGES] I agree. Phil, why did you push this patch without implementing this, or at least responding to Jan to say why you thought it was a bad idea? I think this is bad form; we want to encourage developers to review patches, but if we ignore their suggestions that pretty much kills any incentive for people to review stuff. Please revert the patch and let's talk about Jan's suggestion. http://codereview.appspot.com/4951047/ ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Uses langdefs.py to create language list for create-weblinks-itexi.py (issue 4951047)
If that works, then why not have --- a/scripts/build/create-weblinks-itexi.py +++ b/scripts/build/create-weblinks-itexi.py @@ -9,11 +9,11 @@ import sys import os import glob ### translation data -- shouldn't be here; see issue ### http://code.google.com/p/lilypond/issues/detail?id=1050 -#langs = ['', 'cs', 'de', 'es', 'fr', 'hu', 'it', 'ja', 'nl', 'zh'] -langs = ['', 'cs', 'de', 'es', 'fr', 'hu', 'it', 'ja', 'nl', 'zh'] +import langdefs +langs = [i.code if i.code != 'en' else '' for i in langdefs.LANGUAGES] # Get/update node translations ''' http://codereview.appspot.com/4951047/ ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Uses langdefs.py to create language list for create-weblinks-itexi.py (issue 4951047)
Looks plausible, but I haven't tested it quite yet. Could we get: 1) update to the make-website.sh portion of the CG, line 249 of website-work.itexi ? 2) define WEB_LANGS (or something similar) in langdefs.py, then use those in create-weblinks.itexi.py ? Once that's done, I'll give it a whirl, and then I think you can push it. http://codereview.appspot.com/4951047/ ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Uses langdefs.py to create language list for create-weblinks-itexi.py (issue 4951047)
An update after further research following GP's pointer. Please review. http://codereview.appspot.com/4951047/ ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Uses langdefs.py to create language list for create-weblinks-itexi.py (issue 4951047)
http://codereview.appspot.com/4951047/diff/1/scripts/build/create-weblinks-itexi.py File scripts/build/create-weblinks-itexi.py (right): http://codereview.appspot.com/4951047/diff/1/scripts/build/create-weblinks-itexi.py#newcode31 scripts/build/create-weblinks-itexi.py:31: # Unable to find langdefs This looks more complicated than I was expecting, and I had a vague feeling that I'd seen an easier way to do this. Thankfully lilynet.net is now up, so I can point out this: http://news.lilynet.net/spip.php?article115#paper_baggers I never looked into it in any more depth, but evidently you can do something special in website.make to let it find langdefs. http://codereview.appspot.com/4951047/ ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Uses langdefs.py to create language list for create-weblinks-itexi.py (issue 4951047)
Reviewers: Graham Percival, Message: As requested - please review. Description: This demonstrates how to import a library into a python file where the path is not already in the pathlist. It half-fixes the issue where languages are defined in many places in make website - the other needs changes to website.make, but there is a problem with that since the variable PYTHON is not guaranteed to be defined. Please review this at http://codereview.appspot.com/4951047/ Affected files: M scripts/build/create-weblinks-itexi.py Index: scripts/build/create-weblinks-itexi.py diff --git a/scripts/build/create-weblinks-itexi.py b/scripts/build/create-weblinks-itexi.py index d799925909c9c4933527cafe77bfb56149977c4b..1f4d90f21fcacb5427be8fe1d5384d679e995e75 100644 --- a/scripts/build/create-weblinks-itexi.py +++ b/scripts/build/create-weblinks-itexi.py @@ -9,14 +9,40 @@ import sys import os import glob -# these links are relative from /website/ on lilypond.org -depth = "../" - ### translation data -- shouldn't be here; see issue ### http://code.google.com/p/lilypond/issues/detail?id=1050 -#langs = ['', 'cs', 'de', 'es', 'fr', 'hu', 'it', 'ja', 'nl', 'zh'] -langs = ['', 'cs', 'de', 'es', 'fr', 'hu', 'it', 'ja', 'nl', 'zh'] +LangDefsImported=True +langs = [] + +try: +import langdefs +except: +LangDefsImported=False + +if not LangDefsImported: +LangDefsImported=True +try: +SrcDir = sys.argv[1] +ScriptDir = os.path.join(SrcDir, 'python') +sys.path.insert(0, ScriptDir) +import langdefs +except: +# Unable to find langdefs +LangDefsImported=False +langs = ['', 'cs', 'de', 'es', 'fr', 'hu', 'it', 'ja', 'nl', 'zh'] +sys.stderr.write ('create-weblinks-itexi: warning: unable to find langdefs: language list may be wrong') + +if LangDefsImported: +langobjs = langdefs.LANGUAGES +for i in langobjs: +if i.code == 'en': +langs.append ('') +else: +langs.append(i.code) + +# these links are relative from /website/ on lilypond.org +depth = "../" # Get/update node translations ''' ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel