This patch contains the necessary changes to the build/install process
to accommodate locale files. The main changes are in the setup.py script
where several operations were overloaded to
1) Build any .po files it finds in the po directory to .mo
2) Place these files in INSTALLROOT/share/locale as appropriate
3) Do appropriate locale path replacement in __init__.py so
virtinst knows where to find the locale files.
I'm not sure if their is a better place for the gettext includes than
__init__.py, but it seems to work for the library and the scripts that
use it (virt-install and virt-clone).
Thanks,
Cole
--
Cole Robinson
crobinso@xxxxxxxxxx
diff -r 65ea24a40b29 MANIFEST.in
--- a/MANIFEST.in Fri Jun 22 13:03:53 2007 -0400
+++ b/MANIFEST.in Fri Jun 29 14:02:43 2007 -0400
@@ -1,9 +1,14 @@ include README AUTHORS NEWS ChangeLog
include README AUTHORS NEWS ChangeLog
include *.py
include virtinst/*.py
+include virtinst/*.in
include tests/*.xml
include tests/*.py
include virt-install
+include virt-clone
include autobuild.sh
include man/*/*.1
include man/*/*.pod
+include po/*.mo
+include po/*.po
+include po/*.pot
diff -r 65ea24a40b29 po/virtinst.pot
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/po/virtinst.pot Fri Jun 29 12:58:06 2007 -0400
@@ -0,0 +1,758 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2007-06-29 12:58-0400\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@xxxxxx>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../virt-install:44 ../virt-clone:48
+#, python-format
+msgid "Could not create %d directory: "
+msgstr ""
+
+#: ../virt-install:53 ../virt-clone:73 ../virt-clone:83
+msgid "ERROR: "
+msgstr ""
+
+#: ../virt-install:62
+msgid "A yes or no response is required"
+msgstr ""
+
+#: ../virt-install:74
+msgid ""
+"Would you like a fully virtualized guest (yes or no)? This will allow you "
+"to run unmodified operating systems."
+msgstr ""
+
+#: ../virt-install:82
+msgid "What is the name of your virtual machine?"
+msgstr ""
+
+#: ../virt-install:93
+msgid "How much RAM should be allocated (in megabytes)?"
+msgstr ""
+
+#: ../virt-install:95
+#, python-format
+msgid "ERROR: Installs currently require %d megs of RAM."
+msgstr ""
+
+#: ../virt-install:121
+#, python-format
+msgid ""
+"You have asked for more virtual CPUs (%(vcpu)d) than there are physical CPUs "
+"(%(phys)d) on the host. This will work, but performance will be poor. Are "
+"you sure? (yes or no)"
+msgstr ""
+
+#: ../virt-install:125
+msgid "How many VCPUs should be attached?"
+msgstr ""
+
+#: ../virt-install:138
+msgid "What would you like to use as the disk (path)?"
+msgstr ""
+
+#: ../virt-install:140
+#, python-format
+msgid ""
+"Please enter the path to the file you would like to use for storage. It will "
+"have size %sGB."
+msgstr ""
+
+#: ../virt-install:145
+#, python-format
+msgid "How large would you like the disk (%s) to be (in gigabytes)?"
+msgstr ""
+
+#: ../virt-install:158
+#, python-format
+msgid "Disk %s is already in use by another guest!"
+msgstr ""
+
+#: ../virt-install:159
+msgid " Do you really want to use the disk (yes or no)? "
+msgstr ""
+
+#: ../virt-install:185
+msgid "Cannot use --file with --nodisks"
+msgstr ""
+
+#: ../virt-install:190
+msgid "Need to pass size for each disk"
+msgstr ""
+
+#: ../virt-install:216
+msgid "Unknown network type "
+msgstr ""
+
+#: ../virt-install:231
+msgid "Cannot mix both --bridge and --network arguments"
+msgstr ""
+
+#: ../virt-install:241 ../virt-install:253
+msgid "Need to pass equal numbers of networks & mac addresses"
+msgstr ""
+
+#: ../virt-install:262
+msgid "Can't do both VNC graphics and nographics"
+msgstr ""
+
+#: ../virt-install:264
+msgid "Can't do both VNC graphics and SDL"
+msgstr ""
+
+#: ../virt-install:266
+msgid "Can't do both SDL and nographics"
+msgstr ""
+
+#: ../virt-install:277
+msgid "Would you like to enable graphics support? (yes or no)"
+msgstr ""
+
+#: ../virt-install:293
+msgid "What is the install location?"
+msgstr ""
+
+#: ../virt-install:311
+msgid "What is the virtual CD image, CD device or install location?"
+msgstr ""
+
+#: ../virt-install:322 ../virt-install:327 ../virt-clone:122 ../virt-clone:127
+#, python-format
+msgid "%s option requires an argument"
+msgstr ""
+
+#: ../virt-install:334
+msgid "Name of the guest instance"
+msgstr ""
+
+#: ../virt-install:336
+msgid "Memory to allocate for guest instance in megabytes"
+msgstr ""
+
+#: ../virt-install:339
+msgid ""
+"UUID for the guest; if none is given a random UUID will be generated. If you "
+"specify UUID, you should use a 32-digit hexadecimal number."
+msgstr ""
+
+#: ../virt-install:341
+msgid "Number of vcpus to configure for your guest"
+msgstr ""
+
+#: ../virt-install:343
+msgid "Check that vcpus do not exceed physical CPUs and warn if they do."
+msgstr ""
+
+#: ../virt-install:348
+msgid "File to use as the disk image"
+msgstr ""
+
+#: ../virt-install:351
+msgid "Size of the disk image (if it doesn't exist) in gigabytes"
+msgstr ""
+
+#: ../virt-install:354
+msgid ""
+"Don't use sparse files for disks. Note that this will be significantly "
+"slower for guest creation"
+msgstr ""
+
+#: ../virt-install:356
+msgid "Don't set up any disks for the guest."
+msgstr ""
+
+#: ../virt-install:361
+msgid ""
+"Fixed MAC address for the guest; if none or RANDOM is given a random address "
+"will be used"
+msgstr ""
+
+#: ../virt-install:364
+msgid ""
+"Bridge to connect guest NIC to; if none given, will try to determine the "
+"default"
+msgstr ""
+
+#: ../virt-install:367
+msgid ""
+"Connect the guest to a virtual network, forwarding to the physical network "
+"with NAT"
+msgstr ""
+
+#: ../virt-install:371
+msgid "Use VNC for graphics support"
+msgstr ""
+
+#: ../virt-install:373
+msgid "Port to use for VNC"
+msgstr ""
+
+#: ../virt-install:375
+msgid "Use SDL for graphics support"
+msgstr ""
+
+#: ../virt-install:377
+msgid "Don't set up a graphical console for the guest."
+msgstr ""
+
+#: ../virt-install:380
+msgid "Don't automatically try to connect to the guest console"
+msgstr ""
+
+#: ../virt-install:384
+msgid "set up keymap for a graphical console"
+msgstr ""
+
+#: ../virt-install:387
+msgid "Use kernel acceleration capabilities"
+msgstr ""
+
+#: ../virt-install:390 ../virt-clone:159
+msgid "Connect to hypervisor with URI"
+msgstr ""
+
+#: ../virt-install:394
+msgid "Specify the installation method to use e.g. 'distro', ..."
+msgstr ""
+
+#: ../virt-install:398
+msgid "This guest should be a fully virtualized guest"
+msgstr ""
+
+#: ../virt-install:401
+msgid "File to use a virtual CD-ROM device for fully virtualized guests"
+msgstr ""
+
+#: ../virt-install:404
+msgid ""
+"The OS type for fully virtualized guests, e.g. 'linux', 'unix', 'windows'"
+msgstr ""
+
+#: ../virt-install:407
+msgid ""
+"The OS variant for fully virtualized guests, e.g. 'fedora6', 'rhel5', "
+"'solaris10', 'win2k', 'vista'"
+msgstr ""
+
+#: ../virt-install:408
+msgid ""
+"Disables APIC for fully virtualized guest (overrides value in os-type/os-"
+"variant db)"
+msgstr ""
+
+#: ../virt-install:409
+msgid ""
+"Disables ACPI for fully virtualized guest (overrides value in os-type/os-"
+"variant db)"
+msgstr ""
+
+#: ../virt-install:412
+msgid "The CPU architecture to simulate"
+msgstr ""
+
+#: ../virt-install:416
+msgid "This guest should be a paravirtualized guest"
+msgstr ""
+
+#: ../virt-install:419
+msgid ""
+"Installation source for paravirtualized guest (eg, nfs:host:/path, http://"
+"host/path, ftp://host/path)"
+msgstr ""
+
+#: ../virt-install:422
+msgid "Additional arguments to pass to the installer with paravirt guests"
+msgstr ""
+
+#: ../virt-install:426 ../virt-clone:179
+msgid "Print debugging information"
+msgstr ""
+
+#: ../virt-install:467
+msgid "Unable to connect to graphical console; vnc port number not found."
+msgstr ""
+
+#: ../virt-install:472 ../virt-install:476
+#, python-format
+msgid ""
+"Unable to connect to graphical console; vncviewer not installed. Please "
+"connect to %(serv)s:%(port)d"
+msgstr ""
+
+#: ../virt-install:520 ../virt-clone:200
+msgid "Must be root to clone Xen guests"
+msgstr ""
+
+#: ../virt-install:533
+msgid "Can't do both --hvm and --paravirt"
+msgstr ""
+
+#: ../virt-install:539
+msgid ""
+"Can't do --hvm on this system: HVM guest is not supported by your CPU or "
+"enabled in your BIOS"
+msgstr ""
+
+#: ../virt-install:559
+#, python-format
+msgid "Unknown installer type '%s'"
+msgstr ""
+
+#: ../virt-install:609
+msgid ""
+"\n"
+"\n"
+"Starting install..."
+msgstr ""
+
+#: ../virt-install:622
+msgid "Guest installation failed"
+msgstr ""
+
+#: ../virt-install:626
+msgid ""
+"Domain installation still in progress. You can reconnect to \n"
+"the console to complete the installation process."
+msgstr ""
+
+#: ../virt-install:632
+#, python-format
+msgid ""
+"Domain installation does not appear to have been\n"
+" successful. If it was, you can restart your domain\n"
+" by running 'virsh start %s'; otherwise, please\n"
+" restart your installation."
+msgstr ""
+
+#: ../virt-install:635
+msgid "Guest installation complete... restarting guest."
+msgstr ""
+
+#: ../virt-install:642
+#, python-format
+msgid ""
+"Domain installation may not have been\n"
+" successful. If it was, you can restart your domain\n"
+" by running 'virsh start %s'; otherwise, please\n"
+" restart your installation."
+msgstr ""
+
+#: ../virt-clone:68
+msgid "What is the name for the cloned virtual machine?"
+msgstr ""
+
+#: ../virt-clone:78
+msgid "What is the name or uuid of the original virtual machine?"
+msgstr ""
+
+#: ../virt-clone:101
+msgid "A new disk image file for the cloned guest is required"
+msgstr ""
+
+#: ../virt-clone:136
+msgid "Name or uuid for the original guest; The status must be shut off"
+msgstr ""
+
+#: ../virt-clone:140
+msgid "Name for the new guest"
+msgstr ""
+
+#: ../virt-clone:145
+msgid "New UUID for the clone guest; Default is a randomly generated UUID"
+msgstr ""
+
+#: ../virt-clone:150
+msgid ""
+"New fixed MAC address for the clone guest. Default is a randomly generated "
+"MAC"
+msgstr ""
+
+#: ../virt-clone:155
+msgid "New file to use as the disk image for the new guest"
+msgstr ""
+
+#: ../virt-clone:165
+msgid ""
+"Force to copy devices (eg, if 'hdc' is a readonly cdrom device, --force-"
+"copy=hdc)"
+msgstr ""
+
+#: ../virt-clone:170
+msgid "Do not use a sparse file for the clone's disk image"
+msgstr ""
+
+#: ../virt-clone:175
+msgid "Preserve a new file to use as the disk image for the new guest"
+msgstr ""
+
+#: ../virtinst/CloneManager.py:71
+msgid "Name or UUID of guest to clone is required"
+msgstr ""
+
+#: ../virtinst/CloneManager.py:80
+msgid "A valid name or UUID of guest to clone is required"
+msgstr ""
+
+#: ../virtinst/CloneManager.py:90
+#, python-format
+msgid "Invalid name for new guest: %s"
+msgstr ""
+
+#: ../virtinst/CloneManager.py:98
+#, python-format
+msgid "Invalid uuid for new guest: %s"
+msgstr ""
+
+#: ../virtinst/CloneManager.py:106
+msgid "New file to use for disk image is required"
+msgstr ""
+
+#: ../virtinst/CloneManager.py:177
+#, python-format
+msgid "Domain %s is not found"
+msgstr ""
+
+#: ../virtinst/CloneManager.py:194
+msgid "Domain status must be SHUTOFF"
+msgstr ""
+
+#: ../virtinst/CloneManager.py:201
+#, python-format
+msgid "Domain %s already exists"
+msgstr ""
+
+#: ../virtinst/CloneManager.py:210 ../virtinst/Guest.py:823
+msgid "The UUID you entered is already in use by another guest!"
+msgstr ""
+
+#: ../virtinst/CloneManager.py:254
+#, python-format
+msgid "Missing new file to use disk image for %s"
+msgstr ""
+
+#: ../virtinst/CloneManager.py:332 ../virtinst/Guest.py:258
+msgid "The MAC address you entered conflicts with the physical NIC."
+msgstr ""
+
+#: ../virtinst/CloneManager.py:333
+msgid "The MAC address you entered is already in use by another guest!"
+msgstr ""
+
+#: ../virtinst/CloneManager.py:334
+msgid ""
+"The MAC address you entered is already in use by another inactive guest!"
+msgstr ""
+
+#: ../virtinst/CloneManager.py:564
+msgid "Cloning domain..."
+msgstr ""
+
+#: ../virtinst/CloneManager.py:562
+#, python-format
+msgid "Cloning from %(src)s to %(dst)s"
+msgstr ""
+
+#: ../virtinst/DistroManager.py:69
+msgid "Verifying install location..."
+msgstr ""
+
+#: ../virtinst/DistroManager.py:73
+#, python-format
+msgid "Opening URL %s failed."
+msgstr ""
+
+#: ../virtinst/DistroManager.py:84
+#, python-format
+msgid "Retrieving file %s..."
+msgstr ""
+
+#: ../virtinst/DistroManager.py:86
+msgid "Invalid URL location given: "
+msgstr ""
+
+#: ../virtinst/DistroManager.py:122
+#, python-format
+msgid "Mounting location %s failed"
+msgstr ""
+
+#: ../virtinst/DistroManager.py:148 ../virtinst/DistroManager.py:150
+msgid "Invalid file location given: "
+msgstr ""
+
+#: ../virtinst/DistroManager.py:316
+msgid "Unable to determine kernel RPM path"
+msgstr ""
+
+#: ../virtinst/DistroManager.py:318
+msgid "Unable to determine install-initrd RPM path"
+msgstr ""
+
+#: ../virtinst/DistroManager.py:329
+msgid "Building initrd"
+msgstr ""
+
+#: ../virtinst/DistroManager.py:564
+msgid "Could not find an installable distribution the install location"
+msgstr ""
+
+#: ../virtinst/DistroManager.py:574 ../virtinst/DistroManager.py:590
+msgid "Invalid install location: "
+msgstr ""
+
+#: ../virtinst/DistroManager.py:608
+msgid ""
+"Install location must be an NFS, HTTP or FTP network install source, or "
+"local file/device"
+msgstr ""
+
+#: ../virtinst/DistroManager.py:610
+msgid "NFS installations are only supported as root"
+msgstr ""
+
+#: ../virtinst/FullVirtGuest.py:120
+#, python-format
+msgid "OS type %s does not exist in our dictionary"
+msgstr ""
+
+#: ../virtinst/FullVirtGuest.py:129
+#, python-format
+msgid ""
+"OS variant %(var)s does not exist in our dictionary for OS type %(type)s"
+msgstr ""
+
+#: ../virtinst/FullVirtGuest.py:180
+msgid "A CD must be specified to boot from"
+msgstr ""
+
+#: ../virtinst/FullVirtGuest.py:211
+msgid "Unable to start domain for guest, aborting installation!"
+msgstr ""
+
+#: ../virtinst/FullVirtGuest.py:238
+msgid "Can't use more than 4 disks on an HVM guest"
+msgstr ""
+
+#: ../virtinst/Guest.py:51
+msgid "The disk path must be a file or a device, not a directory"
+msgstr ""
+
+#: ../virtinst/Guest.py:55
+msgid "The disk path must be an absolute path location, beginning with '/'"
+msgstr ""
+
+#: ../virtinst/Guest.py:74
+msgid "A size must be provided for non-existent disks"
+msgstr ""
+
+#: ../virtinst/Guest.py:77
+msgid "The size of the disk image must be greater than 0"
+msgstr ""
+
+#: ../virtinst/Guest.py:80
+msgid "The specified block device does not exist."
+msgstr ""
+
+#: ../virtinst/Guest.py:82
+msgid "The specified path is not a block device."
+msgstr ""
+
+#: ../virtinst/Guest.py:117
+msgid "Creating storage file..."
+msgstr ""
+
+#: ../virtinst/Guest.py:207
+msgid "MAC address must be of the format AA:BB:CC:DD:EE:FF"
+msgstr ""
+
+#: ../virtinst/Guest.py:214
+msgid "A network name was not provided"
+msgstr ""
+
+#: ../virtinst/Guest.py:216 ../virtinst/Guest.py:224
+#, python-format
+msgid "Bridge name is not required for %s"
+msgstr ""
+
+#: ../virtinst/Guest.py:219 ../virtinst/Guest.py:222
+#, python-format
+msgid "Network name is not required for %s"
+msgstr ""
+
+#: ../virtinst/Guest.py:226
+#, python-format
+msgid "Unknown network type %s"
+msgstr ""
+
+#: ../virtinst/Guest.py:255
+msgid ""
+"The MAC address you entered is already in use by another virtual machine!"
+msgstr ""
+
+#: ../virtinst/Guest.py:260
+msgid ""
+"The MAC address you entered is already in use by another inactive virtual "
+"machine!"
+msgstr ""
+
+#: ../virtinst/Guest.py:330
+msgid ""
+"Invalid value for vnc port, port number must be greater than or equal to 5900"
+msgstr ""
+
+#: ../virtinst/Guest.py:410 ../virtinst/Guest.py:415 ../virtinst/Guest.py:419
+msgid "Must pass both a kernel and initrd"
+msgstr ""
+
+#: ../virtinst/Guest.py:448
+msgid "Unable to connect to hypervisor, aborting installation!"
+msgstr ""
+
+#: ../virtinst/Guest.py:469
+msgid "System name must be greater than 0 and no more than 50 characters"
+msgstr ""
+
+#: ../virtinst/Guest.py:471
+msgid "System name must not be only numeric characters"
+msgstr ""
+
+#: ../virtinst/Guest.py:473
+msgid "System name can only contain alphanumeric, '_', '.', or '-' characters"
+msgstr ""
+
+#: ../virtinst/Guest.py:475
+msgid "System name must be a string"
+msgstr ""
+
+#: ../virtinst/Guest.py:485
+msgid "Memory value must be an integer greater than 0"
+msgstr ""
+
+#: ../virtinst/Guest.py:496
+msgid "Max Memory value must be an integer greater than 0"
+msgstr ""
+
+#: ../virtinst/Guest.py:510
+msgid ""
+"UUID must be a 32-digit hexadecimal number. It may take the form XXXXXXXX-"
+"XXXX-XXXX-XXXX-XXXXXXXXXXXX or may omit hyphens altogether."
+msgstr ""
+
+#: ../virtinst/Guest.py:526
+#, python-format
+msgid "Number of vcpus must be in the range of 1-%d"
+msgstr ""
+
+#: ../virtinst/Guest.py:539
+msgid "Keymap must be a string"
+msgstr ""
+
+#: ../virtinst/Guest.py:541
+msgid "Keymap must be less than 16 characters"
+msgstr ""
+
+#: ../virtinst/Guest.py:543
+msgid "Keymap can only contain alphanumeric, '_', or '-' characters"
+msgstr ""
+
+#: ../virtinst/Guest.py:550
+msgid "Must specify whether graphics are enabled"
+msgstr ""
+
+#: ../virtinst/Guest.py:569
+msgid "Graphics enabled must be True or False"
+msgstr ""
+
+#: ../virtinst/Guest.py:580
+msgid "Unknown graphics type"
+msgstr ""
+
+#: ../virtinst/Guest.py:616
+msgid "You must specify an ISO or CD-ROM location for the installation"
+msgstr ""
+
+#: ../virtinst/Guest.py:618
+msgid "The specified media path does not exist."
+msgstr ""
+
+#: ../virtinst/Guest.py:708
+#, python-format
+msgid "Domain named %s already exists!"
+msgstr ""
+
+#: ../virtinst/Guest.py:717
+msgid "Creating domain..."
+msgstr ""
+
+#: ../virtinst/Guest.py:720
+msgid "Unable to create domain for the guest, aborting installation!"
+msgstr ""
+
+#: ../virtinst/Guest.py:740
+msgid ""
+"It appears that your installation has crashed. You should be able to find "
+"more information in the logs"
+msgstr ""
+
+#: ../virtinst/Guest.py:786
+msgid ""
+"Domain has not existed. You should be able to find more information in the "
+"logs"
+msgstr ""
+
+#: ../virtinst/Guest.py:788
+msgid ""
+"Domain has not run yet. You should be able to find more information in the "
+"logs"
+msgstr ""
+
+#: ../virtinst/Guest.py:803
+msgid "Domain has already been started!"
+msgstr ""
+
+#: ../virtinst/Guest.py:831
+msgid "Name and memory must be specified for all guests!"
+msgstr ""
+
+#: ../virtinst/LiveCDInstaller.py:32
+#, python-format
+msgid "LiveCD image '%s' does not exist"
+msgstr ""
+
+#: ../virtinst/LiveCDInstaller.py:43
+msgid "HVM virtualisation not supported; cannot boot LiveCD"
+msgstr ""
+
+#: ../virtinst/ParaVirtGuest.py:40
+msgid "A location must be specified to install from"
+msgstr ""
+
+#: ../virtinst/ParaVirtGuest.py:54
+msgid "Can't use more than 16 disks on a PV guest"
+msgstr ""
+
+#: ../virtinst/util.py:27
+#, python-format
+msgid "Invalid line length while parsing %s."
+msgstr ""
+
+#: ../virtinst/util.py:28
+#, python-format
+msgid "Defaulting bridge to xenbr%d"
+msgstr ""
+
+#: ../virtinst/util.py:186
+msgid "Couldn't determine max vcpus. Using 32."
+msgstr ""
diff -r 65ea24a40b29 python-virtinst.spec.in
--- a/python-virtinst.spec.in Fri Jun 22 13:03:53 2007 -0400
+++ b/python-virtinst.spec.in Fri Jun 29 14:00:55 2007 -0400
@@ -42,11 +42,12 @@ python setup.py build
%install
rm -rf $RPM_BUILD_ROOT
python setup.py install -O1 --root=$RPM_BUILD_ROOT
+%find_lang %{appname} || echo 0
%clean
rm -rf $RPM_BUILD_ROOT
-%files
+%files -f %{appname}.lang
%defattr(-,root,root)
%doc README AUTHORS ChangeLog NEWS
%dir %{python_sitelib}/%{appname}
diff -r 65ea24a40b29 setup.py
--- a/setup.py Fri Jun 22 13:03:53 2007 -0400
+++ b/setup.py Fri Jun 29 13:12:55 2007 -0400
@@ -1,12 +1,19 @@ from distutils.core import setup, Comman
from distutils.core import setup, Command
+from distutils.command.build import build as _build
+from distutils.command.install_data import install_data as _install_data
+from distutils.command.install_lib import install_lib as _install_lib
+from distutils.command.install import install as _install
from unittest import TextTestRunner, TestLoader
from glob import glob
from os.path import splitext, basename, join as pjoin, walk
import os
import tests.coverage as coverage
-
pkgs = ['virtinst']
+datafiles = [('share/man/man1', ['man/en/virt-install.1', \
+ 'man/en/virt-clone.1'])]
+locale = None
+builddir = None
class TestCommand(Command):
user_options = [ ]
@@ -34,6 +41,74 @@ class TestCommand(Command):
t.run(tests)
coverage.stop()
+class build(_build):
+ """ custom build command to compile i18n files"""
+
+ def run(self):
+ global builddir
+ dirlist = os.listdir("po")
+ for filename in dirlist:
+ if filename.endswith(".po"):
+ newname = filename.rpartition(".")[0] + ".mo"
+ print "Building %s from %s." % (newname, filename)
+ os.system("msgfmt po/%s -o po/%s" % (filename, newname))
+
+ _build.run(self)
+ builddir = self.build_lib
+
+
+class install(_install):
+ """custom install command to extract install base for locale install"""
+
+ def finalize_options(self):
+ global locale
+ _install.finalize_options(self)
+ locale = self.install_base + "/share/locale"
+
+
+class install_lib(_install_lib):
+ """ custom install_lib command to place locale location into library"""
+
+ def run(self):
+ tmplocale = locale.replace("/", "\/") # Escape path to call sed
+ cmd = "cat virtinst/__init__.py.in | " +\
+ "sed -e \"s/::LOCALEDIR::/%s/\" > " % tmplocale +\
+ "%s/virtinst/__init__.py" % builddir
+ os.system(cmd)
+ _install_lib.run(self)
+
+
+class install_data(_install_data):
+ """ custom install_data command to prepare i18n files for install"""
+
+ def run(self):
+ dirlist = os.listdir("po")
+ for filename in dirlist:
+
+ if filename.endswith(".mo"):
+ part = filename.rpartition('.')
+ install_path = "share/locale/%s/LC_MESSAGES/" % (part[0],)
+
+ # make a temp path ./build/po-rename/LANG/virtinst.mo, since we
+ # cannot rename files on install with the distutils
+ orig_path = "po/" + filename
+ new_path = "build/po-rename/%s/" % part[0]
+
+ if not os.path.exists(new_path):
+ os.makedirs(new_path)
+ new_path = new_path + "virtinst.mo"
+
+ if os.path.isfile(new_path):
+ os.remove(new_path)
+ print "Linking %s to %s" % (orig_path, new_path)
+ os.link(orig_path, new_path)
+
+ toadd = (install_path, [new_path])
+
+ # Add these to the datafiles list
+ datafiles.append(toadd)
+ _install_data.run(self)
+
setup(name='virtinst',
version='0.103.0',
description='Virtual machine installation',
@@ -43,7 +118,9 @@ setup(name='virtinst',
package_dir={'virtinst': 'virtinst'},
scripts = ["virt-install","virt-clone"],
packages=pkgs,
- data_files = [('share/man/man1', ['man/en/virt-install.1', 'man/en/virt-clone.1'])],
- cmdclass = { 'test': TestCommand }
+ data_files = datafiles,
+ cmdclass = { 'test': TestCommand, 'build': build, \
+ 'install_data' : install_data, \
+ 'install_lib' : install_lib,
+ 'install' : install}
)
-
diff -r 65ea24a40b29 virtinst/__init__.py
--- a/virtinst/__init__.py Fri Jun 22 13:03:53 2007 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-import util
-from Guest import Guest, VirtualDisk, VirtualNetworkInterface, XenGuest, XenDisk, XenNetworkInterface
-from FullVirtGuest import FullVirtGuest
-from ParaVirtGuest import ParaVirtGuest
-from DistroManager import DistroInstaller
-from LiveCDInstaller import LiveCDInstaller
diff -r 65ea24a40b29 virtinst/__init__.py.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/virtinst/__init__.py.in Tue Jun 26 13:45:35 2007 -0400
@@ -0,0 +1,16 @@
+import util
+from Guest import Guest, VirtualDisk, VirtualNetworkInterface, XenGuest, XenDisk, XenNetworkInterface
+from FullVirtGuest import FullVirtGuest
+from ParaVirtGuest import ParaVirtGuest
+from DistroManager import DistroInstaller
+from LiveCDInstaller import LiveCDInstaller
+
+import gettext
+import locale
+
+gettext_app = "virtinst"
+gettext_dir = "::LOCALEDIR::"
+
+locale.setlocale(locale.LC_ALL, '')
+gettext.install(gettext_app, gettext_dir)
+gettext.bindtextdomain(gettext_app, gettext_dir)
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools