Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 2 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 17
1
#! /bin/sh /usr/share/dpatch/dpatch-run
1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 10_installation.dpatch by Magnus Holmgren <magnus@kibibyte.se>
2
## 10_installation.dpatch by Magnus Holmgren <magnus@kibibyte.se>
3
##
3
##
4
## All lines beginning with `## DP:' are a description of the patch.
4
## All lines beginning with `## DP:' are a description of the patch.
5
## DP: Mostly adapt server to run as a daemon
5
## DP: Mostly adapt server to run as a daemon
6
6
7
@DPATCH@
7
@DPATCH@
8
8
9
--- pyscrabble-1.6.2.orig/pyscrabble/net/server.py
9
--- pyscrabble-1.6.2.orig/pyscrabble/net/server.py
10
+++ pyscrabble-1.6.2/pyscrabble/net/server.py
10
+++ pyscrabble-1.6.2/pyscrabble/net/server.py
11
@@ -46,7 +46,7 @@
11
@@ -46,7 +46,7 @@
12
         self.db = db.DB()
12
         self.db = db.DB()
13
         self.maxUsersLoggedIn = 0
13
         self.maxUsersLoggedIn = 0
14
         self.startDate = util.Time(seconds=time.time(), dispDate=True)
14
         self.startDate = util.Time(seconds=time.time(), dispDate=True)
15
-        self.rankings = rank.Rankings( resources["config"][constants.RANK_CONFIG] )
15
-        self.rankings = rank.Rankings( resources["config"][constants.RANK_CONFIG] )
16
+        self.rankings = rank.Rankings( resources["serverconfig"][constants.RANK_CONFIG] )
16
+        self.rankings = rank.Rankings( resources["serverconfig"][constants.RANK_CONFIG] )
17
         
17
         
18
         dir = resources["resources"][constants.DICT_DIR].path
18
         dir = resources["resources"][constants.DICT_DIR].path
19
         for lang in os.listdir( dir ):
19
         for lang in os.listdir( dir ):
20
--- pyscrabble-1.6.2.orig/pyscrabble/dist.py
20
--- pyscrabble-1.6.2.orig/pyscrabble/dist.py
21
+++ pyscrabble-1.6.2/pyscrabble/dist.py
21
+++ pyscrabble-1.6.2/pyscrabble/dist.py
22
@@ -1,8 +1,6 @@
22
@@ -1,8 +1,6 @@
23
 import glob
23
 import glob
24
 import os
24
 import os
25
 import sys
25
 import sys
26
-from distutils.command.install_lib import install_lib
26
-from distutils.command.install_lib import install_lib
27
-from distutils.command.install_scripts import install_scripts
27
-from distutils.command.install_scripts import install_scripts
28
 
28
 
29
 APP_NAME = 'pyscrabble'
29
 APP_NAME = 'pyscrabble'
30
 
30
 
31
@@ -31,50 +29,13 @@
31
@@ -31,50 +29,13 @@
32
     RESOURCE_PREFIX = 'resources'
32
     RESOURCE_PREFIX = 'resources'
33
 
33
 
34
 CONFIG_DIR = get_app_data_dir()
34
 CONFIG_DIR = get_app_data_dir()
35
-if not os.path.exists(CONFIG_DIR):
35
-if not os.path.exists(CONFIG_DIR):
36
-    CONFIG_DIR = os.path.join(RESOURCE_PREFIX, 'config')
36
-    CONFIG_DIR = os.path.join(RESOURCE_PREFIX, 'config')
37
 
37
 
