~ubuntu-branches/ubuntu/precise/remuco-server/precise

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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
"""Setup script to install Remuco base and player adapters.

This script simply installs everything: the Python module 'remuco', all
player adapters (either as script or as data files) and the client binaries.

Installation my be configured by environment variables - search for 'os.getenv'
within this script.

"""
from distutils.core import setup
import os
import os.path

# =============================================================================
# specify script and data files for each player adapter (relative file names)
# =============================================================================

pa_files = {} # keys are adapter names, values are lists with:
               # first element: script file list
               # following elements: date file tuples

# --- Amarok ------------------------------------------------------------------

pa_files["amarok"] = [
    ["remuco-amarok"]
]

# --- Audacious ---------------------------------------------------------------

pa_files["audacious"] = [
    ["remuco-audacious"]
]

# --- Banshee -----------------------------------------------------------------

pa_files["banshee"] = [
    ["remuco-banshee"]
]

# --- FooPlay -----------------------------------------------------------------

pa_files["fooplay"] = [
    ["remuco-fooplay"]
]

# --- MPD ---------------------------------------------------------------------

pa_files["mpd"] = [
    ["remuco-mpd"]
]

# --- Rhythmbox ---------------------------------------------------------------

# set prefix may not be valid for Rhythmbox -> use a Rhythmbox specific prefix:
PREFIX_RHYTHMBOX = os.getenv("PREFIX_RHYTHMBOX", "/usr/")

pa_files["rhythmbox"] = [
    [],
    ("%slib/rhythmbox/plugins/remuco" % PREFIX_RHYTHMBOX,
     ["remuco.rb-plugin", "remythm.py"])
]

# --- Totem -------------------------------------------------------------------

# set prefix may not be valid for Totem -> use a Totem specific prefix:
PREFIX_TOTEM = os.getenv("PREFIX_TOTEM", "/usr/")

pa_files["totem"] = [
    [],
    ("%slib/totem/plugins/remuco" % PREFIX_TOTEM,
     ["remuco.totem-plugin", "remotem.py"])
]

# --- TVtime ------------------------------------------------------------------

pa_files["tvtime"] = [
    ["remuco-tvtime"]
]

# --- VLC ---------------------------------------------------------------------

pa_files["vlc"] = [
    ["remuco-vlc"]
]

# --- XMMS2 -------------------------------------------------------------------

pa_files["xmms2"] = [
    ["remuco-xmms2"]
]

# =============================================================================
# select player adapters to build/install (all by default)
# =============================================================================

components = os.getenv("REMUCO_COMPONENTS")

if components is None:
    # build/install everything
    player_adapters = pa_files.keys()
    client = True
elif components == "adapters":
    # build/install all player adapters
    player_adapters = pa_files.keys()
    client = False
elif components == "":
    # build/install no adapters, no client, only the base module
    player_adapters = []
    client = False
else:
    # build/install according to list selection
    player_adapters = components.split(',')
    try:
        player_adapters.remove("client")
        client = True
    except ValueError:
        client = False
    
# =============================================================================
# generate script and data file list (add prefix to pa_files)
# =============================================================================

print player_adapters

scripts = []
data_files = []

for pa in player_adapters:
    
    pa_scripts = pa_files[pa][0]
    pa_data_files = pa_files[pa][1:]
    
    for script in pa_scripts:
        scripts.append("adapter/%s/%s" % (pa, script))
    
    for tup in pa_data_files:
        group = []
        for data in tup[1]:
            group.append("adapter/%s/%s" % (pa, data))
        data_files.append((tup[0], group))

# =============================================================================
# client binaries
# =============================================================================

CLIENT_DEST = os.getenv("REMUCO_CLIENT_DEST", "share/remuco/client")

if client and os.path.exists("client/app"):
    data_files.append((CLIENT_DEST, ["client/app/remuco.jar",
                                     "client/app/remuco.jad"]))

# =============================================================================
# setup
# =============================================================================

setup(name='remuco',
      version='0.9.0',
      description='Remuco is a remote control system for media players.',
      author='Oben Sonne',
      author_email='obensonne@googlemail.com',
      url='http://remuco.sourcefourge.net',
      license='GPLv3',
      packages=['remuco'],
      package_dir={'remuco': 'base/module/remuco'},
      scripts=scripts,
      data_files=data_files,
)