コード例 #1
0
                    'if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY',
                    "    os.putenv('PYTHONPATH', PROJECT_ROOT_DIRECTORY) # for subprocesses",
                    content_to_update)
        except templatetools.CantUpdateFile, e:
            print _("WARNING: can't update your project to support /opt. This doesn't matter if you don't plan to submit your project to the application review board. Cause is: %s" % e)

### 11.09 update (but only through 11.10; later versions don't want this change)
if project_version < '11.09' and template_version <= '11.10':
    filename = './%s_lib/Builder.py' % python_name
    try:
        with open(filename) as fileobj:
            contents = fileobj.read()
        contents = contents.replace('from gi.repository import GObject', 'import gobject')
        contents = contents.replace('GObject.', 'gobject.')
        templatetools.set_file_contents(filename, contents)
    except IOError:
        pass

### EPOCH CHANGE
### This is where we upgraded the default projects to GTK3, PyGI, and GSettings.
### Warn the user that this happened and they should upgrade manually to fix.
if project_version and project_version < '11.12' and internal_run:
    print _("""WARNING: Your project is out of date.  Newly created projects use
GTK+ 3, PyGI, and GSettings.  See https://wiki.ubuntu.com/Quickly/GTK3 for
porting information and when you have finished porting your code, run
'quickly upgrade' to get rid of this message.""")
    sys.exit(0)

templatetools.update_version_in_project_file(template_version, 'git-python-gtk')
sys.exit(0)
コード例 #2
0
              "s|^import gettext$|import locale|g;" + \
              "s|^from gettext import |from locale import |g;" + \
              "s|^gettext.textdomain|locale.textdomain|g;" + \
              "'"
    # This find only hits the main module, and that is fine, other files will
    # be updated by normal overwriting mechanism below.
    os.system("find %s -name '*.py' -exec %s {} \;" % (python_name, sedline))

# Overwrite quickly-owned files as necessary
if project_version < template_version:
    print _(
        """Note: This is the first time you have run Quickly since it has been updated.
Quickly will now upgrade its files (bin/*, %s_lib/*, and setup.py).
But first it will save your project.  View Quickly's changes by running:
bzr diff""" % python_name)
    subprocess.call(["bzr", "add", "-q"])
    subprocess.call(
        ["bzr", "commit", "--unchanged", "-q", "-m", "Pre-upgrade checkpoint"])
    templatetools.copy_dirs_from_template(dirs=['bin', 'python_lib'])
    templatetools.copy_setup_py_from_template()
    try:
        # License new files as needed
        license.licensing()
    except license.LicenceError as e:
        pass  # Don't worry about it, user may not have set it up yet
    subprocess.call(["bzr", "add", "-q"])  # bzr diff will show new files

templatetools.update_version_in_project_file(template_version,
                                             'ubuntu-application')
sys.exit(0)