38
-def getLocaleDirs(dir, domain):
38
-def getLocaleDirs(dir, domain):
39
-    l = []
39
-    l = []
40
-    
40
-    
41
-    langs = os.listdir( dir )
41
-    langs = os.listdir( dir )
42
-    for lang in langs:
42
-    for lang in langs:
43
-        d = os.path.join(dir,lang,"LC_MESSAGES")
43
-        d = os.path.join(dir,lang,"LC_MESSAGES")
44
-        path = os.path.join(d, '%s.mo' % domain)
44
-        path = os.path.join(d, '%s.mo' % domain)
45
-        l.append( (d,[path]) )
45
-        l.append( (d,[path]) )
46
-    
46
-    
47
-    return l
47
-    return l
48
-
48
-
49
-def getResourceDirs(dir, ensureLower=True, basePath = None, outdir=None):
49
-def getResourceDirs(dir, ensureLower=True, basePath = None, outdir=None):
50
-    result = []
50
-    result = []
51
-    absolute = os.path.abspath(dir)
51
-    absolute = os.path.abspath(dir)
52
-    
52
-    
53
-    base = basePath
53
-    base = basePath
54
-    if base is None:
54
-    if base is None:
55
-        base = os.path.dirname(absolute)
55
-        base = os.path.dirname(absolute)
56
-    else:
56
-    else:
57
-        base = os.path.dirname( os.path.abspath(base) )
57
-        base = os.path.dirname( os.path.abspath(base) )
58
-    
58
-    
59
-    for root, dirs, files in os.walk(absolute):
59
-    for root, dirs, files in os.walk(absolute):
60
-        if ensureLower and not os.path.basename(root).islower(): continue
60
-        if ensureLower and not os.path.basename(root).islower(): continue
61
-        if len(files) > 0:
61
-        if len(files) > 0:
62
-            f = []
62
-            f = []
63
-            d = root[len(base)+1:]
63
-            d = root[len(base)+1:]
64
-            if outdir is not None:
64
-            if outdir is not None:
65
-                d = os.path.join(outdir, d)
65
-                d = os.path.join(outdir, d)
66
-            for file in files:
66
-            for file in files:
67
-                f.append( os.path.join(root, file) )
67
-                f.append( os.path.join(root, file) )
68
-            result.append( (d, f) )
68
-            result.append( (d, f) )
69
-    return result
69
-    return result
70
-
70
-
71
-def getDataFiles():
71
-def getDataFiles():
72
-    return getLocaleDirs('resources/locale',APP_NAME) + \
72
-    return getLocaleDirs('resources/locale',APP_NAME) + \
73
-           [('resources/images', glob.glob('resources/images/*.*')), \
73
-           [('resources/images', glob.glob('resources/images/*.*')), \
74
-            ('resources/sounds', glob.glob('resources/sounds/*.*')), \
74
-            ('resources/sounds', glob.glob('resources/sounds/*.*')), \
75
-            ('config', glob.glob('resources/config/*.cfg')), \
75
-            ('config', glob.glob('resources/config/*.cfg')), \
76
-            ('resources/web', glob.glob('resources/web/*.*'))] + \
76
-            ('resources/web', glob.glob('resources/web/*.*'))] + \
77
-           getResourceDirs('resources/dict', True, 'resources') + \
77
-           getResourceDirs('resources/dict', True, 'resources') + \
78
-           getResourceDirs('resources/letters', True, 'resources')
78
-           getResourceDirs('resources/letters', True, 'resources')
79
+try:
79
+try:
80
+    from __installed__ import SERVER_LOG_DIR, SERVER_DB_DIR, SERVER_CONFIG_DIR
80
+    from __installed__ import SERVER_LOG_DIR, SERVER_DB_DIR, SERVER_CONFIG_DIR
81
+except ImportError:
81
+except ImportError:
82
+    SERVER_CONFIG_DIR = os.path.join(RESOURCE_PREFIX, 'config')
82
+    SERVER_CONFIG_DIR = os.path.join(RESOURCE_PREFIX, 'config')
83
+    SERVER_DB_DIR = CONFIG_DIR
83
+    SERVER_DB_DIR = CONFIG_DIR
84
+    SERVER_LOG_DIR = CONFIG_DIR
84
+    SERVER_LOG_DIR = CONFIG_DIR
85
 
85
 
86
 def ensure_config_dir(dir):
86
 def ensure_config_dir(dir):
87
     '''
87
     '''
88
@@ -86,45 +47,6 @@
88
@@ -86,45 +47,6 @@
89
         os.makedirs(dir)
89
         os.makedirs(dir)
90
 
90
 
91
 
91
 
