Merge lp:~noskcaj/testdrive/pep8 into lp:testdrive

Proposed by Jackson Doak
Status: Needs review
Proposed branch: lp:~noskcaj/testdrive/pep8
Merge into: lp:testdrive
Diff against target: 3322 lines (+922/-571)
17 files modified
bin/testdrive (+106/-51)
bin/testdrive-gtk (+250/-152)
debian/changelog (+4/-6)
debian/control (+2/-1)
debian/copyright (+5/-0)
debian/release.sh (+1/-1)
po/testdrive.pot (+177/-132)
setup.py (+30/-28)
testdrive/testdrive.py (+75/-36)
testdrive/virt/kvm.py (+22/-8)
testdrive/virt/parallels.py (+18/-7)
testdrive/virt/virtualbox.py (+55/-25)
testdrivegtk/AboutTestdrivegtkDialog.py (+20/-17)
testdrivegtk/AddOtherTestdrivegtkDialog.py (+31/-19)
testdrivegtk/PreferencesTestdrivegtkDialog.py (+101/-65)
testdrivegtk/helpers.py (+13/-12)
testdrivegtk/testdrivegtkconfig.py (+12/-11)
To merge this branch: bzr merge lp:~noskcaj/testdrive/pep8
Reviewer Review Type Date Requested Status
Andres Rodriguez Needs Fixing
Review via email: mp+189491@code.launchpad.net

Description of the change

makes the program pep8 compliant and adds some minor fixes.

To post a comment you must log in.
lp:~noskcaj/testdrive/pep8 updated
434. By Jackson Doak

prevent testdrive from importing gettext twice

435. By Jackson Doak

Comment out unused imports

436. By Jackson Doak

Fix minor text bugs i made.

Revision history for this message
Andres Rodriguez (andreserl) wrote :

Hi Jackson!

I like this fixes for sure.. however, it is way too big to review.. is there anyway you can split this in smaller branches? (Say one branch per binary, so that it is easier to test and review).

thank you! this is awesome!

review: Needs Fixing
Revision history for this message
Jackson Doak (noskcaj) wrote :

first, thanks for having time to review.
second, I'll re-do this in separate branches one the PyGI (and maybe
python3) port is over. Is there any chance you could help with either,
since glade keep breaking for me and dan hasn't got the time.

On Sun, Oct 27, 2013 at 5:24 AM, Andres Rodriguez
<email address hidden>wrote:

> Review: Needs Fixing
>
> Hi Jackson!
>
> I like this fixes for sure.. however, it is way too big to review.. is
> there anyway you can split this in smaller branches? (Say one branch per
> binary, so that it is easier to test and review).
>
> thank you! this is awesome!
> --
> https://code.launchpad.net/~noskcaj/testdrive/pep8/+merge/189491
> You are the owner of lp:~noskcaj/testdrive/pep8.
>

Unmerged revisions

436. By Jackson Doak

Fix minor text bugs i made.

435. By Jackson Doak

Comment out unused imports

434. By Jackson Doak

prevent testdrive from importing gettext twice

433. By Jackson Doak

* debian/control: Add working VCS fields
  * debian/release.sh: Update current ubuntu release

432. By Jackson Doak

Add copyright entry for testdrivegtk/AddOtherTestdrivegtkDialog.py

431. By Jackson Doak

Finish pep8 changes

430. By Jackson Doak

