From 20ae20cc4205fcdc744b841d550fa1628d3a9771 Mon Sep 17 00:00:00 2001 From: ckruse Date: Tue, 26 Feb 2013 22:49:13 +0100 Subject: [PATCH 1/4] fix: place config file under ~/.config/bungloo --- Linux/Bungloo.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Linux/Bungloo.py b/Linux/Bungloo.py index 43a9920..de1b5d8 100755 --- a/Linux/Bungloo.py +++ b/Linux/Bungloo.py @@ -4,6 +4,8 @@ import os, sys, pickle, subprocess from PyQt4 import QtCore, QtGui, QtWebKit import Windows, Helper +import shutil + class Bungloo: def __init__(self): @@ -63,11 +65,16 @@ class Controller(QtCore.QObject): def __init__(self, app): QtCore.QObject.__init__(self) self.app = app + self.config_path = os.path.expanduser('~/.config/bungloo/bungloo.cfg') - if not os.path.exists(os.path.expanduser("~/.bungloo/")): - os.makedirs(os.path.expanduser("~/.bungloo/")) + if not os.path.exists(os.path.expanduser("~/.config/bungloo/")): + os.makedirs(os.path.expanduser("~/.config/bungloo/")) + + oldpath = os.path.expanduser('~/.bungloo/bungloo.cfg') + if os.path.isfile(oldpath): + shutil.copyfile(oldpath, self.config_path) + shutil.rmtree(os.path.expanduser('~/.bungloo/')) - self.config_path = os.path.expanduser('~/.bungloo/bungloo.cfg') if os.access(self.config_path, os.R_OK): with open(self.config_path, 'r') as f: self.config = pickle.load(f) From 7c6d9566bb0af196881bb768566271ac51c0187b Mon Sep 17 00:00:00 2001 From: ckruse Date: Tue, 26 Feb 2013 23:24:00 +0100 Subject: [PATCH 2/4] fix: move whole tree --- Linux/Bungloo.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Linux/Bungloo.py b/Linux/Bungloo.py index de1b5d8..b8f6e75 100755 --- a/Linux/Bungloo.py +++ b/Linux/Bungloo.py @@ -65,15 +65,16 @@ class Controller(QtCore.QObject): def __init__(self, app): QtCore.QObject.__init__(self) self.app = app - self.config_path = os.path.expanduser('~/.config/bungloo/bungloo.cfg') + + oldpath = os.path.expanduser('~/.bungloo/') + if os.path.isdir(oldpath): + shutil.copytree(oldpath, os.path.expanduser('~/.config/bungloo/')) + shutil.rmtree(os.path.expanduser('~/.bungloo/')) if not os.path.exists(os.path.expanduser("~/.config/bungloo/")): os.makedirs(os.path.expanduser("~/.config/bungloo/")) - oldpath = os.path.expanduser('~/.bungloo/bungloo.cfg') - if os.path.isfile(oldpath): - shutil.copyfile(oldpath, self.config_path) - shutil.rmtree(os.path.expanduser('~/.bungloo/')) + self.config_path = os.path.expanduser('~/.config/bungloo/bungloo.cfg') if os.access(self.config_path, os.R_OK): with open(self.config_path, 'r') as f: From 9c36ef3785b71f7a742c1fbeaf0c458be7e6ec0f Mon Sep 17 00:00:00 2001 From: ckruse Date: Wed, 27 Feb 2013 00:10:27 +0100 Subject: [PATCH 3/4] created a deployment script for packing bungloo packages --- Linux/Bungloo.py | 11 +++++++++-- Linux/Helper.py | 7 ++++++- Linux/deploy.sh | 14 ++++++++++++++ Linux/setup.py | 25 +++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 3 deletions(-) create mode 100755 Linux/deploy.sh create mode 100644 Linux/setup.py diff --git a/Linux/Bungloo.py b/Linux/Bungloo.py index b8f6e75..0de5bf0 100755 --- a/Linux/Bungloo.py +++ b/Linux/Bungloo.py @@ -2,7 +2,11 @@ import os, sys, pickle, subprocess from PyQt4 import QtCore, QtGui, QtWebKit -import Windows, Helper + +if __file__ == 'Bungloo.py': + import Windows, Helper +else: + from bungloo import Windows, Helper import shutil @@ -25,7 +29,10 @@ class Bungloo: self.app.exec_() def resources_path(self): - return os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) + if __file__ == 'Bungloo.py': + return os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) + else: + return Helper.Helper.get_resource_path() def resources_uri(self): return "file://localhost" + os.path.abspath(os.path.join(self.resources_path(), "WebKit")) diff --git a/Linux/Helper.py b/Linux/Helper.py index 4fb321c..50910fa 100644 --- a/Linux/Helper.py +++ b/Linux/Helper.py @@ -9,6 +9,11 @@ import os import array +class Helper: + @classmethod + def get_resource_path(cls): + return os.path.dirname(__file__) + class WebPage(QtWebKit.QWebPage): def __init__(self, parent=0, app=None): super(QtWebKit.QWebPage, self).__init__(parent) @@ -125,4 +130,4 @@ class RestorableWindow(QtGui.QMainWindow): def show(self): QtGui.QMainWindow.show(self) self.activateWindow() - self.raise_() \ No newline at end of file + self.raise_() diff --git a/Linux/deploy.sh b/Linux/deploy.sh new file mode 100755 index 0000000..358af46 --- /dev/null +++ b/Linux/deploy.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +mkdir -p build +mkdir -p build/bin +mkdir -p build/bungloo +touch build/bungloo/__init__.py + +cp Bungloo.py build/bin/bungloo +cp Helper.py Windows.py build/bungloo +cp setup.py build/ +cp -r ../WebKit build/bungloo/ +cp -r ../images build/bungloo/ + +# eof diff --git a/Linux/setup.py b/Linux/setup.py new file mode 100644 index 0000000..d56faef --- /dev/null +++ b/Linux/setup.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python2 + +import os +from distutils.core import setup + +files = [] +for dirname, dirnames, filenames in os.walk('bungloo/WebKit'): + for filename in filenames: + files += [os.path.join(dirname, filename)[8:]] + +for dirname, dirnames, filenames in os.walk('bungloo/images'): + for filename in filenames: + files += [os.path.join(dirname, filename)[8:]] + +setup( + name = "bungloo", + version = "0.1", + author = "Jeena Paradies", + author_email = "spam@jeenaparadies.net", + url = "https://github.com/jeena/bungloo", + license = "BSD license", + packages = ['bungloo'], + package_data = {"bungloo": files}, + scripts = ["bin/bungloo"] + ) From 7d6ae7844bdc71cbc8629f261c19377f3e82ad56 Mon Sep 17 00:00:00 2001 From: Jeena Paradies Date: Wed, 27 Feb 2013 07:50:36 +0100 Subject: [PATCH 4/4] changed url --- Linux/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Linux/setup.py b/Linux/setup.py index d56faef..2e79b55 100644 --- a/Linux/setup.py +++ b/Linux/setup.py @@ -17,7 +17,7 @@ setup( version = "0.1", author = "Jeena Paradies", author_email = "spam@jeenaparadies.net", - url = "https://github.com/jeena/bungloo", + url = "http://jabs.nu/bungloo", license = "BSD license", packages = ['bungloo'], package_data = {"bungloo": files},