92
-class InstallScripts(install_scripts):
92
-class InstallScripts(install_scripts):
93
-    '''
93
-    '''
94
-    install_scripts handler to strip any possible ^M's from files so they will run properly on unix
94
-    install_scripts handler to strip any possible ^M's from files so they will run properly on unix
95
-    '''
95
-    '''
96
-    
96
-    
97
-    def run(self):
97
-    def run(self):
98
-        install_scripts.run(self)
98
-        install_scripts.run(self)
99
-        for file in self.get_outputs():
99
-        for file in self.get_outputs():
100
-            self.fix(file)
100
-            self.fix(file)
101
-    
101
-    
102
-    def fix(self, path):
102
-    def fix(self, path):
103
-        f = open(path, "rb")
103
-        f = open(path, "rb")
104
-        data = f.read().replace("\r\n", "\n")
104
-        data = f.read().replace("\r\n", "\n")
105
-        f.close()
105
-        f.close()
106
-        f = open(path, "w")
106
-        f = open(path, "w")
107
-        f.write(data)
107
-        f.write(data)
108
-        f.close()
108
-        f.close()
109
-    
109
-    
110
-
110
-
111
-class InstallLib(install_lib):
111
-class InstallLib(install_lib):
112
-    
112
-    
113
-    def generate_template(self):
113
-    def generate_template(self):
114
-        filename = os.path.join(self.build_dir, APP_NAME, '__installed__.py')
114
-        filename = os.path.join(self.build_dir, APP_NAME, '__installed__.py')
115
-        self.mkpath(os.path.dirname(filename))
115
-        self.mkpath(os.path.dirname(filename))
116
-        
116
-        
117
-        install = self.distribution.get_command_obj('install')
117
-        install = self.distribution.get_command_obj('install')
118
-        datadir = os.path.join(install.prefix, 'share', APP_NAME)
118
-        datadir = os.path.join(install.prefix, 'share', APP_NAME)
119
-        
119
-        
120
-        fp = open(filename, 'w')
120
-        fp = open(filename, 'w')
121
-        fp.write('# Generated by setup.py do not modify\n')
121
-        fp.write('# Generated by setup.py do not modify\n')
122
-        fp.write("RESOURCE_PREFIX = '%s'\n" % datadir)
122
-        fp.write("RESOURCE_PREFIX = '%s'\n" % datadir)
123
-        fp.close()
123
-        fp.close()
124
-
124
-
125
-        return filename
125
-        return filename
126
-    
126
-    
127
-    def install(self):
127
-    def install(self):
128
-        template = self.generate_template()
128
-        template = self.generate_template()
129
-        return install_lib.install(self) + [template]
129
-        return install_lib.install(self) + [template]
130
-
130
-
131
 class Resource(object):
131
 class Resource(object):
132
     '''
132
     '''
133
     Filesystem resource
133
     Filesystem resource
134
--- pyscrabble-1.6.2.orig/pyscrabble/db.py
134
--- pyscrabble-1.6.2.orig/pyscrabble/db.py
135
+++ pyscrabble-1.6.2/pyscrabble/db.py
135
+++ pyscrabble-1.6.2/pyscrabble/db.py
136
@@ -1,5 +1,4 @@
136
@@ -1,5 +1,4 @@
137
 from pyscrabble import constants
137
 from pyscrabble import constants
138
-from pyscrabble import manager
138
-from pyscrabble import manager
139
 from ZODB import FileStorage, DB as _DB
139
 from ZODB import FileStorage, DB as _DB
140
 import transaction
140
 import transaction
141
 
141
 
142
@@ -12,8 +11,10 @@
142
@@ -12,8 +11,10 @@
143
         '''
143
         '''
144
         Initialize the connection to the DB
144
         Initialize the connection to the DB
145
         '''
145
         '''
146
-        r = manager.ResourceManager()
146
-        r = manager.ResourceManager()
147
-        path = r["config"][constants.DB_LOCATION]
147
-        path = r["config"][constants.DB_LOCATION]
148
+        import os
148
+        import os
149
+        from pyscrabble import dist
149
+        from pyscrabble import dist
150
+
150
+
151
+        path = os.path.join(dist.SERVER_DB_DIR, constants.DB_LOCATION)
151
+        path = os.path.join(dist.SERVER_DB_DIR, constants.DB_LOCATION)
152
         
152
         
153
         storage = FileStorage.FileStorage(path)    
153
         storage = FileStorage.FileStorage(path)    
154
         db = _DB(storage)
154
         db = _DB(storage)
155
--- pyscrabble-1.6.2.orig/pyscrabble/manager.py
155
--- pyscrabble-1.6.2.orig/pyscrabble/manager.py
156
+++ pyscrabble-1.6.2/pyscrabble/manager.py
156
+++ pyscrabble-1.6.2/pyscrabble/manager.py
157
@@ -36,6 +36,7 @@
157
@@ -36,6 +36,7 @@
158
         '''
158
         '''
159
         self.loaded = True
159
         self.loaded = True
