Hellas, Michael Vogt and I had a go at setup.py and tried to make jokosher run happily locally, but also installed with sudo ./setup.py Here's the result from a quick hack session. Please review it and see if it makes sense. Packaging should be *really* easy now. Have a nice day, Daniel
diff -ruN trunk/Jokosher/AddInstrumentDialog.py jokosher/Jokosher/AddInstrumentDialog.py --- trunk/Jokosher/AddInstrumentDialog.py 2006-08-25 01:58:13.000000000 +0200 +++ jokosher/Jokosher/AddInstrumentDialog.py 2006-08-25 15:59:44.000000000 +0200 @@ -135,14 +135,11 @@ if len(instrumentPropertyList) > 0: return - basepath = os.path.dirname(os.path.abspath(__file__)) - instrpath = os.path.join(basepath, "..", "Instruments") - - files = os.walk(instrpath).next()[2] + files = os.walk(Globals.INSTR_PATH).next()[2] instrFiles = [x for x in files if x.endswith(".instr")] for f in instrFiles: config = SafeConfigParser() - config.read(os.path.join(instrpath, f)) + config.read(os.path.join(Globals.INSTR_PATH, f)) if config.has_option('core', 'type') and config.has_option('core', 'icon'): icon = config.get('core', 'icon') @@ -163,7 +160,7 @@ else: continue - pixbufPath = os.path.join(instrpath, "images", icon) + pixbufPath = os.path.join(Globals.INSTR_PATH, "images", icon) pixbuf = gtk.gdk.pixbuf_new_from_file(pixbufPath) instrumentPropertyList.append((name, type, pixbuf)) diff -ruN trunk/Jokosher/Globals.py jokosher/Jokosher/Globals.py --- trunk/Jokosher/Globals.py 2006-08-25 01:58:13.000000000 +0200 +++ jokosher/Jokosher/Globals.py 2006-08-25 15:55:51.000000000 +0200 @@ -90,14 +90,23 @@ def SetAbsPaths(): """Set a bunch of paths for use across the project. This is particularly useful for that 'orrible packaging lot""" - global JOKOSHER_PATH, IMAGE_PATH, GLADE_PATH, LOCALE_DIR, LOCALE_APP, EFFECT_PRESETS_PATH - - JOKOSHER_PATH = os.path.dirname(os.path.abspath(__file__)) - IMAGE_PATH = os.path.join(JOKOSHER_PATH, "..", "images") - EFFECT_PRESETS_PATH = os.path.join(JOKOSHER_PATH, "..", "effectspresets") - GLADE_PATH = os.path.join(JOKOSHER_PATH, "Jokosher.glade") - LOCALE_DIR = os.path.join(JOKOSHER_PATH, "..", "locale") + global JOKOSHER_PATH, IMAGE_PATH, GLADE_PATH, LOCALE_DIR, LOCALE_APP, EFFECT_PRESETS_PATH, INSTR_PATH + LOCALE_APP = "jokosher" + JOKOSHER_PATH = os.getenv("JOKOSHER_DATA_PATH") + if JOKOSHER_PATH: + IMAGE_PATH = "/usr/share/pixmaps" + EFFECT_PRESETS_PATH = os.path.join(JOKOSHER_PATH, "effectspresets") + INSTR_PATH = os.path.join(JOKOSHER_PATH, "Instruments") + GLADE_PATH = os.path.join(JOKOSHER_PATH, "Jokosher.glade") + LOCALE_DIR = os.path.join("/usr/share/locale") + else: + JOKOSHER_PATH = os.path.dirname(os.path.abspath(__file__)) + IMAGE_PATH = os.path.join(JOKOSHER_PATH, "..", "images") + EFFECT_PRESETS_PATH = os.path.join(JOKOSHER_PATH, "..", "effectspresets") + GLADE_PATH = os.path.join(JOKOSHER_PATH, "Jokosher.glade") + LOCALE_DIR = os.path.join(JOKOSHER_PATH, "..", "locale") + INSTR_PATH = os.path.join(JOKOSHER_PATH, "..", "Instruments") settings = Settings() diff -ruN trunk/Jokosher/Jokosher jokosher/Jokosher/Jokosher --- trunk/Jokosher/Jokosher 2006-08-25 02:24:39.000000000 +0200 +++ jokosher/Jokosher/Jokosher 2006-08-25 16:00:49.000000000 +0200 @@ -1,3 +1,13 @@ -#!/bin/bash +#!/usr/bin/env python + +try: + import JokosherApp + print "Runing local" +except ImportError, e: + print "runing from global because of ", e + import Jokosher.JokosherApp as JokosherApp + import os + os.environ["JOKOSHER_DATA_PATH"] = "/usr/share/jokosher/" + +JokosherApp.main() -PYTHONPATH=$(dirname $(dirname $0)):$PYTHONPATH python $(dirname $0)/JokosherApp.py \ Kein Zeilenumbruch am Dateiende. diff -ruN trunk/Jokosher/JokosherApp.py jokosher/Jokosher/JokosherApp.py --- trunk/Jokosher/JokosherApp.py 2006-08-25 01:58:13.000000000 +0200 +++ jokosher/Jokosher/JokosherApp.py 2006-08-25 16:01:19.000000000 +0200 @@ -174,7 +174,13 @@ self.PopulateRecentProjects() #set window icon - self.window.set_icon_from_file(os.path.join(Globals.IMAGE_PATH, "jokosher-icon.png")) + #self.window.set_icon_from_file(os.path.join(Globals.IMAGE_PATH, "jokosher-icon.png")) + icon_theme = gtk.icon_theme_get_default() + try: + pixbuf = icon_theme.load_icon("jokosher-icon", 48, 0) + self.window.set_icon(pixbuf) + except gobject.GError, exc: + print "can't load icon", exc #make icon available to others self.icon = self.window.get_icon() diff -ruN trunk/jokosher.desktop jokosher/jokosher.desktop --- trunk/jokosher.desktop 2006-08-25 02:24:39.000000000 +0200 +++ jokosher/jokosher.desktop 2006-08-25 16:02:37.000000000 +0200 @@ -4,8 +4,8 @@ Name=Jokosher GenericName=Jokosher audio editing Comment=Multi-track non-linear audio editing -Exec=Jokosher/Jokosher -Icon=images/jokosher-icon.png +Exec=Jokosher +Icon=jokosher-icon Terminal=false Type=Application Categories=Application;AudioVideo; diff -ruN trunk/locale/src/Makefile jokosher/locale/src/Makefile --- trunk/locale/src/Makefile 2006-08-04 22:46:08.000000000 +0200 +++ jokosher/locale/src/Makefile 2006-08-25 14:46:03.000000000 +0200 @@ -1,34 +1,20 @@ -#Generic rule for MO files -%.mo: DIR1 = ../$(basename $@) -%.mo: DIR2 = $(DIR1)/LC_MESSAGES -%.mo: %.po - ############## - #GENERATING $@ - ############## - if [ ! -d $(DIR1) ]; then mkdir $(DIR1); fi - if [ ! -d $(DIR2) ]; then mkdir $(DIR2); fi - msgfmt $< -o $@ - cp $@ $(DIR2)/jokosher.mo - -#Generic rule for PO files -%.po: jokosher.pot - ################## - #MERGING $@ AND $< - ################## - msgmerge -UN $@ $< - -#Generic rule for POT files -%.pot: ../../Jokosher.glade ../../*.py ../../Instruments/*.instr - ############ - #CREATING $@ - ############ - intltool-extract --type=gettext/glade ../../Jokosher.glade - python i18nReadInstr.py ../../Instruments/*.instr > i18n.instr.h - xgettext -k_ -kN_ -o $@ ../../Jokosher.glade.h ../../*.py i18n.instr.h -update: $(shell ls *.po) +DOMAIN=jokosher +PO_FILES := $(wildcard *.po) -all: $(subst .po,.mo,$(shell ls *.po)) +all: update-po -clean: - rm *.mo i18n.instr.h ../../Jokosher.glade.h \ Kein Zeilenumbruch am Dateiende. +# update the pot +$(DOMAIN).pot: + intltool-update -p -g $(DOMAIN) + +# merge the new stuff into the po files +merge-po: $(PO_FILES) + intltool-update -r -g $(DOMAIN); + +# create mo from the pos +%.mo : %.po + mkdir -p mo/$(subst .po,,$<)/LC_MESSAGES/ + msgfmt $< -o mo/$(subst .po,,$<)/LC_MESSAGES/$(DOMAIN).mo + +update-po: $(DOMAIN).pot merge-po $(patsubst %.po,%.mo,$(wildcard *.po)) diff -ruN trunk/locale/src/POTFILES.in jokosher/locale/src/POTFILES.in --- trunk/locale/src/POTFILES.in 1970-01-01 01:00:00.000000000 +0100 +++ jokosher/locale/src/POTFILES.in 2006-08-25 14:55:12.000000000 +0200 @@ -0,0 +1,12 @@ +../Jokosher/AddInstrumentDialog.py +../Jokosher/CompactMixView.py +../Jokosher/EventLaneViewer.py +../Jokosher/EventViewer.py +../Jokosher/Extension.py +../Jokosher/InstrumentConnectionsDialog.py +../Jokosher/InstrumentViewer.py +../Jokosher/JokosherApp.py +../Jokosher/MasterMixerStrip.py +../Jokosher/MixerStrip.py +../Jokosher/NewProjectDialog.py +../Jokosher/VUWidget.py diff -ruN trunk/setup.py jokosher/setup.py --- trunk/setup.py 1970-01-01 01:00:00.000000000 +0100 +++ jokosher/setup.py 2006-08-25 14:57:57.000000000 +0200 @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +from distutils.core import setup +import os +import glob + +I18NFILES = [] +for filepath in glob.glob("locale/src/mo/*/LC_MESSAGES/*.mo"): + lang = filepath[len("locale/src/mo/"):] + targetpath = os.path.dirname(os.path.join("share/locale",lang)) + I18NFILES.append((targetpath, [filepath])) +os.system("cd locale/src; make update-po") + + +setup(name='jokosher', + version='0.2', + scripts=['Jokosher/Jokosher'], + packages=['Jokosher'], + data_files=[('share/jokosher/', + glob.glob("*/*.glade") + ), + ('share/jokosher/Instruments', + glob.glob("Instruments/*.instr") + ), + ('share/jokosher/Instruments/images', + glob.glob('Instruments/images/*') + ), + ('share/applications', + glob.glob("*/jokosher.desktop") + ), + ('share/icons/hicolor/48x48/apps', + ['Jokosher/jokosher-logo.png'] + ), + ('share/pixmaps', + glob.glob("images/*.png") + ), + ('share/applications', + ['jokosher.desktop'], + ) + ]+I18NFILES + ) +
Attachment:
signature.asc
Description: This is a digitally signed message part