Rev 547: Merge improvements to license location. in file:///data/jelmer/bzr-gtk/trunk/
Jelmer Vernooij
jelmer at samba.org
Fri Jul 18 11:41:43 BST 2008
At file:///data/jelmer/bzr-gtk/trunk/
------------------------------------------------------------
revno: 547
revision-id: jelmer at samba.org-20080718104142-jowo24tkk0z646z3
parent: jelmer at samba.org-20080718104023-d0ohq135irc66rsm
parent: jelmer at samba.org-20080704080517-o6othv35xmid6in6
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 __init__.py-20060519165329-a1fd52c8a829fcd5
about.py about.py-20070715145104-2ihlkw9xgrwj7i3d-1
------------------------------------------------------------
revno: 531.6.1
revision-id: jelmer at samba.org-20080704080517-o6othv35xmid6in6
parent: jelmer at samba.org-20080701215625-udvespwg6srjo252
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 __init__.py-20060519165329-a1fd52c8a829fcd5
about.py about.py-20070715145104-2ihlkw9xgrwj7i3d-1
=== 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 bazaar-commits
mailing list