160
         
160
         
161
+        self["serverconfig"] = dist.Resource( dist.SERVER_CONFIG_DIR )
161
+        self["serverconfig"] = dist.Resource( dist.SERVER_CONFIG_DIR )
162
         self["config"] = dist.Resource( dist.CONFIG_DIR )
162
         self["config"] = dist.Resource( dist.CONFIG_DIR )
163
         self["resources"] = dist.Resource( dist.RESOURCE_PREFIX )
163
         self["resources"] = dist.Resource( dist.RESOURCE_PREFIX )
164
     
164
     
165
--- pyscrabble-1.6.2.orig/server_console.py
165
--- pyscrabble-1.6.2.orig/server_console.py
166
+++ pyscrabble-1.6.2/server_console.py
166
+++ pyscrabble-1.6.2/server_console.py
167
@@ -76,15 +76,15 @@
167
@@ -76,15 +76,15 @@
168
         '''
168
         '''
169
         Configure the server
169
         Configure the server
170
         '''
170
         '''
171
-        dist.ensure_config_dir(dist.CONFIG_DIR)
171
-        dist.ensure_config_dir(dist.CONFIG_DIR)
172
+        dist.ensure_config_dir(dist.SERVER_CONFIG_DIR)
172
+        dist.ensure_config_dir(dist.SERVER_CONFIG_DIR)
173
         resources = manager.ResourceManager()
173
         resources = manager.ResourceManager()
174
         logging.basicConfig(level=logging.DEBUG,
174
         logging.basicConfig(level=logging.DEBUG,
175
                     format='%(asctime)s %(name)s %(levelname)s %(message)s',
175
                     format='%(asctime)s %(name)s %(levelname)s %(message)s',
176
-                    filename=resources["config"][constants.LOG_FILE],
176
-                    filename=resources["config"][constants.LOG_FILE],
177
-                    filemode='w')
177
-                    filemode='w')
178
+                    filename=os.path.join(dist.SERVER_LOG_DIR, constants.LOG_FILE),
178
+                    filename=os.path.join(dist.SERVER_LOG_DIR, constants.LOG_FILE),
179
+                    filemode='a')
179
+                    filemode='a')
180
         
180
         
181
         
181
         
182
-        config = resources["config"][constants.SERVER_CONSOLE_CONFIG]
182
-        config = resources["config"][constants.SERVER_CONSOLE_CONFIG]
183
+        config = resources["serverconfig"][constants.SERVER_CONSOLE_CONFIG]
183
+        config = resources["serverconfig"][constants.SERVER_CONSOLE_CONFIG]
184
         
184
         
185
         if not os.path.exists(config):
185
         if not os.path.exists(config):
186
             raise IOError, "%s must exist in %s" % (constants.SERVER_CONSOLE_CONFIG, resources["config"].path)
186
             raise IOError, "%s must exist in %s" % (constants.SERVER_CONSOLE_CONFIG, resources["config"].path)
187
--- pyscrabble-1.6.2.orig/setup.py
187
--- pyscrabble-1.6.2.orig/setup.py
188
+++ pyscrabble-1.6.2/setup.py
188
+++ pyscrabble-1.6.2/setup.py
189
@@ -7,20 +7,130 @@
189
@@ -7,20 +7,130 @@
190
     HAS_PY2EXE = False
190
     HAS_PY2EXE = False
191
 import glob
191
 import glob
192
 import os
192
 import os
193
-import pkg_resources
193
-import pkg_resources
194
+#import pkg_resources
194
+#import pkg_resources
195
 import sys
195
 import sys
196
+from distutils.command.install_lib import install_lib
196
+from distutils.command.install_lib import install_lib
197
+from distutils.command.install_scripts import install_scripts
197
+from distutils.command.install_scripts import install_scripts
198
+from distutils.command.install_data import install_data
198
+from distutils.command.install_data import install_data
199
+from distutils.command.install import install
199
+from distutils.command.install import install
200
 from pyscrabble.constants import VERSION
200
 from pyscrabble.constants import VERSION
201
 from pyscrabble import util
201
 from pyscrabble import util
202
 from pyscrabble import dist
202
 from pyscrabble import dist
203
 
203
 
