~ubuntu-branches/debian/sid/jokosher/sid

« back to all changes in this revision

Viewing changes to .pc/update_mime_database.patch/setup.py

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2010-02-28 14:04:08 UTC
  • mfrom: (1.3.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100228140408-1wuhwpdyd0fu9u50
Tags: 0.11.4-1
* New upstream release.
* Switch to format 3.0 (quilt).
* Bump Standards-Version to 3.8.4, no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
from distutils.core import setup
 
4
from subprocess import *
 
5
import os
 
6
import glob
 
7
 
 
8
#Create an array with all the locale filenames
 
9
I18NFILES = []
 
10
for filepath in glob.glob("locale/*/LC_MESSAGES/*.mo"):
 
11
        targetpath = os.path.dirname(os.path.join("share/", filepath))
 
12
        I18NFILES.append((targetpath, [filepath]))
 
13
 
 
14
#Create an array with all the help documents (docbook)
 
15
HELPDOCS = []
 
16
for filepath in glob.glob("help/jokosher/*/*.xml"):
 
17
        targetpath = os.path.dirname(os.path.join("share/gnome/", filepath))
 
18
        HELPDOCS.append((targetpath, [filepath]))
 
19
 
 
20
 
 
21
#Create an array with all the help images
 
22
HELPIMAGES = []
 
23
for filepath in glob.glob("help/jokosher/*/figures/*.png"):
 
24
        targetpath = os.path.dirname(os.path.join("share/gnome/", filepath))
 
25
        HELPIMAGES.append((targetpath, [filepath]))
 
26
        
 
27
#Check if scrollkeeper is available
 
28
OMFFILES = []
 
29
omfdir = None
 
30
try:
 
31
        process = Popen(args=["scrollkeeper-config", "--omfdir"], stdout=PIPE)
 
32
except OSError:
 
33
        #Not available. Skip the registration.
 
34
        pass
 
35
else:
 
36
        #Obtain the OMF repository directory to install and register the help files
 
37
        omfdir = os.path.join(process.stdout.read().strip(), "jokosher")
 
38
        OMFFILES.append((omfdir, glob.glob("help/jokosher/*.omf")))
 
39
                
 
40
dist = setup(name='jokosher',
 
41
        version='0.11.4',
 
42
        author='Jokosher Project',
 
43
        author_email='jokosher-devel-list@gnome.org',
 
44
        maintainer='Jokosher Project',
 
45
        maintainer_email='jokosher-devel-list@gnome.org',
 
46
        description='Multi-track non-linear audio editing.',
 
47
        long_description='Jokosher is a simple yet powerful multi-track studio. With it you can create and record music, podcasts and more, all from an integrated simple environment.',
 
48
        url='http://www.jokosher.org/',
 
49
        download_url='http://www.jokosher.org/download',
 
50
        license='GNU GPL',
 
51
        platforms='linux',
 
52
        scripts=['bin/jokosher'],
 
53
        packages=['Jokosher', 'Jokosher/elements', 'Jokosher/ui', 'Jokosher/PlatformUtils'],
 
54
        data_files=[
 
55
                ('share/jokosher/', glob.glob("Jokosher/*.glade")),
 
56
                ('share/jokosher/', ["Jokosher/jokosher-logo.png"]),
 
57
                ('share/jokosher/Instruments', glob.glob("Instruments/*.instr")),
 
58
                ('share/jokosher/Instruments/images', glob.glob('Instruments/images/*.png')),
 
59
                ('share/icons/hicolor/48x48/apps', ['images/jokosher.png']),
 
60
                ('share/pixmaps', ['images/jokosher.png']),
 
61
                ('share/jokosher/pixmaps', glob.glob("images/*.png")),
 
62
                ('share/applications', ['bin/jokosher.desktop']),
 
63
                ('share/mime/packages', ['bin/jokosher.xml']),
 
64
                ('share/jokosher/extensions', glob.glob("extensions/*.py") + glob.glob("extensions/*.egg"))
 
65
                ]+I18NFILES+HELPDOCS+HELPIMAGES+OMFFILES
 
66
)
 
67
 
 
68
#Non-documented way of getting the final directory prefix
 
69
installCmd = dist.get_command_obj(command="install_data")
 
70
installdir = installCmd.install_dir
 
71
installroot = installCmd.root
 
72
 
 
73
if not installroot:
 
74
        installroot = ""
 
75
 
 
76
if installdir:
 
77
        installdir = os.path.join(os.path.sep,
 
78
                        installdir.replace(installroot, ""))
 
79
 
 
80
# Update the real URL attribute inside the OMF files
 
81
# and register them with scrollkeeper
 
82
if omfdir != None and installdir != None and dist != None:
 
83
        
 
84
        #Create an array with the docbook file locations
 
85
        HELPURI = []
 
86
        for filepath in glob.glob("help/jokosher/*/jokosher.xml"):
 
87
                targeturi = os.path.join(installdir, "share/gnome/", filepath)
 
88
                HELPURI.append(targeturi)
 
89
        
 
90
        #Replace the URL placeholder inside the OMF files
 
91
        installedOmfFiles = glob.glob(installroot + omfdir + "/*.omf")
 
92
        for fileNum in range(0, len(installedOmfFiles)):
 
93
                call(["scrollkeeper-preinstall", HELPURI[fileNum],
 
94
                        installedOmfFiles[fileNum], installedOmfFiles[fileNum]])
 
95
                
 
96
        #Update the scrollkeeper catalog
 
97
        if os.geteuid() == 0:
 
98
                print "Updating the scrollkeeper index..."
 
99
                call(["scrollkeeper-update", "-o", installroot + omfdir])
 
100
 
 
101
# Update the mime types
 
102
if os.geteuid() == 0 and dist != None:
 
103
        print "Updating the mime-types...."
 
104
        
 
105
        #update the mimetypes database
 
106
        try:
 
107
            call(["update-mime-database", "/usr/share/mime/"])
 
108
        except:
 
109
            pass
 
110
        
 
111
        #update the .desktop file database
 
112
        try:
 
113
           call(["update-desktop-database"])
 
114
        except:
 
115
            pass
 
116
 
 
117
print "\nInstallation finished! You can now run Jokosher by typing 'jokosher' or through your applications menu icon."
 
118
        
 
119
## To uninstall manually delete these files/folders:
 
120
## /usr/bin/jokosher
 
121
## /usr/share/jokosher/
 
122
## /usr/share/gnome/help/jokosher/
 
123
## /usr/share/icons/hicolor/48x48/apps/jokosher.png
 
124
## /usr/share/locale/*/LC_MESSAGES/jokosher.mo
 
125
## /usr/share/pixmaps/jokosher.png
 
126
## /usr/share/applications/jokosher.desktop
 
127
## /usr/lib/python2.X/site-packages/Jokosher/
 
128
## /usr/share/omf/jokosher/*.omf