~robert-ancell/quickly/drop-lpi

« back to all changes in this revision

Viewing changes to data/templates/ubuntu-application/upgrade.py

  • Committer: Michael Terry
  • Date: 2011-12-22 14:13:32 UTC
  • mfrom: (647.1.3 upgradegtk3)
  • Revision ID: michael.terry@canonical.com-20111222141332-8yw2qjwfpo25q5bd
support notifying users about upgrade to gtk3

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
# set domain text
32
32
gettext.textdomain('quickly')
33
33
 
34
 
# get project version and template version if no argument given
35
 
if len(sys.argv) < 3:
36
 
    (project_version, template_version) = templatetools.get_project_and_template_versions("ubuntu-application")
37
 
    if len(sys.argv) == 2: # we have been given project but not template version
38
 
        project_version = sys.argv[1]
39
 
else:
40
 
    project_version = sys.argv[1]
41
 
    template_version = sys.argv[2]
 
34
options = ["--internal",]
 
35
 
 
36
def usage():
 
37
    templatetools.print_usage('quickly upgrade')
 
38
def help():
 
39
    print _("""Tells Quickly that you have manually upgraded your project to
 
40
the latest framework.""")
 
41
 
 
42
templatetools.handle_additional_parameters(sys.argv, help, usage=usage)
 
43
 
 
44
i = 0
 
45
internal_run = False
 
46
project_version = None
 
47
template_version = None
 
48
while i < len(sys.argv):
 
49
    arg = sys.argv[i]
 
50
    if arg.startswith('-'):
 
51
        if arg == '--internal':
 
52
            internal_run = True
 
53
        else:
 
54
            cmd = commands.get_command('upgrade', 'ubuntu-application')
 
55
            templatetools.usage_error(_("Unknown option: %s."  % arg), cmd=cmd)
 
56
    else:
 
57
        if project_version is None:
 
58
            project_version = arg
 
59
        elif template_version is None:
 
60
            template_version = arg
 
61
    i += 1
 
62
 
 
63
(project_version_inspected, template_version_inspected) = templatetools.get_project_and_template_versions("ubuntu-application")
 
64
if project_version is None:
 
65
    project_version = project_version_inspected
 
66
if template_version is None:
 
67
    template_version = template_version_inspected
42
68
 
43
69
if not configurationhandler.project_config:
44
70
    configurationhandler.loadConfig()
215
241
    except IOError:
216
242
        pass
217
243
 
 
244
### EPOCH CHANGE
 
245
### This is where we upgraded the default projects to GTK3, PyGI, and GSettings.
 
246
### Warn the user that this happened and they should upgrade manually to fix.
 
247
if project_version < '11.12' and internal_run:
 
248
    print _("""WARNING: Your project is out of date.  Newly created projects use
 
249
GTK+ 3, PyGI, and GSettings.  See https://wiki.ubuntu.com/Quickly/GTK3 for
 
250
porting information and when you have finished porting your code, run
 
251
'quickly upgrade' to get rid of this message.""")
 
252
    sys.exit(0)
 
253
 
 
254
templatetools.update_version_in_project_file(template_version, 'ubuntu-application')
218
255
sys.exit(0)