[et-mgmt-tools] [RFC] Approach to installing a localized virtinst

Cole Robinson crobinso at redhat.com
Thu Jun 28 18:44:29 UTC 2007

Hello all,

I've recently undertaken adding localization support to virtinst. Since 
currently build and install from source is done using a typical setup.py 
script, I've encountered several issues involving how to handle 
installing the locale files, and making virtinst aware of where they are.

The attached patch handles the first issue: I added custom functionality 
to to the build and install_data commands as invoked in the setup 
script. The build command searchs po/ for any .po files and invokes 
msgfmt to compile them. The install_data additions have to do some silly 
  things to name the files correctly as distutils cannot rename extra 
install files on the fly (ex. moves po/es.mo to build/es/virtinst.mo).

The second problem is a bit more perplexing. The path to the locale 
files has to be placed into a virtinst header so that the library knows 
where to look for them. Possible solutions I see:

1) Extracting the install root from setup.py mid run. This has to happen 
after build but before actual install. The locale path could then be 
formed and sed'd or some equivalent into a virtinst header file, which 
would than have to be (re)compiled and moved to the build directory. 
Ugly way to do it, but the user can still use setup.py as normal and all 
should work.

2) Force the user to use the autobuild.sh script and pass an environment 
variable to that if they want to specify a different install root. That 
way the sed'ing can be done prior to calling setup.py. Would be pretty 
simple and non-intrusive, but no good for a user who wants to pass other 
  arguments to setup.py.

3) Use traditional autotools. Probably the 'right' solution, but a tad 
overkill :) The only real way at multiplatforming the install as well, 
since all other solutions would involve hardcoding share/locale/... 
among other things, which might not be the directory structure used by 
other platforms.

Thoughts? I'm not too familiar with this stuff so I may be overlooking a 
simpler solution, or oversimplifying a complex one!


Cole Robinson
crobinso at redhat.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: virtinst-build-install-l10n.patch
Type: text/x-patch
Size: 3001 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/et-mgmt-tools/attachments/20070628/952f2bf6/attachment.bin>

More information about the et-mgmt-tools mailing list