OSDN Git Service

For install.
authorAiwota Programmer <aiwotaprog@tetteke.tk>
Fri, 15 Sep 2006 08:50:02 +0000 (17:50 +0900)
committerAiwota Programmer <aiwotaprog@tetteke.tk>
Fri, 15 Sep 2006 08:50:02 +0000 (17:50 +0900)
MANIFEST.in [new file with mode: 0644]
setup.py [new file with mode: 0755]
src/FukuiNoNamari/board_window.py
src/FukuiNoNamari/bookmark_editwindow.py
src/FukuiNoNamari/bookmark_window.py
src/FukuiNoNamari/config.py
src/FukuiNoNamari/submit_window.py
src/FukuiNoNamari/thread_window.py
src/fukui-no-namari

diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644 (file)
index 0000000..f37232a
--- /dev/null
@@ -0,0 +1,8 @@
+include AUTHORS
+include ChangeLog
+include COPYING
+include README
+include PSF_LICENSE
+include MANIFEST.in
+
+include src/data/*.glade
diff --git a/setup.py b/setup.py
new file mode 100755 (executable)
index 0000000..922729a
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+
+from distutils.core import setup
+from glob import glob
+
+setup(name='fukui-no-namari',
+      version='0.1',
+      description='Fukui no Namari 2ch Browser',
+      author='Aiwota Programmer',
+      author_email='aiwotaprog@tetteke.tk',
+      url='http://www.fukui-no-namari.tetteke.tk/',
+      license='GPL-2',
+      scripts=['src/fukui-no-namari'],
+      package_dir={'': 'src'},
+      packages=['FukuiNoNamari', 'FukuiNoNamari/BbsType'],
+      data_files=[('share/fukui-no-namari', glob('src/data/*.glade'))],
+      )
index 42097be..824f76d 100644 (file)
@@ -24,6 +24,7 @@ import time
 import gobject
 import gconf
 import traceback
+import sys
 
 import board_data
 import uri_opener
@@ -37,8 +38,6 @@ from misc import ThreadInvoker
 import bookmark_list
 import bookmark_window
 
-GLADE_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)),
-                         "..", "data")
 GLADE_FILENAME = "board_window.glade"
 
 def open_board(uri, update=False):
@@ -63,7 +62,7 @@ class WinWrap(winwrapbase.WinWrapBase, board_data.BoardData):
         self.bbs_type = bbs_type_judge_uri.get_type(uri)
         board_data.BoardData.__init__(self, self.bbs_type)
         
-        glade_path = os.path.join(GLADE_DIR, GLADE_FILENAME)
+        glade_path = os.path.join(config.glade_dir, GLADE_FILENAME)
         self.widget_tree = gtk.glade.XML(glade_path)
 
         self.window = self.widget_tree.get_widget("board_window")
index 95e0bc4..3b04209 100644 (file)
@@ -20,18 +20,18 @@ pygtk.require("2.0")
 import gtk
 import gtk.glade
 import os.path
+import sys
 
 from bookmark_core import Bookmark
+import config
 
-GLADE_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)),
-                         "..", "data")
 GLADE_FILENAME = "bookmark_editwindow.glade"
 
 
 class BookmarkEditWindow:
 
     def __init__(self, on_newbookmark_complete, bookmark=None):
-        glade_path = os.path.join(GLADE_DIR, GLADE_FILENAME)
+        glade_path = os.path.join(config.glade_dir, GLADE_FILENAME)
         self.widget_tree = gtk.glade.XML(glade_path)
         self.widget_tree.signal_autoconnect(self)
         self.window = self.widget_tree.get_widget("window_editbookmark")
index 77f52ef..440c702 100644 (file)
@@ -23,6 +23,7 @@ import traceback
 import gnome
 import os.path
 import itertools
+import sys
 
 from bookmark_core import Bookmark
 from bookmark_editwindow import BookmarkEditWindow
@@ -31,9 +32,8 @@ import bookmark_list
 import uri_opener
 import winwrapbase
 import session
+import config
 
-GLADE_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)),
-                         "..", "data")
 GLADE_FILENAME = "bookmark_window.glade"
 
 def open():
@@ -53,7 +53,7 @@ class WinWrap(winwrapbase.WinWrapBase):
         self.bookmarklist = bookmark_list.bookmark_list
         self.bookmarklist.set_view(self)
 
-        glade_path = os.path.join(GLADE_DIR, GLADE_FILENAME)
+        glade_path = os.path.join(config.glade_dir, GLADE_FILENAME)
         self.widget_tree = gtk.glade.XML(glade_path)
         self.window = self.widget_tree.get_widget("window_bookmark")
         self.window.connect("destroy", self.on_destroy)
index bddbad0..e7a2fa5 100644 (file)
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
+import os
 import os.path
+import sys
 
-APPNAME = "example-1.0"
-User_Agent = "FukuiNoNamari/0.1"
+APPNAME = "fukui-no-namari"
+APPVERSION = "0.1"
+User_Agent = "FukuiNoNamari" + "/" + APPVERSION
+
+_real_argv_0 = os.path.realpath(sys.argv[0])
+_appdir = os.path.dirname(_real_argv_0)
+
+glade_dir = os.path.join(_appdir, "data")
+if not os.access(glade_dir, os.F_OK):
+    glade_dir = os.path.realpath(os.path.join(_appdir, "..", "share", APPNAME))
 
 def get_config_dir_path():
     return os.path.expanduser("~/." + APPNAME.lower())
index 07b1889..19adfa2 100644 (file)
@@ -25,6 +25,7 @@ import urllib
 import urllib2
 import cookielib
 import os.path
+import sys
 
 from BbsType import bbs_type_judge_uri
 from BbsType import bbs_type_exception
@@ -34,8 +35,6 @@ import uri_opener
 import config
 from http_sub import HTTPDebugHandler
 
-GLADE_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)),
-                         "..", "data")
 GLADE_FILENAME = "submit_window.glade"
 
 cookie_jar = cookielib.CookieJar()
@@ -115,7 +114,7 @@ class WinWrap:
             raise bbs_type_exception.BbsTypeError, \
                   "the uri does not represent thread: " + uri
 
-        glade_path = os.path.join(GLADE_DIR, GLADE_FILENAME)
+        glade_path = os.path.join(config.glade_dir, GLADE_FILENAME)
         self.widget_tree = gtk.glade.XML(glade_path)
         self.window = self.widget_tree.get_widget("submit_window")
         self.entry_name = self.widget_tree.get_widget("entry_name")
index eb4ce60..9d38f86 100644 (file)
@@ -32,6 +32,7 @@ import gconf
 import traceback
 import itertools
 import os
+import sys
 
 import misc
 from misc import FileWrap, ThreadInvoker
@@ -49,8 +50,6 @@ import winwrapbase
 import bookmark_list
 import bookmark_window
 
-GLADE_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)),
-                         "..", "data")
 GLADE_FILENAME = "thread_window.glade"
 
 def open_thread(uri, update=False):
@@ -97,7 +96,7 @@ class WinWrap(winwrapbase.WinWrapBase):
         self.jump_request_num = 0
         self.progress = False
 
-        glade_path = os.path.join(GLADE_DIR, GLADE_FILENAME)
+        glade_path = os.path.join(config.glade_dir, GLADE_FILENAME)
         self.widget_tree = gtk.glade.XML(glade_path)
         self.window = self.widget_tree.get_widget("thread_window")
         self.toolbar = self.widget_tree.get_widget("toolbar")
index fb0c5a1..52b07df 100755 (executable)
@@ -28,11 +28,7 @@ import dbus
 import dbus.service
 import os.path
 
-APPNAME = 'Fukui-no-Namari'
-APPVERSION = '0.1'
-
 from FukuiNoNamari import config
-config.APPNAME = APPNAME.lower()
 from FukuiNoNamari import thread_window
 from FukuiNoNamari import board_window
 from FukuiNoNamari import dbus_object
@@ -91,7 +87,7 @@ if __name__ == "__main__":
         bus_name = dbus.service.BusName(dbus_bus_name, bus=session_bus)
         obj = dbus_object.DBusFukuiNoNamariObject(bus_name, dbus_object_path)
 
-        gnome.init(APPNAME, APPVERSION)
+        gnome.init(config.APPNAME, config.APPVERSION)
         gobject.threads_init()
 
         bookmark_path = os.path.join(config.get_config_dir_path(),