Make testdrive pep8 compliant

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/testdrive'
--- bin/testdrive 2013-08-10 20:52:38 +0000
+++ bin/testdrive 2013-10-06 20:59:44 +0000
@@ -19,11 +19,21 @@
19# You should have received a copy of the GNU General Public License19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.20# along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
22import commands, hashlib, os, string, sys, tempfile, time, platform, subprocess, tarfile, logging22import commands
23#import hashlib
24import os
25import string
26import sys
27#import tempfile
28import time
29#import platform
30import subprocess
31import tarfile
32import logging
23from optparse import OptionParser33from optparse import OptionParser
2434
25import gettext35import gettext
26from gettext import gettext as _36_ = gettext.gettext
27gettext.textdomain('testdrive')37gettext.textdomain('testdrive')
2838
29from testdrive import testdrive39from testdrive import testdrive
@@ -57,9 +67,12 @@
57 filename = os.path.basename(iso["url"])67 filename = os.path.basename(iso["url"])
58 path = "%s/%s_%s" % (td.CACHE_ISO, iso["category"], filename)68 path = "%s/%s_%s" % (td.CACHE_ISO, iso["category"], filename)
59 if os.path.exists(path):69 if os.path.exists(path):
60 print(_(" +-cache--> [%s] %s") % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(os.path.getmtime(path))), filename))70 print(_(" +-cache--> [%s] %s") % (time.strftime(
61 i=i+171 "%Y-%m-%d %H:%M:%S", time.localtime(
62 menu.append({"id":i, "url":iso["url"], "cat": iso["category"]})72 os.path.getmtime(path))), filename))
73 i += 1
74 menu.append({"id": i, "url": iso["url"],
75 "cat": iso["category"]})
63 print(_(" %d. Other (prompt for ISO URL)") % i)76 print(_(" %d. Other (prompt for ISO URL)") % i)
64 try:77 try:
65 input = raw_input(_("\nSelect an image to testdrive [1]: "))78 input = raw_input(_("\nSelect an image to testdrive [1]: "))
@@ -84,38 +97,46 @@
84 logger.error(_("\nERROR: Invalid selection\n"))97 logger.error(_("\nERROR: Invalid selection\n"))
85 return(url)98 return(url)
8699
100
87def error(str):101def error(str):
88 logger.error(_("\n%s\n") % str)102 logger.error(_("\n%s\n") % str)
89 sys.exit(1)103 sys.exit(1)
90104
105
91def is_iso(file):106def is_iso(file):
92 # If it's a URL, assume it's good107 # If it's a URL, assume it's good
93 for i in ("http", "ftp", "rsync", "file", "zsync"):108 for i in ("http", "ftp", "rsync", "file", "zsync"):
94 if string.find(file, "%s://" % i) == 0:109 if string.find(file, "%s://" % i) == 0:
95 return(file)110 return(file)
96 # If it's a local path, test it for viability111 # If it's a local path, test it for viability
97 if commands.getstatusoutput("file \"%s\" | grep -qs \"ISO 9660\"" % file)[0] == 0:112 if commands.getstatusoutput("file \"%s\" | grep -qs \"ISO 9660\""
113 % file)[0] == 0:
98 return("file://%s" % file)114 return("file://%s" % file)
99 elif tarfile.is_tarfile(file):115 elif tarfile.is_tarfile(file):
100 return("file://%s" % file)116 return("file://%s" % file)
101 else:117 else:
102 error(_("Invalid ISO URL [%s]") % file)118 error(_("Invalid ISO URL [%s]") % file)
103119
120
104def is_disk_img(file):121def is_disk_img(file):
105 (status, output) = commands.getstatusoutput("file %s | grep -qs 'Qemu Image'" % file)122 (status, output) = commands.getstatusoutput(
106 if status == 0:123 "file %s | grep -qs 'Qemu Image'" % file)
107 # qemu/kvm qcow2 image124 if status == 0:
108 return True125 # qemu/kvm qcow2 image
109 (status, output) = commands.getstatusoutput("file %s | grep -qs 'QEMU QCOW Image'" % file)126 return True
110 if status == 0:127 (status, output) = commands.getstatusoutput(
111 # qemu/kvm qcow2 image128 "file %s | grep -qs 'QEMU QCOW Image'" % file)
112 return True129 if status == 0:
113 (status, output) = commands.getstatusoutput("file %s | grep -qs '.img: data$'" % file)130 # qemu/kvm qcow2 image
131 return True
132 (status, output) = commands.getstatusoutput(
133 "file %s | grep -qs '.img: data$'" % file)
114 if status == 0:134 if status == 0:
115 # probably a virtual box image135 # probably a virtual box image
116 return True136 return True
117 return False137 return False
118138
139
119def is_cloud_img(file):140def is_cloud_img(file):
120 img = False141 img = False
121 floppy = False142 floppy = False
@@ -136,19 +157,23 @@
136 else:157 else:
137 return False158 return False
138159
160
139def run(cmd):161def run(cmd):
140 return(os.system(cmd))162 return(os.system(cmd))
141163
164
142def run_or_die(cmd):165def run_or_die(cmd):
143 if run(cmd) != 0:166 if run(cmd) != 0:
144 error(_("Command failed\n `%s`") % cmd)167 error(_("Command failed\n `%s`") % cmd)
145168
169
146def run_vm(cmd, td, curses):170def run_vm(cmd, td, curses):
147 if not curses:171 if not curses:
148 p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)172 p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
149 if td.VIRT == 'kvm':173 if td.VIRT == 'kvm':
150 if curses:174 if curses:
151 logger.info(_("Launching Virtual Machine using CURSES as screen mode"))175 logger.info(_(
176 "Launching Virtual Machine using CURSES as screen mode"))
152 run_or_die(cmd)177 run_or_die(cmd)
153 else:178 else:
154 p.wait()179 p.wait()
@@ -156,15 +181,20 @@
156 # Give this VM a few seconds to start up181 # Give this VM a few seconds to start up
157 time.sleep(5)182 time.sleep(5)
158 # Loop as long as this VM is running183 # Loop as long as this VM is running
159 while commands.getstatusoutput("VBoxManage list runningvms | grep -qs %s" % td.VBOX_NAME)[0] == 0:184 while commands.getstatusoutput(
185 "VBoxManage list runningvms | grep -qs %s" % td.VBOX_NAME
186 )[0] == 0:
160 time.sleep(2)187 time.sleep(2)
161 elif td.VIRT == 'parallels':188 elif td.VIRT == 'parallels':
162 # Loop as long as this VM is running189 # Loop as long as this VM is running
163 while commands.getstatusoutput("prlctl list %s | grep -qs stopped" % td.VBOX_NAME)[0] != 0:190 while commands.getstatusoutput(
191 "prlctl list %s | grep -qs stopped" % td.VBOX_NAME)[0] != 0:
164 time.sleep(2)192 time.sleep(2)
165193
194
166def main():195def main():
167 # Initialize Testdrive Class, sending section used to retrieve settings from config file196 # Initialize Testdrive Class,
197 # sending section used to retrieve settings from config file
168 td = testdrive.Testdrive('testdrive')198 td = testdrive.Testdrive('testdrive')
169199
170 # Local UI200 # Local UI
@@ -190,36 +220,48 @@
190 Users wanting to change the behavior default configuration can make a\n\220 Users wanting to change the behavior default configuration can make a\n\
191 copy of /etc/%progrc, and pass this as a parameter to %prog.\n"221 copy of /etc/%progrc, and pass this as a parameter to %prog.\n"
192222
193
194 parser = OptionParser(usage)223 parser = OptionParser(usage)
195 parser.add_option('-f', '--config', action='store', type='string', dest='config',224 parser.add_option(
225 '-f', '--config', action='store', type='string', dest='config',
196 help=_('user configuration file (overriding default values'))226 help=_('user configuration file (overriding default values'))
197 parser.add_option('-v', '--version', action='store_true', dest='version', default=False,227 parser.add_option(
228 '-v', '--version', action='store_true', dest='version', default=False,
198 help=_('print version and system data, and exit'))229 help=_('print version and system data, and exit'))
199 parser.add_option('-u', '--url', action='store', type='string', dest='url',230 parser.add_option(
231 '-u', '--url', action='store', type='string', dest='url',
200 help=_('get ISO image from this URL location'))232 help=_('get ISO image from this URL location'))
201 parser.add_option('-d', '--desktop', action='store_true', dest='desktop', default=False,233 parser.add_option(
234 '-d', '--desktop', action='store_true', dest='desktop', default=False,
202 help=_('try to launch usb-creator for further testing'))235 help=_('try to launch usb-creator for further testing'))
203 parser.add_option('-r', '--release', action='store', type='string', dest='release',236 parser.add_option(
237 '-r', '--release', action='store', type='string', dest='release',
204 help=_('hardcode Ubuntu RELEASE codename'))238 help=_('hardcode Ubuntu RELEASE codename'))
205 parser.add_option('-l', '--flavor', action='store', type='string', dest='flavor',239 parser.add_option(
240 '-l', '--flavor', action='store', type='string', dest='flavor',
206 help=_('hardcode Ubuntu flavor. Available Flavors:\n\241 help=_('hardcode Ubuntu flavor. Available Flavors:\n\
207 ubuntu/kubuntu/xubuntu/edubuntu/mythbuntu/ubuntustudio/lubuntu/ubuntukylin'))242 ubuntu/kubuntu/xubuntu/edubuntu/mythbuntu/'
208 parser.add_option('-p', '--repo', action='store', type='string', dest='repository',243 'ubuntustudio/lubuntu/ubuntukylin'))
244 parser.add_option(
245 '-p', '--repo', action='store', type='string', dest='repository',
209 help=_('hardcode Ubuntu repository from where to obtain ISOs:\n\246 help=_('hardcode Ubuntu repository from where to obtain ISOs:\n\
210 releases/cdimage/cloud-daily/cloud-releases'))247 releases/cdimage/cloud-daily/cloud-releases'))
211 parser.add_option('-c', '--curses', action='store_true', default=False, dest='curses',248 parser.add_option(
212 help=_('displays the Virtual Machine in the shell. Only valid for Cloud images.'))249 '-c', '--curses', action='store_true', default=False, dest='curses',
213 #parser.add_option('-v', '--verbose', action='store_true', default=False, dest='verbose',250 help=_('displays the Virtual Machine in the shell. '
251 'Only valid for Cloud images.'))
252 #parser.add_option(
253 # '-v', '--verbose', action='store_true', default=False, dest='verbose',
214 # help=_('show debug messages'))254 # help=_('show debug messages'))
215255
216 (opt, args) = parser.parse_args()256 (opt, args) = parser.parse_args()
217 logger.info(_("version passed: %s") % opt.version)257 logger.info(_("version passed: %s") % opt.version)
218 if opt.version:258 if opt.version:
219 hasOptions = True259 hasOptions = True
220 version = commands.getstatusoutput("dpkg -l testdrive-cli | tail -n1 | awk '{print $3}'")260 version = commands.getstatusoutput(
261 "dpkg -l testdrive-cli | tail -n1 | awk '{print $3}'")
221 logger.info(_("testdrive %s") % version[1])262 logger.info(_("testdrive %s") % version[1])
222 #TODO: Why is get_virt() here? Disable until is determined if we really need it or not. If yes, we'll have to add same code as below,263 #TODO: Why is get_virt() here? Disable until is determined if we really
264 # need it or not. If yes, we'll have to add same code as below,
223 # for same function265 # for same function
224 td.get_virt()266 td.get_virt()
225 sys.exit(0)267 sys.exit(0)
@@ -229,8 +271,9 @@
229 ##############################271 ##############################
230272
231 # prime configuration with defaults273 # prime configuration with defaults
232 config_files = ["/etc/%s" % td.PKGRC, "%s/.%s" % (td.HOME, td.PKGRC), "%s/.config/%s/%s" % (td.HOME, td.PKG, td.PKGRC) ]274 config_files = ["/etc/%s" % td.PKGRC, "%s/.%s" % (td.HOME, td.PKGRC),
233 logger.info(_("config passed: %s") %opt.config)275 "%s/.config/%s/%s" % (td.HOME, td.PKG, td.PKGRC)]
276 logger.info(_("config passed: %s") % opt.config)
234 if opt.config:277 if opt.config:
235 hasOptions = True278 hasOptions = True
236 if opt.config[0] != '/':279 if opt.config[0] != '/':
@@ -257,21 +300,23 @@
257 error(_("Your CPU supports KVM acceleration; please install KVM:\n\300 error(_("Your CPU supports KVM acceleration; please install KVM:\n\
258 sudo apt-get install qemu-kvm"))301 sudo apt-get install qemu-kvm"))
259 elif td.VIRT == 0:302 elif td.VIRT == 0:
260 error(_("Your CPU does not support acceleration; run kvm-ok for more information; then please install VirtualBox:\n\303 error(_("Your CPU does not support acceleration; run kvm-ok for more "
304 "information; then please install VirtualBox:\n\
261 kvm-ok\n\305 kvm-ok\n\
262 sudo apt-get install virtualbox"))306 sudo apt-get install virtualbox"))
263 elif td.VIRT == "kvm":307 elif td.VIRT == "kvm":
264 logger.info(_("Using KVM for virtual machine hosting..."));308 logger.info(_("Using KVM for virtual machine hosting."))
265 elif td.VIRT == "virtualbox":309 elif td.VIRT == "virtualbox":
266 logger.info(_("Using VirtualBox for virtual machine hosting..."))310 logger.info(_("Using VirtualBox for virtual machine hosting."))
267 elif td.VIRT == "paralels":311 elif td.VIRT == "paralels":
268 logger.info(_("Using Parallels Desktop for virtual machine hosting..."))312 logger.info(_("Using Parallels Desktop for virtual machine hosting."))
269313
270 ##########################################314 ##########################################
271 ## UI Options needed after config files ##315 ## UI Options needed after config files ##
272 ##########################################316 ##########################################
273317
274 # TODO: is_iso function is locally used to see if the url is indeed one or not. Could be used by the front-end318 # TODO: is_iso function is locally used to see if the url is indeed one
319 # or not. Could be used by the front-end
275 # Process the rest of the options320 # Process the rest of the options
276 if opt.url:321 if opt.url:
277 hasOptions = True322 hasOptions = True
@@ -281,7 +326,8 @@
281 td.ISO_URL = "file:///dev/null"326 td.ISO_URL = "file:///dev/null"
282 elif is_cloud_img(opt.url):327 elif is_cloud_img(opt.url):
283 if td.VIRT != 'kvm':328 if td.VIRT != 'kvm':
284 error(_("Launching Cloud images only works with KVM. Please switch your virtualization method..."))329 error(_("Launching Cloud images only works with KVM. Please "
330 "switch your virtualization method..."))
285 td.p = 'cloud-daily'331 td.p = 'cloud-daily'
286 if opt.curses:332 if opt.curses:
287 td.KVM_ARGS = td.KVM_ARGS + ' -curses'333 td.KVM_ARGS = td.KVM_ARGS + ' -curses'
@@ -297,7 +343,7 @@
297 else:343 else:
298 DESKTOP = 0344 DESKTOP = 0
299345
300 # Hardcoded release codename from executable. Overrides value in config file346 # Hardcoded release codename from executable. Override value in config file
301 if opt.release:347 if opt.release:
302 hasOptions = True348 hasOptions = True
303 td.r = opt.release349 td.r = opt.release
@@ -323,20 +369,24 @@
323 ## Obtain Release Codename from ISO cache ##369 ## Obtain Release Codename from ISO cache ##
324 #################################################370 #################################################
325371
326 # Verify if the ISO list is cached, if not, set variable to update/create it.372 # Verify if the ISO list is cached, if not,
373 # set variable to update/create it
327 if td.is_iso_list_cached() is False:374 if td.is_iso_list_cached() is False:
328 update_cache = 1375 update_cache = 1
329 # If ISO list is cached, verify if it is expired. If it is, set variable to update it.376 # If ISO list is cached, verify if it is expired.
377 # If it is, set variable to update it.
330 elif td.is_iso_list_cache_expired() is True:378 elif td.is_iso_list_cache_expired() is True:
331 update_cache = 1379 update_cache = 1
332380
333 # If variable set to update, obtain the ISO list from the Ubuntu CD Image repository.381 # If variable set to update, obtain the ISO list
382 # from the Ubuntu CD Image repository.
334 if update_cache == 1:383 if update_cache == 1:
335 logger.info(_("Obtaining Ubuntu ISO list from %s...") % td.u)384 logger.info(_("Obtaining Ubuntu ISO list from %s...") % td.u)
336 try:385 try:
337 cdimage = td.obtain_ubuntu_iso_list_from_repo()386 cdimage = td.obtain_ubuntu_iso_list_from_repo()
338 except:387 except:
339 error(_("ERROR: Could not obtain the Ubuntu ISO list from %s...") % td.u)388 error(_("ERROR: Could not obtain the Ubuntu ISO list from %s..."
389 ) % td.u)
340 # If the ISO List was obtained, update the cache fle390 # If the ISO List was obtained, update the cache fle
341 if cdimage:391 if cdimage:
342 try:392 try:
@@ -374,12 +424,14 @@
374 if cmd == 1:424 if cmd == 1:
375 error(_("Unsupported protocol [%s]") % td.PROTO)425 error(_("Unsupported protocol [%s]") % td.PROTO)
376 if td.PROTO != 'file' and td.PROTO != 'rsync':426 if td.PROTO != 'file' and td.PROTO != 'rsync':
377 if run("wget --spider -S %s 2>&1 | grep 'HTTP/1.. 200 OK'" % td.ISO_URL) != 0:427 if run("wget --spider -S %s 2>&1 | grep 'HTTP/1.. 200 OK'"
428 % td.ISO_URL) != 0:
378 error(_("ISO not found at [%s]") % td.ISO_URL)429 error(_("ISO not found at [%s]") % td.ISO_URL)
379 if cmd != 0:430 if cmd != 0:
380 run_or_die(cmd)431 run_or_die(cmd)
381 if td.p == 'cloud-daily' or td.p == 'cloud-releases':432 if td.p == 'cloud-daily' or td.p == 'cloud-releases':
382 logger.info("Preparing Cloud image [%s]" % os.path.basename(td.PATH_TO_ISO).split("_")[-1])433 logger.info("Preparing Cloud image [%s]" % os.path.basename(
434 td.PATH_TO_ISO).split("_")[-1])
383 td.prepare_cloud_img_tarball()435 td.prepare_cloud_img_tarball()
384436
385 ##########################437 ##########################
@@ -428,12 +480,15 @@
428 logger.info(_("You may wish to clean up the cache directory..."))480 logger.info(_("You may wish to clean up the cache directory..."))
429 print(_(" %s and %s") % (td.CACHE_ISO, td.CACHE_IMG))481 print(_(" %s and %s") % (td.CACHE_ISO, td.CACHE_IMG))
430 #run("ls -HhalF %s %s" % (CACHE_ISO, CACHE_IMG))482 #run("ls -HhalF %s %s" % (CACHE_ISO, CACHE_IMG))
431 #run("du -sh --apparent-size %s %s 2>/dev/null || du -sh %s %s" % (CACHE_ISO, CACHE_IMG))483 #run("du -sh --apparent-size %s %s 2>/dev/null || \
484 #du -sh %s %s" % (CACHE_ISO, CACHE_IMG))
432485
433 # Launch Desktop486 # Launch Desktop
434 if DESKTOP == 1:487 if DESKTOP == 1:
435 if os.path.exists("/usr/bin/usb-creator-gtk") or os.path.exists("/usr/bin/usb-creator-kde"):488 if os.path.exists("/usr/bin/usb-creator-gtk") or \
436 input = raw_input(_("\nLaunch USB Startup Disk Creator for further testing of this ISO? [y/N] "))489 os.path.exists("/usr/bin/usb-creator-kde"):
490 input = raw_input(_("\nLaunch USB Startup Disk Creator for "
491 "further testing of this ISO? [y/N] "))
437 if input == "y" or input == "Y":492 if input == "y" or input == "Y":
438 td.launch_usb_creator()493 td.launch_usb_creator()
439 else:494 else:
440495
=== modified file 'bin/testdrive-gtk'
--- bin/testdrive-gtk 2013-08-10 20:52:38 +0000
+++ bin/testdrive-gtk 2013-10-06 20:59:44 +0000
@@ -2,20 +2,20 @@
2# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-2# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3### BEGIN LICENSE3### BEGIN LICENSE
4# Copyright (C) 2010 Canonical Ltd.4# Copyright (C) 2010 Canonical Ltd.
5# 5#
6# Authors:6# Authors:
7# Andres Rodriguez <andreserl@ubuntu.com>7# Andres Rodriguez <andreserl@ubuntu.com>
8# 8#
9# This program is free software: you can redistribute it and/or modify it 9# This program is free software: you can redistribute it and/or modify it
10# under the terms of the GNU General Public License version 3, as published 10# under the terms of the GNU General Public License version 3, as published
11# by the Free Software Foundation.11# by the Free Software Foundation.
12# 12#
13# This program is distributed in the hope that it will be useful, but 13# This program is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranties of 14# WITHOUT ANY WARRANTY; without even the implied warranties of
15# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 15# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
16# PURPOSE. See the GNU General Public License for more details.16# PURPOSE. See the GNU General Public License for more details.
17# 17#
18# You should have received a copy of the GNU General Public License along 18# You should have received a copy of the GNU General Public License along
19# with this program. If not, see <http://www.gnu.org/licenses/>.19# with this program. If not, see <http://www.gnu.org/licenses/>.
20### END LICENSE20### END LICENSE
2121
@@ -25,28 +25,30 @@
25import time25import time
2626
27import gettext27import gettext
28from gettext import gettext as _28_ = gettext.gettext
29gettext.textdomain('testdrive')29gettext.textdomain('testdrive')
3030
31from testdrive import testdrive31from testdrive import testdrive
32from testdrive.virt import kvm, parallels, virtualbox32from testdrive.virt import kvm, parallels, virtualbox
33import threading, subprocess, commands33import threading
34import random34import subprocess
35import commands
36#import random
35import re37import re
3638
37gtk.gdk.threads_init()39gtk.gdk.threads_init()
3840
39TAB_LABEL = []41TAB_LABEL = []
40TAB_LABEL.append({"dist":"ubuntu", "label":"Ubuntu"})42TAB_LABEL.append({"dist": "ubuntu", "label": "Ubuntu"})
41TAB_LABEL.append({"dist":"kubuntu", "label":"Kubuntu"})43TAB_LABEL.append({"dist": "kubuntu", "label": "Kubuntu"})
42TAB_LABEL.append({"dist":"xubuntu", "label":"Xubuntu"})44TAB_LABEL.append({"dist": "xubuntu", "label": "Xubuntu"})
43TAB_LABEL.append({"dist":"ubuntu-server", "label":"Server"})45TAB_LABEL.append({"dist": "ubuntu-server", "label": "Server"})
44TAB_LABEL.append({"dist":"edubuntu", "label":"Edubuntu"})46TAB_LABEL.append({"dist": "edubuntu", "label": "Edubuntu"})
45TAB_LABEL.append({"dist":"mythbuntu", "label":"Mythbuntu"})47TAB_LABEL.append({"dist": "mythbuntu", "label": "Mythbuntu"})
46TAB_LABEL.append({"dist":"ubuntustudio", "label":"Ubuntu Studio"})48TAB_LABEL.append({"dist": "ubuntustudio", "label": "Ubuntu Studio"})
47TAB_LABEL.append({"dist":"lubuntu", "label":"Lubuntu"})49TAB_LABEL.append({"dist": "lubuntu", "label": "Lubuntu"})
48TAB_LABEL.append({"dist":"ubuntukylin", "label":"UbuntuKylin"})50TAB_LABEL.append({"dist": "ubuntukylin", "label": "UbuntuKylin"})
49TAB_LABEL.append({"dist":"other", "label":_("Other")})51TAB_LABEL.append({"dist": "other", "label": _("Other")})
5052
51global ISOLIST53global ISOLIST
5254
@@ -57,9 +59,9 @@
57 os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))))59 os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))))
5860
59if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'testdrivegtk'))61if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'testdrivegtk'))
60 and PROJECT_ROOT_DIRECTORY not in sys.path):62 and PROJECT_ROOT_DIRECTORY not in sys.path):
61 sys.path.insert(0, PROJECT_ROOT_DIRECTORY)63 sys.path.insert(0, PROJECT_ROOT_DIRECTORY)
62 os.putenv('PYTHONPATH', PROJECT_ROOT_DIRECTORY) # for subprocesses64 os.putenv('PYTHONPATH', PROJECT_ROOT_DIRECTORY) # for subprocesses
6365
64try:66try:
65 import pynotify67 import pynotify
@@ -70,7 +72,8 @@
70 notifications_available = False72 notifications_available = False
7173
72from testdrivegtk import (74from testdrivegtk import (
73 AboutTestdrivegtkDialog, PreferencesTestdrivegtkDialog, AddOtherTestdrivegtkDialog)75 AboutTestdrivegtkDialog, PreferencesTestdrivegtkDialog,
76 AddOtherTestdrivegtkDialog)
74from testdrivegtk.helpers import get_builder77from testdrivegtk.helpers import get_builder
7578
76try:79try:
@@ -93,7 +96,7 @@
93class TestdrivegtkWindow(gtk.Window):96class TestdrivegtkWindow(gtk.Window):
94 __gtype_name__ = "TestdrivegtkWindow"97 __gtype_name__ = "TestdrivegtkWindow"
9598
96 # To construct a new instance of this method, the following notable 99 # To construct a new instance of this method, the following notable
97 # methods are called in this order:100 # methods are called in this order:
98 # __new__(cls)101 # __new__(cls)
99 # __init__(self)102 # __init__(self)
@@ -104,7 +107,7 @@
104 # your inialization code in finish_intializing107 # your inialization code in finish_intializing
105108
106 def __new__(cls):109 def __new__(cls):
107 """Special static method that's automatically called by Python when 110 """Special static method that's automatically called by Python when
108 constructing a new instance of this class.111 constructing a new instance of this class.
109112
110 Returns a fully instantiated TestdrivegtkWindow object.113 Returns a fully instantiated TestdrivegtkWindow object.
@@ -166,8 +169,10 @@
166 self.application_indicator_menu()169 self.application_indicator_menu()
167170
168 def application_indicator_menu(self):171 def application_indicator_menu(self):
169 self.appindicator = appindicator.Indicator ("testdrive", "indicator-messages", appindicator.CATEGORY_APPLICATION_STATUS)172 self.appindicator = appindicator.Indicator(
170 self.appindicator.set_status (appindicator.STATUS_PASSIVE)173 "testdrive", "indicator-messages",
174 appindicator.CATEGORY_APPLICATION_STATUS)
175 self.appindicator.set_status(appindicator.STATUS_PASSIVE)
171 #self.appindicator.set_icon("testdrive-indicator")176 #self.appindicator.set_icon("testdrive-indicator")
172 self.appindicator.set_icon("testdrive-attention")177 self.appindicator.set_icon("testdrive-attention")
173 #self.appindicator.set_attention_icon("distributor-logo")178 #self.appindicator.set_attention_icon("distributor-logo")
@@ -175,7 +180,8 @@
175 # create a menu180 # create a menu
176 self.app_indicator_menu = gtk.Menu()181 self.app_indicator_menu = gtk.Menu()
177182
178 # create items for the menu - labels, checkboxes, radio buttons and images are supported:183 # create items for the menu - labels, checkboxes,
184 # radio buttons and images are supported:
179 item = gtk.MenuItem("Pre-release available for testing!")185 item = gtk.MenuItem("Pre-release available for testing!")
180 item.connect("activate", self.on_indicator_message_clicked, item)186 item.connect("activate", self.on_indicator_message_clicked, item)
181 item.show()187 item.show()
@@ -189,8 +195,10 @@
189 self.app_indicator_menu.show()195 self.app_indicator_menu.show()
190 self.appindicator.set_menu(self.app_indicator_menu)196 self.appindicator.set_menu(self.app_indicator_menu)
191197
192 gobject.timeout_add_seconds(self.timea, self.on_check_qa_releases_available, self.timea)198 gobject.timeout_add_seconds(
193 gobject.timeout_add_seconds(self.timeb, self.on_check_qa_releases_available, self.timeb)199 self.timea, self.on_check_qa_releases_available, self.timea)
200 gobject.timeout_add_seconds(
201 self.timeb, self.on_check_qa_releases_available, self.timeb)
194202
195 # Initializes the indicator203 # Initializes the indicator
196 def messaging_indicator_menu(self):204 def messaging_indicator_menu(self):
@@ -204,25 +212,34 @@
204212
205 # Initializes the Indicator213 # Initializes the Indicator
206 self.indicator = indicate.Indicator()214 self.indicator = indicate.Indicator()
207 self.indicator.set_property("name", "Pre-release available for testing!")215 self.indicator.set_property(
216 "name", "Pre-release available for testing!")
208 self.indicator.set_property_time("time", time.time())217 self.indicator.set_property_time("time", time.time())
209 #indicator.show()218 #indicator.show()
210219
211 self.indicator.connect("user-display", self.on_indicator_message_clicked)220 self.indicator.connect(
221 "user-display", self.on_indicator_message_clicked)
212222
213 # Checks every 3600 seconds - hour - (If TestDrive is open that long)223 # Checks every 3600 seconds - hour - (If TestDrive is open that long)
214 gobject.timeout_add_seconds(self.timea, self.on_check_qa_releases_available, self.timea)224 gobject.timeout_add_seconds(
215 gobject.timeout_add_seconds(self.timeb, self.on_check_qa_releases_available, self.timeb)225 self.timea, self.on_check_qa_releases_available, self.timea)
226 gobject.timeout_add_seconds(
227 self.timeb, self.on_check_qa_releases_available, self.timeb)
216228
217 # Checks for the availability of ISOs at iso.qa.ubuntu.com and displays notification if so.229 # Checks for the availability of ISOs at iso.qa.ubuntu.com
230 # and displays notification if so.
218 def on_check_qa_releases_available(self, time):231 def on_check_qa_releases_available(self, time):
219 output = ""232 output = ""
220 if self.notified is True:233 if self.notified is True:
221 return False234 return False
222 logging.info(_("Checking available ISOs at the ISO tracker [http://iso.qa.ubuntu.com] every %s seconds") % time)235 logging.info(_("Checking available ISOs at the ISO tracker "
236 "[http://iso.qa.ubuntu.com] every %s seconds") % time)
223 try:237 try:
224 #(status, output) = commands.getstatusoutput("wget -q -O- http://iso.qa.ubuntu.com/qatracker/dllist")238 #(status, output) = commands.getstatusoutput(
225 (status, output) = commands.getstatusoutput("wget -q -O- http://iso.qa.ubuntu.com/qatracker | egrep 'iso.qa.ubuntu.com/qatracker/test'")239 # "wget -q -O- http://iso.qa.ubuntu.com/qatracker/dllist")
240 (status, output) = commands.getstatusoutput(
241 "wget -q -O- http://iso.qa.ubuntu.com/qatracker | egrep "
242 "'iso.qa.ubuntu.com/qatracker/test'")
226 except:243 except:
227 logging.error(_("Unable to check the ISO tracker"))244 logging.error(_("Unable to check the ISO tracker"))
228245
@@ -231,7 +248,9 @@
231 global notifications_available248 global notifications_available
232 if notifications_available:249 if notifications_available:
233 # Notification250 # Notification
234 self.notification = pynotify.Notification("TestDrive an Ubuntu ISO!", "Pre-release available for testing!", imageURI)251 self.notification = pynotify.Notification(
252 "TestDrive an Ubuntu ISO!",
253 "Pre-release available for testing!", imageURI)
235 self.notification.show()254 self.notification.show()
236 global message_indicator255 global message_indicator
237 if message_indicator:256 if message_indicator:
@@ -248,7 +267,8 @@
248267
249 return True268 return True
250269
251 # Click event for Indicator: Opens website when the notification is being clicked.270 # Click event for Indicator:
271 # Opens website when the notification is being clicked.
252 def on_indicator_message_clicked(self, indicator, timestamp):272 def on_indicator_message_clicked(self, indicator, timestamp):
253 webbrowser.open("http://iso.qa.ubuntu.com/")273 webbrowser.open("http://iso.qa.ubuntu.com/")
254 if message_indicator:274 if message_indicator:
@@ -287,8 +307,10 @@
287307
288 # Obtain preferences308 # Obtain preferences
289 td = prefs.get_preferences()309 td = prefs.get_preferences()
290 # If Repo (p), Release, Arch (m), Flavor, or ISO CACHE are different, then, regenerate the UI310 # If Repo (p), Release, Arch (m), Flavor, or ISO CACHE are
291 if self.td.p != td.p or self.td.r != td.r or self.td.m != td.m or self.td.f != td.f or self.td.CACHE_ISO != td.CACHE_ISO:311 # different, then, regenerate the UI
312 if self.td.p != td.p or self.td.r != td.r or self.td.m != td.m or \
313 self.td.f != td.f or self.td.CACHE_ISO != td.CACHE_ISO:
292 ui_recreate = True314 ui_recreate = True
293 # Update preferences315 # Update preferences
294 self.td = td316 self.td = td
@@ -302,7 +324,8 @@
302324
303 def new_other_iso(self, widget, data=None):325 def new_other_iso(self, widget, data=None):
304 """Display Add Other ISO dialog"""326 """Display Add Other ISO dialog"""
305 other = AddOtherTestdrivegtkDialog.AddOtherTestdrivegtkDialog(self.td.CACHE)327 other = AddOtherTestdrivegtkDialog.AddOtherTestdrivegtkDialog(
328 self.td.CACHE)
306 other.set_title(_("Add an ISO to TestDrive"))329 other.set_title(_("Add an ISO to TestDrive"))
307 response = other.run()330 response = other.run()
308 if response == gtk.RESPONSE_OK:331 if response == gtk.RESPONSE_OK:
@@ -319,9 +342,10 @@
319 ###################################################################342 ###################################################################
320343
321 if commands.getstatusoutput("which testdrive")[0] != 0:344 if commands.getstatusoutput("which testdrive")[0] != 0:
322 self.on_error_dialog( _("Unable to open because 'testdrive' is not installed.\n"345 self.on_error_dialog(_("Unable to open because 'testdrive' "
323 "Please install testdrive: \n\n"346 "is not installed.\n"
324 "sudo apt-get install testdrive-cli"))347 "Please install testdrive: \n\n"
348 "sudo apt-get install testdrive-cli"))
325 return349 return
326 title = _("TestDrive an ISO or Disk Image")350 title = _("TestDrive an ISO or Disk Image")
327 filename = None351 filename = None
@@ -329,15 +353,19 @@
329 testdrives.add_pattern("*.iso")353 testdrives.add_pattern("*.iso")
330 testdrives.add_pattern("*.img")354 testdrives.add_pattern("*.img")
331355
332 chooser = gtk.FileChooserDialog(title,action=gtk.FILE_CHOOSER_ACTION_SAVE,356 chooser = gtk.FileChooserDialog(
333 buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))357 title, action=gtk.FILE_CHOOSER_ACTION_SAVE,
358 buttons=(
359 gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
360 gtk.STOCK_OPEN, gtk.RESPONSE_OK))
334 chooser.add_filter(testdrives)361 chooser.add_filter(testdrives)
335 # Run Chooser Dialog362 # Run Chooser Dialog
336 response = chooser.run()363 response = chooser.run()
337364
338 if response == gtk.RESPONSE_OK:365 if response == gtk.RESPONSE_OK:
339 filename = chooser.get_filename()366 filename = chooser.get_filename()
340 subprocess.Popen(['testdrive', '-u', filename], stdout=subprocess.PIPE)367 subprocess.Popen([
368 'testdrive', '-u', filename], stdout=subprocess.PIPE)
341 pass369 pass
342 chooser.destroy()370 chooser.destroy()
343371
@@ -350,31 +378,31 @@
350 # Clean up code for saving application state should be added here.378 # Clean up code for saving application state should be added here.
351 # Stop all the syncs and launched ISOs379 # Stop all the syncs and launched ISOs
352 for t in self.isos_to_run:380 for t in self.isos_to_run:
353 if t[0] != None:381 if t[0] is not None:
354 t[0].stop()382 t[0].stop()
355 if t[1] != None:383 if t[1] is not None:
356 t[1].stop()384 t[1].stop()
357 # Class function to cleanup the IMG Cache385 # Class function to cleanup the IMG Cache
358 self.cleanup_img_cache()386 self.cleanup_img_cache()
359 gtk.main_quit()387 gtk.main_quit()
360388
361 def on_warn_dialog(self, data=None):389 def on_warn_dialog(self, data=None):
362 warnbox = gtk.MessageDialog(self, 390 warnbox = gtk.MessageDialog(
363 gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_WARNING, 391 self, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_WARNING,
364 gtk.BUTTONS_CLOSE, data)392 gtk.BUTTONS_CLOSE, data)
365 warnbox.run()393 warnbox.run()
366 warnbox.destroy()394 warnbox.destroy()
367395
368 def on_error_dialog(self, data=None):396 def on_error_dialog(self, data=None):
369 errorbox = gtk.MessageDialog(self, 397 errorbox = gtk.MessageDialog(
370 gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, 398 self, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR,
371 gtk.BUTTONS_CLOSE, data)399 gtk.BUTTONS_CLOSE, data)
372 errorbox.run()400 errorbox.run()
373 errorbox.destroy()401 errorbox.destroy()
374402
375 def on_info_dialog(self, data=None):403 def on_info_dialog(self, data=None):
376 infobox = gtk.MessageDialog(self, 404 infobox = gtk.MessageDialog(
377 gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, 405 self, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO,
378 gtk.BUTTONS_CLOSE, data)406 gtk.BUTTONS_CLOSE, data)
379 infobox.run()407 infobox.run()
380 infobox.destroy()408 infobox.destroy()
@@ -387,7 +415,8 @@
387 imagelist = os.listdir(self.td.CACHE_IMG)415 imagelist = os.listdir(self.td.CACHE_IMG)
388 for disk in imagelist:416 for disk in imagelist:
389 path = "%s/%s" % (self.td.CACHE_IMG, disk)417 path = "%s/%s" % (self.td.CACHE_IMG, disk)
390 (status, output) = commands.getstatusoutput("file %s | grep -qs 'empty'" % path)418 (status, output) = commands.getstatusoutput(
419 "file %s | grep -qs 'empty'" % path)
391 if status == 0:420 if status == 0:
392 os.unlink(path)421 os.unlink(path)
393 for disk in self.isos_to_run:422 for disk in self.isos_to_run:
@@ -401,7 +430,8 @@
401 logging.info(_("Obtaining the sync protocol for the specified ISO..."))430 logging.info(_("Obtaining the sync protocol for the specified ISO..."))
402 cmd = self.td.get_proto()431 cmd = self.td.get_proto()
403 if cmd == 1:432 if cmd == 1:
404 self.on_error_dialog(_("Unsupported protocol [%s]") % self.td.PROTO)433 self.on_error_dialog(_(
434 "Unsupported protocol [%s]") % self.td.PROTO)
405 if cmd != 0:435 if cmd != 0:
406 return cmd436 return cmd
407 return False437 return False
@@ -416,18 +446,22 @@
416 if not self.td.VIRT:446 if not self.td.VIRT:
417 self.td.VIRT = self.td.get_virt()447 self.td.VIRT = self.td.get_virt()
418 if self.td.VIRT == 1:448 if self.td.VIRT == 1:
419 logging.error(_("Your CPU supports KVM acceleration; please install KVM"))449 logging.error(_("Your CPU supports KVM acceleration; "
420 self.on_warn_dialog( _("Your CPU supports KVM acceleration; please install KVM:"450 "please install KVM"))
421 "\n\n"451 self.on_warn_dialog(_("Your CPU supports KVM acceleration; "
422 "sudo apt-get install qemu-kvm"))452 "please install KVM:"
453 "\n\n"
454 "sudo apt-get install qemu-kvm"))
423 if self.td.VIRT == 0:455 if self.td.VIRT == 0:
424 logging.error(_("Your CPU does not support acceleration; run kvm-ok for more information; then install VBox"))456 logging.error(_("Your CPU does not support acceleration; "
425 self.on_warn_dialog( _("Your CPU does not support acceleration; run kvm-ok for more information;\n"457 "run kvm-ok for more information; then install VBox"))
426 "then please install VirtualBox"458 self.on_warn_dialog(_("Your CPU does not support acceleration; "
427 "\n\n"459 "run kvm-ok for more information;\n"
428 "kvm-ok"460 "then please install VirtualBox"
429 "\n"461 "\n\n"
430 "sudo apt-get install virtualbox"))462 "kvm-ok"
463 "\n"
464 "sudo apt-get install virtualbox"))
431465
432 def obtain_isos_list(self):466 def obtain_isos_list(self):
433 ###################################################################467 ###################################################################
@@ -439,8 +473,10 @@
439 try:473 try:
440 isos = self.td.get_ubuntu_iso_list()474 isos = self.td.get_ubuntu_iso_list()
441 except:475 except:
442 logging.error(_("Unable to retrieve the Ubuntu ISO list from cache..."))476 logging.error(_(
443 self.on_error_dialog(_("Unable to retrieve the Ubuntu ISO list from cache..."))477 "Unable to retrieve the Ubuntu ISO list from cache..."))
478 self.on_error_dialog(_(
479 "Unable to retrieve the Ubuntu ISO list from cache..."))
444 return []480 return []
445 return isos481 return isos
446482
@@ -461,12 +497,14 @@
461 # Processing ISOS from file into ISO list497 # Processing ISOS from file into ISO list
462 for iso in ISOS:498 for iso in ISOS:
463 category = iso.split()[0]499 category = iso.split()[0]
464 distro = iso.split()[1] #This will be the distro showed instead of arch500 #This will be the distro showed instead of arch
501 distro = iso.split()[1]
465 url = iso.split()[2]502 url = iso.split()[2]
466 if url.partition("://")[0] == "wget":503 if url.partition("://")[0] == "wget":
467 url = url.replace('wget', 'http')504 url = url.replace('wget', 'http')
468 name = iso.split()[3]505 name = iso.split()[3]
469 ISO.append({"name":name, "url":url, "arch":distro, "category":category})506 ISO.append({"name": name, "url": url,
507 "arch": distro, "category": category})
470 return ISO508 return ISO
471509
472 def on_distro_tab_change(self, widget, none=None, current_page=None):510 def on_distro_tab_change(self, widget, none=None, current_page=None):
@@ -491,7 +529,7 @@
491 self.create_iso_menu(ISO)529 self.create_iso_menu(ISO)
492 self.update_status_bar()530 self.update_status_bar()
493531
494 def create_iso_menu(self, iso_list = None):532 def create_iso_menu(self, iso_list=None):
495 ###################################################################533 ###################################################################
496 ############ Creates all the Distro Tabs and the ISO's ############534 ############ Creates all the Distro Tabs and the ISO's ############
497 ###################################################################535 ###################################################################
@@ -542,7 +580,7 @@
542 vbox = gtk.VBox()580 vbox = gtk.VBox()
543 scroll.add_with_viewport(vbox)581 scroll.add_with_viewport(vbox)
544 scroll.get_children()[0].set_shadow_type(gtk.SHADOW_NONE)582 scroll.get_children()[0].set_shadow_type(gtk.SHADOW_NONE)
545 scroll.set_policy(gtk.POLICY_NEVER,gtk.POLICY_AUTOMATIC)583 scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
546 scroll.show()584 scroll.show()
547 for arch in self.td.m:585 for arch in self.td.m:
548 c = 0586 c = 0
@@ -555,30 +593,45 @@
555 if iso['category'] == dist and iso['arch'] == arch:593 if iso['category'] == dist and iso['arch'] == arch:
556 c = c + 1594 c = c + 1
557 table = gtk.Table(2, 3, False)595 table = gtk.Table(2, 3, False)
558 lb_iso_name = gtk.CheckButton("%s - (%s)" % (iso["name"], self.td.r))596 lb_iso_name = gtk.CheckButton("%s - (%s)" % (
597 iso["name"], self.td.r))
559 lb_iso_name.show()598 lb_iso_name.show()
560 filename = os.path.basename(iso["url"])599 filename = os.path.basename(iso["url"])
561 path = "%s/%s_%s" % (self.td.CACHE_ISO, iso["category"], filename)600 path = "%s/%s_%s" % (self.td.CACHE_ISO,
601 iso["category"], filename)
562 if os.path.exists(path):602 if os.path.exists(path):
563 lb_cache = gtk.Label(_("<i> CACHE: [%s]</i>") % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(os.path.getmtime(path)))))603 lb_cache = gtk.Label(_(
604 "<i> CACHE: [%s]</i>") % (time.strftime(
605 "%Y-%m-%d %H:%M:%S", time.localtime(
606 os.path.getmtime(path)))))
564 else:607 else:
565 lb_cache = gtk.Label(_("<i> CACHE: [empty]</i>"))608 lb_cache = gtk.Label(_(
609 "<i> CACHE: [empty]</i>"))
566 lb_cache.set_use_markup(True)610 lb_cache.set_use_markup(True)
567 # To align to righ otherwise it is centered611 # To align to righ otherwise it is centered
568 lb_cache.set_alignment(0,0)612 lb_cache.set_alignment(0, 0)
569 lb_cache.show()613 lb_cache.show()
570 # Adding the Spiiner614 # Adding the Spiiner
571 spin = gtk.Spinner()615 spin = gtk.Spinner()
572 spin.set_size_request(18, -1);616 spin.set_size_request(18, -1)
573 spin.hide()617 spin.hide()
574 #lb_iso_name.connect("clicked", self.on_select_iso_clicked, spin, lb_cache, iso["url"], iso["category"], vm_id)618 #lb_iso_name.connect(
575 lb_iso_name.connect("clicked", self.on_select_iso_clicked, vm_id)619 # "clicked", self.on_select_iso_clicked, spin,
576 ISOLIST.append({"vm_id":vm_id, "url":iso["url"], "prefix":iso["category"], "spinner":spin, "lb_status":lb_cache})620 # lb_cache, iso["url"], iso["category"], vm_id)
621 lb_iso_name.connect(
622 "clicked", self.on_select_iso_clicked, vm_id)
623 ISOLIST.append({"vm_id": vm_id, "url": iso["url"],
624 "prefix": iso["category"], "spinner":
625 spin, "lb_status": lb_cache})
577 vm_id += 1626 vm_id += 1
578 table.attach(lb_iso_name, 0, 3, 0, 1, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND)627 table.attach(lb_iso_name, 0, 3, 0, 1, gtk.FILL |
579 table.attach(spin, 0, 1, 1, 2, gtk.FILL, gtk.FILL | gtk.EXPAND)628 gtk.EXPAND, gtk.FILL | gtk.EXPAND)
580 table.attach(lb_cache, 1, 2, 1, 2, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND, 0, 5)629 table.attach(spin, 0, 1, 1, 2, gtk.FILL,
581 #table.attach(lb_progress, 2, 3, 1, 2, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND)630 gtk.FILL | gtk.EXPAND)
631 table.attach(lb_cache, 1, 2, 1, 2, gtk.FILL |
632 gtk.EXPAND, gtk.FILL | gtk.EXPAND, 0, 5)
633 #table.attach(lb_progress, 2, 3, 1, 2, gtk.FILL |
634 # gtk.EXPAND, gtk.FILL | gtk.EXPAND)
582 table.show()635 table.show()
583 viewport = gtk.Viewport()636 viewport = gtk.Viewport()
584 viewport.add(table)637 viewport.add(table)
@@ -593,27 +646,42 @@
593 lb_iso_name = gtk.CheckButton("%s" % iso["name"])646 lb_iso_name = gtk.CheckButton("%s" % iso["name"])
594 lb_iso_name.show()647 lb_iso_name.show()
595 filename = os.path.basename(iso["url"])648 filename = os.path.basename(iso["url"])
596 path = "%s/%s_%s" % (self.td.CACHE_ISO, iso["category"], filename)649 path = "%s/%s_%s" % (self.td.CACHE_ISO,
650 iso["category"], filename)
597 if os.path.exists(path):651 if os.path.exists(path):
598 lb_cache = gtk.Label(_("<i> CACHE: [%s]</i>") % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(os.path.getmtime(path)))))652 lb_cache = gtk.Label(_("<i> CACHE: [%s]</i>")
653 % (time.strftime("%Y-%m-%d %H"
654 ":%M:%S", time.localtime(
655 os.path.getmtime(path)))))
599 else:656 else:
600 lb_cache = gtk.Label(_("<i> CACHE: [empty]</i>"))657 lb_cache = gtk.Label(_(
658 "<i> CACHE: [empty]</i>"))
601 lb_cache.set_use_markup(True)659 lb_cache.set_use_markup(True)
602 # To align to righ otherwise it is centered660 # To align to right otherwise it is centered
603 lb_cache.set_alignment(0,0)661 lb_cache.set_alignment(0, 0)
604 lb_cache.show()662 lb_cache.show()
605 # Adding the Spiiner663 # Adding the Spiiner
606 spin = gtk.Spinner()664 spin = gtk.Spinner()
607 spin.set_size_request(18, -1);665 spin.set_size_request(18, -1)
608 spin.hide()666 spin.hide()
609 #lb_iso_name.connect("clicked", self.on_select_iso_clicked, spin, lb_cache, iso["url"], iso["category"], vm_id)667 #lb_iso_name.connect("clicked",
610 lb_iso_name.connect("clicked", self.on_select_iso_clicked, vm_id)668 # self.on_select_iso_clicked, spin,
611 ISOLIST.append({"vm_id":vm_id, "url":iso["url"], "prefix":iso["category"], "spinner":spin, "lb_status":lb_cache})669 # lb_cache, iso["url"],
670 # iso["category"], vm_id)
671 lb_iso_name.connect("clicked",
672 self.on_select_iso_clicked, vm_id)
673 ISOLIST.append({"vm_id": vm_id, "url": iso["url"],
674 "prefix": iso["category"], "spinner":
675 spin, "lb_status": lb_cache})
612 vm_id += 1676 vm_id += 1
613 table.attach(lb_iso_name, 0, 3, 0, 1, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND)677 table.attach(lb_iso_name, 0, 3, 0, 1, gtk.FILL |
614 table.attach(spin, 0, 1, 1, 2, gtk.FILL, gtk.FILL | gtk.EXPAND)678 gtk.EXPAND, gtk.FILL | gtk.EXPAND)
615 table.attach(lb_cache, 1, 2, 1, 2, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND, 0, 5)679 table.attach(spin, 0, 1, 1, 2, gtk.FILL,
616 #table.attach(lb_progress, 2, 3, 1, 2, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND)680 gtk.FILL | gtk.EXPAND)
681 table.attach(lb_cache, 1, 2, 1, 2, gtk.FILL |
682 gtk.EXPAND, gtk.FILL | gtk.EXPAND, 0, 5)
683 #table.attach(lb_progress, 2, 3, 1, 2, gtk.FILL |
684 # gtk.EXPAND, gtk.FILL | gtk.EXPAND)
617 table.show()685 table.show()
618 viewport = gtk.Viewport()686 viewport = gtk.Viewport()
619 viewport.add(table)687 viewport.add(table)
@@ -625,10 +693,12 @@
625 if c == 0:693 if c == 0:
626 if dist == 'other':694 if dist == 'other':
627 no_isos_label = gtk.Label()695 no_isos_label = gtk.Label()
628 no_isos_label.set_markup(_("<b><i>There are no Other ISOs yet...</i></b>"))696 no_isos_label.set_markup(_("<b><i>There are no Other "
697 "ISOs yet...</i></b>"))
629 else:698 else:
630 no_isos_label = gtk.Label()699 no_isos_label = gtk.Label()
631 no_isos_label.set_markup(_("<b><i>There are no ISOs for this architecture yet...</i></b>"))700 no_isos_label.set_markup(_("<b><i>There are no ISOs "
701 "for this architecture yet...</i></b>"))
632 no_isos_label.show()702 no_isos_label.show()
633 vbox2.add(no_isos_label)703 vbox2.add(no_isos_label)
634704
@@ -637,7 +707,8 @@
637 if dist != 'other':707 if dist != 'other':
638 fr_arch.add(vbox2)708 fr_arch.add(vbox2)
639 fr_arch.show()709 fr_arch.show()
640 vbox.pack_start(fr_arch, expand=False, fill=False, padding=0)710 vbox.pack_start(
711 fr_arch, expand=False, fill=False, padding=0)
641 vbox.show()712 vbox.show()
642 else:713 else:
643 vbox.pack_start(vbox2, expand=False, fill=False, padding=0)714 vbox.pack_start(vbox2, expand=False, fill=False, padding=0)
@@ -647,7 +718,8 @@
647 # Create Tabs718 # Create Tabs
648 for lb_iso_name in TAB_LABEL:719 for lb_iso_name in TAB_LABEL:
649 if dist == lb_iso_name["dist"]:720 if dist == lb_iso_name["dist"]:
650 self.notebook.append_page(scroll, gtk.Label(lb_iso_name["label"]))721 self.notebook.append_page(
722 scroll, gtk.Label(lb_iso_name["label"]))
651 break723 break
652 self.notebook.show()724 self.notebook.show()
653725
@@ -670,7 +742,8 @@
670742
671 # Create Buttons743 # Create Buttons
672 button = gtk.Button(_("Create USB Disk"))744 button = gtk.Button(_("Create USB Disk"))
673 button.connect("clicked", self.on_create_iso_disk_clicked, 'Create Disk')745 button.connect(
746 "clicked", self.on_create_iso_disk_clicked, 'Create Disk')
674 button.show()747 button.show()
675 bbox.pack_start(button)748 bbox.pack_start(button)
676749
@@ -687,9 +760,12 @@
687760
688 vbox.pack_start(bbox, True, True)761 vbox.pack_start(bbox, True, True)
689762
690 #def on_select_iso_clicked(self, widget, spin, status_label, url=None, iso_path_header=None, vm_id=None):763 #def on_select_iso_clicked(self, widget, spin, status_label,
691 #ISOLIST.append({"vm_id":vm_id, "url":iso["url"], "prefix":iso["category"], "spin":spin, "lb_status":lb_cache})764 #url=None, iso_path_header=None, vm_id=None):
692 #lb_iso_name.connect("clicked", self.on_select_iso_clicked, spin, lb_cache, iso["url"], iso["category"], vm_id)765 #ISOLIST.append({"vm_id":vm_id, "url":iso["url"],
766 #"prefix":iso["category"], "spin":spin, "lb_status":lb_cache})
767 #lb_iso_name.connect("clicked", self.on_select_iso_clicked,
768 # spin, lb_cache, iso["url"], iso["category"], vm_id)
693 def on_select_iso_clicked(self, widget, vm_id):769 def on_select_iso_clicked(self, widget, vm_id):
694 ###################################################################770 ###################################################################
695 # When ISO is clicked, does the setup to be ready to launch/sync ##771 # When ISO is clicked, does the setup to be ready to launch/sync ##
@@ -704,7 +780,7 @@
704 #ISOLIST[vm_id]["sync_cmd"] # Sync command used780 #ISOLIST[vm_id]["sync_cmd"] # Sync command used
705 #ISOLIST[vm_id]["vbox_name"] # Name for VBOX/Parallels781 #ISOLIST[vm_id]["vbox_name"] # Name for VBOX/Parallels
706 #ISOLIST[vm_id]["virt"] # Holds the Virt Object782 #ISOLIST[vm_id]["virt"] # Holds the Virt Object
707 #ISOLIST[vm_id]["virt_type"] # Defines the type of virt (kvm, vbox, parallels)783 #ISOLIST[vm_id]["virt_type"] # Defines kvm, vbox, or parallels
708784
709 launch_cmd = None785 launch_cmd = None
710 sync_cmd = None786 sync_cmd = None
@@ -716,14 +792,15 @@
716 self.td.set_launch_path()792 self.td.set_launch_path()
717793
718 ISOLIST[vm_id]["path_to_iso"] = self.td.PATH_TO_ISO794 ISOLIST[vm_id]["path_to_iso"] = self.td.PATH_TO_ISO
719 # TODO - This is a workaround to issue of zsync command. See testdrive.py 'cd '%s' && zsync etc etc'795 # TODO - This is a workaround to issue of zsync command.
796 # See testdrive.py 'cd '%s' && zsync etc etc'
720 cmd = self.obtain_sync_protocol_cmd()797 cmd = self.obtain_sync_protocol_cmd()
721 if self.td.PROTO == "zsync":798 if self.td.PROTO == "zsync":
722 ISOLIST[vm_id]["sync_cmd"] = cmd.split("&&")[1].strip()799 ISOLIST[vm_id]["sync_cmd"] = cmd.split("&&")[1].strip()
723 else:800 else:
724 ISOLIST[vm_id]["sync_cmd"] = cmd801 ISOLIST[vm_id]["sync_cmd"] = cmd
725802
726 if widget.get_active() == True:803 if widget.get_active() is True:
727 self.td.DISK_FILE = self.td.create_disk_file()804 self.td.DISK_FILE = self.td.create_disk_file()
728 self.td.VBOX_NAME = "%s-%s" % (self.td.PKG, vm_id)805 self.td.VBOX_NAME = "%s-%s" % (self.td.PKG, vm_id)
729 ISOLIST[vm_id]["vbox_name"] = self.td.VBOX_NAME806 ISOLIST[vm_id]["vbox_name"] = self.td.VBOX_NAME
@@ -733,13 +810,16 @@
733810
734 # Selecting virt method and Instancing VIRT object811 # Selecting virt method and Instancing VIRT object
735 if self.td.VIRT == "kvm":812 if self.td.VIRT == "kvm":
736 logging.info(_("Using KVM for virtual machine hosting..."))813 logging.info(_(
814 "Using KVM for virtual machine hosting..."))
737 virt = kvm.KVM(self.td)815 virt = kvm.KVM(self.td)
738 if self.td.VIRT == "virtualbox":816 if self.td.VIRT == "virtualbox":
739 logging.info(_("Using VirtualBox for virtual machine hosting..."))817 logging.info(_(
818 "Using VirtualBox for virtual machine hosting..."))
740 virt = virtualbox.VBox(self.td)819 virt = virtualbox.VBox(self.td)
741 if self.td.VIRT == "paralels":820 if self.td.VIRT == "paralels":
742 logging.info(_("Using Parallels Desktop for virtual machine hosting..."))821 logging.info(_(
822 "Using Parallels Desktop for virtual machine hosting..."))
743 virt = parallels.Parallels(self.td)823 virt = parallels.Parallels(self.td)
744824
745 # Passing VIRT object to ISOLIST825 # Passing VIRT object to ISOLIST
@@ -749,9 +829,10 @@
749 # Instancing Launch Thread829 # Instancing Launch Thread
750 launch_thread = LaunchThread(vm_id)830 launch_thread = LaunchThread(vm_id)
751831
752 self.isos_to_run.append([sync_thread, launch_thread, self.td.DISK_FILE, status])832 self.isos_to_run.append([
833 sync_thread, launch_thread, self.td.DISK_FILE, status])
753834
754 if widget.get_active() == False:835 if not widget.get_active():
755 for t in self.isos_to_run:836 for t in self.isos_to_run:
756 if t[0].command == ISOLIST[vm_id]["sync_cmd"]:837 if t[0].command == ISOLIST[vm_id]["sync_cmd"]:
757 t[0].stop()838 t[0].stop()
@@ -760,8 +841,8 @@
760 self.td.delete_image()841 self.td.delete_image()
761 self.isos_to_run.remove(t)842 self.isos_to_run.remove(t)
762843
763 ###############################################################################844 #######################################################################
764 # TODO - TODO - TODO - Determine better method to stop des-selected ISO's845 # TODO - Determine better method to stop des-selected ISO's
765 """846 """
766 if widget.get_active() == False:847 if widget.get_active() == False:
767 for t in self.isos_to_run:848 for t in self.isos_to_run:
@@ -814,40 +895,44 @@
814 except:895 except:
815 pass896 pass
816 else:897 else:
817 logging.debug(_("launch_iso: Thread is executing or syncing..."))898 logging.debug(_(
899 "launch_iso: Thread is executing or syncing..."))
818900
819 def on_create_iso_disk_clicked(self, widget, data=None):901 def on_create_iso_disk_clicked(self, widget, data=None):
820 ###################################################################902 ###################################################################
821 ############ Launches USB Creator for the selected ISO ############903 ############ Launches USB Creator for the selected ISO ############
822 ###################################################################904 ###################################################################
823 if not self.isos_to_run:905 if not self.isos_to_run:
824 self.on_error_dialog( _("No ISO has been selected."906 self.on_error_dialog(_("No ISO has been selected."
825 "\n\n"907 "\n\n"
826 "Please select an ISO to create an USB Startup Disk."))908 "Please select an ISO to create an "
909 "USB Startup Disk."))
827 return910 return
828 if len(self.isos_to_run) > 1:911 if len(self.isos_to_run) > 1:
829 self.on_error_dialog( _("More than 1 ISO has been selected."912 self.on_error_dialog(_("More than 1 ISO has been selected."
830 "\n\n"913 "\n\n"
831 "Please select only 1 ISO to continue!"))914 "Please select only 1 ISO to continue!"))
832 return915 return
833 if not os.path.exists(self.td.PATH_TO_ISO):916 if not os.path.exists(self.td.PATH_TO_ISO):
834 self.on_error_dialog( _("The specified ISO does not exist!"917 self.on_error_dialog(_("The specified ISO does not exist!"
835 "\n\n"918 "\n\n"
836 "Please, synchronize the ISO to continue."))919 "Please synchronize the ISO to continue."))
837 return920 return
838 try:921 try:
839 self.p = subprocess.Popen(["usb-creator-gtk", "-i", self.td.PATH_TO_ISO])922 self.p = subprocess.Popen(["usb-creator-gtk", "-i",
923 self.td.PATH_TO_ISO])
840 except:924 except:
841 self.on_error_dialog(_("Unable to launch USB Creator!"))925 self.on_error_dialog(_("Unable to launch USB Creator!"))
842 return926 return
843927
928
844###################################################################929###################################################################
845########## Class that support threading for ISO Syncing ###########930########## Class that support threading for ISO Syncing ###########
846###################################################################931###################################################################
847class SyncThread(threading.Thread):932class SyncThread(threading.Thread):
848 #def __init__(self, label, spinner, progress, cmd, url):933 #def __init__(self, label, spinner, progress, cmd, url):
849 def __init__(self, vm_id):934 def __init__(self, vm_id):
850 threading.Thread.__init__ (self)935 threading.Thread.__init__(self)
851 self.spin = ISOLIST[vm_id]["spinner"]936 self.spin = ISOLIST[vm_id]["spinner"]
852 self.status_label = ISOLIST[vm_id]["lb_status"]937 self.status_label = ISOLIST[vm_id]["lb_status"]
853 self.previous_text = self.status_label.get_text()938 self.previous_text = self.status_label.get_text()
@@ -859,16 +944,19 @@
859944
860 def run(self):945 def run(self):
861 cmd = self.command.split()946 cmd = self.command.split()
862 self.p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines = True)947 self.p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
948 universal_newlines=True)
863 percent = re.compile(r'(\d+)%')949 percent = re.compile(r'(\d+)%')
864 self.status_label.show()950 self.status_label.show()
865 self.spin.show()951 self.spin.show()
866 self.spin.start()952 self.spin.start()
867 text = _(" Downloading %s (0%%)") % os.path.basename(self.url).partition("_")[2]953 text = _(" Downloading %s (0%%)") % os.path.basename(
868 self.status_label.set_markup("<b><span size='10000'>%s</span></b>" % text)954 self.url).partition("_")[2]
955 self.status_label.set_markup(
956 "<b><span size='10000'>%s</span></b>" % text)
869 prev = None957 prev = None
870 while not self.stopthread.isSet():958 while not self.stopthread.isSet():
871 if self.p.poll() != None:959 if self.p.poll() is not None:
872 self.update_status_label()960 self.update_status_label()
873 self.p = None961 self.p = None
874 self.spin.stop()962 self.spin.stop()
@@ -880,12 +968,14 @@
880 #gtk.gdk.threads_leave()968 #gtk.gdk.threads_leave()
881 line = self.p.stdout.readline(1024).strip()969 line = self.p.stdout.readline(1024).strip()
882 match = percent.search(line)970 match = percent.search(line)
883 if match != None:971 if match is not None:
884 cur = match.group(1)972 cur = match.group(1)
885 if prev != cur:973 if prev != cur:
886 prev = match.group(1)974 prev = match.group(1)
887 text = _(" Downloading %s (%s%%)") % (os.path.basename(self.url).partition("_")[2], prev)975 text = _(" Downloading %s (%s%%)") % (os.path.basename(
888 self.status_label.set_markup("<b><span size='10000'>%s</span></b>" % text)976 self.url).partition("_")[2], prev)
977 self.status_label.set_markup(
978 "<b><span size='10000'>%s</span></b>" % text)
889 time.sleep(1)979 time.sleep(1)
890980
891 def stop(self):981 def stop(self):
@@ -902,10 +992,13 @@
902992
903 def update_status_label(self):993 def update_status_label(self):
904 if os.path.exists(self.url):994 if os.path.exists(self.url):
905 self.status_label.set_markup(_("<i> CACHE: [%s]</i>") % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(os.path.getmtime(self.url)))))995 self.status_label.set_markup(_("<i> CACHE: [%s]</i>") % (
996 time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(
997 os.path.getmtime(self.url)))))
906 else:998 else:
907 self.status_label.set_markup(_("<i> CACHE: [empty]</i>"))999 self.status_label.set_markup(_("<i> CACHE: [empty]</i>"))
9081000
1001
909###################################################################1002###################################################################
910########## Class that supports threading for VM Running ###########1003########## Class that supports threading for VM Running ###########
911###################################################################1004###################################################################
@@ -923,9 +1016,9 @@
923 self.p = None1016 self.p = None
9241017
925 def prepare_to_launch_vm(self):1018 def prepare_to_launch_vm(self):
926 ###################################################################1019 ###############################################################
927 ######## Prepare the VM to launch and return launch command #######1020 ##### Prepare the VM to launch and return launch command ######
928 ###################################################################1021 ###############################################################
929 # TODO TODO TODO - Re-add validation1022 # TODO TODO TODO - Re-add validation
930 self.ovirt.validate_virt()1023 self.ovirt.validate_virt()
931 self.ovirt.setup_virt()1024 self.ovirt.setup_virt()
@@ -945,8 +1038,9 @@
9451038
946 if self.virt == 'kvm':1039 if self.virt == 'kvm':
947 while not self.stopthread.isSet():1040 while not self.stopthread.isSet():
948 if self.p.poll() != None:1041 if self.p.poll() is not None:
949 self.status_label.set_markup("<i>%s</i>" % self.previous_text)1042 self.status_label.set_markup(
1043 "<i>%s</i>" % self.previous_text)
950 self.p = None1044 self.p = None
951 break1045 break
952 time.sleep(0.1)1046 time.sleep(0.1)
@@ -954,16 +1048,20 @@
954 elif self.virt == 'virtualbox':1048 elif self.virt == 'virtualbox':
955 time.sleep(5)1049 time.sleep(5)
956 while not self.stopthread.isSet():1050 while not self.stopthread.isSet():
957 if commands.getstatusoutput("VBoxManage list runningvms | grep -qs %s" % self.VBOX_NAME)[0] != 0:1051 if commands.getstatusoutput("VBoxManage list runningvms | "
958 self.status_label.set_markup("<i>%s</i>" % self.previous_text)1052 "grep -qs %s" % self.VBOX_NAME)[0] != 0:
1053 self.status_label.set_markup("<i>%s</i>"
1054 % self.previous_text)
959 self.p = None1055 self.p = None
960 break1056 break
961 time.sleep(2)1057 time.sleep(2)
9621058
963 elif self.virt == 'parallels':1059 elif self.virt == 'parallels':
964 while not self.stopthread.isSet():1060 while not self.stopthread.isSet():
965 if commands.getstatusoutput("prlctl list %s | grep -qs stopped" % td.VBOX_NAME)[0] == 0:1061 if commands.getstatusoutput("prlctl list %s | grep -qs stopped"
966 self.status_label.set_markup("<i>%s</i>" % self.previous_text)1062 % td.VBOX_NAME)[0] == 0:
1063 self.status_label.set_markup(
1064 "<i>%s</i>" % self.previous_text)
967 self.p = None1065 self.p = None
968 break1066 break
969 time.sleep(2)1067 time.sleep(2)
9701068
=== modified file 'debian/changelog'
--- debian/changelog 2013-09-28 02:34:10 +0000
+++ debian/changelog 2013-10-06 20:59:44 +0000
@@ -2,15 +2,13 @@
22
3 * Fixed VirtualBox PAE option bug. LP: #9407553 * Fixed VirtualBox PAE option bug. LP: #940755
4 Thanks Ben Blankley4 Thanks Ben Blankley
5 * Follow pep8 standards
6 * debian/copyright: Add testdrivegtk/AddOtherTestdrivegtkDialog.py
7 * debian/control: Add working VCS fields
8 * debian/release.sh: Update current ubuntu release
59
6 -- Jackson Doak <noskcaj@ubuntu.com> Sat, 28 Sep 2013 12:30:24 +100010 -- Jackson Doak <noskcaj@ubuntu.com> Sat, 28 Sep 2013 12:30:24 +1000
711
8testdrive (3.25) unreleased; urgency=low
9
10 * UNRELEASED
11
12 -- Dustin Kirkland <kirkland@ubuntu.com> Tue, 27 Aug 2013 11:31:59 -0500
13
14testdrive (3.24-0ubuntu1) saucy; urgency=low12testdrive (3.24-0ubuntu1) saucy; urgency=low
1513
16 [ Jackson Doak ]14 [ Jackson Doak ]
1715
=== modified file 'debian/control'
--- debian/control 2013-08-27 16:23:53 +0000
+++ debian/control 2013-10-06 20:59:44 +0000
@@ -6,7 +6,8 @@
6Build-Depends: debhelper (>= 9), gettext-base, python (>= 2.6.6-3~), python-distutils-extra (>= 2.10)6Build-Depends: debhelper (>= 9), gettext-base, python (>= 2.6.6-3~), python-distutils-extra (>= 2.10)
7X-Python-Version: >= 2.67X-Python-Version: >= 2.6
8Homepage: http://launchpad.net/testdrive8Homepage: http://launchpad.net/testdrive
9Vcs-Bzr: http://bazaar.launchpad.net/~kirkland/testdrive/trunk9Vcs-Bzr: bzr://bazaar.launchpad.net/+branch/testdrive/
10Vcr-Browser: https://code.launchpad.net/~testdrive/testdrive/trunk
1011
11Package: testdrive12Package: testdrive
12Architecture: all13Architecture: all
1314
=== modified file 'debian/copyright'
--- debian/copyright 2013-08-13 06:10:36 +0000
+++ debian/copyright 2013-10-06 20:59:44 +0000
@@ -22,3 +22,8 @@
22 .22 .
23 On Debian systems, the complete text of the GNU General Public23 On Debian systems, the complete text of the GNU General Public
24 License, version 3, can be found in /usr/share/common-licenses/GPL-3.24 License, version 3, can be found in /usr/share/common-licenses/GPL-3.
25
26Files: testdrivegtk/AddOtherTestdrivegtkDialog.py
27Copyright: Public domain
28License: Public domain
29 This file is in the public domain
2530
=== modified file 'debian/release.sh'
--- debian/release.sh 2009-11-12 23:26:08 +0000
+++ debian/release.sh 2013-10-06 20:59:44 +0000
@@ -8,7 +8,7 @@
8 exit 18 exit 1
9}9}
1010
11head -n1 debian/changelog | grep "lucid" || error "This version must be ready for 'lucid'"11head -n1 debian/changelog | grep "saucy" || error "This version must be ready for 'saucy'"
1212
13# Tag the release in bzr13# Tag the release in bzr
14minor=`head -n1 debian/changelog | sed "s/^.*($MAJOR.//" | sed "s/-.*$//"`14minor=`head -n1 debian/changelog | sed "s/^.*($MAJOR.//" | sed "s/-.*$//"`
1515
=== modified file 'po/testdrive.pot'
--- po/testdrive.pot 2013-08-10 21:31:38 +0000
+++ po/testdrive.pot 2013-10-06 20:59:44 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: PACKAGE VERSION\n"9"Project-Id-Version: PACKAGE VERSION\n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2013-08-11 07:31+1000\n"11"POT-Creation-Date: 2013-10-06 19:12+1100\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -29,62 +29,63 @@
29msgid "ISO;Testing;Ubuntu;Daily;VM;Virtual Machine;zsync;rsync;Testdrive"29msgid "ISO;Testing;Ubuntu;Daily;VM;Virtual Machine;zsync;rsync;Testdrive"
30msgstr ""30msgstr ""
3131
32#: ../bin/testdrive-gtk.py:4932#: ../bin/testdrive-gtk.py:51
33msgid "Other"33msgid "Other"
34msgstr ""34msgstr ""
3535
36#. ##################################################################36#. ##################################################################
37#. ####### Obtaining the settings from the Preferences Class ########37#. ####### Obtaining the settings from the Preferences Class ########
38#. ##################################################################38#. ##################################################################
39#: ../bin/testdrive-gtk.py:13939#: ../bin/testdrive-gtk.py:142
40msgid "Instancing Preferences..."40msgid "Instancing Preferences..."
41msgstr ""41msgstr ""
4242
43#: ../bin/testdrive-gtk.py:22243#: ../bin/testdrive-gtk.py:235
44#, python-format44#, python-format
45msgid ""45msgid ""
46"Checking available ISOs at the ISO tracker [http://iso.qa.ubuntu.com] every "46"Checking available ISOs at the ISO tracker [http://"
47"%s seconds"47"iso.qa.ubuntu.com] every %s seconds"
48msgstr ""48msgstr ""
4949
50#: ../bin/testdrive-gtk.py:22750#: ../bin/testdrive-gtk.py:244
51msgid "Unable to check the ISO tracker"51msgid "Unable to check the ISO tracker"
52msgstr ""52msgstr ""
5353
54#: ../bin/testdrive-gtk.py:26554#: ../bin/testdrive-gtk.py:285
55#, python-format55#, python-format
56msgid "<b>Release:</b> %s"56msgid "<b>Release:</b> %s"
57msgstr ""57msgstr ""
5858
59#: ../bin/testdrive-gtk.py:26659#: ../bin/testdrive-gtk.py:286
60#, python-format60#, python-format
61msgid "<b>ISO Repository:</b> http://%s.ubuntu.com/"61msgid "<b>ISO Repository:</b> http://%s.ubuntu.com/"
62msgstr ""62msgstr ""
6363
64#: ../bin/testdrive-gtk.py:30664#: ../bin/testdrive-gtk.py:329
65msgid "Add an ISO to TestDrive"65msgid "Add an ISO to TestDrive"
66msgstr ""66msgstr ""
6767
68#: ../bin/testdrive-gtk.py:32268#: ../bin/testdrive-gtk.py:345
69msgid ""69msgid ""
70"Unable to open because 'testdrive' is not installed.\n"70"Unable to open because 'testdrive' is "
71"not installed.\n"
71"Please install testdrive: \n"72"Please install testdrive: \n"
72"\n"73"\n"
73"sudo apt-get install testdrive-cli"74"sudo apt-get install testdrive-cli"
74msgstr ""75msgstr ""
7576
76#: ../bin/testdrive-gtk.py:32677#: ../bin/testdrive-gtk.py:350
77msgid "TestDrive an ISO or Disk Image"78msgid "TestDrive an ISO or Disk Image"
78msgstr ""79msgstr ""
7980
80#. ##################################################################81#. ##################################################################
81#. ## Obtains the command for the Sync process based on Protocol ####82#. ## Obtains the command for the Sync process based on Protocol ####
82#. ##################################################################83#. ##################################################################
83#: ../bin/testdrive-gtk.py:40184#: ../bin/testdrive-gtk.py:430
84msgid "Obtaining the sync protocol for the specified ISO..."85msgid "Obtaining the sync protocol for the specified ISO..."
85msgstr ""86msgstr ""
8687
87#: ../bin/testdrive-gtk.py:404 ../bin/testdrive.py:37588#: ../bin/testdrive-gtk.py:434 ../bin/testdrive.py:425
88#, python-format89#, python-format
89msgid "Unsupported protocol [%s]"90msgid "Unsupported protocol [%s]"
90msgstr ""91msgstr ""
@@ -93,30 +94,34 @@
93#. #### Obtains the Virtualization Method, if not shows warnings ####94#. #### Obtains the Virtualization Method, if not shows warnings ####
94#. ##################################################################95#. ##################################################################
95#. Choose the virtualization engine96#. Choose the virtualization engine
96#: ../bin/testdrive-gtk.py:41597#: ../bin/testdrive-gtk.py:445
97msgid "Obtaining the virtualization method..."98msgid "Obtaining the virtualization method..."
98msgstr ""99msgstr ""
99100
100#: ../bin/testdrive-gtk.py:419101#: ../bin/testdrive-gtk.py:449
101msgid "Your CPU supports KVM acceleration; please install KVM"102msgid ""
103"Your CPU supports KVM acceleration; please "
104"install KVM"
102msgstr ""105msgstr ""
103106
104#: ../bin/testdrive-gtk.py:420107#: ../bin/testdrive-gtk.py:451
105msgid ""108msgid ""
106"Your CPU supports KVM acceleration; please install KVM:\n"109"Your CPU supports KVM acceleration; please "
110"install KVM:\n"
107"\n"111"\n"
108"sudo apt-get install qemu-kvm"112"sudo apt-get install qemu-kvm"
109msgstr ""113msgstr ""
110114
111#: ../bin/testdrive-gtk.py:424115#: ../bin/testdrive-gtk.py:456
112msgid ""116msgid ""
113"Your CPU does not support acceleration; run kvm-ok for more information; "117"Your CPU does not support acceleration; run kvm-ok "
114"then install VBox"118"for more information; then install VBox"
115msgstr ""119msgstr ""
116120
117#: ../bin/testdrive-gtk.py:425121#: ../bin/testdrive-gtk.py:458
118msgid ""122msgid ""
119"Your CPU does not support acceleration; run kvm-ok for more information;\n"123"Your CPU does not support acceleration; "
124"run kvm-ok for more information;\n"
120"then please install VirtualBox\n"125"then please install VirtualBox\n"
121"\n"126"\n"
122"kvm-ok\n"127"kvm-ok\n"
@@ -127,292 +132,307 @@
127#. ### Obtains the list of ISO available from the iso list cache ####132#. ### Obtains the list of ISO available from the iso list cache ####
128#. ##################################################################133#. ##################################################################
129#. Try to retrieve the ISO list from the cache134#. Try to retrieve the ISO list from the cache
130#: ../bin/testdrive-gtk.py:438 ../bin/testdrive.py:348135#: ../bin/testdrive-gtk.py:472 ../bin/testdrive.py:398
131msgid "Retrieving the Ubuntu ISO list from cache..."136msgid "Retrieving the Ubuntu ISO list from cache..."
132msgstr ""137msgstr ""
133138
134#: ../bin/testdrive-gtk.py:442 ../bin/testdrive-gtk.py:443139#: ../bin/testdrive-gtk.py:477 ../bin/testdrive-gtk.py:479
135#: ../bin/testdrive.py:352140#: ../bin/testdrive.py:402
136msgid "Unable to retrieve the Ubuntu ISO list from cache..."141msgid "Unable to retrieve the Ubuntu ISO list from cache..."
137msgstr ""142msgstr ""
138143
139#: ../bin/testdrive-gtk.py:563 ../bin/testdrive-gtk.py:598144#: ../bin/testdrive-gtk.py:604 ../bin/testdrive-gtk.py:652
140#: ../bin/testdrive-gtk.py:905145#: ../bin/testdrive-gtk.py:995
141#, python-format146#, python-format
142msgid "<i> CACHE: [%s]</i>"147msgid "<i> CACHE: [%s]</i>"
143msgstr ""148msgstr ""
144149
145#: ../bin/testdrive-gtk.py:565 ../bin/testdrive-gtk.py:600150#: ../bin/testdrive-gtk.py:609 ../bin/testdrive-gtk.py:658
146#: ../bin/testdrive-gtk.py:907151#: ../bin/testdrive-gtk.py:999
147msgid "<i> CACHE: [empty]</i>"152msgid "<i> CACHE: [empty]</i>"
148msgstr ""153msgstr ""
149154
150#: ../bin/testdrive-gtk.py:628155#: ../bin/testdrive-gtk.py:696
151msgid "<b><i>There are no Other ISOs yet...</i></b>"156msgid "<b><i>There are no Other ISOs yet...</i></b>"
152msgstr ""157msgstr ""
153158
154#: ../bin/testdrive-gtk.py:631159#: ../bin/testdrive-gtk.py:700
155msgid "<b><i>There are no ISOs for this architecture yet...</i></b>"160msgid ""
161"<b><i>There are no ISOs for this architecture yet..."
162"</i></b>"
156msgstr ""163msgstr ""
157164
158#. Add Button165#. Add Button
159#: ../bin/testdrive-gtk.py:665166#: ../bin/testdrive-gtk.py:737
160msgid "Add ISO"167msgid "Add ISO"
161msgstr ""168msgstr ""
162169
163#. Create Buttons170#. Create Buttons
164#: ../bin/testdrive-gtk.py:672171#: ../bin/testdrive-gtk.py:744
165msgid "Create USB Disk"172msgid "Create USB Disk"
166msgstr ""173msgstr ""
167174
168#: ../bin/testdrive-gtk.py:677175#: ../bin/testdrive-gtk.py:750
169msgid "Sync"176msgid "Sync"
170msgstr ""177msgstr ""
171178
172#: ../bin/testdrive-gtk.py:682179#: ../bin/testdrive-gtk.py:755
173msgid "Launch"180msgid "Launch"
174msgstr ""181msgstr ""
175182
176#: ../bin/testdrive-gtk.py:736 ../bin/testdrive.py:264183#: ../bin/testdrive-gtk.py:814
177msgid "Using KVM for virtual machine hosting..."184msgid "Using KVM for virtual machine hosting..."
178msgstr ""185msgstr ""
179186
180#: ../bin/testdrive-gtk.py:739 ../bin/testdrive.py:266187#: ../bin/testdrive-gtk.py:818
181msgid "Using VirtualBox for virtual machine hosting..."188msgid "Using VirtualBox for virtual machine hosting..."
182msgstr ""189msgstr ""
183190
184#: ../bin/testdrive-gtk.py:742 ../bin/testdrive.py:268191#: ../bin/testdrive-gtk.py:822
185msgid "Using Parallels Desktop for virtual machine hosting..."192msgid "Using Parallels Desktop for virtual machine hosting..."
186msgstr ""193msgstr ""
187194
188#: ../bin/testdrive-gtk.py:796195#: ../bin/testdrive-gtk.py:877
189msgid "sync_iso: Thread is executing..."196msgid "sync_iso: Thread is executing..."
190msgstr ""197msgstr ""
191198
192#: ../bin/testdrive-gtk.py:817199#: ../bin/testdrive-gtk.py:899
193msgid "launch_iso: Thread is executing or syncing..."200msgid "launch_iso: Thread is executing or syncing..."
194msgstr ""201msgstr ""
195202
196#: ../bin/testdrive-gtk.py:824203#: ../bin/testdrive-gtk.py:906
197msgid ""204msgid ""
198"No ISO has been selected.\n"205"No ISO has been selected.\n"
199"\n"206"\n"
200"Please select an ISO to create an USB Startup Disk."207"Please select an ISO to create an USB "
208"Startup Disk."
201msgstr ""209msgstr ""
202210
203#: ../bin/testdrive-gtk.py:829211#: ../bin/testdrive-gtk.py:912
204msgid ""212msgid ""
205"More than 1 ISO has been selected.\n"213"More than 1 ISO has been selected.\n"
206"\n"214"\n"
207"Please select only 1 ISO to continue!"215"Please select only 1 ISO to continue!"
208msgstr ""216msgstr ""
209217
210#: ../bin/testdrive-gtk.py:834218#: ../bin/testdrive-gtk.py:917
211msgid ""219msgid ""
212"The specified ISO does not exist!\n"220"The specified ISO does not exist!\n"
213"\n"221"\n"
214"Please, synchronize the ISO to continue."222"Please synchronize the ISO to continue."
215msgstr ""223msgstr ""
216224
217#: ../bin/testdrive-gtk.py:841225#: ../bin/testdrive-gtk.py:925
218msgid "Unable to launch USB Creator!"226msgid "Unable to launch USB Creator!"
219msgstr ""227msgstr ""
220228
221#: ../bin/testdrive-gtk.py:867229#: ../bin/testdrive-gtk.py:953
222#, python-format230#, python-format
223msgid " Downloading %s (0%%)"231msgid " Downloading %s (0%%)"
224msgstr ""232msgstr ""
225233
226#: ../bin/testdrive-gtk.py:887234#: ../bin/testdrive-gtk.py:975
227#, python-format235#, python-format
228msgid " Downloading %s (%s%%)"236msgid " Downloading %s (%s%%)"
229msgstr ""237msgstr ""
230238
231#: ../bin/testdrive-gtk.py:936239#: ../bin/testdrive-gtk.py:1029
232msgid " Configuring Virtual Machine..."240msgid " Configuring Virtual Machine..."
233msgstr ""241msgstr ""
234242
235#: ../bin/testdrive-gtk.py:942243#: ../bin/testdrive-gtk.py:1035
236msgid " Running Virtual Machine..."244msgid " Running Virtual Machine..."
237msgstr ""245msgstr ""
238246
239#: ../bin/testdrive-gtk.py:991247#: ../bin/testdrive-gtk.py:1089
240msgid "Show debug messages"248msgid "Show debug messages"
241msgstr ""249msgstr ""
242250
243#: ../bin/testdrive.py:52251#: ../bin/testdrive.py:62
244msgid ""252msgid ""
245"\n"253"\n"
246"Welcome to Testdrive!\n"254"Welcome to Testdrive!\n"
247msgstr ""255msgstr ""
248256
249#: ../bin/testdrive.py:60257#: ../bin/testdrive.py:70
250#, python-format258#, python-format
251msgid " +-cache--> [%s] %s"259msgid " +-cache--> [%s] %s"
252msgstr ""260msgstr ""
253261
254#: ../bin/testdrive.py:63262#: ../bin/testdrive.py:76
255#, python-format263#, python-format
256msgid " %d. Other (prompt for ISO URL)"264msgid " %d. Other (prompt for ISO URL)"
257msgstr ""265msgstr ""
258266
259#: ../bin/testdrive.py:65267#: ../bin/testdrive.py:78
260msgid ""268msgid ""
261"\n"269"\n"
262"Select an image to testdrive [1]: "270"Select an image to testdrive [1]: "
263msgstr ""271msgstr ""
264272
265#: ../bin/testdrive.py:74273#: ../bin/testdrive.py:87
266msgid ""274msgid ""
267"\n"275"\n"
268"ERROR: Invalid input\n"276"ERROR: Invalid input\n"
269msgstr ""277msgstr ""
270278
271#: ../bin/testdrive.py:77279#: ../bin/testdrive.py:90
272msgid ""280msgid ""
273"\n"281"\n"
274"Enter an ISO URL to testdrive: "282"Enter an ISO URL to testdrive: "
275msgstr ""283msgstr ""
276284
277#: ../bin/testdrive.py:84285#: ../bin/testdrive.py:97
278msgid ""286msgid ""
279"\n"287"\n"
280"ERROR: Invalid selection\n"288"ERROR: Invalid selection\n"
281msgstr ""289msgstr ""
282290
283#: ../bin/testdrive.py:88291#: ../bin/testdrive.py:102
284#, python-format292#, python-format
285msgid ""293msgid ""
286"\n"294"\n"
287"%s\n"295"%s\n"
288msgstr ""296msgstr ""
289297
290#: ../bin/testdrive.py:102 ../testdrivegtk/AddOtherTestdrivegtkDialog.py:155298#: ../bin/testdrive.py:118 ../testdrivegtk/AddOtherTestdrivegtkDialog.py:161
291#, python-format299#, python-format
292msgid "Invalid ISO URL [%s]"300msgid "Invalid ISO URL [%s]"
293msgstr ""301msgstr ""
294302
295#: ../bin/testdrive.py:144303#: ../bin/testdrive.py:167
296#, python-format304#, python-format
297msgid ""305msgid ""
298"Command failed\n"306"Command failed\n"
299" `%s`"307" `%s`"
300msgstr ""308msgstr ""
301309
302#: ../bin/testdrive.py:151310#: ../bin/testdrive.py:176
303msgid "Launching Virtual Machine using CURSES as screen mode"311msgid "Launching Virtual Machine using CURSES as screen mode"
304msgstr ""312msgstr ""
305313
306#: ../bin/testdrive.py:196314#: ../bin/testdrive.py:226
307msgid "user configuration file (overriding default values"315msgid "user configuration file (overriding default values"
308msgstr ""316msgstr ""
309317
310#: ../bin/testdrive.py:198318#: ../bin/testdrive.py:229
311msgid "print version and system data, and exit"319msgid "print version and system data, and exit"
312msgstr ""320msgstr ""
313321
314#: ../bin/testdrive.py:200322#: ../bin/testdrive.py:232
315msgid "get ISO image from this URL location"323msgid "get ISO image from this URL location"
316msgstr ""324msgstr ""
317325
318#: ../bin/testdrive.py:202326#: ../bin/testdrive.py:235
319msgid "try to launch usb-creator for further testing"327msgid "try to launch usb-creator for further testing"
320msgstr ""328msgstr ""
321329
322#: ../bin/testdrive.py:204330#: ../bin/testdrive.py:238
323msgid "hardcode Ubuntu RELEASE codename"331msgid "hardcode Ubuntu RELEASE codename"
324msgstr ""332msgstr ""
325333
326#: ../bin/testdrive.py:206334#: ../bin/testdrive.py:241
327msgid ""335msgid ""
328"hardcode Ubuntu flavor. Available Flavors:\n"336"hardcode Ubuntu flavor. Available Flavors:\n"
329" ubuntu/kubuntu/xubuntu/edubuntu/mythbuntu/ubuntustudio/lubuntu/"337" ubuntu/kubuntu/xubuntu/edubuntu/mythbuntu/ "
330"ubuntukylin"338"ubuntustudio/lubuntu/ubuntukylin"
331msgstr ""339msgstr ""
332340
333#: ../bin/testdrive.py:209341#: ../bin/testdrive.py:246
334msgid ""342msgid ""
335"hardcode Ubuntu repository from where to obtain ISOs:\n"343"hardcode Ubuntu repository from where to obtain ISOs:\n"
336" releases/cdimage/cloud-daily/cloud-releases"344" releases/cdimage/cloud-daily/cloud-releases"
337msgstr ""345msgstr ""
338346
339#: ../bin/testdrive.py:212347#: ../bin/testdrive.py:250
340msgid "displays the Virtual Machine in the shell. Only valid for Cloud images."348msgid ""
349"displays the Virtual Machine in the shell. Only valid for Cloud "
350"images."
341msgstr ""351msgstr ""
342352
343#: ../bin/testdrive.py:217353#: ../bin/testdrive.py:257
344#, python-format354#, python-format
345msgid "version passed: %s"355msgid "version passed: %s"
346msgstr ""356msgstr ""
347357
348#: ../bin/testdrive.py:221358#: ../bin/testdrive.py:262
349#, python-format359#, python-format
350msgid "testdrive %s"360msgid "testdrive %s"
351msgstr ""361msgstr ""
352362
353#: ../bin/testdrive.py:233363#: ../bin/testdrive.py:276
354#, python-format364#, python-format
355msgid "config passed: %s"365msgid "config passed: %s"
356msgstr ""366msgstr ""
357367
358#: ../bin/testdrive.py:243368#: ../bin/testdrive.py:286
359#, python-format369#, python-format
360msgid "Trying config in %s"370msgid "Trying config in %s"
361msgstr ""371msgstr ""
362372
363#: ../bin/testdrive.py:247373#: ../bin/testdrive.py:290
364#, python-format374#, python-format
365msgid "Using configuration in %s"375msgid "Using configuration in %s"
366msgstr ""376msgstr ""
367377
368#: ../bin/testdrive.py:249378#: ../bin/testdrive.py:292
369#, python-format379#, python-format
370msgid "Invalid configuration [%s]"380msgid "Invalid configuration [%s]"
371msgstr ""381msgstr ""
372382
373#: ../bin/testdrive.py:257383#: ../bin/testdrive.py:300
374msgid ""384msgid ""
375"Your CPU supports KVM acceleration; please install KVM:\n"385"Your CPU supports KVM acceleration; please install KVM:\n"
376" sudo apt-get install qemu-kvm"386" sudo apt-get install qemu-kvm"
377msgstr ""387msgstr ""
378388
379#: ../bin/testdrive.py:260389#: ../bin/testdrive.py:303
380msgid ""390msgid ""
381"Your CPU does not support acceleration; run kvm-ok for more information; "391"Your CPU does not support acceleration; run kvm-ok for more "
382"then please install VirtualBox:\n"392"information; then please install VirtualBox:\n"
383" kvm-ok\n"393" kvm-ok\n"
384" sudo apt-get install virtualbox"394" sudo apt-get install virtualbox"
385msgstr ""395msgstr ""
386396
387#: ../bin/testdrive.py:284397#: ../bin/testdrive.py:308
398msgid "Using KVM for virtual machine hosting."
399msgstr ""
400
401#: ../bin/testdrive.py:310
402msgid "Using VirtualBox for virtual machine hosting."
403msgstr ""
404
405#: ../bin/testdrive.py:312
406msgid "Using Parallels Desktop for virtual machine hosting."
407msgstr ""
408
409#: ../bin/testdrive.py:329
388msgid ""410msgid ""
389"Launching Cloud images only works with KVM. Please switch your "411"Launching Cloud images only works with KVM. Please switch "
390"virtualization method..."412"your virtualization method..."
391msgstr ""413msgstr ""
392414
393#: ../bin/testdrive.py:335415#: ../bin/testdrive.py:384
394#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:339
395#, python-format416#, python-format
396msgid "Obtaining Ubuntu ISO list from %s..."417msgid "Obtaining Ubuntu ISO list from %s..."
397msgstr ""418msgstr ""
398419
399#: ../bin/testdrive.py:339420#: ../bin/testdrive.py:388
400#, python-format421#, python-format
401msgid "ERROR: Could not obtain the Ubuntu ISO list from %s..."422msgid "ERROR: Could not obtain the Ubuntu ISO list from %s..."
402msgstr ""423msgstr ""
403424
404#: ../bin/testdrive.py:345425#: ../bin/testdrive.py:395
405#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:351
406msgid "Unable to update the Ubuntu ISO list cache..."426msgid "Unable to update the Ubuntu ISO list cache..."
407msgstr ""427msgstr ""
408428
409#. BUG: should check disk space availability in CACHE dir429#. BUG: should check disk space availability in CACHE dir
410#. Update the cache430#. Update the cache
411#: ../bin/testdrive.py:371431#: ../bin/testdrive.py:421
412msgid "Syncing the specified ISO..."432msgid "Syncing the specified ISO..."
413msgstr ""433msgstr ""
414434
415#: ../bin/testdrive.py:378 ../testdrivegtk/AddOtherTestdrivegtkDialog.py:167435#: ../bin/testdrive.py:429 ../testdrivegtk/AddOtherTestdrivegtkDialog.py:174
416#, python-format436#, python-format
417msgid "ISO not found at [%s]"437msgid "ISO not found at [%s]"
418msgstr ""438msgstr ""
@@ -420,75 +440,78 @@
420#. ##################440#. ##################
421#. # Launch the VM ##441#. # Launch the VM ##
422#. ##################442#. ##################
423#: ../bin/testdrive.py:401443#: ../bin/testdrive.py:453
424msgid "Validating Virtualization Method...."444msgid "Validating Virtualization Method...."
425msgstr ""445msgstr ""
426446
427#: ../bin/testdrive.py:405447#: ../bin/testdrive.py:457
428#, python-format448#, python-format
429msgid "Unable to validate Virtualization Method [%s]"449msgid "Unable to validate Virtualization Method [%s]"
430msgstr ""450msgstr ""
431451
432#: ../bin/testdrive.py:407452#: ../bin/testdrive.py:459
433msgid "Setting up Virtual Machine..."453msgid "Setting up Virtual Machine..."
434msgstr ""454msgstr ""
435455
436#: ../bin/testdrive.py:411456#: ../bin/testdrive.py:463
437msgid "Unable to setup Virtual Machine"457msgid "Unable to setup Virtual Machine"
438msgstr ""458msgstr ""
439459
440#: ../bin/testdrive.py:413460#: ../bin/testdrive.py:465
441msgid "Launching Virtual Machine..."461msgid "Launching Virtual Machine..."
442msgstr ""462msgstr ""
443463
444#: ../bin/testdrive.py:421464#: ../bin/testdrive.py:473
445msgid "Unable to launch Virtual Machine"465msgid "Unable to launch Virtual Machine"
446msgstr ""466msgstr ""
447467
448#: ../bin/testdrive.py:425468#: ../bin/testdrive.py:477
449#, python-format469#, python-format
450msgid "Cleaning up disk image [%s]..."470msgid "Cleaning up disk image [%s]..."
451msgstr ""471msgstr ""
452472
453#. Remind about cache cleanup473#. Remind about cache cleanup
454#: ../bin/testdrive.py:428474#: ../bin/testdrive.py:480
455msgid "You may wish to clean up the cache directory..."475msgid "You may wish to clean up the cache directory..."
456msgstr ""476msgstr ""
457477
458#: ../bin/testdrive.py:429478#: ../bin/testdrive.py:481
459#, python-format479#, python-format
460msgid " %s and %s"480msgid " %s and %s"
461msgstr ""481msgstr ""
462482
463#: ../bin/testdrive.py:436483#: ../bin/testdrive.py:490
464msgid ""484msgid ""
465"\n"485"\n"
466"Launch USB Startup Disk Creator for further testing of this ISO? [y/N] "486"Launch USB Startup Disk Creator for further testing of this ISO? "
487"[y/N] "
467msgstr ""488msgstr ""
468489
469#: ../bin/testdrive.py:440490#: ../bin/testdrive.py:495
470msgid ""491msgid ""
471"\n"492"\n"
472"Press <enter> to exit..."493"Press <enter> to exit..."
473msgstr ""494msgstr ""
474495
475#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:135496#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:140
476msgid "Please insert a Description"497msgid "Please insert a Description"
477msgstr ""498msgstr ""
478499
479#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:140500#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:145
480msgid "Please insert a URL"501msgid "Please insert a URL"
481msgstr ""502msgstr ""
482503
483#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:171504#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:178
484msgid "No sync protocol has been selected, please select one."505msgid ""
506"No sync protocol has been selected, please "
507"select one."
485msgstr ""508msgstr ""
486509
487#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:196510#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:204
488msgid "Description"511msgid "Description"
489msgstr ""512msgstr ""
490513
491#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:227514#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:238
492msgid "Select Protocol:"515msgid "Select Protocol:"
493msgstr ""516msgstr ""
494517
@@ -497,54 +520,76 @@
497msgid "Other..."520msgid "Other..."
498msgstr ""521msgstr ""
499522
500#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:72523#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:73
501msgid "TestDrive Preferences"524msgid "TestDrive Preferences"
502msgstr ""525msgstr ""
503526
504#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:98527#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:99
505msgid "finish_initialization()"528msgid "finish_initialization()"
506msgstr ""529msgstr ""
507530
508#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:138531#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:143
509msgid "Select Repository:"532msgid "Select Repository:"
510msgstr ""533msgstr ""
511534
512#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:149535#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:155
513#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:496536#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:532
514msgid "Select Release:"537msgid "Select Release:"
515msgstr ""538msgstr ""
516539
517#. Load config files for local variables540#. Load config files for local variables
518#. self.load_config_files(file)541#. self.load_config_files(file)
519#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:217542#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:238
520#, python-format543#, python-format
521msgid "Reading config file: [%s]"544msgid "Reading config file: [%s]"
522msgstr ""545msgstr ""
523546
524#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:219547#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:241
525#, python-format548#, python-format
526msgid "Unable to load config file [%s]"549msgid "Unable to load config file [%s]"
527msgstr ""550msgstr ""
528551
529#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:282552#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:305
530#, python-format553#, python-format
531msgid " of %s available."554msgid " of %s available."
532msgstr ""555msgstr ""
533556
534#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:343557#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:366
535#, python-format558#, python-format
536msgid "Could not obtain the Ubuntu ISO list from %s..."559msgid ""
537msgstr ""560"\n"
538561" Obtaining Ubuntu ISO list from %s...\n"
539#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:347562" "
563msgstr ""
564
565#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:372
566#, python-format
567msgid ""
568"\n"
569" Could not obtain the Ubuntu ISO list from %s...\n"
570" "
571msgstr ""
572
573#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:378
540msgid "Updating the Ubuntu ISO list cache..."574msgid "Updating the Ubuntu ISO list cache..."
541msgstr ""575msgstr ""
542576
543#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:355577#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:382
578msgid ""
579"\n"
580" Unable to update the Ubuntu ISO list cache...\n"
581" "
582msgstr ""
583
584#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:388
544msgid "get_preferences()"585msgid "get_preferences()"
545msgstr ""586msgstr ""
546587
547#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:478588#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:512
548#, python-format589#, python-format
549msgid "Unable to clean up files from [%s]"590msgid "Unable to clean up files from [%s]"
550msgstr ""591msgstr ""
592
593#: ../testdrivegtk/AboutTestdrivegtkDialog.py:48
594msgid "PyGTK Front-end for TestDrive"
595msgstr ""
551596
=== modified file 'setup.py'
--- setup.py 2013-08-27 16:31:59 +0000
+++ setup.py 2013-10-06 20:59:44 +0000
@@ -2,24 +2,25 @@
2# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-2# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3### BEGIN LICENSE3### BEGIN LICENSE
4# Copyright (C) 2010 Canonical Ltd.4# Copyright (C) 2010 Canonical Ltd.
5# 5#
6# Authors:6# Authors:
7# Andres Rodriguez <andreserl@ubuntu.com>7# Andres Rodriguez <andreserl@ubuntu.com>
8# 8#
9# This program is free software: you can redistribute it and/or modify it 9# This program is free software: you can redistribute it and/or modify it
10# under the terms of the GNU General Public License version 3, as published 10# under the terms of the GNU General Public License version 3, as published
11# by the Free Software Foundation.11# by the Free Software Foundation.
12# 12#
13# This program is distributed in the hope that it will be useful, but 13# This program is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranties of 14# WITHOUT ANY WARRANTY; without even the implied warranties of
15# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 15# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
16# PURPOSE. See the GNU General Public License for more details.16# PURPOSE. See the GNU General Public License for more details.
17# 17#
18# You should have received a copy of the GNU General Public License along 18# You should have received a copy of the GNU General Public License along
19# with this program. If not, see <http://www.gnu.org/licenses/>.19# with this program. If not, see <http://www.gnu.org/licenses/>.
20### END LICENSE20### END LICENSE
2121
22###################### DO NOT TOUCH THIS (HEAD TO THE SECOND PART) ######################22
23################# DO NOT TOUCH THIS (HEAD TO THE SECOND PART) #################
2324
24import os25import os
25import sys26import sys
@@ -28,9 +29,11 @@
28try:29try:
29 import DistUtilsExtra.auto30 import DistUtilsExtra.auto
30except ImportError:31except ImportError:
31 print >> sys.stderr, 'To build testdrivegtk you need https://launchpad.net/python-distutils-extra'32 print >> sys.stderr, 'To build testdrive you need python-distutils-extra'
32 sys.exit(1)33 sys.exit(1)
33assert DistUtilsExtra.auto.__version__ >= '2.18', 'needs DistUtilsExtra.auto >= 2.18'34assert DistUtilsExtra.auto.__version__ >= '2.18', \
35 'needs DistUtilsExtra.auto >= 2.18'
36
3437
35def update_data_path(prefix, oldvalue=None):38def update_data_path(prefix, oldvalue=None):
3639
@@ -38,14 +41,14 @@
38 fin = file('testdrivegtk/testdrivegtkconfig.py', 'r')41 fin = file('testdrivegtk/testdrivegtkconfig.py', 'r')
39 fout = file(fin.name + '.new', 'w')42 fout = file(fin.name + '.new', 'w')
4043
41 for line in fin: 44 for line in fin:
42 fields = line.split(' = ') # Separate variable from value45 fields = line.split(' = ') # Separate variable from value
43 if fields[0] == '__testdrivegtk_data_directory__':46 if fields[0] == '__testdrivegtk_data_directory__':
44 # update to prefix, store oldvalue47 # update to prefix, store oldvalue
45 if not oldvalue:48 if not oldvalue:
46 oldvalue = fields[1]49 oldvalue = fields[1]
47 line = "%s = '%s'\n" % (fields[0], prefix)50 line = "%s = '%s'\n" % (fields[0], prefix)
48 else: # restore oldvalue51 else: # restore oldvalue
49 line = "%s = %s" % (fields[0], oldvalue)52 line = "%s = %s" % (fields[0], oldvalue)
50 fout.write(line)53 fout.write(line)
5154
@@ -53,7 +56,7 @@
53 fout.close()56 fout.close()
54 fin.close()57 fin.close()
55 os.rename(fout.name, fin.name)58 os.rename(fout.name, fin.name)
56 except (OSError, IOError), e:59 except (OSError, IOError):
57 print ("ERROR: Can't find testdrivegtk/testdrivegtkconfig.py")60 print ("ERROR: Can't find testdrivegtk/testdrivegtkconfig.py")
58 sys.exit(1)61 sys.exit(1)
59 return oldvalue62 return oldvalue
@@ -65,7 +68,7 @@
65 fin = file('testdrive-gtk.desktop.in', 'r')68 fin = file('testdrive-gtk.desktop.in', 'r')
66 fout = file(fin.name + '.new', 'w')69 fout = file(fin.name + '.new', 'w')
6770
68 for line in fin: 71 for line in fin:
69 if 'Icon=' in line:72 if 'Icon=' in line:
70 line = "Icon=%s\n" % (datadir + 'media/testdrive-gtk.xpm')73 line = "Icon=%s\n" % (datadir + 'media/testdrive-gtk.xpm')
71 fout.write(line)74 fout.write(line)
@@ -73,7 +76,7 @@
73 fout.close()76 fout.close()
74 fin.close()77 fin.close()
75 os.rename(fout.name, fin.name)78 os.rename(fout.name, fin.name)
76 except (OSError, IOError), e:79 except (OSError, IOError):
77 print ("ERROR: Can't find testdrive-gtk.desktop.in")80 print ("ERROR: Can't find testdrive-gtk.desktop.in")
78 sys.exit(1)81 sys.exit(1)
7982
@@ -86,10 +89,9 @@
86 update_data_path(self.prefix, previous_value)89 update_data_path(self.prefix, previous_value)
8790
8891
89 92###############################################################################
90##################################################################################93#################### YOU SHOULD MODIFY ONLY WHAT IS BELOW #####################
91###################### YOU SHOULD MODIFY ONLY WHAT IS BELOW ######################94###############################################################################
92##################################################################################
9395
94DistUtilsExtra.auto.setup(96DistUtilsExtra.auto.setup(
95 name='testdrive',97 name='testdrive',
@@ -100,11 +102,11 @@
100 description='Test Drive an Ubuntu ISO',102 description='Test Drive an Ubuntu ISO',
101 long_description='Download and run an Ubuntu ISO in a Virtual Machine',103 long_description='Download and run an Ubuntu ISO in a Virtual Machine',
102 url='https://launchpad.net/testdrive',104 url='https://launchpad.net/testdrive',
103 packages=[ 'testdrive',105 packages=['testdrive',
104 'testdrive.virt',106 'testdrive.virt',
105 'testdrivegtk'],107 'testdrivegtk'],
106 scripts=['bin/testdrive', 'bin/testdrive-gtk'],108 scripts=['bin/testdrive', 'bin/testdrive-gtk'],
107 data_files=[ ('/etc', ['testdriverc']),109 data_files=[('/etc', ['testdriverc']),
108 ('share/testdrive', ['testdriverc']),110 ('share/testdrive', ['testdriverc']),
109 ('share/testdrivegtk/ui', glob('data/ui/*.ui')),111 ('share/testdrivegtk/ui', glob('data/ui/*.ui')),
110 ('share/testdrivegtk/ui', glob('data/ui/*.xml')),112 ('share/testdrivegtk/ui', glob('data/ui/*.xml')),
@@ -112,8 +114,8 @@
112 ('share/testdrivegtk/media', glob('data/media/*.svg'))114 ('share/testdrivegtk/media', glob('data/media/*.svg'))
113 #('share/pixmaps', glob('data/media/testdrive-gtk.xpm')),115 #('share/pixmaps', glob('data/media/testdrive-gtk.xpm')),
114 #('share/testdrivegtk/indicator', glob('indicator/testdrive-gtk'))116 #('share/testdrivegtk/indicator', glob('indicator/testdrive-gtk'))
115 #('share/indicators/messages/applications', glob('indicator/testdrive-gtk'))117 #('share/indicators/messages/applications',
116 ],118 # glob('indicator/testdrive-gtk'))
119 ],
117 cmdclass={'install': InstallAndUpdateDataDirectory}120 cmdclass={'install': InstallAndUpdateDataDirectory}
118 )121 )
119
120122
=== modified file 'testdrive/testdrive.py'
--- testdrive/testdrive.py 2013-08-10 09:59:15 +0000
+++ testdrive/testdrive.py 2013-10-06 20:59:44 +0000
@@ -19,9 +19,16 @@
19# You should have received a copy of the GNU General Public License19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.20# along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
22import os, platform, commands, tempfile, hashlib, ConfigParser, time22import os
23import platform
24import commands
25import tempfile
26import hashlib
27import ConfigParser
28import time
23import xdg.BaseDirectory29import xdg.BaseDirectory
2430
31
25class Testdrive:32class Testdrive:
26 def __init__(self, pkg_section):33 def __init__(self, pkg_section):
27 self.HOME = os.getenv("HOME", "")34 self.HOME = os.getenv("HOME", "")
@@ -42,10 +49,11 @@
42 self.PROTO = None49 self.PROTO = None
43 self.ISO_PATH_HEADER = None50 self.ISO_PATH_HEADER = None
44 self.PKG_SECTION = pkg_section51 self.PKG_SECTION = pkg_section
45 self.r = None #Release (maverick, lucid, etc)52 self.r = None # Release (precise, saucy, etc)
46 self.m = None #Arch (amd64, i386)53 self.m = None # Arch (amd64, i386)
47 self.f = None #Flavor (ubuntu, kubuntu, etc)54 self.f = None # Flavor (ubuntu, kubuntu, etc)
48 self.p = None # Ubuntu ISO Repository (cdimage, releases, cloud-daily, cloud-releases)55 self.p = None # Ubuntu ISO Repository
56 # (cdimage, releases, cloud-daily, cloud-releases)
4957
50 def set_values(self, var, value):58 def set_values(self, var, value):
51 if var == 'kvm_args':59 if var == 'kvm_args':
@@ -95,7 +103,8 @@
95 except:103 except:
96 pass104 pass
97105
98 ## TODO: This possible needs to go outside the class due to in PyGTK front end we might need the list of ISO's before even instancing an object106 ## TODO: This possible needs to go outside the class due to in PyGTK front
107 ## end we might need the list of ISO's before even instancing an object
99 def list_isos(self, ISOS):108 def list_isos(self, ISOS):
100 ISO = []109 ISO = []
101 for iso in ISOS:110 for iso in ISOS:
@@ -141,19 +150,23 @@
141 url = iso.split()[2]150 url = iso.split()[2]
142 if self.p == 'cloud-daily' or self.p == 'cloud-releases':151 if self.p == 'cloud-daily' or self.p == 'cloud-releases':
143 arch = url.split(".tar.gz")[0].split("-")[-1]152 arch = url.split(".tar.gz")[0].split("-")[-1]
144 name = "%s" % flavor 153 name = "%s" % flavor
145 else:154 else:
146 arch = url.split(".iso")[0].split("-")[-1]155 arch = url.split(".iso")[0].split("-")[-1]
147 image = url.split("-%s.iso" % arch)[0].split("-")[-1].capitalize()156 image = url.split("-%s.iso" % arch)[0].split(
157 "-")[-1].capitalize()
148 if image == 'Dvd':158 if image == 'Dvd':
149 image = url.split("-%s.iso" % arch)[0].split("-")[-1].swapcase()159 image = url.split("-%s.iso" % arch)[0].split(
160 "-")[-1].swapcase()
150 name = "%s %s" % (flavor, image)161 name = "%s %s" % (flavor, image)
151 # Name: Shows a description162 # Name: Shows a description
152 # URL: Shows the URL from where it downloads the ISO163 # URL: Shows the URL from where it downloads the ISO
153 # Arch: Shows the architecture (amd64|i386)164 # Arch: Shows the architecture (amd64|i386)
154 # Category: The header used to save the ISO, i.e.: ubuntu_lucid-desktop-i386.iso kubuntu_lucid-desktop-i386.iso165 # Category: The header used to save the ISO, i.e.:
166 # ubuntu_saucy-desktop-i386.iso kubuntu_saucy-desktop-i386.iso
155 if arch in self.m:167 if arch in self.m:
156 ISO.append({"name":name, "url":"%s%s" % (self.u, url), "arch":arch, "category":category})168 ISO.append({"name": name, "url": "%s%s" % (self.u, url),
169 "arch": arch, "category": category})
157 return ISO170 return ISO
158171
159 def get_virt(self):172 def get_virt(self):
@@ -165,7 +178,9 @@
165 acceleration = 1178 acceleration = 1
166 else:179 else:
167 # Okay, we don't have kvm-ok, so let's hack it...180 # Okay, we don't have kvm-ok, so let's hack it...
168 if commands.getstatusoutput("egrep \"^flags.*:.*(svm|vmx)\" /proc/cpuinfo")[0] == 0:181 if commands.getstatusoutput(
182 "egrep \"^flags.*:.*(svm|vmx)\" /proc/cpuinfo"
183 )[0] == 0:
169 acceleration = 1184 acceleration = 1
170 # Prefer KVM if acceleration available and installed185 # Prefer KVM if acceleration available and installed
171 if acceleration == 1 and commands.getstatusoutput("which kvm")[0] == 0:186 if acceleration == 1 and commands.getstatusoutput("which kvm")[0] == 0:
@@ -186,7 +201,8 @@
186 # Set defaults where undefined201 # Set defaults where undefined
187 if self.CACHE is None:202 if self.CACHE is None:
188 if xdg.BaseDirectory.xdg_cache_home:203 if xdg.BaseDirectory.xdg_cache_home:
189 self.CACHE = "%s/%s" % (xdg.BaseDirectory.xdg_cache_home, self.PKG)204 self.CACHE = "%s/%s" % (
205 xdg.BaseDirectory.xdg_cache_home, self.PKG)
190 else:206 else:
191 self.CACHE = "%s/.cache/%s" % (self.HOME, self.PKG)207 self.CACHE = "%s/.cache/%s" % (self.HOME, self.PKG)
192208
@@ -214,7 +230,8 @@
214 self.DISK_SIZE = "6G"230 self.DISK_SIZE = "6G"
215231
216 if len(self.MEM) == 0:232 if len(self.MEM) == 0:
217 total = commands.getoutput("grep ^MemTotal /proc/meminfo | awk '{print $2}'")233 total = commands.getoutput(
234 "grep ^MemTotal /proc/meminfo | awk '{print $2}'")
218 if total > 4000000:235 if total > 4000000:
219 self.MEM = "2048"236 self.MEM = "2048"
220 elif total > 2000000:237 elif total > 2000000:
@@ -227,15 +244,16 @@
227 self.MEM = "256"244 self.MEM = "256"
228245
229 if len(self.KVM_ARGS) == 0:246 if len(self.KVM_ARGS) == 0:
230 self.KVM_ARGS = "-usb -usbdevice tablet -net nic,model=virtio -net user -soundhw es1370"247 self.KVM_ARGS = "-usb -usbdevice tablet -net nic,model=virtio",
248 "-net user -soundhw es1370"
231249
232 if len(self.VBOX_NAME) == 0:250 if len(self.VBOX_NAME) == 0:
233 self.VBOX_NAME = self.PKG251 self.VBOX_NAME = self.PKG
234252
235 if self.ISO_PATH_HEADER == None:253 if self.ISO_PATH_HEADER is None:
236 self.ISO_PATH_HEADER = 'other'254 self.ISO_PATH_HEADER = 'other'
237255
238 if self.f == None:256 if self.f is None:
239 self.f = 'ubuntu'257 self.f = 'ubuntu'
240258
241 if self.m is None:259 if self.m is None:
@@ -244,7 +262,7 @@
244 else:262 else:
245 self.m = ["i386"]263 self.m = ["i386"]
246264
247 if self.p == None:265 if self.p is None:
248 self.p = 'cdimage'266 self.p = 'cdimage'
249267
250 if self.p == 'cdimage':268 if self.p == 'cdimage':
@@ -263,11 +281,14 @@
263 if self.PROTO == "rsync":281 if self.PROTO == "rsync":
264 cmd = "rsync -azPL %s %s" % (self.ISO_URL, self.PATH_TO_ISO)282 cmd = "rsync -azPL %s %s" % (self.ISO_URL, self.PATH_TO_ISO)
265 return cmd283 return cmd
266 elif self.PROTO == "zsync" or self.PROTO == "http" or self.PROTO == "ftp":284 elif self.PROTO == "zsync" or \
285 self.PROTO == "http" or self.PROTO == "ftp":
267 if commands.getstatusoutput("which zsync")[0] == 0:286 if commands.getstatusoutput("which zsync")[0] == 0:
268 if self.ISO_URL.partition("://")[0] == "zsync":287 if self.ISO_URL.partition("://")[0] == "zsync":
269 self.ISO_URL = self.ISO_URL.replace('zsync', 'http')288 self.ISO_URL = self.ISO_URL.replace('zsync', 'http')
270 cmd = "cd '%s' && zsync %s.zsync -o %s" % (self.CACHE_ISO, self.ISO_URL, self.PATH_TO_ISO)289 cmd = "cd '%s' && zsync %s.zsync -o %s" % (
290 self.CACHE_ISO, self.ISO_URL, self.PATH_TO_ISO
291 )
271 return cmd292 return cmd
272 else:293 else:
273 cmd = "wget %s -O %s" % (self.ISO_URL, self.PATH_TO_ISO)294 cmd = "wget %s -O %s" % (self.ISO_URL, self.PATH_TO_ISO)
@@ -276,7 +297,8 @@
276 # If the iso is on file:///, use the ISO in place297 # If the iso is on file:///, use the ISO in place
277 self.PATH_TO_ISO = self.ISO_URL.partition("://")[2]298 self.PATH_TO_ISO = self.ISO_URL.partition("://")[2]
278 # Get absolute path if a relative path is used299 # Get absolute path if a relative path is used
279 DIR = commands.getoutput("cd `dirname '%s'` && pwd" % self.PATH_TO_ISO)300 DIR = commands.getoutput("cd `dirname '%s'` && pwd" %
301 self.PATH_TO_ISO)
280 FILE = os.path.basename("%s" % self.PATH_TO_ISO)302 FILE = os.path.basename("%s" % self.PATH_TO_ISO)
281 self.PATH_TO_ISO = "%s/%s" % (DIR, FILE)303 self.PATH_TO_ISO = "%s/%s" % (DIR, FILE)
282 return 0304 return 0
@@ -299,10 +321,11 @@
299 else:321 else:
300 rm_disk = False322 rm_disk = False
301323
302 # If disk image is stock (e.g., you just ran a LiveCD, no installation),324 # If disk image is stock (e.g. you just ran a LiveCD, no installation),
303 # purge it automatically.325 # purge it automatically.
304 if os.path.exists(self.DISK_FILE):326 if os.path.exists(self.DISK_FILE):
305 if os.path.getsize(self.DISK_FILE) == 262144 and self.md5sum(self.DISK_FILE) == "1da7553f642332ec9fb58a6094d2c8ef":327 if os.path.getsize(self.DISK_FILE) == 262144 and self.md5sum(
328 self.DISK_FILE) == "1da7553f642332ec9fb58a6094d2c8ef":
306 # Clean up kvm qcow2 image329 # Clean up kvm qcow2 image
307 rm_disk = True330 rm_disk = True
308 if os.path.getsize(self.DISK_FILE) == 24576:331 if os.path.getsize(self.DISK_FILE) == 24576:
@@ -321,18 +344,22 @@
321344
322 def set_launch_path(self):345 def set_launch_path(self):
323 # Move from set_defaults, due to merge of upstream rev 189346 # Move from set_defaults, due to merge of upstream rev 189
324 ISO_NAME = "%s_%s" % (self.ISO_PATH_HEADER, os.path.basename(self.ISO_URL))347 ISO_NAME = "%s_%s" % (self.ISO_PATH_HEADER,
348 os.path.basename(self.ISO_URL))
325 self.PROTO = self.ISO_URL.partition(":")[0]349 self.PROTO = self.ISO_URL.partition(":")[0]
326 self.PATH_TO_ISO = "%s/%s" % (self.CACHE_ISO, ISO_NAME)350 self.PATH_TO_ISO = "%s/%s" % (self.CACHE_ISO, ISO_NAME)
327351
328 def launch_usb_creator(self):352 def launch_usb_creator(self):
329 if os.path.exists("/usr/bin/usb-creator-gtk"):353 if os.path.exists("/usr/bin/usb-creator-gtk"):
330 os.execv("/usr/bin/usb-creator-gtk", ["usb-creator-gtk", "-i", self.PATH_TO_ISO])354 os.execv("/usr/bin/usb-creator-gtk",
355 ["usb-creator-gtk", "-i", self.PATH_TO_ISO])
331 else:356 else:
332 os.execv("/usr/bin/usb-creator-kde", ["usb-creator-kde", "-i", self.PATH_TO_ISO])357 os.execv("/usr/bin/usb-creator-kde",
358 ["usb-creator-kde", "-i", self.PATH_TO_ISO])
333359
334 def is_disk_empty(self):360 def is_disk_empty(self):
335 (status, output) = commands.getstatusoutput("file %s | grep -qs 'empty'" % self.DISK_FILE)361 (status, output) = commands.getstatusoutput(
362 "file %s | grep -qs 'empty'" % self.DISK_FILE)
336 if status == 0:363 if status == 0:
337 return True364 return True
338 return False365 return False
@@ -346,7 +373,8 @@
346 return True373 return True
347374
348 def is_iso_list_cache_expired(self):375 def is_iso_list_cache_expired(self):
349 cache_time = time.localtime(os.path.getmtime("%s/%s.isos" % (self.CACHE, self.p)))376 cache_time = time.localtime(os.path.getmtime(
377 "%s/%s.isos" % (self.CACHE, self.p)))
350 local_time = time.localtime()378 local_time = time.localtime()
351 time_difference = time.mktime(local_time) - time.mktime(cache_time)379 time_difference = time.mktime(local_time) - time.mktime(cache_time)
352 # Check for new release at most every 12hrs (60*60*12 = 43200)380 # Check for new release at most every 12hrs (60*60*12 = 43200)
@@ -356,18 +384,26 @@
356384
357 def obtain_ubuntu_iso_list_from_repo(self):385 def obtain_ubuntu_iso_list_from_repo(self):
358 if self.p == 'cdimage':386 if self.p == 'cdimage':
359 (status, output) = commands.getstatusoutput("wget -q -O- http://cdimage.ubuntu.com/.manifest-daily | egrep '(amd64|i386)' | egrep '(current)'")387 (status, output) = commands.getstatusoutput(
388 "wget -q -O- http://cdimage.ubuntu.com/.manifest-daily "
389 "| egrep '(amd64|i386)' | egrep '(current)'")
360 elif self.p == 'releases':390 elif self.p == 'releases':
361 (status, output) = commands.getstatusoutput("wget -q -O- http://releases.ubuntu.com/.manifest | egrep '(amd64|i386)'")391 (status, output) = commands.getstatusoutput(
392 "wget -q -O- http://releases.ubuntu.com/.manifest "
393 "| egrep '(amd64|i386)'")
362 elif self.p == 'cloud-daily':394 elif self.p == 'cloud-daily':
363 (status, output) = commands.getstatusoutput("wget -q -O- http://cloud-images.ubuntu.com/.manifest-daily | egrep '(amd64|i386)'")395 (status, output) = commands.getstatusoutput(
396 "wget -q -O- http://cloud-images.ubuntu.com/.manifest-daily "
397 "| egrep '(amd64|i386)'")
364 elif self.p == 'cloud-releases':398 elif self.p == 'cloud-releases':
365 (status, output) = commands.getstatusoutput("wget -q -O- http://cloud-images.ubuntu.com/.manifest | egrep '(amd64|i386)'")399 (status, output) = commands.getstatusoutput(
400 "wget -q -O- http://cloud-images.ubuntu.com/.manifest "
401 "| egrep '(amd64|i386)'")
366 return output402 return output
367403
368 def update_ubuntu_iso_list_cache(self, str):404 def update_ubuntu_iso_list_cache(self, str):
369 try:405 try:
370 f = open("%s/%s.isos" % (self.CACHE, self.p),'w')406 f = open("%s/%s.isos" % (self.CACHE, self.p), 'w')
371 f.write(str)407 f.write(str)
372 f.close408 f.close
373 except IOError:409 except IOError:
@@ -390,16 +426,19 @@
390 self.r = codename[-1]426 self.r = codename[-1]
391427
392 def create_disk_file(self):428 def create_disk_file(self):
393 return tempfile.mkstemp(".img", "testdrive-disk-", "%s" % self.CACHE_IMG)[1]429 return tempfile.mkstemp(".img", "testdrive-disk-",
430 "%s" % self.CACHE_IMG)[1]
394431
395 def prepare_cloud_img_tarball(self):432 def prepare_cloud_img_tarball(self):
396 untar = False433 untar = False
397 TAR_BASENAME = os.path.basename(self.PATH_TO_ISO).split(".tar.gz")[0].split("_")[-1]434 TAR_BASENAME = os.path.basename(self.PATH_TO_ISO).split(
435 ".tar.gz")[0].split("_")[-1]
398 ORIG_DISK_NAME = "%s.img" % TAR_BASENAME436 ORIG_DISK_NAME = "%s.img" % TAR_BASENAME
399 FLOPPY_NAME = "%s-floppy" % TAR_BASENAME437 FLOPPY_NAME = "%s-floppy" % TAR_BASENAME
400438
401 image_path = "%s/%s" % (self.CACHE_ISO, ORIG_DISK_NAME)439 image_path = "%s/%s" % (self.CACHE_ISO, ORIG_DISK_NAME)
402 floppy_path = "%s/%s" % (self.CACHE_ISO, FLOPPY_NAME)440 floppy_path = "%s/%s" % (self.CACHE_ISO, FLOPPY_NAME)
403441
404 cmd = 'cd %s && tar Szxvf %s %s %s' % (self.CACHE_ISO, self.PATH_TO_ISO, ORIG_DISK_NAME, FLOPPY_NAME)442 cmd = 'cd %s && tar Szxvf %s %s %s' % (
443 self.CACHE_ISO, self.PATH_TO_ISO, ORIG_DISK_NAME, FLOPPY_NAME)
405 os.system(cmd)444 os.system(cmd)
406445
=== modified file 'testdrive/virt/kvm.py'
--- testdrive/virt/kvm.py 2013-05-20 17:12:31 +0000
+++ testdrive/virt/kvm.py 2013-10-06 20:59:44 +0000
@@ -19,10 +19,14 @@
19# You should have received a copy of the GNU General Public License19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.20# along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
22import commands, os, uuid, logging22import commands
23import os
24import uuid
25import logging
2326
24logger = logging.getLogger("testdrive.virt.kvm")27logger = logging.getLogger("testdrive.virt.kvm")
2528
29
26class KVM:30class KVM:
2731
28 def __init__(self, td):32 def __init__(self, td):
@@ -36,7 +40,8 @@
36 self.DISK_SIZE = td.DISK_SIZE40 self.DISK_SIZE = td.DISK_SIZE
3741
38 def is_disk_empty(self):42 def is_disk_empty(self):
39 (status, output) = commands.getstatusoutput("file %s | grep -qs 'empty'" % self.DISK_FILE)43 (status, output) = commands.getstatusoutput(
44 "file %s | grep -qs 'empty'" % self.DISK_FILE)
40 if status == 0:45 if status == 0:
41 return True46 return True
42 return False47 return False
@@ -50,23 +55,32 @@
50 # Code to setup virtual machine55 # Code to setup virtual machine
51 def setup_virt(self):56 def setup_virt(self):
52 if self.p == 'cloud-daily' or self.p == 'cloud-releases':57 if self.p == 'cloud-daily' or self.p == 'cloud-releases':
53 #path = "%s/%s" % (self.CACHE_ISO, self.PATH_TO_ISO.split(".tar.gz")[0].split("_")[-1])58 #path = "%s/%s" % (self.CACHE_ISO, self.PATH_TO_ISO.split(
54 path = "%s/%s" % (self.CACHE_ISO, os.path.basename(self.PATH_TO_ISO).split(".tar.gz")[0])59 # ".tar.gz")[0].split("_")[-1])
60 path = "%s/%s" % (self.CACHE_ISO, os.path.basename(
61 self.PATH_TO_ISO).split(".tar.gz")[0])
55 self.ORIG_DISK = "%s.img" % path62 self.ORIG_DISK = "%s.img" % path
56 self.FLOPPY_FILE = "%s-floppy" % path63 self.FLOPPY_FILE = "%s-floppy" % path
57 self.run_or_die("kvm-img create -f qcow2 -b %s %s" % (self.ORIG_DISK, self.DISK_FILE))64 self.run_or_die("kvm-img create -f qcow2 -b %s %s" % (
65 self.ORIG_DISK, self.DISK_FILE))
58 elif not os.path.exists(self.DISK_FILE) or self.is_disk_empty():66 elif not os.path.exists(self.DISK_FILE) or self.is_disk_empty():
59 logger.info("Creating disk image [%s]..." % self.DISK_FILE)67 logger.info("Creating disk image [%s]..." % self.DISK_FILE)
60 self.run_or_die("kvm-img create -f qcow2 %s %s" % (self.DISK_FILE, self.DISK_SIZE))68 self.run_or_die("kvm-img create -f qcow2 %s %s" % (
69 self.DISK_FILE, self.DISK_SIZE))
6170
62 # Code launch virtual machine71 # Code launch virtual machine
63 def launch_virt(self):72 def launch_virt(self):
64 logger.info("Running the Virtual Machine...")73 logger.info("Running the Virtual Machine...")
65 UUID = uuid.uuid4()74 UUID = uuid.uuid4()
66 if self.p == 'cloud-daily' or self.p == 'cloud-releases':75 if self.p == 'cloud-daily' or self.p == 'cloud-releases':
67 cmd = "qemu-system-x86_64 -uuid %s -boot a -fda %s -drive file=%s,if=virtio %s" % (UUID, self.FLOPPY_FILE, self.DISK_FILE, self.KVM_ARGS)76 cmd = "qemu-system-x86_64 -uuid %s -boot a -fda %s -drive file=%s,"
77 "if=virtio %s" % (
78 UUID, self.FLOPPY_FILE, self.DISK_FILE, self.KVM_ARGS)
68 else:79 else:
69 cmd = "qemu-system-x86_64 -uuid %s -m %s -smp %s -cdrom %s -drive file=%s,if=virtio,cache=writeback,index=0 %s" % (UUID, self.MEM, self.SMP, self.PATH_TO_ISO, self.DISK_FILE, self.KVM_ARGS)80 cmd = "qemu-system-x86_64 -uuid %s -m %s -smp %s -cdrom %s -drive",
81 "file=%s,if=virtio,cache=writeback,index=0 %s" % (
82 UUID, self.MEM, self.SMP, self.PATH_TO_ISO,
83 self.DISK_FILE, self.KVM_ARGS)
70 return cmd84 return cmd
7185
72 def run(self, cmd):86 def run(self, cmd):
7387
=== modified file 'testdrive/virt/parallels.py'
--- testdrive/virt/parallels.py 2012-04-21 02:05:42 +0000
+++ testdrive/virt/parallels.py 2013-10-06 20:59:44 +0000
@@ -19,7 +19,10 @@
19# You should have received a copy of the GNU General Public License19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.20# along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
22import commands, os, time22import commands
23import os
24#import time
25
2326
24class Parallels:27class Parallels:
2528
@@ -34,7 +37,9 @@
3437
35 # Code to validate if virtualization is installed/supported38 # Code to validate if virtualization is installed/supported
36 def validate_virt(self):39 def validate_virt(self):
37 if commands.getstatusoutput("prlctl list %s | grep -qsv \"UUID\"" % self.VBOX_NAME)[0] == 0:40 if commands.getstatusoutput(
41 "prlctl list %s | grep -qsv \"UUID\"" % self.VBOX_NAME
42 )[0] == 0:
38 self.run_or_die("prlctl delete %s" % self.VBOX_NAME)43 self.run_or_die("prlctl delete %s" % self.VBOX_NAME)
3944
40 # Code to setup virtual machine45 # Code to setup virtual machine
@@ -42,18 +47,24 @@
42 self.DISK_SIZE = self.DISK_SIZE.replace("G", "000")47 self.DISK_SIZE = self.DISK_SIZE.replace("G", "000")
43 #info("Creating VM...")48 #info("Creating VM...")
44 print "INFO: Creating VM..."49 print "INFO: Creating VM..."
45 self.run_or_die("prlctl create %s --ostype linux --distribution ubuntu" % self.VBOX_NAME)50 self.run_or_die("prlctl create %s --ostype linux --distribution ubuntu"
46 self.run_or_die("prlctl set %s --memsize %s" % (self.VBOX_NAME, self.MEM))51 % self.VBOX_NAME)
52 self.run_or_die("prlctl set %s --memsize %s" % (
53 self.VBOX_NAME, self.MEM))
47 self.run_or_die("prlctl set %s --device-del hdd0" % self.VBOX_NAME)54 self.run_or_die("prlctl set %s --device-del hdd0" % self.VBOX_NAME)
48 self.run_or_die("prlctl set %s --device-add hdd --type expand --size %s --iface scsi --position 0:0" % (self.VBOX_NAME, self.DISK_SIZE))55 self.run_or_die("prlctl set %s --device-add hdd --type expand --size",
49 self.run_or_die("prlctl set %s --device-set cdrom0 --image %s" % (self.VBOX_NAME, self.PATH_TO_ISO))56 "%s --iface scsi --position 0:0" % (
57 self.VBOX_NAME, self.DISK_SIZE))
58 self.run_or_die("prlctl set %s --device-set cdrom0 --image %s" % (
59 self.VBOX_NAME, self.PATH_TO_ISO))
5060
51 # Code launch virtual machine61 # Code launch virtual machine
52 def launch_virt(self):62 def launch_virt(self):
53 #self.run_or_die("prlctl start %s" % self.td.VBOX_NAME)63 #self.run_or_die("prlctl start %s" % self.td.VBOX_NAME)
54 return "prlctl start %s" % self.VBOX_NAME64 return "prlctl start %s" % self.VBOX_NAME
55 # Loop as long as this VM is running65 # Loop as long as this VM is running
56 #while commands.getstatusoutput("prlctl list %s | grep -qs stopped" % self.td.VBOX_NAME)[0] != 0:66 #while commands.getstatusoutput(
67 #"prlctl list %s | grep -qs stopped" % self.td.VBOX_NAME)[0] != 0:
57 # time.sleep(2)68 # time.sleep(2)
5869
59 def run(self, cmd):70 def run(self, cmd):
6071
=== modified file 'testdrive/virt/virtualbox.py'
--- testdrive/virt/virtualbox.py 2013-09-19 06:13:32 +0000
+++ testdrive/virt/virtualbox.py 2013-10-06 20:59:44 +0000
@@ -19,10 +19,14 @@
19# You should have received a copy of the GNU General Public License19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.20# along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
22import commands, os, time, logging22import commands
23import os
24#import time
25import logging
2326
24logger = logging.getLogger("testdrive.virt.vbox")27logger = logging.getLogger("testdrive.virt.vbox")
2528
29
26class VBox:30class VBox:
2731
28 def __init__(self, td):32 def __init__(self, td):
@@ -37,72 +41,98 @@
37 self.ISO_URL = td.ISO_URL41 self.ISO_URL = td.ISO_URL
3842
39 def is_disk_empty(self):43 def is_disk_empty(self):
40 (status, output) = commands.getstatusoutput("file %s | grep -qs 'empty'" % self.DISK_FILE)44 (status, output) = commands.getstatusoutput(
45 "file %s | grep -qs 'empty'" % self.DISK_FILE)
41 if status == 0:46 if status == 0:
42 return True47 return True
43 return False48 return False
4449
45 # Code to validate if virtualization is installed/supported50 # Code to validate if virtualization is installed/supported
46 def validate_virt(self):51 def validate_virt(self):
47 # Determine which version of VirtualBox we have installed. What is returned is52 # Determine which version of VirtualBox we have installed. What is
48 # typically a string such as '4.1.0r55467', lets assume that the command line53 # returned is typically a string such as '4.1.0r55467', lets assume
49 # is consistent within 4.x.x versions extract this part of the54 # that the command line is consistent within 4.x.x versions extract
50 # version string for comparison later55 # this part of the version string for comparison later
51 self.vboxversion = commands.getoutput("VBoxManage --version")56 self.vboxversion = commands.getoutput("VBoxManage --version")
52 self.vboxversion = ( int(self.vboxversion.split(".")[0]), int(self.vboxversion.split(".")[1]) )57 self.vboxversion = (int(self.vboxversion.split(".")[0]),
53 if self.vboxversion == (4,0) or self.vboxversion == (4,1) or self.vboxversion == (4,2):58 int(self.vboxversion.split(".")[1]))
59 if self.vboxversion == (4, 0) or self.vboxversion == (4, 1) \
60 or self.vboxversion == (4, 2):
54 logger.info("VirtualBox %s.%s detected." % self.vboxversion)61 logger.info("VirtualBox %s.%s detected." % self.vboxversion)
55 else:62 else:
56 logger.error("ERROR: Unsupported version (%s.%s) of VirtualBox; please install v4.0, v4.1 or v4.2." % self.vboxversion)63 logger.error(
64 "ERROR: Unsupported version (%s.%s) of VirtualBox; please",
65 "install v4.0, v4.1 or v4.2." % self.vboxversion)
57 exit(0)66 exit(0)
5867
59 # Code to setup virtual machine68 # Code to setup virtual machine
60 def setup_virt(self):69 def setup_virt(self):
61 self.run("sed -i \":HardDisk.*%s:d\" %s/.VirtualBox/VirtualBox.xml" % (self.DISK_FILE, self.HOME))70 self.run("sed -i \":HardDisk.*%s:d\" %s/.VirtualBox/VirtualBox.xml"
71 % (self.DISK_FILE, self.HOME))
62 if self.is_disk_empty():72 if self.is_disk_empty():
63 os.unlink(self.DISK_FILE)73 os.unlink(self.DISK_FILE)
64 if not os.path.exists(self.DISK_FILE):74 if not os.path.exists(self.DISK_FILE):
65 self.DISK_SIZE = self.DISK_SIZE.replace("G", "000")75 self.DISK_SIZE = self.DISK_SIZE.replace("G", "000")
66 logger.info("Creating disk image...")76 logger.info("Creating disk image...")
67 self.run_or_die("VBoxManage createhd --filename %s --size %s" % (self.DISK_FILE, self.DISK_SIZE))77 self.run_or_die("VBoxManage createhd --filename %s --size %s"
68 if self.vboxversion == (4,0) or self.vboxversion == (4,1) or self.vboxversion == (4,2):78 % (self.DISK_FILE, self.DISK_SIZE))
69 self.run("VBoxManage storageattach %s --storagectl \"IDE Controller\" --port 0 --device 0 --type hdd --medium none" % self.VBOX_NAME)79 if self.vboxversion == (4, 0) or self.vboxversion == (4, 1) \
80 or self.vboxversion == (4, 2):
81 self.run(
82 "VBoxManage storageattach %s --storagectl \"IDE Controller\"",
83 "--port 0 --device 0 --type hdd --medium none"
84 % self.VBOX_NAME)
70 if self.PATH_TO_ISO != "/dev/null":85 if self.PATH_TO_ISO != "/dev/null":
71 self.run("VBoxManage storageattach %s --storagectl \"IDE Controller\" --port 0 --device 1 --type dvddrive --medium none" % self.VBOX_NAME)86 self.run("VBoxManage storageattach %s --storagectl \"IDE "
87 "Controller\" --port 0 --device 1 --type dvddrive "
88 "--medium none" % self.VBOX_NAME)
72 #info("Creating the Virtual Machine...")89 #info("Creating the Virtual Machine...")
73 logger.info("Creating the Virtual Machine...")90 logger.info("Creating the Virtual Machine...")
74 if os.path.exists("%s/.VirtualBox/Machines/%s/%s.xml" % (self.HOME, self.VBOX_NAME, self.VBOX_NAME)):91 if os.path.exists("%s/.VirtualBox/Machines/%s/%s.xml" % (
75 os.unlink("%s/.VirtualBox/Machines/%s/%s.xml" % (self.HOME, self.VBOX_NAME, self.VBOX_NAME))92 self.HOME, self.VBOX_NAME, self.VBOX_NAME)):
93 os.unlink("%s/.VirtualBox/Machines/%s/%s.xml" % (
94 self.HOME, self.VBOX_NAME, self.VBOX_NAME))
76 self.run("VBoxManage unregistervm %s --delete" % self.VBOX_NAME)95 self.run("VBoxManage unregistervm %s --delete" % self.VBOX_NAME)
77 self.run_or_die("VBoxManage createvm --register --name %s" % self.VBOX_NAME)96 self.run_or_die("VBoxManage createvm --register --name %s"
78 self.run_or_die("VBoxManage modifyvm %s --memory %s" % (self.VBOX_NAME, self.MEM))97 % self.VBOX_NAME)
98 self.run_or_die("VBoxManage modifyvm %s --memory %s"
99 % (self.VBOX_NAME, self.MEM))
79 # This should probably support more than just Ubuntu...100 # This should probably support more than just Ubuntu...
80 if self.ISO_URL.find("amd64") >= 0:101 if self.ISO_URL.find("amd64") >= 0:
81 platform = "Ubuntu_64"102 platform = "Ubuntu_64"
82 else:103 else:
83 platform = "Ubuntu"104 platform = "Ubuntu"
84 self.run_or_die("VBoxManage modifyvm %s --ostype %s" % (self.VBOX_NAME, platform))105 self.run_or_die("VBoxManage modifyvm %s --ostype %s"
106 % (self.VBOX_NAME, platform))
85 self.run_or_die("VBoxManage modifyvm %s --vram 128" % self.VBOX_NAME)107 self.run_or_die("VBoxManage modifyvm %s --vram 128" % self.VBOX_NAME)
86 self.run_or_die("VBoxManage modifyvm %s --boot1 disk" % self.VBOX_NAME)108 self.run_or_die("VBoxManage modifyvm %s --boot1 disk" % self.VBOX_NAME)
87 self.run_or_die("VBoxManage modifyvm %s --boot2 dvd" % self.VBOX_NAME)109 self.run_or_die("VBoxManage modifyvm %s --boot2 dvd" % self.VBOX_NAME)
88 self.run_or_die("VBoxManage modifyvm %s --nic1 nat" % self.VBOX_NAME)110 self.run_or_die("VBoxManage modifyvm %s --nic1 nat" % self.VBOX_NAME)
89 self.run_or_die("VBoxManage modifyvm %s --pae on" % self.VBOX_NAME)111 self.run_or_die("VBoxManage modifyvm %s --pae on" % self.VBOX_NAME)
90112
91 # Code launch virtual machine113 # Code launch virtual machine
92 def launch_virt(self):114 def launch_virt(self):
93 logger.info("Running the Virtual Machine...")115 logger.info("Running the Virtual Machine...")
94 if self.vboxversion == (4,0) or self.vboxversion == (4,1) or self.vboxversion == (4,2):116 if self.vboxversion == (4, 0) or self.vboxversion == (4, 1) \
95 self.run_or_die("VBoxManage storagectl %s --name \"IDE Controller\" --add ide" % self.VBOX_NAME)117 or self.vboxversion == (4, 2):
96 self.run_or_die("VBoxManage storageattach %s --storagectl \"IDE Controller\" --port 0 --device 0 --type hdd --medium %s" % (self.VBOX_NAME, self.DISK_FILE))118 self.run_or_die("VBoxManage storagectl %s --name \"IDE",
119 "Controller\" --add ide" % self.VBOX_NAME)
120 self.run_or_die("VBoxManage storageattach %s --storagectl \"IDE",
121 "Controller\" --port 0 --device 0 --type hdd",
122 "--medium %s" % (self.VBOX_NAME, self.DISK_FILE))
97 if self.PATH_TO_ISO != "/dev/null":123 if self.PATH_TO_ISO != "/dev/null":
98 self.run_or_die("VBoxManage storageattach %s --storagectl \"IDE Controller\" --port 0 --device 1 --type dvddrive --medium %s" % (self.VBOX_NAME, self.PATH_TO_ISO))124 self.run_or_die(
125 "VBoxManage storageattach %s --storagectl \"IDE",
126 "Controller\"--port 0 --device 1 --type dvddrive",
127 "--medium %s" % (self.VBOX_NAME, self.PATH_TO_ISO))
99 #self.run_or_die("VBoxManage startvm %s" % self.td.VBOX_NAME)128 #self.run_or_die("VBoxManage startvm %s" % self.td.VBOX_NAME)
100 return "VBoxManage startvm %s" % self.VBOX_NAME129 return "VBoxManage startvm %s" % self.VBOX_NAME
101130
102 # Give this VM a few seconds to start up131 # Give this VM a few seconds to start up
103 #time.sleep(5)132 #time.sleep(5)
104 # Loop as long as this VM is running133 # Loop as long as this VM is running
105 #while commands.getstatusoutput("VBoxManage list runningvms | grep -qs %s" % self.td.VBOX_NAME)[0] == 0:134 #while commands.getstatusoutput("VBoxManage list runningvms | \
135 # grep -qs %s" % self.td.VBOX_NAME)[0] == 0:
106 # time.sleep(2)136 # time.sleep(2)
107137
108 def run(self, cmd):138 def run(self, cmd):
109139
=== modified file 'testdrivegtk/AboutTestdrivegtkDialog.py'
--- testdrivegtk/AboutTestdrivegtkDialog.py 2012-05-15 20:43:24 +0000
+++ testdrivegtk/AboutTestdrivegtkDialog.py 2013-10-06 20:59:44 +0000
@@ -1,20 +1,20 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2### BEGIN LICENSE2### BEGIN LICENSE
3# Copyright (C) 2010 Canonical Ltd.3# Copyright (C) 2010 Canonical Ltd.
4# 4#
5# Authors:5# Authors:
6# Andres Rodriguez <andreserl@ubuntu.com>6# Andres Rodriguez <andreserl@ubuntu.com>
7# 7#
8# This program is free software: you can redistribute it and/or modify it 8# This program is free software: you can redistribute it and/or modify it
9# under the terms of the GNU General Public License version 3, as published 9# under the terms of the GNU General Public License version 3, as published
10# by the Free Software Foundation.10# by the Free Software Foundation.
11# 11#
12# This program is distributed in the hope that it will be useful, but 12# This program is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranties of 13# WITHOUT ANY WARRANTY; without even the implied warranties of
14# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 14# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15# PURPOSE. See the GNU General Public License for more details.15# PURPOSE. See the GNU General Public License for more details.
16# 16#
17# You should have received a copy of the GNU General Public License along 17# You should have received a copy of the GNU General Public License along
18# with this program. If not, see <http://www.gnu.org/licenses/>.18# with this program. If not, see <http://www.gnu.org/licenses/>.
19### END LICENSE19### END LICENSE
2020
@@ -23,14 +23,16 @@
23from testdrivegtk.helpers import get_builder23from testdrivegtk.helpers import get_builder
2424
25import gettext25import gettext
26from gettext import gettext as _26_ = gettext.gettext
27gettext.textdomain('testdrive')27gettext.textdomain('testdrive')
2828
29import commands29import commands
30version = commands.getstatusoutput("dpkg -l testdrive-gtk | tail -n1 | awk '{print $3}'")30version = commands.getstatusoutput(
31 "dpkg -l testdrive-gtk | tail -n1 | awk '{print $3}'")
3132
32__version__ = version[1].split("-0")[0]33__version__ = version[1].split("-0")[0]
33__licensenotice__ = 'This program is free software: you can redistribute it and/or modify\n\34__licensenotice__ = """
35'This program is free software: you can redistribute it and/or modify\n\
34it under the terms of the GNU General Public License as published by\n\36it under the terms of the GNU General Public License as published by\n\
35the Free Software Foundation, either version 3 of the License, or\n\37the Free Software Foundation, either version 3 of the License, or\n\
36(at your option) any later version.\n\38(at your option) any later version.\n\
@@ -41,17 +43,18 @@
41GNU General Public License for more details.\n\43GNU General Public License for more details.\n\
42\n\44\n\
43You should have received a copy of the GNU General Public License\n\45You should have received a copy of the GNU General Public License\n\
44along with this program. If not, see <http://www.gnu.org/licenses/>.'46along with this program. If not, see <http://www.gnu.org/licenses/>. """
45__authors__ = ['Andres Rodriguez <andreserl@ubuntu.com>']47__authors__ = ['Andres Rodriguez <andreserl@ubuntu.com>']
46__description__ = 'PyGTK Front-end for TestDrive'48__description__ = _('PyGTK Front-end for TestDrive')
47__website__ = "https://launchpad.net/testdrive"49__website__ = "https://launchpad.net/testdrive"
48__copyright__ = "Copyright © 2010 - 2012 Canonical Ltd."50__copyright__ = "Copyright © 2010 - 2012 Canonical Ltd."
4951
52
50class AboutTestdrivegtkDialog(gtk.AboutDialog):53class AboutTestdrivegtkDialog(gtk.AboutDialog):
51 __gtype_name__ = "AboutTestdrivegtkDialog"54 __gtype_name__ = "AboutTestdrivegtkDialog"
5255
53 def __new__(cls):56 def __new__(cls):
54 """Special static method that's automatically called by Python when 57 """Special static method that's automatically called by Python when
55 constructing a new instance of this class.58 constructing a new instance of this class.
5659
57 Returns a fully instantiated AboutTestdrivegtkDialog object.60 Returns a fully instantiated AboutTestdrivegtkDialog object.
@@ -77,7 +80,7 @@
7780
78 # Code for other initialization actions should be added here.81 # Code for other initialization actions should be added here.
79 dialog = builder.get_object("about_testdrivegtk_dialog")82 dialog = builder.get_object("about_testdrivegtk_dialog")
80 83
81 dialog.set_version(__version__)84 dialog.set_version(__version__)
82 dialog.set_authors(__authors__)85 dialog.set_authors(__authors__)
83 dialog.set_comments(__description__)86 dialog.set_comments(__description__)
8487
=== modified file 'testdrivegtk/AddOtherTestdrivegtkDialog.py'
--- testdrivegtk/AddOtherTestdrivegtkDialog.py 2012-04-21 02:05:42 +0000
+++ testdrivegtk/AddOtherTestdrivegtkDialog.py 2013-10-06 20:59:44 +0000
@@ -6,17 +6,20 @@
6import gtk6import gtk
77
8from testdrivegtk.helpers import get_builder8from testdrivegtk.helpers import get_builder
9import os, string, commands9import os
10import string
11import commands
1012
11import gettext13import gettext
12from gettext import gettext as _14_ = gettext.gettext
13gettext.textdomain('testdrive')15gettext.textdomain('testdrive')
1416
17
15class AddOtherTestdrivegtkDialog(gtk.Dialog):18class AddOtherTestdrivegtkDialog(gtk.Dialog):
16 __gtype_name__ = "AddothertestdrivegtkDialog"19 __gtype_name__ = "AddothertestdrivegtkDialog"
1720
18 def __new__(cls, cache):21 def __new__(cls, cache):
19 """Special static method that's automatically called by Python when 22 """Special static method that's automatically called by Python when
20 constructing a new instance of this class.23 constructing a new instance of this class.
2124
22 Returns a fully instantiated AddothertestdrivegtkDialog object.25 Returns a fully instantiated AddothertestdrivegtkDialog object.
@@ -57,7 +60,7 @@
57 # Saving changes in the isos file60 # Saving changes in the isos file
58 path = "%s/other.isos" % self.CACHE61 path = "%s/other.isos" % self.CACHE
59 try:62 try:
60 f = open(path,'w')63 f = open(path, 'w')
61 for item in self.liststore:64 for item in self.liststore:
62 iso = "other\tother\t\t%s\t\t%s\n" % (item[2], item[1])65 iso = "other\tother\t\t%s\t\t%s\n" % (item[2], item[1])
63 f.write(iso)66 f.write(iso)
@@ -83,15 +86,17 @@
83 self.PROTO = None86 self.PROTO = None
8487
85 def on_error_dlg(self, data=None):88 def on_error_dlg(self, data=None):
86 errorbox = gtk.MessageDialog(self, 89 errorbox = gtk.MessageDialog(
87 gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, 90 self,
91 gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR,
88 gtk.BUTTONS_CLOSE, data)92 gtk.BUTTONS_CLOSE, data)
89 response = errorbox.run()93 response = errorbox.run()
90 errorbox.destroy()94 errorbox.destroy()
9195
92 def on_info_dlg(self, data=None):96 def on_info_dlg(self, data=None):
93 errorbox = gtk.MessageDialog(self, 97 errorbox = gtk.MessageDialog(
94 gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, 98 self,
99 gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO,
95 gtk.BUTTONS_CLOSE, data)100 gtk.BUTTONS_CLOSE, data)
96 errorbox.run()101 errorbox.run()
97 errorbox.destroy()102 errorbox.destroy()
@@ -116,7 +121,7 @@
116 self.cb_sync_proto.set_active(0)121 self.cb_sync_proto.set_active(0)
117122
118 def on_btn_del_iso_clicked(self, widget):123 def on_btn_del_iso_clicked(self, widget):
119 # When Delete button is clicked, deletes it from the list store, 124 # When Delete button is clicked, deletes it from the list store,
120 # but changes are not saved125 # but changes are not saved
121 selection = self.treeview.get_selection()126 selection = self.treeview.get_selection()
122 model, iter = selection.get_selected()127 model, iter = selection.get_selected()
@@ -129,7 +134,7 @@
129 ###### Validating that the input URL si correct and exists #######134 ###### Validating that the input URL si correct and exists #######
130 ##################################################################135 ##################################################################
131 file = self.txt_other_url.get_text().strip()136 file = self.txt_other_url.get_text().strip()
132 desc = self.txt_other_desc.get_text().replace(' ','-')137 desc = self.txt_other_desc.get_text().replace(' ', '-')
133138
134 if len(desc) == 0:139 if len(desc) == 0:
135 self.on_error_dlg(_("Please insert a Description"))140 self.on_error_dlg(_("Please insert a Description"))
@@ -147,9 +152,10 @@
147 if string.find(file, "%s://" % i) == 0:152 if string.find(file, "%s://" % i) == 0:
148 self.url = file153 self.url = file
149 #If it's a local path, test it for viability154 #If it's a local path, test it for viability
150 if commands.getstatusoutput("file \"%s\" | grep -qs \"ISO 9660\"" % file)[0] == 0:155 if commands.getstatusoutput("file \"%s\" | grep -qs \"ISO 9660\""
156 % file)[0] == 0:
151 #return("file://%s" % file)157 #return("file://%s" % file)
152 self.url ="file://%s" % file158 self.url = "file://%s" % file
153159
154 if self.url is None:160 if self.url is None:
155 self.on_error_dlg(_("Invalid ISO URL [%s]") % file)161 self.on_error_dlg(_("Invalid ISO URL [%s]") % file)
@@ -163,12 +169,14 @@
163 url = url.replace(proto, 'http')169 url = url.replace(proto, 'http')
164 if proto == 'file':170 if proto == 'file':
165 pass171 pass
166 elif os.system("wget --spider -S %s 2>&1 | grep 'HTTP/1.. 200 OK'" % url) != 0:172 elif os.system("wget --spider -S %s 2>&1 | grep 'HTTP/1.. 200 OK'"
173 % url) != 0:
167 self.on_error_dlg(_("ISO not found at [%s]") % url)174 self.on_error_dlg(_("ISO not found at [%s]") % url)
168 return False 175 return False
169176
170 if self.PROTO is None:177 if self.PROTO is None:
171 self.on_error_dlg(_("No sync protocol has been selected, please select one."))178 self.on_error_dlg(_("No sync protocol has been selected, "
179 "please select one."))
172 return False180 return False
173 else:181 else:
174 return True182 return True
@@ -205,9 +213,11 @@
205 if n >= 1:213 if n >= 1:
206 self.treeview.columns[n].cell.set_property('editable', True)214 self.treeview.columns[n].cell.set_property('editable', True)
207 # add the cells to the columns215 # add the cells to the columns
208 self.treeview.columns[n].pack_start(self.treeview.columns[n].cell, True)216 self.treeview.columns[n].pack_start(
217 self.treeview.columns[n].cell, True)
209 # set the cell attributes to the appropriate liststore column218 # set the cell attributes to the appropriate liststore column
210 self.treeview.columns[n].set_attributes(self.treeview.columns[n].cell, text=n)219 self.treeview.columns[n].set_attributes(
220 self.treeview.columns[n].cell, text=n)
211221
212 self.btn_add_other = self.builder.get_object("btn_add_iso")222 self.btn_add_other = self.builder.get_object("btn_add_iso")
213 self.btn_add_other.connect("clicked", self.on_btn_add_iso_clicked)223 self.btn_add_other.connect("clicked", self.on_btn_add_iso_clicked)
@@ -217,7 +227,8 @@
217227
218 # Expander228 # Expander
219 self.ex_other_iso_list = self.builder.get_object("ex_other_iso_list")229 self.ex_other_iso_list = self.builder.get_object("ex_other_iso_list")
220 self.ex_other_iso_list.connect('notify::expanded', self.on_iso_list_expanded)230 self.ex_other_iso_list.connect(
231 'notify::expanded', self.on_iso_list_expanded)
221 self.scroll_iso_list = self.builder.get_object("scrolledwindow1")232 self.scroll_iso_list = self.builder.get_object("scrolledwindow1")
222 self.ex_other_iso_list.remove(self.ex_other_iso_list.child)233 self.ex_other_iso_list.remove(self.ex_other_iso_list.child)
223234
@@ -232,7 +243,8 @@
232 self.cb_sync_proto.connect('changed', self.on_select_sync_proto)243 self.cb_sync_proto.connect('changed', self.on_select_sync_proto)
233 self.cb_sync_proto.set_active(0)244 self.cb_sync_proto.set_active(0)
234 self.cb_sync_proto.show()245 self.cb_sync_proto.show()
235 self.layout_table.attach(self.cb_sync_proto, 1,3,2,3, gtk.FILL | gtk.EXPAND, gtk.SHRINK)246 self.layout_table.attach(
247 self.cb_sync_proto, 1, 3, 2, 3, gtk.FILL | gtk.EXPAND, gtk.SHRINK)
236248
237 def get_other_isos_list_from_cache(self):249 def get_other_isos_list_from_cache(self):
238 ##################################################################250 ##################################################################
239251
=== modified file 'testdrivegtk/PreferencesTestdrivegtkDialog.py'
--- testdrivegtk/PreferencesTestdrivegtkDialog.py 2013-08-10 21:31:38 +0000
+++ testdrivegtk/PreferencesTestdrivegtkDialog.py 2013-10-06 20:59:44 +0000
@@ -1,20 +1,20 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2### BEGIN LICENSE2### BEGIN LICENSE
3# Copyright (C) 2010 Canonical Ltd.3# Copyright (C) 2010 Canonical Ltd.
4# 4#
5# Authors:5# Authors:
6# Andres Rodriguez <andreserl@ubuntu.com>6# Andres Rodriguez <andreserl@ubuntu.com>
7# 7#
8# This program is free software: you can redistribute it and/or modify it 8# This program is free software: you can redistribute it and/or modify it
9# under the terms of the GNU General Public License version 3, as published 9# under the terms of the GNU General Public License version 3, as published
10# by the Free Software Foundation.10# by the Free Software Foundation.
11# 11#
12# This program is distributed in the hope that it will be useful, but 12# This program is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranties of 13# WITHOUT ANY WARRANTY; without even the implied warranties of
14# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 14# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15# PURPOSE. See the GNU General Public License for more details.15# PURPOSE. See the GNU General Public License for more details.
16# 16#
17# You should have received a copy of the GNU General Public License along 17# You should have received a copy of the GNU General Public License along
18# with this program. If not, see <http://www.gnu.org/licenses/>.18# with this program. If not, see <http://www.gnu.org/licenses/>.
19### END LICENSE19### END LICENSE
2020
@@ -29,19 +29,20 @@
29from testdrivegtk.helpers import get_builder29from testdrivegtk.helpers import get_builder
3030
31import gettext31import gettext
32from gettext import gettext as _32_ = gettext.gettext
33gettext.textdomain('testdrive')33gettext.textdomain('testdrive')
3434
35ISO_REPOSITORY = ['cdimage', 'releases']35ISO_REPOSITORY = ['cdimage', 'releases']
36MEM_SIZE_TAB = ['256', '384', '512', '1024', '2048',_('Other...')]36MEM_SIZE_TAB = ['256', '384', '512', '1024', '2048', _('Other...')]
37DISK_SIZE_TAB = ['4', '6', '8', '10', '16',_('Other...')]37DISK_SIZE_TAB = ['4', '6', '8', '10', '16', _('Other...')]
38
3839
39class PreferencesTestdrivegtkDialog(gtk.Dialog):40class PreferencesTestdrivegtkDialog(gtk.Dialog):
40 __gtype_name__ = "PreferencesTestdrivegtkDialog"41 __gtype_name__ = "PreferencesTestdrivegtkDialog"
41 preferences = {}42 preferences = {}
4243
43 def __new__(cls):44 def __new__(cls):
44 """Special static method that's automatically called by Python when 45 """Special static method that's automatically called by Python when
45 constructing a new instance of this class.46 constructing a new instance of this class.
4647
47 Returns a fully instantiated PreferencesTestdrivegtkDialog object.48 Returns a fully instantiated PreferencesTestdrivegtkDialog object.
@@ -96,7 +97,7 @@
96 self.initialize_widgets()97 self.initialize_widgets()
97 self.initialize_widgets_values()98 self.initialize_widgets_values()
98 self.logger.debug(_('finish_initialization()'))99 self.logger.debug(_('finish_initialization()'))
99 100
100 self.builder.get_object("txt_gral_cache")101 self.builder.get_object("txt_gral_cache")
101102
102 def initialize_variables(self):103 def initialize_variables(self):
@@ -119,11 +120,15 @@
119 self.txt_iso_list_cache = self.builder.get_object("txt_iso_list_cache")120 self.txt_iso_list_cache = self.builder.get_object("txt_iso_list_cache")
120 # Clean Ups121 # Clean Ups
121 self.btn_iso_clean = self.builder.get_object("btn_iso_clean")122 self.btn_iso_clean = self.builder.get_object("btn_iso_clean")
122 self.btn_iso_clean.connect("clicked", self.on_cache_cleanup_clicked, self.td.CACHE_ISO)123 self.btn_iso_clean.connect(
124 "clicked", self.on_cache_cleanup_clicked, self.td.CACHE_ISO)
123 self.btn_img_clean = self.builder.get_object("btn_img_clean")125 self.btn_img_clean = self.builder.get_object("btn_img_clean")
124 self.btn_img_clean.connect("clicked", self.on_cache_cleanup_clicked, self.td.CACHE_IMG)126 self.btn_img_clean.connect(
125 self.btn_update_iso_list_cache = self.builder.get_object("btn_update_iso_list_cache")127 "clicked", self.on_cache_cleanup_clicked, self.td.CACHE_IMG)
126 self.btn_update_iso_list_cache.connect("clicked", self.on_force_iso_list_update)128 self.btn_update_iso_list_cache = self.builder.get_object(
129 "btn_update_iso_list_cache")
130 self.btn_update_iso_list_cache.connect(
131 "clicked", self.on_force_iso_list_update)
127132
128 # Ubuntu Releases133 # Ubuntu Releases
129 self.chk_arch_i386 = self.builder.get_object("chk_arch_i386")134 self.chk_arch_i386 = self.builder.get_object("chk_arch_i386")
@@ -136,33 +141,37 @@
136 self.cb_ubuntu_repo = gtk.combo_box_new_text()141 self.cb_ubuntu_repo = gtk.combo_box_new_text()
137 self.cb_ubuntu_repo.set_size_request(260, -1)142 self.cb_ubuntu_repo.set_size_request(260, -1)
138 self.cb_ubuntu_repo.append_text(_('Select Repository:'))143 self.cb_ubuntu_repo.append_text(_('Select Repository:'))
139 for repo in ISO_REPOSITORY: 144 for repo in ISO_REPOSITORY:
140 self.cb_ubuntu_repo.append_text(repo)145 self.cb_ubuntu_repo.append_text(repo)
141 self.cb_ubuntu_repo.connect('changed', self.on_select_iso_image_repo)146 self.cb_ubuntu_repo.connect('changed', self.on_select_iso_image_repo)
142 self.cb_ubuntu_repo.set_active(0)147 self.cb_ubuntu_repo.set_active(0)
143 self.cb_ubuntu_repo.show()148 self.cb_ubuntu_repo.show()
144 self.tb_general_prefs.attach(self.cb_ubuntu_repo, 1,2,7,8)149 self.tb_general_prefs.attach(self.cb_ubuntu_repo, 1, 2, 7, 8)
145 # Ubuntu Releases Combo Box150 # Ubuntu Releases Combo Box
146 self.cb_ubuntu_release = gtk.combo_box_new_text()151 self.cb_ubuntu_release = gtk.combo_box_new_text()
147 self.cb_ubuntu_release.set_size_request(260, -1)152 self.cb_ubuntu_release.set_size_request(260, -1)
148 self.cb_ubuntu_release.connect('changed', self.on_select_ubuntu_release)153 self.cb_ubuntu_release.connect(
154 'changed', self.on_select_ubuntu_release)
149 self.cb_ubuntu_release.append_text(_('Select Release:'))155 self.cb_ubuntu_release.append_text(_('Select Release:'))
150 self.cb_ubuntu_release.set_active(0)156 self.cb_ubuntu_release.set_active(0)
151 self.cb_ubuntu_release.show()157 self.cb_ubuntu_release.show()
152 self.tb_general_prefs.attach(self.cb_ubuntu_release, 1,2,8,9)158 self.tb_general_prefs.attach(self.cb_ubuntu_release, 1, 2, 8, 9)
153 159
154 # Initialize Virtualization Method Options160 # Initialize Virtualization Method Options
155 self.opt_virt_kvm = self.builder.get_object("opt_virt_kvm")161 self.opt_virt_kvm = self.builder.get_object("opt_virt_kvm")
156 self.opt_virt_kvm.connect("toggled", self.on_select_virt_method, "kvm")162 self.opt_virt_kvm.connect(
163 "toggled", self.on_select_virt_method, "kvm")
157 self.opt_virt_vbox = self.builder.get_object("opt_virt_vbox")164 self.opt_virt_vbox = self.builder.get_object("opt_virt_vbox")
158 self.opt_virt_vbox.connect("toggled", self.on_select_virt_method, "virtualbox")165 self.opt_virt_vbox.connect(
166 "toggled", self.on_select_virt_method, "virtualbox")
159 self.opt_virt_parallels = self.builder.get_object("opt_virt_parallels")167 self.opt_virt_parallels = self.builder.get_object("opt_virt_parallels")
160 self.opt_virt_parallels.connect("toggled", self.on_select_virt_method, "parallels")168 self.opt_virt_parallels.connect(
169 "toggled", self.on_select_virt_method, "parallels")
161170
162 # Initialize Memory Options171 # Initialize Memory Options
163 self.cbe_mem_size = self.builder.get_object("cbe_mem_size")172 self.cbe_mem_size = self.builder.get_object("cbe_mem_size")
164 self.cbe_mem_size.remove_text(0)173 self.cbe_mem_size.remove_text(0)
165 for mem in MEM_SIZE_TAB: 174 for mem in MEM_SIZE_TAB:
166 self.cbe_mem_size.append_text(mem)175 self.cbe_mem_size.append_text(mem)
167 self.cbe_mem_size.connect('changed', self.on_select_mem)176 self.cbe_mem_size.connect('changed', self.on_select_mem)
168177
@@ -183,30 +192,42 @@
183 self.lb_smp_available = self.builder.get_object("lb_smp_available")192 self.lb_smp_available = self.builder.get_object("lb_smp_available")
184193
185 # Flavors194 # Flavors
186 self.chk_flavor_ubuntu = self.builder.get_object("chk_flavor_ubuntu")195 self.chk_flavor_ubuntu = self.builder.get_object(
196 "chk_flavor_ubuntu")
187 self.chk_flavor_ubuntu.connect("clicked", self.on_select_flavors)197 self.chk_flavor_ubuntu.connect("clicked", self.on_select_flavors)
188 self.chk_flavor_kubuntu = self.builder.get_object("chk_flavor_kubuntu")198 self.chk_flavor_kubuntu = self.builder.get_object(
199 "chk_flavor_kubuntu")
189 self.chk_flavor_kubuntu.connect("clicked", self.on_select_flavors)200 self.chk_flavor_kubuntu.connect("clicked", self.on_select_flavors)
190 self.chk_flavor_xubuntu = self.builder.get_object("chk_flavor_xubuntu")201 self.chk_flavor_xubuntu = self.builder.get_object(
202 "chk_flavor_xubuntu")
191 self.chk_flavor_xubuntu.connect("clicked", self.on_select_flavors)203 self.chk_flavor_xubuntu.connect("clicked", self.on_select_flavors)
192 self.chk_flavor_edubuntu = self.builder.get_object("chk_flavor_edubuntu")204 self.chk_flavor_edubuntu = self.builder.get_object(
205 "chk_flavor_edubuntu")
193 self.chk_flavor_edubuntu.connect("clicked", self.on_select_flavors)206 self.chk_flavor_edubuntu.connect("clicked", self.on_select_flavors)
194 self.chk_flavor_mythbuntu = self.builder.get_object("chk_flavor_mythbuntu")207 self.chk_flavor_mythbuntu = self.builder.get_object(
208 "chk_flavor_mythbuntu")
195 self.chk_flavor_mythbuntu.connect("clicked", self.on_select_flavors)209 self.chk_flavor_mythbuntu.connect("clicked", self.on_select_flavors)
196 self.chk_flavor_ubuntustudio = self.builder.get_object("chk_flavor_ubuntustudio")210 self.chk_flavor_ubuntustudio = self.builder.get_object(
211 "chk_flavor_ubuntustudio")
197 self.chk_flavor_ubuntustudio.connect("clicked", self.on_select_flavors)212 self.chk_flavor_ubuntustudio.connect("clicked", self.on_select_flavors)
198 self.chk_flavor_lubuntu = self.builder.get_object("chk_flavor_lubuntu")213 self.chk_flavor_lubuntu = self.builder.get_object(
214 "chk_flavor_lubuntu")
199 self.chk_flavor_lubuntu.connect("clicked", self.on_select_flavors)215 self.chk_flavor_lubuntu.connect("clicked", self.on_select_flavors)
200 self.chk_flavor_ubuntukylin = self.builder.get_object("chk_flavor_ubuntukylin")216 self.chk_flavor_ubuntukylin = self.builder.get_object(
217 "chk_flavor_ubuntukylin")
201 self.chk_flavor_ubuntukylin.connect("clicked", self.on_select_flavors)218 self.chk_flavor_ubuntukylin.connect("clicked", self.on_select_flavors)
202 self.chk_flavor_other = self.builder.get_object("chk_flavor_other")219 self.chk_flavor_other = self.builder.get_object(
220 "chk_flavor_other")
203 self.chk_flavor_other.connect("clicked", self.on_select_flavors)221 self.chk_flavor_other.connect("clicked", self.on_select_flavors)
204222
205 def initialize_config_files(self):223 def initialize_config_files(self):
206 ##################################################################224 ##################################################################
207 ########### Read the configuration file for settings #############225 ########### Read the configuration file for settings #############
208 ##################################################################226 ##################################################################
209 config_files = ["/etc/%s" % self.td.PKGRC, "%s/.%s" % (self.td.HOME, self.td.PKGRC), "%s/.config/%s/%s" % (self.td.HOME, self.td.PKG, self.td.PKGRC) ]227 config_files = ["/etc/%s" % self.td.PKGRC,
228 "%s/.%s" % (self.td.HOME, self.td.PKGRC),
229 "%s/.config/%s/%s" % (self.td.HOME, self.td.PKG,
230 self.td.PKGRC)]
210 for file in config_files:231 for file in config_files:
211 if os.path.exists(file):232 if os.path.exists(file):
212 try:233 try:
@@ -216,7 +237,8 @@
216 #self.load_config_files(file)237 #self.load_config_files(file)
217 self.logger.debug(_("Reading config file: [%s]") % file)238 self.logger.debug(_("Reading config file: [%s]") % file)
218 except:239 except:
219 self.logger.debug(_("Unable to load config file [%s]") % file)240 self.logger.debug(_(
241 "Unable to load config file [%s]") % file)
220 # return False242 # return False
221 #return True243 #return True
222244
@@ -275,11 +297,13 @@
275297
276 # KVM Args298 # KVM Args
277 self.txt_kvm_args.set_text(self.td.KVM_ARGS)299 self.txt_kvm_args.set_text(self.td.KVM_ARGS)
278 300
279 # SMP301 # SMP
280 if self.td.SMP:302 if self.td.SMP:
281 self.txt_smp_nbr.set_text(self.td.SMP)303 self.txt_smp_nbr.set_text(self.td.SMP)
282 self.lb_smp_available.set_text(_(" of %s available.") % commands.getoutput("grep -c ^processor /proc/cpuinfo"))304 self.lb_smp_available.set_text(_(
305 " of %s available."
306 ) % commands.getoutput("grep -c ^processor /proc/cpuinfo"))
283307
284 # Flavors308 # Flavors
285 i = 0309 i = 0
@@ -318,29 +342,36 @@
318 if arch == 'amd64':342 if arch == 'amd64':
319 self.chk_arch_amd64.set_active(True)343 self.chk_arch_amd64.set_active(True)
320344
321 def update_iso_cache(self, force_update = False):345 def update_iso_cache(self, force_update=False):
322 ##################################################################346 ##################################################################
323 ###### Code to update the ISO list from the repository Cache #####347 ###### Code to update the ISO list from the repository Cache #####
324 ##################################################################348 ##################################################################
325 update_cache = None349 update_cache = None
326 cdimage = False350 cdimage = False
327 """ Verify if the ISO list is cached, if not, set variable to update/create it. """351 """ Verify if the ISO list is cached, if not,
352 set variable to update/create it. """
328 if force_update is True:353 if force_update is True:
329 update_cache = 1354 update_cache = 1
330 pass355 pass
331 elif self.td.is_iso_list_cached() is False:356 elif self.td.is_iso_list_cached() is False:
332 update_cache = 1357 update_cache = 1
333 # If ISO list is cached, verify if it is expired. If it is, set variable to update it.358 # If ISO list is cached, verify if it is expired.
359 # If it is, set variable to update it.
334 elif self.td.is_iso_list_cache_expired() is True:360 elif self.td.is_iso_list_cache_expired() is True:
335 update_cache = 1361 update_cache = 1
336362
337 """ If variable set to update, obtain the ISO list from the Ubuntu CD Image repository. """363 """ If variable set to update, obtain the ISO
364 list from the Ubuntu CD Image repository. """
338 if update_cache == 1:365 if update_cache == 1:
339 self.logger.info(_("Obtaining Ubuntu ISO list from %s...") % self.td.u)366 self.logger.info(_("""
367 Obtaining Ubuntu ISO list from %s...
368 """) % self.td.u)
340 try:369 try:
341 cdimage = self.td.obtain_ubuntu_iso_list_from_repo()370 cdimage = self.td.obtain_ubuntu_iso_list_from_repo()
342 except:371 except:
343 self.logger.error(_("Could not obtain the Ubuntu ISO list from %s...") % self.td.u)372 self.logger.error(_("""
373 Could not obtain the Ubuntu ISO list from %s...
374 """) % self.td.u)
344375
345 """ If the ISO List was obtained, update the cache file"""376 """ If the ISO List was obtained, update the cache file"""
346 if cdimage:377 if cdimage:
@@ -348,7 +379,9 @@
348 try:379 try:
349 self.td.update_ubuntu_iso_list_cache(cdimage)380 self.td.update_ubuntu_iso_list_cache(cdimage)
350 except:381 except:
351 self.logger.error(_("Unable to update the Ubuntu ISO list cache..."))382 self.logger.error(_("""
383 Unable to update the Ubuntu ISO list cache...
384 """))
352385
353 def get_preferences(self):386 def get_preferences(self):
354 """Returns preferences for testdrivegtk."""387 """Returns preferences for testdrivegtk."""
@@ -393,8 +426,9 @@
393 pass426 pass
394427
395 def on_error_dlg(self, data=None):428 def on_error_dlg(self, data=None):
396 errorbox = gtk.MessageDialog(self, 429 errorbox = gtk.MessageDialog(
397 gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, 430 self,
431 gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR,
398 gtk.BUTTONS_CLOSE, data)432 gtk.BUTTONS_CLOSE, data)
399 response = errorbox.run()433 response = errorbox.run()
400 errorbox.destroy()434 errorbox.destroy()
@@ -452,9 +486,9 @@
452486
453 def on_select_arch(self, widget, arch):487 def on_select_arch(self, widget, arch):
454 # On selecting the architecture488 # On selecting the architecture
455 if widget.get_active() == True:489 if widget.get_active():
456 self.arch.append(arch)490 self.arch.append(arch)
457 if widget.get_active() == False:491 if not widget.get_active():
458 self.arch.remove(arch)492 self.arch.remove(arch)
459493
460 def on_txt_gral_cache_focus_out_event(self, widget, data=None):494 def on_txt_gral_cache_focus_out_event(self, widget, data=None):
@@ -476,7 +510,7 @@
476 os.unlink(path)510 os.unlink(path)
477 except:511 except:
478 on_error_dlg(_("Unable to clean up files from [%s]") % cache_path)512 on_error_dlg(_("Unable to clean up files from [%s]") % cache_path)
479 513
480 def on_select_iso_image_repo(self, widget):514 def on_select_iso_image_repo(self, widget):
481 ##################################################################515 ##################################################################
482 #### Select image repo, populate Release combobox accordingly ####516 #### Select image repo, populate Release combobox accordingly ####
@@ -487,9 +521,11 @@
487 old_repo = self.td.p521 old_repo = self.td.p
488 self.repo = model[index][0]522 self.repo = model[index][0]
489 self.td.p = self.repo523 self.td.p = self.repo
490 self.txt_iso_list_cache.set_text("%s/%s.isos" % (self.td.CACHE, self.td.p))524 self.txt_iso_list_cache.set_text("%s/%s.isos" %
525 (self.td.CACHE, self.td.p))
491526
492 # Update cache commented given the hack to sync every repo on initialization527 # Update cache commented given the
528 # hack to sync every repo on initialization
493 #self.update_iso_cache()529 #self.update_iso_cache()
494 # Populate the releases combobox530 # Populate the releases combobox
495 self.cb_ubuntu_release.get_model().clear()531 self.cb_ubuntu_release.get_model().clear()
@@ -536,30 +572,30 @@
536 ##################################################################572 ##################################################################
537 self.preferences = []573 self.preferences = []
538 # CACHE Variables574 # CACHE Variables
539 if self.txt_gral_cache.get_text() != None:575 if self.txt_gral_cache.get_text() is not None:
540 self.td.CACHE = self.txt_gral_cache.get_text()576 self.td.CACHE = self.txt_gral_cache.get_text()
541 self.preferences.append(['cache', self.td.CACHE])577 self.preferences.append(['cache', self.td.CACHE])
542 if self.txt_img_cache.get_text() != None:578 if self.txt_img_cache.get_text() is not None:
543 self.td.CACHE_IMG = self.txt_img_cache.get_text()579 self.td.CACHE_IMG = self.txt_img_cache.get_text()
544 self.preferences.append(['cache_img', self.td.CACHE_IMG])580 self.preferences.append(['cache_img', self.td.CACHE_IMG])
545 if self.txt_iso_cache.get_text() != None:581 if self.txt_iso_cache.get_text() is not None:
546 self.td.CACHE_ISO = self.txt_iso_cache.get_text()582 self.td.CACHE_ISO = self.txt_iso_cache.get_text()
547 self.preferences.append(['cache_iso', self.td.CACHE_ISO])583 self.preferences.append(['cache_iso', self.td.CACHE_ISO])
548584
549 # Repo selection585 # Repo selection
550 if self.repo != None:586 if self.repo is not None:
551 self.preferences.append(['p', self.td.p])587 self.preferences.append(['p', self.td.p])
552588
553 if self.r != None:589 if self.r is not None:
554 self.td.r = self.r590 self.td.r = self.r
555 self.preferences.append(['r', self.td.r])591 self.preferences.append(['r', self.td.r])
556592
557 # KVM Args593 # KVM Args
558 if self.txt_kvm_args.get_text() != None:594 if self.txt_kvm_args.get_text() is not None:
559 self.td.KVM_ARGS = self.txt_kvm_args.get_text()595 self.td.KVM_ARGS = self.txt_kvm_args.get_text()
560 self.preferences.append(['kvm_args', self.td.KVM_ARGS])596 self.preferences.append(['kvm_args', self.td.KVM_ARGS])
561597
562 if self.txt_smp_nbr.get_text() != None:598 if self.txt_smp_nbr.get_text() is not None:
563 self.td.SMP = self.txt_smp_nbr.get_text()599 self.td.SMP = self.txt_smp_nbr.get_text()
564 self.preferences.append(['smp', self.td.SMP])600 self.preferences.append(['smp', self.td.SMP])
565601
@@ -573,21 +609,21 @@
573 self.preferences.append(['m', self.td.m[0]])609 self.preferences.append(['m', self.td.m[0]])
574610
575 # VIRT Methods611 # VIRT Methods
576 if self.virt_method != None:612 if self.virt_method is not None:
577 self.td.VIRT = self.virt_method613 self.td.VIRT = self.virt_method
578 self.preferences.append(['virt', self.td.VIRT])614 self.preferences.append(['virt', self.td.VIRT])
579615
580 # Memory - TODO: Add validation of text616 # Memory - TODO: Add validation of text
581 if self.mem == 'other':617 if self.mem == 'other':
582 self.mem = self.cbe_mem_size.child.get_text()618 self.mem = self.cbe_mem_size.child.get_text()
583 if self.mem != None or self.mem not in MEM_SIZE_TAB:619 if self.mem is not None or self.mem not in MEM_SIZE_TAB:
584 self.td.MEM = self.mem620 self.td.MEM = self.mem
585 self.preferences.append(['mem', self.td.MEM])621 self.preferences.append(['mem', self.td.MEM])
586622
587 # Disk Size - TODO: Add validation of text623 # Disk Size - TODO: Add validation of text
588 if self.disk_size == 'other':624 if self.disk_size == 'other':
589 self.disk_size = self.cbe_disk_size.child.get_text()625 self.disk_size = self.cbe_disk_size.child.get_text()
590 if self.disk_size != None or self.disk_size not in DISK_SIZE_TAB:626 if self.disk_size is not None or self.disk_size not in DISK_SIZE_TAB:
591 self.td.DISK_SIZE = "%sG" % self.disk_size627 self.td.DISK_SIZE = "%sG" % self.disk_size
592 self.preferences.append(['disk_size', self.td.DISK_SIZE])628 self.preferences.append(['disk_size', self.td.DISK_SIZE])
593629
594630
=== modified file 'testdrivegtk/helpers.py'
--- testdrivegtk/helpers.py 2012-04-21 02:05:42 +0000
+++ testdrivegtk/helpers.py 2013-10-06 20:59:44 +0000
@@ -1,20 +1,20 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2### BEGIN LICENSE2### BEGIN LICENSE
3# Copyright (C) 2010 Canonical Ltd.3# Copyright (C) 2010 Canonical Ltd.
4# 4#
5# Authors:5# Authors:
6# Andres Rodriguez <andreserl@ubuntu.com>6# Andres Rodriguez <andreserl@ubuntu.com>
7# 7#
8# This program is free software: you can redistribute it and/or modify it 8# This program is free software: you can redistribute it and/or modify it
9# under the terms of the GNU General Public License version 3, as published 9# under the terms of the GNU General Public License version 3, as published
10# by the Free Software Foundation.10# by the Free Software Foundation.
11# 11#
12# This program is distributed in the hope that it will be useful, but 12# This program is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranties of 13# WITHOUT ANY WARRANTY; without even the implied warranties of
14# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 14# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15# PURPOSE. See the GNU General Public License for more details.15# PURPOSE. See the GNU General Public License for more details.
16# 16#
17# You should have received a copy of the GNU General Public License along 17# You should have received a copy of the GNU General Public License along
18# with this program. If not, see <http://www.gnu.org/licenses/>.18# with this program. If not, see <http://www.gnu.org/licenses/>.
19### END LICENSE19### END LICENSE
2020
@@ -30,11 +30,12 @@
30from testdrivegtk.testdrivegtkconfig import get_data_file30from testdrivegtk.testdrivegtkconfig import get_data_file
3131
32import gettext32import gettext
33from gettext import gettext as _33_ = gettext.gettext
34gettext.textdomain('testdrive')34gettext.textdomain('testdrive')
3535
36
36def get_builder(builder_file_name):37def get_builder(builder_file_name):
37 """Return a fully-instantiated gtk.Builder instance from specified ui 38 """Return a fully-instantiated gtk.Builder instance from specified ui
38 file39 file
3940
40 :param builder_file_name: The name of the builder file, without extension.41 :param builder_file_name: The name of the builder file, without extension.
4142
=== modified file 'testdrivegtk/testdrivegtkconfig.py'
--- testdrivegtk/testdrivegtkconfig.py 2012-04-21 02:05:42 +0000
+++ testdrivegtk/testdrivegtkconfig.py 2013-10-06 20:59:44 +0000
@@ -1,20 +1,20 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2### BEGIN LICENSE2### BEGIN LICENSE
3# Copyright (C) 2010 Canonical Ltd.3# Copyright (C) 2010 Canonical Ltd.
4# 4#
5# Authors:5# Authors:
6# Andres Rodriguez <andreserl@ubuntu.com>6# Andres Rodriguez <andreserl@ubuntu.com>
7# 7#
8# This program is free software: you can redistribute it and/or modify it 8# This program is free software: you can redistribute it and/or modify it
9# under the terms of the GNU General Public License version 3, as published 9# under the terms of the GNU General Public License version 3, as published
10# by the Free Software Foundation.10# by the Free Software Foundation.
11# 11#
12# This program is distributed in the hope that it will be useful, but 12# This program is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranties of 13# WITHOUT ANY WARRANTY; without even the implied warranties of
14# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 14# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15# PURPOSE. See the GNU General Public License for more details.15# PURPOSE. See the GNU General Public License for more details.
16# 16#
17# You should have received a copy of the GNU General Public License along 17# You should have received a copy of the GNU General Public License along
18# with this program. If not, see <http://www.gnu.org/licenses/>.18# with this program. If not, see <http://www.gnu.org/licenses/>.
19### END LICENSE19### END LICENSE
2020
@@ -37,9 +37,10 @@
37import os37import os
3838
39import gettext39import gettext
40from gettext import gettext as _40_ = gettext.gettext
41gettext.textdomain('testdrive')41gettext.textdomain('testdrive')
4242
43
43class project_path_not_found(Exception):44class project_path_not_found(Exception):
44 """Raised when we can't find the project directory."""45 """Raised when we can't find the project directory."""
4546

Subscribers

People subscribed via source and target branches