[Pkg-bazaar-commits] ./bzr-gtk/unstable r547: Merge improvements to license location.

Jelmer Vernooij jelmer at samba.org
Fri Apr 10 07:50:41 UTC 2009


------------------------------------------------------------
revno: 547
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Fri 2008-07-18 12:41:42 +0200
message:
  Merge improvements to license location.
modified:
  __init__.py
  about.py
    ------------------------------------------------------------
    revno: 531.6.1
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Fri 2008-07-04 10:05:17 +0200
    message:
      Try harder to find license and credits files.
    modified:
      __init__.py
      about.py
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2008-06-27 17:10:27 +0000
+++ b/__init__.py	2008-07-04 08:05:17 +0000
@@ -103,21 +103,24 @@
     bzrlib.ui.ui_factory = GtkUIFactory()
 
 
-def data_path():
-    return os.path.dirname(__file__)
-
-
-def icon_path(*args):
-    basedirs = [os.path.join(data_path()),
+def data_basedirs():
+    return [os.path.dirname(__file__),
              "/usr/share/bzr-gtk", 
              "/usr/local/share/bzr-gtk"]
-    for basedir in basedirs:
-        path = os.path.join(basedir, 'icons', *args)
+
+
+def data_path(*args):
+    for basedir in data_basedirs():
+        path = os.path.join(basedir, *args)
         if os.path.exists(path):
             return path
     return None
 
 
+def icon_path(*args):
+    return data_path(os.path.join('icons', *args))
+
+
 def open_display():
     pygtk = import_pygtk()
     try:

=== modified file 'about.py'
--- a/about.py	2008-06-28 20:24:16 +0000
+++ b/about.py	2008-07-04 08:05:17 +0000
@@ -27,13 +27,14 @@
 from bzrlib.errors import NotBranchError, NoRepositoryPresent
 from bzrlib.trace import mutter
 
-from bzrlib.plugins.gtk import icon_path
+from bzrlib.plugins.gtk import data_path, icon_path
 
 
 def read_license():
-    license_file = os.path.join(os.path.dirname(__file__), "COPYING")
-    if os.path.exists(license_file):
-        return file(license_file).read()
+    license_paths = [data_path("COPYING"), "/usr/share/common-licenses/GPL-2"]
+    for license_file in license_paths:
+        if os.path.exists(license_file):
+            return file(license_file).read()
     # Fall back to just license name if we can't find the file
     return "GPLv2 or later"
 
@@ -41,7 +42,7 @@
 def load_credits():
     import pickle
     try:
-        credits = pickle.load(file("credits.pickle"))
+        credits = pickle.load(file(data_path("credits.pickle")))
     except IOError:
         credits = None
     return credits



More information about the Pkg-bazaar-commits mailing list