204
-def fix_path(item):
204
-def fix_path(item):
205
-    if type(item) in (list, tuple):
205
-    if type(item) in (list, tuple):
206
-        if 'config' in item[0]:
206
-        if 'config' in item[0]:
207
-            return (item[0].replace('config', dist.get_app_data_dir()), item[1])
207
-            return (item[0].replace('config', dist.get_app_data_dir()), item[1])
208
-        else:
208
-        else:
209
-            return (item[0].replace('resources/', 'share/pyscrabble/'), item[1])
209
-            return (item[0].replace('resources/', 'share/pyscrabble/'), item[1])
210
+    
210
+    
211
+def getLocaleDirs(dir, domain):
211
+def getLocaleDirs(dir, domain):
212
+    l = []
212
+    l = []
213
+    
213
+    
214
+    langs = os.listdir( dir )
214
+    langs = os.listdir( dir )
215
+    for lang in langs:
215
+    for lang in langs:
216
+        d = os.path.join(dir,lang,"LC_MESSAGES")
216
+        d = os.path.join(dir,lang,"LC_MESSAGES")
217
+        path = os.path.join(d, '%s.mo' % domain)
217
+        path = os.path.join(d, '%s.mo' % domain)
218
+        l.append( (d,[path]) )
218
+        l.append( (d,[path]) )
219
+    
219
+    
220
+    return l
220
+    return l
221
+
221
+
222
+def getResourceDirs(dir, ensureLower=True, basePath = None, outdir=None):
222
+def getResourceDirs(dir, ensureLower=True, basePath = None, outdir=None):
223
+    result = []
223
+    result = []
224
+    absolute = os.path.abspath(dir)
224
+    absolute = os.path.abspath(dir)
225
+    
225
+    
226
+    base = basePath
226
+    base = basePath
227
+    if base is None:
227
+    if base is None:
228
+        base = os.path.dirname(absolute)
228
+        base = os.path.dirname(absolute)
229
     else:
229
     else:
