#!/bin/sh if [ -n "$1" ]; then FILES_TO_CONVERT="$@" else FILES_TO_CONVERT="$(find . -name '*.py')" fi for f in $FILES_TO_CONVERT; do perl -i -0 \ -pe "s/import gconf\n/from gi.repository import GConf\n/g;" \ -pe "s/gconf\./GConf\./g;" \ -pe "s/GConf\.client_get_default/GConf.Client.get_default/g;" \ -pe "s/GConf\.CLIENT_/GConf.ClientPreloadType./g;" \ -pe "s/GConf\.VALUE_/GConf.ValueType./g;" \ -pe "s/gconf_client.notify_add\('\/desktop\/sugar\/collaboration\/publish_gadget',/return;gconf_client.notify_add\('\/desktop\/sugar\/collaboration\/publish_gadget',/g;" \ \ -pe "s/import pygtk/import gi/g;" \ -pe "s/pygtk.require\('2.0'\)/gi.require_version\('Gtk', '3.0'\)/g;" \ -pe "s/import gtk\n/from gi.repository import Gtk\n/g;" \ -pe "s/(? 0/self._content.get_children\(\)/g;" \ -pe "s/len\(self.menu.get_children\(\)\) > 0/self.menu.get_children\(\)/g;" \ -pe "s/([^\.^ ]*)\.drag_dest_set\(/Gtk.drag_dest_set\(\1, /g;" \ -pe "s/import gobject\n/from gi.repository import GObject\n/g;" \ -pe "s/Gtk\..*\.__init__/gobject.GObject.__init__/g;" \ \ -pe "s/from gtk import gdk\n/from gi.repository import Gdk\n/g;" \ -pe "s/import gtk.gdk as gdk\n/from gi.repository import Gdk\n/g;" \ -pe "s/Gtk.gdk.x11_/GdkX11\./g;" \ -pe "s/Gtk.gdk\./Gdk\./g;" \ -pe "s/(?