-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
196 changed files
with
67,559 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
WINE = WINEPREFIX=$(PWD)/wine wine | ||
WINEPY = $(WINE) C:\\Python26\\python.exe | ||
RVER = `head -n1 debian/changelog | sed 's,.*(\(.*\)).*,\1,'` | ||
REV = `bzr revno` | ||
RESULT="build/usb-creator-r$(REV)-$(RVER).exe" | ||
|
||
update-po: | ||
find -regex "./\(usbcreator\|dbus\|gui\|desktop\).*\.\(py\|glade\|ui\|in\)" \ | ||
| sed '/gtk\.ui/ s,^,[type: gettext/glade],' > po/POTFILES.in | ||
echo ./main.py >> po/POTFILES.in | ||
echo ./bin/usb-creator-gtk >> po/POTFILES.in | ||
echo ./bin/usb-creator-kde >> po/POTFILES.in | ||
python setup.py build_i18n --merge-po --po-dir po | ||
|
||
check_external_deps: | ||
tools/check_external_deps | ||
|
||
check_windows: check_external_deps | ||
$(WINEPY) ./tests/run-win | ||
|
||
check: check_windows | ||
tests/run | ||
|
||
build_windows: build_pylauncher translations | ||
cp wine/drive_c/Program\ Files/7-Zip/7z.exe build | ||
$(WINEPY) -OO tools/pypack/pypack --verbose --bytecompile --outputdir=build/usbcreator main.py tools/_include.py tools/dd.exe tools/syslinux.exe build/7z.exe build/translations | ||
$(WINEPY) -OO build/pylauncher/pack.py build/usbcreator | ||
mv build/application.exe $(RESULT) | ||
du -h $(RESULT) | ||
|
||
build_pylauncher: clean check_external_deps | ||
cp -r tools/pylauncher build | ||
cp wine/drive_c/windows/system32/python26.dll build/pylauncher | ||
cp desktop/usb-creator.ico build/pylauncher/application.ico | ||
cd build/pylauncher; $(MAKE) | ||
|
||
test_windows: build_windows | ||
$(WINE) $(RESULT) | ||
|
||
clean: | ||
rm -rf build/* | ||
cd tools/pylauncher; $(MAKE) clean | ||
find tools/pypack -type f -name "*.pyo" -delete | ||
|
||
translations: po/*.po | ||
# TODO evand 2009-07-28: Ideally we should build the mo files once, | ||
# instead of once here and once in setup.py. | ||
# Taken from Wubi. | ||
rm -rf build/translations | ||
mkdir -p build/translations/ | ||
@for po in $^; do \ | ||
language=`basename $$po`; \ | ||
language=$${language%%.po}; \ | ||
target="build/translations/$$language/LC_MESSAGES"; \ | ||
mkdir -p $$target; \ | ||
msgfmt --output=$$target/usbcreator.mo $$po; \ | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#! /usr/bin/env bash | ||
|
||
NAME="usbcreator" | ||
XGETTEXT="xgettext -ki18n --language=Python" | ||
EXTRACTRC="extractrc" | ||
|
||
$EXTRACTRC gui/$NAME-kde.ui > ./$NAME-kde.ui.py | ||
$XGETTEXT $NAME-kde.ui.py $NAME/frontends/kde/*.py -o "$NAME.pot" | ||
|
||
sed -e 's/charset=CHARSET/charset=UTF-8/g' -i "$NAME.pot" | ||
|
||
if [ -d "po" ]; then | ||
if [ -f "po/$NAME.pot" ]; then | ||
echo "Merging $NAME.pot -> po/$NAME.pot ..." | ||
msgcat -o "po/tmp-$NAME.pot" "po/$NAME.pot" "$NAME.pot" | ||
mv "po/tmp-$NAME.pot" "po/$NAME.pot" | ||
else | ||
echo "Copying $NAME.pot -> po/$NAME.pot ..." | ||
cp "$NAME.pot" "po/$NAME.pot" | ||
fi | ||
fi | ||
|
||
rm -f "$NAME-kde.ui.py" | ||
rm -f "$NAME.pot" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
TODO for usb-creator-kde: | ||
------------------------------------- | ||
* Find out why resume from cancel install hangs the creator | ||
* Implement icons in treeview similar to gtk frontend (warning, etc) | ||
- need gio and get_gnome_drive equivalent functions from commit 205 | ||
|
||
TODO for usb-creator-win: | ||
------------------------- | ||
|
||
* Resolve possible redistribution issue with Python for Windows 2.6 mentioned | ||
by Agostino Russo. | ||
* Improve the icon. Get the icon working in the title bar. | ||
* Include sources for all of the code we're distributing. | ||
|
||
General TODO: | ||
------------- | ||
|
||
* Mac OSX support. It looks like it requires GPT and a blessed image. GRUB 2 | ||
does not support it as of this writing (2009-07-09), which will have to | ||
happen first. We'll also likely move to GRUB 2 at that point, assuming | ||
Ubuntu does first. | ||
* QA and testing | ||
- Successful install does not unmount USB Stick | ||
- Format USB stick fails to re-detect the formatted stick (format does not make a valid FS) | ||
- Cannot eject CD-ROM (held by root) | ||
* Create a backend.base.install class, replace usb-creator/install.py with | ||
backend.BACKEND.install. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#!/usr/bin/python3 | ||
|
||
# Copyright (C) 2009 Canonical Ltd. | ||
|
||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 3, | ||
# as published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import os | ||
import sys | ||
import optparse | ||
import logging | ||
|
||
from dbus import DBusException | ||
|
||
program = sys.argv[0] | ||
if program.startswith('./') or program.startswith('bin/'): | ||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) | ||
os.environ['USBCREATOR_LOCAL'] = '1' | ||
from usbcreator.frontends.gtk import GtkFrontend | ||
from usbcreator.backends.udisks import UDisksBackend | ||
from usbcreator.backends.fastboot import FastbootBackend | ||
from usbcreator.misc import sane_path, setup_gettext, setup_logging, text_type | ||
|
||
sane_path() | ||
setup_logging() | ||
setup_gettext() | ||
|
||
# TODO evand 2009-07-09: Rename to bin/usb-creator-gtk.in and substitue the | ||
# version in at build time. | ||
parser = optparse.OptionParser(usage=_('%prog [options]'), version='0.2.23') | ||
parser.set_defaults(safe=False, | ||
iso=None, | ||
persistent=True, | ||
allow_system_internal=False, | ||
trace=False) | ||
# FIXME evand 2009-07-28: Reconnect this option to the install routine. | ||
parser.add_option('-s', '--safe', dest='safe', action='store_true', | ||
help=_('choose safer options when constructing the startup ' | ||
'disk (may slow down the boot process).')) | ||
parser.add_option('-i', '--iso', dest='img', | ||
help=_('provide a source image (CD or disk) to ' | ||
'pre-populate the UI.')) | ||
parser.add_option('-n', '--not_persistent', dest='persistent', | ||
action='store_false', | ||
help=_('disable persistent setting in the UI')) | ||
parser.add_option('--allow-system-internal', dest='allow_system_internal', | ||
action='store_true', | ||
help=_('allow writing to system-internal devices')) | ||
parser.add_option('--show-all', dest='show_all', action='store_true', | ||
help=_('Show all devices')) | ||
parser.add_option('--fastboot', dest='fastboot', action='store_true', | ||
help=_('Use fastboot backend to flash Android devices.')) | ||
(options, args) = parser.parse_args() | ||
|
||
try: | ||
if options.fastboot: | ||
options.persistent = False | ||
backend = FastbootBackend() | ||
else: | ||
backend = UDisksBackend( | ||
allow_system_internal=options.allow_system_internal, | ||
show_all=options.show_all) | ||
frontend = GtkFrontend( | ||
backend, options.img, options.persistent, | ||
allow_system_internal=options.allow_system_internal) | ||
except DBusException as e: | ||
# FIXME evand 2009-07-09: Wouldn't service activation pick this up | ||
# automatically? | ||
# FIXME evand 2009-07-28: Does this really belong this far out? | ||
logging.exception('DBus exception:') | ||
if e._dbus_error_name == 'org.freedesktop.DBus.Error.ServiceUnknown': | ||
message = _('This program needs udisks running in order to' | ||
'properly function.') | ||
else: | ||
message = _('An error occurred while talking to the udisks ' | ||
'service.') | ||
GtkFrontend.startup_failure(message) | ||
sys.exit(1) | ||
except (KeyboardInterrupt, Exception) as e: | ||
# TODO evand 2009-05-03: What should we do here to make sure devices are | ||
# unmounted, etc? | ||
logging.exception('Unhandled exception:') | ||
message = _('An unhandled exception occurred:\n%s' % text_type(e)) | ||
GtkFrontend.startup_failure(message) |
Oops, something went wrong.