230
-        return item
230
-        return item
231
+        base = os.path.dirname( os.path.abspath(base) )
231
+        base = os.path.dirname( os.path.abspath(base) )
232
+    
232
+    
233
+    for root, dirs, files in os.walk(absolute):
233
+    for root, dirs, files in os.walk(absolute):
234
+        if ensureLower and not os.path.basename(root).islower(): continue
234
+        if ensureLower and not os.path.basename(root).islower(): continue
235
+        if len(files) > 0:
235
+        if len(files) > 0:
236
+            f = []
236
+            f = []
237
+            d = root[len(base)+1:]
237
+            d = root[len(base)+1:]
238
+            if outdir is not None:
238
+            if outdir is not None:
239
+                d = os.path.join(outdir, d)
239
+                d = os.path.join(outdir, d)
240
+            for file in files:
240
+            for file in files:
241
+                f.append( os.path.join(root, file) )
241
+                f.append( os.path.join(root, file) )
242
+            result.append( (d, f) )
242
+            result.append( (d, f) )
243
+    return result
243
+    return result
244
+
244
+
245
+def getDataFiles():
245
+def getDataFiles():
246
+    return getLocaleDirs('resources/locale',dist.APP_NAME) + \
246
+    return getLocaleDirs('resources/locale',dist.APP_NAME) + \
247
+           [('resources/images', glob.glob('resources/images/*.*')), \
247
+           [('resources/images', glob.glob('resources/images/*.*')), \
248
+            ('resources/sounds', glob.glob('resources/sounds/*.*')), \
248
+            ('resources/sounds', glob.glob('resources/sounds/*.*')), \
249
+            ('config', glob.glob('resources/config/*.cfg')), \
249
+            ('config', glob.glob('resources/config/*.cfg')), \
250
+            ('resources/web', glob.glob('resources/web/*.*'))] + \
250
+            ('resources/web', glob.glob('resources/web/*.*'))] + \
251
+           getResourceDirs('resources/dict', True, 'resources') + \
251
+           getResourceDirs('resources/dict', True, 'resources') + \
252
+           getResourceDirs('resources/letters', True, 'resources')
252
+           getResourceDirs('resources/letters', True, 'resources')
253
+
253
+
254
+class InstallScripts(install_scripts):
254
+class InstallScripts(install_scripts):
255
+    '''
255
+    '''
256
+    install_scripts handler to strip any possible ^Ms from files so they will run properly on unix
256
+    install_scripts handler to strip any possible ^Ms from files so they will run properly on unix
257
+    '''
257
+    '''
258
+    
258
+    
259
+    def run(self):
259
+    def run(self):
260
+        install_scripts.run(self)
260
+        install_scripts.run(self)
261
+        for file in self.get_outputs():
261
+        for file in self.get_outputs():
262
+            self.fix(file)
262
+            self.fix(file)
263
+    
263
+    
264
+    def fix(self, path):
264
+    def fix(self, path):
265
+        f = open(path, "rb")
265
+        f = open(path, "rb")
266
+        data = f.read().replace("\r\n", "\n")
266
+        data = f.read().replace("\r\n", "\n")
267
+        f.close()
267
+        f.close()
268
+        f = open(path, "w")
268
+        f = open(path, "w")
269
+        f.write(data)
269
+        f.write(data)
270
+        f.close()
270
+        f.close()
271
+    
271
+    
272
+
272
+
273
+class InstallLib(install_lib):
273
+class InstallLib(install_lib):
274
+    
274
+    
275
+    def generate_template(self):
275
+    def generate_template(self):
276
+        filename = os.path.join(self.build_dir, dist.APP_NAME, '__installed__.py')
276
+        filename = os.path.join(self.build_dir, dist.APP_NAME, '__installed__.py')
277
+        self.mkpath(os.path.dirname(filename))
277
+        self.mkpath(os.path.dirname(filename))
278
+        
278
+        
279
+        install = self.distribution.get_command_obj('install')
279
+        install = self.distribution.get_command_obj('install')
280
+        datadir = os.path.join(install.prefix, 'share', 'games', dist.APP_NAME)
280
+        datadir = os.path.join(install.prefix, 'share', 'games', dist.APP_NAME)
281
+        
281
+        
282
+        fp = open(filename, 'w')
282
+        fp = open(filename, 'w')
283
+        fp.write('# Generated by setup.py do not modify\n')
283
+        fp.write('# Generated by setup.py do not modify\n')
284
+        fp.write("RESOURCE_PREFIX = %r\n" % datadir)
284
+        fp.write("RESOURCE_PREFIX = %r\n" % datadir)
285
+        fp.write("SERVER_CONFIG_DIR = %r\n" % install.confdir)
285
+        fp.write("SERVER_CONFIG_DIR = %r\n" % install.confdir)
286
+        fp.write("SERVER_DB_DIR = %r\n" % install.dbdir)
286
+        fp.write("SERVER_DB_DIR = %r\n" % install.dbdir)
287
+        fp.write("SERVER_LOG_DIR = %r\n" % install.logdir)
287
+        fp.write("SERVER_LOG_DIR = %r\n" % install.logdir)
288
+        fp.close()
288
+        fp.close()
289
+
289
+
290
+        return filename
290
+        return filename
291
+    
291
+    
292
+    def install(self):
292
+    def install(self):
293
+        template = self.generate_template()
293
+        template = self.generate_template()
294
+        return install_lib.install(self) + [template]
294
+        return install_lib.install(self) + [template]
295
+
295
+
296
+class InstallData(install_data):
296
+class InstallData(install_data):
297
+    def fix_path(self, item):
297
+    def fix_path(self, item):
298
+        install = self.distribution.get_command_obj('install')
298
+        install = self.distribution.get_command_obj('install')
299
+        if type(item) in (list, tuple):
299
+        if type(item) in (list, tuple):
300
+            if 'config' in item[0]:
300
+            if 'config' in item[0]:
301
+                return (item[0].replace('config', install.confdir), item[1])
301
+                return (item[0].replace('config', install.confdir), item[1])
302
+            else:
302
+            else:
303
+                return (item[0].replace('resources/', 'share/games/pyscrabble/'), item[1])
303
+                return (item[0].replace('resources/', 'share/games/pyscrabble/'), item[1])
304
+        else:
304
+        else:
305
+            return item
305
+            return item
306
+
306
+
307
+    def finalize_options(self):
307
+    def finalize_options(self):
308
+        self.data_files = [ self.fix_path(f) for f in self.data_files ]
308
+        self.data_files = [ self.fix_path(f) for f in self.data_files ]
309
+        install_data.finalize_options(self)
309
+        install_data.finalize_options(self)
310
+
310
+
311
+class Install(install):
311
+class Install(install):
312
+    user_options = install.user_options + [ ('logdir=', None, "log directory"),
312
+    user_options = install.user_options + [ ('logdir=', None, "log directory"),
313
+                                            ('dbdir=', None, "database directory"),
313
+                                            ('dbdir=', None, "database directory"),
314
+                                            ('confdir=', None, "configuration directory") ]
314
+                                            ('confdir=', None, "configuration directory") ]
315
+
315
+
316
+    def initialize_options(self):
316
+    def initialize_options(self):
317
+        self.logdir = None
317
+        self.logdir = None
318
+        self.dbdir = None
318
+        self.dbdir = None
319
+        self.confdir = None
319
+        self.confdir = None
320
+        install.initialize_options(self)
320
+        install.initialize_options(self)
321
+
321
+
322
+    def finalize_options(self):
322
+    def finalize_options(self):
323
+        print self.logdir
323
+        print self.logdir
324
+        install.finalize_options(self)
324
+        install.finalize_options(self)
325
 
