[creepy] 01/01: Restructure local-config patch & add debug statements
Ross Gammon
ross-guest at moszumanska.debian.org
Thu Dec 4 06:49:36 UTC 2014
This is an automated email from the git hooks/post-receive script.
ross-guest pushed a commit to branch master
in repository creepy.
commit 399a519a6a409835a20e4d59cfce409bba84827c
Author: Ross Gammon <rossgammon at mail.dk>
Date: Thu Dec 4 07:46:50 2014 +0100
Restructure local-config patch & add debug statements
Restructuring mixed the main problem, but there still a call to
save the twitter configuration to /usr/share that has to be found.
---
debian/patches/01-log-to-homedir.patch | 42 +++++++++----------------
debian/patches/02-plugin-directory.patch | 48 ++++++++++-------------------
debian/patches/03-include-dir.patch | 20 ++++++------
debian/patches/04-local-config.patch | 53 +++++++++++++++++++++++---------
debian/patches/05-project-dir.patch | 39 +++++++++++++++++++++--
5 files changed, 115 insertions(+), 87 deletions(-)
diff --git a/debian/patches/01-log-to-homedir.patch b/debian/patches/01-log-to-homedir.patch
index 948ccda..16e48b2 100644
--- a/debian/patches/01-log-to-homedir.patch
+++ b/debian/patches/01-log-to-homedir.patch
@@ -3,10 +3,8 @@ Author: Petter Reinholdtsen <pere at hungry.com>
Reviewed-By: Petter Reinholdtsen <pere at hungry.com>
Last-Update: 2014-11-17
-Index: creepy/creepy/CreepyMain.py
-===================================================================
---- creepy.orig/creepy/CreepyMain.py 2014-11-17 20:47:18.420285745 +0100
-+++ creepy/creepy/CreepyMain.py 2014-11-17 20:47:18.408285748 +0100
+--- creepy.orig/creepy/CreepyMain.py
++++ creepy/creepy/CreepyMain.py
@@ -35,14 +35,14 @@
# set up logging
logger = logging.getLogger(__name__)
@@ -25,10 +23,8 @@ Index: creepy/creepy/CreepyMain.py
try:
_fromUtf8 = QString.fromUtf8
except AttributeError:
-Index: creepy/creepy/models/InputPlugin.py
-===================================================================
---- creepy.orig/creepy/models/InputPlugin.py 2014-11-17 20:47:18.420285745 +0100
-+++ creepy/creepy/models/InputPlugin.py 2014-11-17 20:47:18.408285748 +0100
+--- creepy.orig/creepy/models/InputPlugin.py
++++ creepy/creepy/models/InputPlugin.py
@@ -9,7 +9,7 @@
#set up logging
logger = logging.getLogger(__name__)
@@ -38,10 +34,8 @@ Index: creepy/creepy/models/InputPlugin.py
fh.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
fh.setFormatter(formatter)
-Index: creepy/creepy/models/Project.py
-===================================================================
---- creepy.orig/creepy/models/Project.py 2014-11-17 20:47:18.420285745 +0100
-+++ creepy/creepy/models/Project.py 2014-11-17 20:47:18.408285748 +0100
+--- creepy.orig/creepy/models/Project.py
++++ creepy/creepy/models/Project.py
@@ -7,7 +7,7 @@
# set up logging
logger = logging.getLogger(__name__)
@@ -51,10 +45,8 @@ Index: creepy/creepy/models/Project.py
fh.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
fh.setFormatter(formatter)
-Index: creepy/creepy/plugins/flickr/flickr.py
-===================================================================
---- creepy.orig/creepy/plugins/flickr/flickr.py 2014-11-17 20:47:18.420285745 +0100
-+++ creepy/creepy/plugins/flickr/flickr.py 2014-11-17 20:47:49.104279309 +0100
+--- creepy.orig/creepy/plugins/flickr/flickr.py
++++ creepy/creepy/plugins/flickr/flickr.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
@@ -72,10 +64,8 @@ Index: creepy/creepy/plugins/flickr/flickr.py
fh.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
fh.setFormatter(formatter)
-Index: creepy/creepy/plugins/instagram/instagram.py
-===================================================================
---- creepy.orig/creepy/plugins/instagram/instagram.py 2014-11-17 20:47:18.420285745 +0100
-+++ creepy/creepy/plugins/instagram/instagram.py 2014-11-17 20:48:03.040276528 +0100
+--- creepy.orig/creepy/plugins/instagram/instagram.py
++++ creepy/creepy/plugins/instagram/instagram.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
@@ -93,10 +83,8 @@ Index: creepy/creepy/plugins/instagram/instagram.py
fh.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
fh.setFormatter(formatter)
-Index: creepy/creepy/plugins/twitter/twitter.py
-===================================================================
---- creepy.orig/creepy/plugins/twitter/twitter.py 2014-11-17 20:47:18.420285745 +0100
-+++ creepy/creepy/plugins/twitter/twitter.py 2014-11-17 20:47:38.632280824 +0100
+--- creepy.orig/creepy/plugins/twitter/twitter.py
++++ creepy/creepy/plugins/twitter/twitter.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
@@ -114,10 +102,8 @@ Index: creepy/creepy/plugins/twitter/twitter.py
fh.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
fh.setFormatter(formatter)
-Index: creepy/creepy/utilities/GeneralUtilities.py
-===================================================================
---- creepy.orig/creepy/utilities/GeneralUtilities.py 2014-11-17 20:47:18.420285745 +0100
-+++ creepy/creepy/utilities/GeneralUtilities.py 2014-11-17 20:47:18.408285748 +0100
+--- creepy.orig/creepy/utilities/GeneralUtilities.py
++++ creepy/creepy/utilities/GeneralUtilities.py
@@ -1,6 +1,8 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
diff --git a/debian/patches/02-plugin-directory.patch b/debian/patches/02-plugin-directory.patch
index 9fb3df9..6914192 100644
--- a/debian/patches/02-plugin-directory.patch
+++ b/debian/patches/02-plugin-directory.patch
@@ -6,10 +6,8 @@ Forwarded: no
Reviewed-By: Petter Reinholdtsen <pere at hungry.com>
Last-Update: 2014-11-17
-Index: creepy/creepy/CreepyMain.py
-===================================================================
---- creepy.orig/creepy/CreepyMain.py 2014-11-17 22:44:37.402337163 +0100
-+++ creepy/creepy/CreepyMain.py 2014-11-17 22:44:37.390337161 +0100
+--- creepy.orig/creepy/CreepyMain.py
++++ creepy/creepy/CreepyMain.py
@@ -58,7 +58,7 @@
def run(self):
pluginManager = PluginManagerSingleton.get()
@@ -19,10 +17,8 @@ Index: creepy/creepy/CreepyMain.py
pluginManager.locatePlugins()
pluginManager.loadPlugins()
locationsList = []
-Index: creepy/creepy/utilities/GeneralUtilities.py
-===================================================================
---- creepy.orig/creepy/utilities/GeneralUtilities.py 2014-11-17 22:44:37.402337163 +0100
-+++ creepy/creepy/utilities/GeneralUtilities.py 2014-11-17 22:44:37.390337161 +0100
+--- creepy.orig/creepy/utilities/GeneralUtilities.py
++++ creepy/creepy/utilities/GeneralUtilities.py
@@ -21,6 +21,9 @@
def reportProblem():
webbrowser.open_new_tab('https://github.com/ilektrojohn/creepy/issues')
@@ -33,10 +29,8 @@ Index: creepy/creepy/utilities/GeneralUtilities.py
def calcDistance(lat1, lng1, lat2, lng2):
"""
Calculate the great circle distance between two points
-Index: creepy/creepy/components/PluginsConfigurationDialog.py
-===================================================================
---- creepy.orig/creepy/components/PluginsConfigurationDialog.py 2014-11-17 22:44:37.402337163 +0100
-+++ creepy/creepy/components/PluginsConfigurationDialog.py 2014-11-17 22:44:37.390337161 +0100
+--- creepy.orig/creepy/components/PluginsConfigurationDialog.py
++++ creepy/creepy/components/PluginsConfigurationDialog.py
@@ -6,13 +6,14 @@
from models.InputPlugin import InputPlugin
from ui.PluginsConfig import Ui_PluginsConfigurationDialog
@@ -53,10 +47,8 @@ Index: creepy/creepy/components/PluginsConfigurationDialog.py
self.PluginManager.locatePlugins()
self.PluginManager.loadPlugins()
-Index: creepy/creepy/components/PersonProjectWizard.py
-===================================================================
---- creepy.orig/creepy/components/PersonProjectWizard.py 2014-11-17 22:44:37.402337163 +0100
-+++ creepy/creepy/components/PersonProjectWizard.py 2014-11-17 22:45:06.818342867 +0100
+--- creepy.orig/creepy/components/PersonProjectWizard.py
++++ creepy/creepy/components/PersonProjectWizard.py
@@ -6,6 +6,7 @@
from models.PluginConfigurationListModel import PluginConfigurationListModel
from models.ProjectWizardPossibleTargetsTable import ProjectWizardPossibleTargetsTable
@@ -74,10 +66,8 @@ Index: creepy/creepy/components/PersonProjectWizard.py
self.PluginManager.locatePlugins()
self.PluginManager.loadPlugins()
pluginList = sorted(self.PluginManager.getAllPlugins(), key=lambda x: x.name)
-Index: creepy/creepy/models/InputPlugin.py
-===================================================================
---- creepy.orig/creepy/models/InputPlugin.py 2014-11-17 22:44:37.402337163 +0100
-+++ creepy/creepy/models/InputPlugin.py 2014-11-17 22:44:37.390337161 +0100
+--- creepy.orig/creepy/models/InputPlugin.py
++++ creepy/creepy/models/InputPlugin.py
@@ -39,17 +39,21 @@
def returnPersonalInformation(self, search_params):
@@ -132,10 +122,8 @@ Index: creepy/creepy/models/InputPlugin.py
try:
params = config['search_options']
except Exception, err:
-Index: creepy/creepy/plugins/flickr/flickr.py
-===================================================================
---- creepy.orig/creepy/plugins/flickr/flickr.py 2014-11-17 22:44:37.402337163 +0100
-+++ creepy/creepy/plugins/flickr/flickr.py 2014-11-17 22:44:37.390337161 +0100
+--- creepy.orig/creepy/plugins/flickr/flickr.py
++++ creepy/creepy/plugins/flickr/flickr.py
@@ -25,10 +25,7 @@
def __init__(self):
@@ -148,10 +136,8 @@ Index: creepy/creepy/plugins/flickr/flickr.py
try:
logger.debug("Trying to load the labels file for the "+self.name+" plugin .")
self.labels = labels_config['labels']
-Index: creepy/creepy/plugins/instagram/instagram.py
-===================================================================
---- creepy.orig/creepy/plugins/instagram/instagram.py 2014-11-17 22:44:37.402337163 +0100
-+++ creepy/creepy/plugins/instagram/instagram.py 2014-11-17 22:44:37.390337161 +0100
+--- creepy.orig/creepy/plugins/instagram/instagram.py
++++ creepy/creepy/plugins/instagram/instagram.py
@@ -25,10 +25,7 @@
def __init__(self):
@@ -164,10 +150,8 @@ Index: creepy/creepy/plugins/instagram/instagram.py
try:
logger.debug("Trying to load the labels file for the "+self.name+" plugin .")
self.labels = labels_config['labels']
-Index: creepy/creepy/plugins/twitter/twitter.py
-===================================================================
---- creepy.orig/creepy/plugins/twitter/twitter.py 2014-11-17 22:44:37.402337163 +0100
-+++ creepy/creepy/plugins/twitter/twitter.py 2014-11-17 22:44:37.390337161 +0100
+--- creepy.orig/creepy/plugins/twitter/twitter.py
++++ creepy/creepy/plugins/twitter/twitter.py
@@ -27,10 +27,7 @@
def __init__(self):
diff --git a/debian/patches/03-include-dir.patch b/debian/patches/03-include-dir.patch
index 84c3e2b..8084a54 100644
--- a/debian/patches/03-include-dir.patch
+++ b/debian/patches/03-include-dir.patch
@@ -4,9 +4,9 @@ Forwarded: no
Reviewed-By: Petter Reinholdtsen <pere at hungry.com>
Last-Update: 2014-11-17
---- creepy-1.2~alpha.orig/creepy/CreepyMain.py
-+++ creepy-1.2~alpha/creepy/CreepyMain.py
-@@ -102,7 +102,7 @@ class MainWindow(QMainWindow):
+--- creepy.orig/creepy/CreepyMain.py
++++ creepy/creepy/CreepyMain.py
+@@ -102,7 +102,7 @@
self.projectsList = []
self.currentProject = None
self.ui.webPage = QWebPage()
@@ -15,7 +15,7 @@ Last-Update: 2014-11-17
self.ui.mapWebView.setPage(self.ui.webPage)
self.ui.menuView.addAction(self.ui.dockWProjects.toggleViewAction())
self.ui.menuView.addAction(self.ui.dockWLocationsList.toggleViewAction())
-@@ -165,7 +165,7 @@ class MainWindow(QMainWindow):
+@@ -165,7 +165,7 @@
filterLocationsPointDialog.ui.mapPage = QWebPage()
myPyObj = filterLocationsPointDialog.pyObj()
filterLocationsPointDialog.ui.mapPage.mainFrame().addToJavaScriptWindowObject('myPyObj', myPyObj)
@@ -24,9 +24,9 @@ Last-Update: 2014-11-17
filterLocationsPointDialog.ui.radiusUnitComboBox.insertItem(0, QString('km'))
filterLocationsPointDialog.ui.radiusUnitComboBox.insertItem(1, QString('m'))
filterLocationsPointDialog.ui.radiusUnitComboBox.activated[str].connect(filterLocationsPointDialog.onUnitChanged)
---- creepy-1.2~alpha.orig/creepy/utilities/GeneralUtilities.py
-+++ creepy-1.2~alpha/creepy/utilities/GeneralUtilities.py
-@@ -7,6 +7,9 @@ import webbrowser
+--- creepy.orig/creepy/utilities/GeneralUtilities.py
++++ creepy/creepy/utilities/GeneralUtilities.py
+@@ -7,6 +7,9 @@
from math import radians, cos, sin, asin, sqrt
@@ -36,8 +36,8 @@ Last-Update: 2014-11-17
def getUserHome():
return expanduser("~")
---- creepy-1.2~alpha.orig/creepy/models/ProjectWizardPluginListModel.py
-+++ creepy-1.2~alpha/creepy/models/ProjectWizardPluginListModel.py
+--- creepy.orig/creepy/models/ProjectWizardPluginListModel.py
++++ creepy/creepy/models/ProjectWizardPluginListModel.py
@@ -3,6 +3,7 @@
from PyQt4.QtCore import QVariant, QAbstractListModel, Qt
from PyQt4.Qt import QPixmap, QFileSystemModel, QIcon
@@ -46,7 +46,7 @@ Last-Update: 2014-11-17
class ProjectWizardPluginListModel(QAbstractListModel):
def __init__(self, plugins, parent=None):
-@@ -24,7 +24,7 @@ class ProjectWizardPluginListModel(QAbst
+@@ -24,7 +25,7 @@
pixmap = QPixmap(picturePath)
return QIcon(pixmap.scaled(30, 30, Qt.IgnoreAspectRatio, Qt.FastTransformation))
else:
diff --git a/debian/patches/04-local-config.patch b/debian/patches/04-local-config.patch
index 2093aa6..af04715 100644
--- a/debian/patches/04-local-config.patch
+++ b/debian/patches/04-local-config.patch
@@ -19,30 +19,55 @@ Author: Ross Gammon <rossgammon at mail.dk>
from utilities import GeneralUtilities
#set up logging
-@@ -41,8 +42,11 @@
- pass
-
+@@ -43,6 +44,9 @@
def getPluginDir(self):
-- """FIXME Figure out way to always set it to the directory where the plugin code was found"""
-- return os.path.join('/usr/share/creepy/plugins', self.name)
-+ """Returns the installed config file or the local override if it exists"""
-+ plugindir = expanduser("~/.creepy/plugins")
-+ if not os.path.isdir(os.path.join(plugindir, self.name)):
-+ plugindir = '/usr/share/creepy/plugins'
-+ return os.path.join(plugindir, self.name)
+ """FIXME Figure out way to always set it to the directory where the plugin code was found"""
+ return os.path.join('/usr/share/creepy/plugins', self.name)
++
++ def getLocalPluginDir(self):
++ return os.path.join('~/.creepy/plugins', self.name)
def getConfigObj(self, config_filename = None):
if config_filename is None:
-@@ -63,6 +67,8 @@
+@@ -52,8 +56,21 @@
+ config.create_empty=False
+ return config
+
++ def getLocalConfigObj(self, config_filename = None):
++ if config_filename is None:
++ config_filename = self.name+".conf"
++ config_file = os.path.join(self.getLocalPluginDir(), config_filename)
++ config = ConfigObj(infile=config_file)
++ config.create_empty=False
++ return config
++
+ def readConfiguration(self, category):
+- config = self.getConfigObj()
++ if os.path.isdir(os.path.join(expanduser("~/.creepy/plugins"), self.name)):
++ config = self.getLocalConfigObj()
++ logger.debug("Trying to load the local config file for the "+self.name+" plugin .")
++ else:
++ config = self.getConfigObj()
++ logger.debug("Trying to load the original config file for the "+self.name+" plugin .")
+ try:
+ options = config[category]
+ except Exception,err:
+@@ -63,7 +80,13 @@
return config,options
def saveConfiguration(self, new_config):
+- config = self.getConfigObj()
+ if not os.path.isdir(expanduser(os.path.join("~/.creepy/plugins", self.name))):
-+ GeneralUtilities.setLocalPluginDir(self.name)
- config = self.getConfigObj()
++ GeneralUtilities.setLocalPluginDir(self.name)
++ config = self.getLocalConfigObj()
++ logger.debug("Trying to create the local config file for the "+self.name+" plugin .")
++ else:
++ config = self.getConfigObj()
++ logger.debug("Trying to save the local config file for the "+self.name+" plugin .")
try:
config['string_options'] = new_config['string_options']
-@@ -88,4 +94,4 @@
+ config['boolean_options'] = new_config['boolean_options']
+@@ -88,4 +111,4 @@
If the developer of the plugin has not implemented this function in the plugin,
return the key name to be used in the label
'''
diff --git a/debian/patches/05-project-dir.patch b/debian/patches/05-project-dir.patch
index 4d8f80c..f10a003 100644
--- a/debian/patches/05-project-dir.patch
+++ b/debian/patches/05-project-dir.patch
@@ -18,7 +18,7 @@ Author: Ross Gammon <rossgammon at mail.dk>
# set up logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
-@@ -95,10 +96,10 @@
+@@ -95,10 +96,11 @@
self.ui = Ui_CreepyMainWindow()
self.ui.setupUi(self)
#Create folders for projects and temp if they do not exist
@@ -30,10 +30,35 @@ Author: Ross Gammon <rossgammon at mail.dk>
+ os.makedirs(os.path.join(expanduser("~/.creepy"),'projects'))
+ if not os.path.exists(os.path.join(expanduser("~/.creepy"),'temp')):
+ os.makedirs(os.path.join(expanduser("~/.creepy"),'temp'))
++ logger.debug("Just created new project & temp folders if not already existing")
self.projectsList = []
self.currentProject = None
self.ui.webPage = QWebPage()
-@@ -610,7 +611,7 @@
+@@ -126,6 +128,7 @@
+ self.ui.actionCheckUpdates.triggered.connect(self.checkForUpdatedVersion)
+ self.ui.actionExit.triggered.connect(self.close)
+ self.loadProjectsFromStorage()
++ logger.debug("Just loaded projects from storage")
+ #If option enabled check for updated version
+
+ def checkForUpdatedVersion(self):
+@@ -503,6 +506,7 @@
+ '''
+ pluginStringOptions = plugin.plugin_object.readConfiguration('string_options')[1]
+ if pluginStringOptions != None:
++ logger.debug("Loading the String options for the "+plugin.name+" plugin .")
+ for idx, item in enumerate(pluginStringOptions.keys()):
+ itemLabel = plugin.plugin_object.getLabelForKey(item)
+ label = QLabel()
+@@ -521,6 +525,7 @@
+ '''
+ pluginBooleanOptions = plugin.plugin_object.readConfiguration('boolean_options')[1]
+ if pluginBooleanOptions != None:
++ logger.debug("Loading the Boolean options for the "+plugin.name+" plugin .")
+ for idx, item in enumerate(pluginBooleanOptions.keys()):
+ itemLabel = plugin.plugin_object.getLabelForKey(item)
+ cb = QCheckBox(itemLabel)
+@@ -610,7 +615,7 @@
Loads all the existing projects from the storage to be shown in the UI
"""
# Show the existing Projects
@@ -82,7 +107,15 @@ Author: Ross Gammon <rossgammon at mail.dk>
#Retieve and save the profile phot only if it does not exist
if not os.path.exists(temp_file):
urllib.urlretrieve(i.profile_image_url, temp_file)
-@@ -278,4 +278,4 @@
+@@ -115,6 +115,7 @@
+ self.wizard.resize(800,600)
+
+ if self.wizard.exec_():
++ logger.debug("About to try saving this new configuration")
+ try:
+ oAuthHandler.get_access_token(str(self.wizard.field("inputPin").toString()).strip())
+ access_token = oAuthHandler.access_token.key
+@@ -278,4 +279,4 @@
return key
return self.labels[key]
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/creepy.git
More information about the Pkg-grass-devel
mailing list