File: setup.py

package info (click to toggle)
jokosher 0.11.5-5
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,452 kB
  • sloc: python: 11,036; xml: 1,576; sh: 9; makefile: 7
file content (112 lines) | stat: -rw-r--r-- 4,215 bytes parent folder | download | duplicates (2)
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
#!/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.11.5',
	author='Jokosher Project',
	author_email='jokosher-devel-list@gnome.org',
	maintainer='Jokosher Project',
	maintainer_email='jokosher-devel-list@gnome.org',
	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', 'Jokosher/elements', 'Jokosher/ui', 'Jokosher/PlatformUtils'],
	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.png']),
		('share/pixmaps', ['images/jokosher.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])

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/share/icons/hicolor/48x48/apps/jokosher.png
## /usr/share/locale/*/LC_MESSAGES/jokosher.mo
## /usr/share/pixmaps/jokosher.png
## /usr/share/applications/jokosher.desktop
## /usr/lib/python2.X/site-packages/Jokosher/
## /usr/share/omf/jokosher/*.omf