File: setup.py

package info (click to toggle)
jokosher 0.9-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,664 kB
  • ctags: 916
  • sloc: python: 8,676; xml: 2,539; sh: 13; makefile: 7
file content (122 lines) | stat: -rw-r--r-- 4,404 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/usr/bin/env python

from distutils.core import setup
from subprocess import *
import os
import glob

#Create an array with all the locale filenames
I18NFILES = []
for filepath in glob.glob("locale/*/LC_MESSAGES/*.mo"):
	targetpath = os.path.dirname(os.path.join("share/", filepath))
	I18NFILES.append((targetpath, [filepath]))

#Create an array with all the help documents (docbook)
HELPDOCS = []
for filepath in glob.glob("help/jokosher/*/*.xml"):
	targetpath = os.path.dirname(os.path.join("share/gnome/", filepath))
	HELPDOCS.append((targetpath, [filepath]))


#Create an array with all the help images
HELPIMAGES = []
for filepath in glob.glob("help/jokosher/*/figures/*.png"):
	targetpath = os.path.dirname(os.path.join("share/gnome/", filepath))
	HELPIMAGES.append((targetpath, [filepath]))
	
#Check if scrollkeeper is available
OMFFILES = []
omfdir = None
try:
	process = Popen(args=["scrollkeeper-config", "--omfdir"], stdout=PIPE)
except OSError:
	#Not available. Skip the registration.
	pass
else:
	#Obtain the OMF repository directory to install and register the help files
	omfdir = os.path.join(process.stdout.read().strip(), "jokosher")
	OMFFILES.append((omfdir, glob.glob("help/jokosher/*.omf")))
		
dist = setup(name='jokosher',
	version='0.9',
	author='Jokosher Project',
	author_email='corrales.david@gmail.com',
	maintainer='David Corrales',
	maintainer_email='corrales.david@gmail.com',
	description='Multi-track non-linear audio editing.',
	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.',
	url='http://www.jokosher.org/',
	download_url='http://www.jokosher.org/download',
	license='GNU GPL',
	platforms='linux',
	scripts=['bin/jokosher'],
	packages=['Jokosher'],
	data_files=[
		('share/jokosher/', glob.glob("Jokosher/*.glade")),
		('share/jokosher/', ["Jokosher/jokosher-logo.png"]),
		('share/jokosher/Instruments', glob.glob("Instruments/*.instr")),
		('share/jokosher/Instruments/images', glob.glob('Instruments/images/*.png')),
		('share/icons/hicolor/48x48/apps', ['images/jokosher-icon.png']),
		('share/pixmaps', ['images/jokosher-icon.png']),
		('share/jokosher/pixmaps', glob.glob("images/*.png")),
		('share/applications', ['bin/jokosher.desktop']),
		('share/mime/packages',	['bin/jokosher.xml']),
		('share/jokosher/extensions', glob.glob("extensions/*.py") + glob.glob("extensions/*.egg"))
		]+I18NFILES+HELPDOCS+HELPIMAGES+OMFFILES
)

#Non-documented way of getting the final directory prefix
installCmd = dist.get_command_obj(command="install_data")
installdir = installCmd.install_dir
installroot = installCmd.root

if not installroot:
	installroot = ""

if installdir:
	installdir = os.path.join(os.path.sep,
			installdir.replace(installroot, ""))

# Update the real URL attribute inside the OMF files
# and register them with scrollkeeper
if omfdir != None and installdir != None and dist != None:
	
	#Create an array with the docbook file locations
	HELPURI = []
	for filepath in glob.glob("help/jokosher/*/jokosher.xml"):
		targeturi = os.path.join(installdir, "share/gnome/", filepath)
		HELPURI.append(targeturi)
	
	#Replace the URL placeholder inside the OMF files
	installedOmfFiles = glob.glob(installroot + omfdir + "/*.omf")
	for fileNum in range(0, len(installedOmfFiles)):
		call(["scrollkeeper-preinstall", HELPURI[fileNum],
			installedOmfFiles[fileNum], installedOmfFiles[fileNum]])
		
	#Update the scrollkeeper catalog
	if os.geteuid() == 0:
		print "Updating the scrollkeeper index..."
		call(["scrollkeeper-update", "-o", installroot + omfdir])

# Update the mime types
if os.geteuid() == 0 and dist != None:
	print "Updating the mime-types...."
	
	#update the mimetypes database
	call(["update-mime-database", "/usr/share/mime/"])
	
	#update the .desktop file database
	call(["update-desktop-database"])

print "\nInstallation finished! You can now run Jokosher by typing 'jokosher' or through your applications menu icon."
	
## To uninstall manually delete these files/folders:
## /usr/bin/jokosher
## /usr/share/jokosher/
## /usr/share/gnome/help/jokosher/
## /usr/icons/hicolor/48x48/apps/jokosher-icon.png
## /usr/share/locale/*/LC_MESSAGES/jokosher.mo
## /usr/share/pixmaps/jokosher-icon.png
## /usr/share/applications/jokosher.desktop
## /usr/lib/python2.X/site-packages/Jokosher/
## omfdir/jokosher/*.omf