325
 
326
 kwargs = {
326
 kwargs = {
327
     'name': 'pyscrabble',
327
     'name': 'pyscrabble',
328
@@ -28,7 +138,7 @@
328
@@ -28,7 +138,7 @@
329
     'author': 'Kevin Conaway',
329
     'author': 'Kevin Conaway',
330
     'author_email': 'kevin.a.conaway@gmail.com',
330
     'author_email': 'kevin.a.conaway@gmail.com',
331
     'url': 'http://pyscrabble.sourceforge.net',
331
     'url': 'http://pyscrabble.sourceforge.net',
332
-    'data_files': dist.getDataFiles(),
332
-    'data_files': dist.getDataFiles(),
333
+    'data_files': getDataFiles(),
333
+    'data_files': getDataFiles(),
334
     'packages': ['pyscrabble', 'pyscrabble.command', 'pyscrabble.game', 'pyscrabble.gui', 'pyscrabble.net']
334
     'packages': ['pyscrabble', 'pyscrabble.command', 'pyscrabble.game', 'pyscrabble.gui', 'pyscrabble.net']
335
 }
335
 }
336
 
336
 
337
@@ -77,10 +187,10 @@
337
@@ -77,10 +187,10 @@
338
     kwargs['data_files'] += [('.', ['CHANGELOG.txt'])]
338
     kwargs['data_files'] += [('.', ['CHANGELOG.txt'])]
339
     kwargs['data_files'] += [('.', ['LICENSE.txt'])]
339
     kwargs['data_files'] += [('.', ['LICENSE.txt'])]
340
     #for egg in eggpacks:
340
     #for egg in eggpacks:
341
-    #    kwargs['data_files'] += dist.getResourceDirs(egg.location, ensureLower=False, basePath=None, outdir='extra')
341
-    #    kwargs['data_files'] += dist.getResourceDirs(egg.location, ensureLower=False, basePath=None, outdir='extra')
342
+    #    kwargs['data_files'] += getResourceDirs(egg.location, ensureLower=False, basePath=None, outdir='extra')
342
+    #    kwargs['data_files'] += getResourceDirs(egg.location, ensureLower=False, basePath=None, outdir='extra')
343
 else:
343
 else:
344
     kwargs['scripts'] = ['pyscrabble-main.py', 'server_console.py', 'db_upgrade.py']
344
     kwargs['scripts'] = ['pyscrabble-main.py', 'server_console.py', 'db_upgrade.py']
345
-    kwargs['data_files'] = [fix_path(x) for x in kwargs['data_files']]
345
-    kwargs['data_files'] = [fix_path(x) for x in kwargs['data_files']]
346
-    kwargs['cmdclass'] = {'install_lib': dist.InstallLib, 'install_scripts' : dist.InstallScripts}
346
-    kwargs['cmdclass'] = {'install_lib': dist.InstallLib, 'install_scripts' : dist.InstallScripts}
347
+    #    kwargs['data_files'] = [fix_path(x) for x in kwargs['data_files']]
347
+    #    kwargs['data_files'] = [fix_path(x) for x in kwargs['data_files']]
348
+    kwargs['cmdclass'] = {'install': Install, 'install_lib': InstallLib, 'install_scripts' : InstallScripts, 'install_data': InstallData}
348
+    kwargs['cmdclass'] = {'install': Install, 'install_lib': InstallLib, 'install_scripts' : InstallScripts, 'install_data': InstallData}
349
 
349
 
350
-setup(**kwargs)
350
-setup(**kwargs)
351
\ No newline at end of file
351
\ No newline at end of file
352
+setup(**kwargs)
352
+setup(**kwargs)