[meld] Preliminary port to Distutils
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Preliminary port to Distutils
- Date: Mon, 14 Oct 2013 21:09:04 +0000 (UTC)
commit 126bdb8b9625634b213343e3f8ba045ae874adf8
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Jan 22 08:19:42 2012 +1000
Preliminary port to Distutils
Most files are installed in the correct place, though several extra
files are unintentionally included (*.xcf for example) and there is no
solution available for building translated documentation.
This introduces a dependency on python-distutils-extra, but the overall
value seems debateable.
.gitignore | 3 +-
bin/meld | 17 ++++----
data/icons/{hicolor => }/16x16/apps/meld.png | Bin 799 -> 799 bytes
data/icons/{hicolor => }/16x16/apps/meld.xcf | Bin 3823 -> 3823 bytes
data/icons/{hicolor => }/22x22/apps/meld.png | Bin 1366 -> 1366 bytes
data/icons/{hicolor => }/22x22/apps/meld.xcf | Bin 6846 -> 6846 bytes
data/icons/{hicolor => }/32x32/apps/meld.png | Bin 2344 -> 2344 bytes
data/icons/{hicolor => }/32x32/apps/meld.svg | 0
data/icons/{hicolor => }/48x48/apps/meld.png | Bin 3633 -> 3633 bytes
data/icons/{hicolor => }/48x48/apps/meld.svg | 0
data/icons/{hicolor => }/scalable/apps/meld.svg | 0
meld/conf.py | 24 +++++------
meld/meldapp.py | 4 +-
meld/meldwindow.py | 8 +---
meld/ui/gnomeglade.py | 2 +-
setup.py | 51 +++++++++++++++++++++++
16 files changed, 77 insertions(+), 32 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 270a094..ec21e59 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,5 @@
*.desktop
*.install
data/appdata.xml
-data/mime/meld.xml
\ No newline at end of file
+data/mime/meld.xml
+build
diff --git a/bin/meld b/bin/meld
index 46f0872..58c9df1 100755
--- a/bin/meld
+++ b/bin/meld
@@ -66,25 +66,24 @@ except ValueError:
# Support running from an uninstalled version
if os.path.basename(__file__) == "meld":
self_path = os.path.realpath(__file__)
-else:
- # Hack around an issue with some modules s.a. runpy/trace in Python <2.7
- self_path = os.path.realpath(sys.argv[0])
melddir = os.path.abspath(os.path.join(os.path.dirname(self_path), ".."))
+uninstalled = False
if os.path.exists(os.path.join(melddir, "meld.doap")):
sys.path[0:0] = [melddir]
-else:
- sys.path[0:0] = [ #LIBDIR#
- ]
+ uninstalled = True
-# i18n support
import meld.conf
+
+if uninstalled:
+ meld.conf.uninstalled()
+
+# i18n support
import gettext
_ = gettext.gettext
-
# Locale setting in gtk.Builder appears somewhat broken under Python. See:
# https://bugzilla.gnome.org/show_bug.cgi?id=574520
-locale_domain = meld.conf.PACKAGE
+locale_domain = meld.conf.__package__
locale_dir = meld.conf.LOCALEDIR
gettext.bindtextdomain(locale_domain, locale_dir)
diff --git a/data/icons/hicolor/32x32/apps/meld.svg b/data/icons/32x32/apps/meld.svg
similarity index 100%
rename from data/icons/hicolor/32x32/apps/meld.svg
rename to data/icons/32x32/apps/meld.svg
diff --git a/data/icons/hicolor/48x48/apps/meld.svg b/data/icons/48x48/apps/meld.svg
similarity index 100%
rename from data/icons/hicolor/48x48/apps/meld.svg
rename to data/icons/48x48/apps/meld.svg
diff --git a/data/icons/hicolor/scalable/apps/meld.svg b/data/icons/scalable/apps/meld.svg
similarity index 100%
rename from data/icons/hicolor/scalable/apps/meld.svg
rename to data/icons/scalable/apps/meld.svg
diff --git a/meld/conf.py b/meld/conf.py
index 3a73855..fd9a5d6 100644
--- a/meld/conf.py
+++ b/meld/conf.py
@@ -1,19 +1,17 @@
import os
-PACKAGE = "meld" # "@PACKAGE"
-VERSION = "1.7.3" # "@VERSION"
-SHAREDIR = ( #SHAREDIR#
-)
-HELPDIR = ( #HELPDIR#
-)
-LOCALEDIR = ( #LOCALEDIR#
-)
+__package__ = "meld"
+__version__ = "1.7.5"
-melddir = os.path.abspath(os.path.join(
- os.path.dirname(os.path.realpath(__file__)), ".."))
+DATADIR = None
+LOCALEDIR = None
-DATADIR = SHAREDIR or os.path.join(melddir, "data")
-HELPDIR = HELPDIR or os.path.join(melddir, "help")
-LOCALEDIR = LOCALEDIR or os.path.join(melddir, "po")
+def uninstalled():
+ global DATADIR, LOCALEDIR
+ melddir = os.path.abspath(os.path.join(
+ os.path.dirname(os.path.realpath(__file__)), ".."))
+
+ DATADIR = DATADIR or os.path.join(melddir, "data")
+ LOCALEDIR = LOCALEDIR or os.path.join(melddir, "build", "mo")
diff --git a/meld/meldapp.py b/meld/meldapp.py
index 0e941e2..00c39c9 100644
--- a/meld/meldapp.py
+++ b/meld/meldapp.py
@@ -47,7 +47,7 @@ class MeldApp(gobject.GObject):
gobject.GObject.__init__(self)
gobject.set_application_name("Meld")
gtk.window_set_default_icon_name("meld")
- self.version = conf.VERSION
+ self.version = conf.__version__
self.prefs = preferences.MeldPreferences()
self.prefs.notify_add(self.on_preference_changed)
self.file_filters = self._parse_filters(self.prefs.filters,
@@ -111,7 +111,7 @@ class MeldApp(gobject.GObject):
parser = optparse.OptionParser(
usage=usage,
description=_("Meld is a file and directory comparison tool."),
- version="%prog " + conf.VERSION)
+ version="%prog " + conf.__version__)
parser.add_option("-L", "--label", action="append", default=[],
help=_("Set label to use instead of file name"))
parser.add_option("-n", "--newtab", action="store_true", default=False,
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index cc7e5bb..af0106f 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -530,13 +530,9 @@ class MeldWindow(gnomeglade.Component):
def on_menu_statusbar_toggled(self, widget):
app.prefs.statusbar_visible = widget.get_active()
- #
- # Toolbar and menu items (help)
- #
def on_menu_help_activate(self, button):
- # FIXME: This is why our current localised help isn't used.
- help_dir = "/".join((conf.HELPDIR, "C", "meld.xml"))
- misc.open_uri("ghelp:///" + os.path.abspath(help_dir))
+ help_path = "/".join(["help", "meld"])
+ misc.open_uri(help_path)
def on_menu_help_bug_activate(self, button):
misc.open_uri("http://bugzilla.gnome.org/buglist.cgi?query=product%3Ameld")
diff --git a/meld/ui/gnomeglade.py b/meld/ui/gnomeglade.py
index 8907d18..7e82ddd 100644
--- a/meld/ui/gnomeglade.py
+++ b/meld/ui/gnomeglade.py
@@ -44,7 +44,7 @@ class Component(object):
def __init__(self, filename, root, extra=None):
"""Load the widgets from the node 'root' in file 'filename'"""
self.builder = gtk.Builder()
- self.builder.set_translation_domain(meld.conf.PACKAGE)
+ self.builder.set_translation_domain(meld.conf.__package__)
objects = [root] + extra if extra else [root]
filename = ui_file(filename)
self.builder.add_objects_from_file(filename, objects)
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..983e94e
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+
+from distutils.core import setup
+import glob
+
+from DistUtilsExtra.command import (
+ build_extra, build_i18n, build_help, build_icons)
+
+import meld.conf
+
+
+setup(
+ name=meld.conf.__package__,
+ version=meld.conf.__version__,
+ description='Visual diff and merge tool',
+ author='Kai Willadsen',
+ author_email='kai willadsen gmail com',
+ url='http://meldmerge.org',
+ packages=[
+ 'meld',
+ 'meld.ui',
+ 'meld.util',
+ 'meld.vc',
+ ],
+ package_data={
+ 'meld.vc': ['README', 'COPYING', 'NEWS']
+ },
+ scripts=['bin/meld'],
+ data_files=[
+ ('share/man/man1',
+ ['meld.1']
+ ),
+ ('share/doc/meld',
+ ['COPYING', 'NEWS']
+ ),
+ ('share/meld/icons',
+ glob.glob("data/icons/*.xpm") +
+ glob.glob("data/icons/*.png") +
+ glob.glob("data/icons/COPYING*")
+ ),
+ ('share/meld/ui',
+ glob.glob("data/ui/*.ui") + glob.glob("data/ui/*.xml")
+ ),
+ ],
+ cmdclass={
+ "build": build_extra.build_extra,
+ "build_i18n": build_i18n.build_i18n,
+ "build_help": build_help.build_help,
+ "build_icons": build_icons.build_icons,
+ }
+)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]