~matttbe/wicd/ubuntu_python27

« back to all changes in this revision

Viewing changes to .pc/01-remove_unused_icons.patch/setup.py

  • Committer: Bazaar Package Importer
  • Author(s): David Paleino
  • Date: 2010-03-05 18:12:51 UTC
  • mfrom: (8.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100305181251-0fcsn0sty5oy8wlq
Tags: 1.7.0+ds1-2
Fix RC bug: daemon doesn't start anymore because copy.deepcopy()
fails with the iniparse object, coming from 20-use_iniparse.patch.
Bug 568326 reopened. (Closes: #572599)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
#
 
3
#   Copyright (C) 2007 - 2009 Adam Blackburn
 
4
#   Copyright (C) 2007 - 2009 Dan O'Reilly
 
5
#   Copyright (C) 2009        Andrew Psaltis
 
6
#
 
7
#   This program is free software; you can redistribute it and/or modify
 
8
#   it under the terms of the GNU General Public License Version 2 as
 
9
#   published by the Free Software Foundation.
 
10
#
 
11
#   This program is distributed in the hope that it will be useful,
 
12
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
#   GNU General Public License for more details.
 
15
#
 
16
#   You should have received a copy of the GNU General Public License
 
17
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
#
 
19
 
 
20
from distutils.core import setup, Command
 
21
from distutils.extension import Extension
 
22
import os
 
23
import sys
 
24
import shutil
 
25
import subprocess
 
26
 
 
27
# Be sure to keep this updated!
 
28
# VERSIONNUMBER
 
29
VERSION_NUM = '1.7.0'
 
30
# REVISION_NUM is automatically updated
 
31
REVISION_NUM = 'unknown'
 
32
CURSES_REVNO = 'uimod'
 
33
 
 
34
# change to the directory setup.py is contained in
 
35
os.chdir(os.path.abspath(os.path.split(__file__)[0]))
 
36
 
 
37
try:
 
38
    if os.path.exists('.bzr') and os.system('bzr > /dev/null 2>&1') == 0:
 
39
        try:
 
40
            os.system('bzr version-info --python > vcsinfo.py')
 
41
        except:
 
42
            pass
 
43
    import vcsinfo
 
44
    REVISION_NUM = vcsinfo.version_info['revno']
 
45
except Exception, e:
 
46
    print 'failed to find revision number:'
 
47
    print e
 
48
 
 
49
class configure(Command):
 
50
    description = "configure the paths that Wicd will be installed to"
 
51
    
 
52
    user_options = [
 
53
        # The first bunch is DIRECTORIES - they need to end with a slash ("/"),
 
54
        # which will automatically be tacked on in the finalize_options method
 
55
        ('lib=', None, 'set the lib directory'),
 
56
        ('share=', None, 'set the share directory'),
 
57
        ('etc=', None, 'set the etc directory'),
 
58
        ('scripts=', None, 'set the global scripts directory'),
 
59
        ('pixmaps=', None, 'set the pixmaps directory'),
 
60
        ('images=', None, 'set the image directory'),
 
61
        ('encryption=', None, 'set the encryption template directory'),
 
62
        ('bin=', None, 'set the bin directory'),
 
63
        ('sbin=', None, 'set the sbin directory'),
 
64
        ('backends=', None, 'set the backend storage directory'),
 
65
        ('daemon=', None, 'set the daemon directory'),
 
66
        ('curses=', None, 'set the curses UI directory'),
 
67
        ('gtk=', None, 'set the GTK UI directory'),
 
68
        ('cli=', None, 'set the CLI directory'),
 
69
        ('networks=', None, 'set the encryption configuration directory'),
 
70
        ('log=', None, 'set the log directory'),
 
71
        ('resume=', None, 'set the directory the resume from suspend script is stored in'),
 
72
        ('suspend=', None, 'set the directory the  suspend script is stored in'),
 
73
        ('pmutils=', None, 'set the directory the  pm-utils hooks are stored in'),
 
74
        ('dbus=', None, 'set the directory the dbus config file is stored in'),
 
75
        ('desktop=', None, 'set the directory the .desktop file is stored in'),
 
76
        ('icons=', None, "set the base directory for the .desktop file's icons"),
 
77
        ('translations=', None, 'set the directory translations are stored in'),
 
78
        ('autostart=', None, 'set the directory that will be autostarted on desktop login'),
 
79
        ('varlib=',None , 'set the path for wicd\'s variable state data'),
 
80
        ('init=', None, 'set the directory for the init file'),
 
81
        ('docdir=', None, 'set the directory for the documentation'),
 
82
        ('mandir=', None, 'set the directory for the man pages'),
 
83
        ('kdedir=', None, 'set the kde autostart directory'),
 
84
        
 
85
        # Anything after this is a FILE; in other words, a slash ("/") will 
 
86
        # not automatically be added to the end of the path.
 
87
        # Do NOT remove the python= entry, as it signals the beginning of 
 
88
        # the file section.
 
89
        ('python=', None, 'set the path to the Python executable'),
 
90
        ('pidfile=', None, 'set the pid file'),
 
91
        ('initfile=', None, 'set the init file to use'),
 
92
        ('initfilename=', None, "set the name of the init file (don't use)"),
 
93
        ('wicdgroup=', None, "set the name of the group used for wicd"),
 
94
        ('distro=', None, 'set the distribution for which wicd will be installed'),
 
95
        ('loggroup=', None, 'the group the log file belongs to'),
 
96
        ('logperms=', None, 'the log file permissions'),
 
97
 
 
98
        # Configure switches
 
99
        ('no-install-init', None, "do not install the init file"),
 
100
        ('no-install-man', None, 'do not install the man files'),
 
101
        ('no-install-i18n-man', None, 'do not install the translated man files'),
 
102
        ('no-install-kde', None, 'do not install the kde autostart file'),
 
103
        ('no-install-acpi', None, 'do not install the suspend.d and resume.d acpi scripts'),
 
104
        ('no-install-pmutils', None, 'do not install the pm-utils hooks'),
 
105
        ('no-install-docs', None, 'do not install the auxiliary documentation'),
 
106
        ('no-install-ncurses', None, 'do not install the ncurses client'),
 
107
        ('no-install-cli', None, 'do not install the command line executable'),
 
108
        ('no-install-gtk', None, 'do not install the gtk client'),
 
109
        ('no-use-notifications', None, 'do not ever allow the use of libnotify notifications')
 
110
        ]
 
111
        
 
112
    def initialize_options(self):
 
113
        self.lib = '/usr/lib/wicd/'
 
114
        self.share = '/usr/share/wicd/'
 
115
        self.etc = '/etc/wicd/'
 
116
        self.scripts = self.etc + "scripts/"
 
117
        self.icons = '/usr/share/icons/hicolor/'
 
118
        self.pixmaps = '/usr/share/pixmaps/'
 
119
        self.images = self.pixmaps + 'wicd/'
 
120
        self.encryption = self.etc + 'encryption/templates/'
 
121
        self.bin = '/usr/bin/'
 
122
        self.sbin = '/usr/sbin/'
 
123
        self.daemon = self.share + 'daemon'
 
124
        self.backends = self.share + 'backends'
 
125
        self.curses = self.share + 'curses'
 
126
        self.gtk = self.share + 'gtk'
 
127
        self.cli = self.share + 'cli'
 
128
        self.varlib = '/var/lib/wicd/'
 
129
        self.networks = self.varlib + 'configurations/'
 
130
        self.log = '/var/log/wicd/'
 
131
        self.resume = '/etc/acpi/resume.d/'
 
132
        self.suspend = '/etc/acpi/suspend.d/'
 
133
        self.pmutils = '/usr/lib/pm-utils/sleep.d/'
 
134
        self.dbus = '/etc/dbus-1/system.d/'
 
135
        self.desktop = '/usr/share/applications/'
 
136
        self.translations = '/usr/share/locale/'
 
137
        self.autostart = '/etc/xdg/autostart/'
 
138
        self.docdir = '/usr/share/doc/wicd/'
 
139
        self.mandir = '/usr/share/man/'
 
140
        self.kdedir = '/usr/share/autostart/'
 
141
        self.distro = 'auto'
 
142
        
 
143
        self.no_install_init = False
 
144
        self.no_install_man = False
 
145
        self.no_install_i18n_man = False
 
146
        self.no_install_kde = False
 
147
        self.no_install_acpi = False
 
148
        self.no_install_pmutils = False
 
149
        self.no_install_docs = False
 
150
        self.no_install_gtk = False
 
151
        self.no_install_ncurses = False
 
152
        self.no_install_cli = False
 
153
        self.no_use_notifications = False
 
154
 
 
155
        # Determine the default init file location on several different distros
 
156
        self.distro_detect_failed = False
 
157
        
 
158
        self.initfile = 'init/default/wicd'
 
159
        # ddistro is the detected distro
 
160
        if os.path.exists('/etc/redhat-release'):
 
161
            self.ddistro = 'redhat'
 
162
        elif os.path.exists('/etc/SuSE-release'):
 
163
            self.ddistro = 'suse'
 
164
        elif os.path.exists('/etc/fedora-release'):
 
165
            self.ddistro = 'redhat'
 
166
        elif os.path.exists('/etc/gentoo-release'):
 
167
            self.ddistro = 'gentoo'
 
168
        elif os.path.exists('/etc/debian_version'):
 
169
            self.ddistro = 'debian'
 
170
        elif os.path.exists('/etc/arch-release'):
 
171
            self.ddistro = 'arch'
 
172
        elif os.path.exists('/etc/slackware-version') or \
 
173
             os.path.exists('/etc/slamd64-version') or \
 
174
             os.path.exists('/etc/bluewhite64-version'):
 
175
            self.ddistro = 'slackware'
 
176
        elif os.path.exists('/etc/pld-release'):
 
177
            self.ddistro = 'pld'
 
178
        elif os.path.exists('/usr/bin/crux'):
 
179
            self.ddistro = 'crux'
 
180
        elif os.path.exists('/etc/lunar.release'):
 
181
            self.distro = 'lunar'
 
182
        else:
 
183
            self.ddistro = 'FAIL'
 
184
            #self.no_install_init = True
 
185
            #self.distro_detect_failed = True
 
186
            print 'WARNING: Unable to detect the distribution in use.  ' + \
 
187
                  'If you have specified --distro or --init and --initfile, configure will continue.  ' + \
 
188
                  'Please report this warning, along with the name of your ' + \
 
189
                  'distribution, to the wicd developers.'
 
190
 
 
191
        # Try to get the pm-utils sleep hooks directory from pkg-config and
 
192
        # the kde prefix from kde-config
 
193
        # Don't run these in a shell because it's not needed and because shell 
 
194
        # swallows the OSError we would get if {pkg,kde}-config do not exist
 
195
        # If we don't get anything from *-config, or it didn't run properly, 
 
196
        # or the path is not a proper absolute path, raise an error
 
197
        try:
 
198
            pmtemp = subprocess.Popen(["pkg-config", "--variable=pm_sleephooks", 
 
199
                                       "pm-utils"], stdout=subprocess.PIPE)
 
200
            returncode = pmtemp.wait() # let it finish, and get the exit code
 
201
            pmutils_candidate = pmtemp.stdout.readline().strip() # read stdout
 
202
            if len(pmutils_candidate) == 0 or returncode != 0 or \
 
203
               not os.path.isabs(pmutils_candidate):
 
204
                raise ValueError
 
205
            else:
 
206
                self.pmutils = pmutils_candidate
 
207
        except (OSError, ValueError):
 
208
            pass # use our default
 
209
 
 
210
        try:
 
211
            kdetemp = subprocess.Popen(["kde-config","--prefix"], stdout=subprocess.PIPE)
 
212
            returncode = kdetemp.wait() # let it finish, and get the exit code
 
213
            kdedir_candidate = kdetemp.stdout.readline().strip() # read stdout
 
214
            if len(kdedir_candidate) == 0 or returncode != 0 or \
 
215
               not os.path.isabs(kdedir_candidate):
 
216
                raise ValueError
 
217
            else:
 
218
                self.kdedir = kdedir_candidate + '/share/autostart'
 
219
        except (OSError, ValueError):
 
220
            # If kde-config isn't present, we'll check for kde-4.x
 
221
            try:
 
222
                kde4temp = subprocess.Popen(["kde4-config","--prefix"], stdout=subprocess.PIPE)
 
223
                returncode = kde4temp.wait() # let it finish, and get the exit code
 
224
                kde4dir_candidate = kde4temp.stdout.readline().strip() # read stdout
 
225
                if len(kde4dir_candidate) == 0 or returncode != 0 or \
 
226
                   not os.path.isabs(kde4dir_candidate):
 
227
                    raise ValueError
 
228
                else:
 
229
                    self.kdedir = kde4dir_candidate + '/share/autostart'
 
230
            except (OSError, ValueError):
 
231
                # If neither kde-config nor kde4-config are not present or 
 
232
                # return an error, then we can assume that kde isn't installed
 
233
                # on the user's system
 
234
                self.no_install_kde = True
 
235
                # If the assumption above turns out to be wrong, do this:
 
236
                #pass # use our default
 
237
 
 
238
        self.python = '/usr/bin/python'
 
239
        self.pidfile = '/var/run/wicd/wicd.pid'
 
240
        self.initfilename = os.path.basename(self.initfile)
 
241
        self.wicdgroup = 'users'
 
242
        self.loggroup = ''
 
243
        self.logperms = '0600'
 
244
 
 
245
    def distro_check(self):
 
246
        print "Distro is: "+self.distro
 
247
        if self.distro in ['sles','suse']:
 
248
            self.init = '/etc/init.d/'
 
249
            self.initfile = 'init/suse/wicd'
 
250
        elif self.distro in ['redhat','centos','fedora']:
 
251
            self.init = '/etc/rc.d/init.d/'
 
252
            self.initfile = 'init/redhat/wicd'
 
253
            self.pidfile = '/var/run/wicd.pid'
 
254
        elif self.distro in ['slackware','slamd64','bluewhite64']:
 
255
            self.init = '/etc/rc.d/'
 
256
            self.initfile = 'init/slackware/rc.wicd'
 
257
            self.docdir = '/usr/doc/wicd-%s' % VERSION_NUM
 
258
            self.mandir = '/usr/man/'
 
259
            self.no_install_acpi = True
 
260
            self.wicdgroup = "netdev"
 
261
        elif self.distro in ['debian']:
 
262
            self.wicdgroup = "netdev"
 
263
            self.loggroup = "adm"
 
264
            self.logperms = "0640"
 
265
            self.init = '/etc/init.d/'
 
266
            self.initfile = 'init/debian/wicd'
 
267
        elif self.distro in ['arch']:
 
268
            self.init = '/etc/rc.d/'
 
269
            self.initfile = 'init/arch/wicd'
 
270
        elif self.distro in ['gentoo']:
 
271
            self.init = '/etc/init.d/'
 
272
            self.initfile = 'init/gentoo/wicd'
 
273
        elif self.distro in ['pld']:
 
274
            self.init = '/etc/rc.d/init.d/'
 
275
            self.initfile = 'init/pld/wicd'
 
276
        elif self.distro in ['crux']:
 
277
            self.init = '/etc/rc.d/'
 
278
        elif self.distro in ['lunar']:
 
279
            self.init='/etc/init.d/'
 
280
            self.initfile = 'init/lunar/wicd'
 
281
        else :
 
282
            if self.distro == 'auto':
 
283
                print "NOTICE: Automatic distro detection found: "+self.ddistro+", retrying with that..."
 
284
                self.distro = self.ddistro
 
285
                self.distro_check()
 
286
            else:
 
287
                print "WARNING: Distro detection failed!"
 
288
                self.init='init/default/wicd'
 
289
                self.no_install_init = True
 
290
                self.distro_detect_failed = True
 
291
        
 
292
 
 
293
 
 
294
    def finalize_options(self):
 
295
        self.distro_check()
 
296
        if self.distro_detect_failed and not self.no_install_init and \
 
297
           'FAIL' in [self.init, self.initfile]:
 
298
            print 'ERROR: Failed to detect distro. Configure cannot continue.  ' + \
 
299
                  'Please specify --init and --initfile to continue with configuration.'
 
300
 
 
301
        # loop through the argument definitions in user_options
 
302
        for argument in self.user_options:
 
303
            # argument name is the first item in the user_options list
 
304
            # sans the = sign at the end
 
305
            argument_name = argument[0][:-1]
 
306
            # select the first one, which is the name of the option
 
307
            value = getattr(self, argument_name)
 
308
            # if the option is not python (which is not a directory)
 
309
            if not argument[0][:-1] == "python":
 
310
                # see if it ends with a /
 
311
                if not value.endswith("/"):
 
312
                    # if it doesn't, slap one on
 
313
                    setattr(self, argument_name, value + "/")
 
314
            else:
 
315
                # as stated above, the python entry defines the beginning
 
316
                # of the files section
 
317
                return
 
318
 
 
319
    def run(self):
 
320
        values = list()
 
321
        for argument in self.user_options:
 
322
            if argument[0].endswith('='):
 
323
                cur_arg = argument[0][:-1]
 
324
                cur_arg_value = getattr(self, cur_arg)
 
325
                print "%s is %s" % (cur_arg, cur_arg_value)
 
326
                values.append((cur_arg, getattr(self, cur_arg.replace('-','_'))))
 
327
            else:
 
328
                cur_arg = argument[0]
 
329
                cur_arg_value = getattr(self, cur_arg.replace('-', '_'))
 
330
                print "Found switch %s %s" % (argument, cur_arg_value) 
 
331
                values.append((cur_arg, bool(cur_arg_value)))
 
332
        
 
333
        print 'Replacing values in template files...'
 
334
        for item in os.listdir('in'):
 
335
            if item.endswith('.in'):
 
336
                print 'Replacing values in',item,
 
337
                original_name = os.path.join('in',item)
 
338
                item_in = open(original_name, 'r')
 
339
                final_name = item[:-3].replace('=','/')
 
340
                parent_dir = os.path.dirname(final_name)
 
341
                if parent_dir and not os.path.exists(parent_dir):
 
342
                    print '(mkdir %s)'%parent_dir,
 
343
                    os.makedirs(parent_dir)
 
344
                print final_name
 
345
                item_out = open(final_name, 'w')
 
346
                for line in item_in.readlines():
 
347
                    for item, value in values:
 
348
                        line = line.replace('%' + str(item.upper().replace('-','_')) + \
 
349
                                            '%', str(value))
 
350
 
 
351
                    # other things to replace that aren't arguments
 
352
                    line = line.replace('%VERSION%', str(VERSION_NUM))
 
353
                    line = line.replace('%REVNO%', str(REVISION_NUM))
 
354
                    line = line.replace('%CURSES_REVNO%', str(CURSES_REVNO))
 
355
                        
 
356
                    item_out.write(line)
 
357
                
 
358
                item_out.close()
 
359
                item_in.close()
 
360
                shutil.copymode(original_name, final_name)
 
361
 
 
362
class clear_generated(Command):
 
363
    description = 'clears out files generated by configure'
 
364
 
 
365
    user_options = []
 
366
 
 
367
    def initialize_options(self):
 
368
        pass
 
369
        
 
370
    def finalize_options(self):
 
371
        pass
 
372
        
 
373
    def run(self):
 
374
        print 'Removing completed template files...'
 
375
        for item in os.listdir('in'):
 
376
            if item.endswith('.in'):
 
377
                print 'Removing completed',item,
 
378
                original_name = os.path.join('in',item)
 
379
                final_name = item[:-3].replace('=','/')
 
380
                print final_name, '...',
 
381
                if os.path.exists(final_name):
 
382
                    os.remove(final_name)
 
383
                    print 'Removed.'
 
384
                else:
 
385
                    print 'Does not exist.'
 
386
 
 
387
class test(Command):
 
388
    description = "run Wicd's unit tests"
 
389
        
 
390
    user_options = []
 
391
        
 
392
    def initialize_options(self):
 
393
        pass
 
394
        
 
395
    def finalize_options(self):
 
396
        pass
 
397
        
 
398
    def run(self):
 
399
        print "importing tests"
 
400
        import tests
 
401
        print 'running tests'
 
402
        tests.run_tests()
 
403
 
 
404
class update_translations_py(Command):
 
405
    description = "download new translations.py from the online translator"
 
406
 
 
407
    user_options = []
 
408
 
 
409
    def initialize_options(self):
 
410
        pass
 
411
 
 
412
    def finalize_options(self):
 
413
        pass
 
414
 
 
415
    def run(self):
 
416
        import urllib, shutil
 
417
        # grab translations.py
 
418
        filename, headers = urllib.urlretrieve('http://wicd.net/translator/generate/translations.py/')
 
419
        # copy it into the right location
 
420
        shutil.copyfile(filename,
 
421
                        os.path.join(os.path.dirname(os.path.realpath(__file__)),
 
422
                                     'wicd/translations.py'))
 
423
 
 
424
class get_translations(Command):
 
425
    description = "download the translations from the online translator"
 
426
         
 
427
    user_options = []
 
428
 
 
429
    def initialize_options(self):
 
430
        pass
 
431
 
 
432
    def finalize_options(self):
 
433
        pass
 
434
 
 
435
    def run(self):
 
436
        import urllib, shutil
 
437
        if os.path.exists('translations'):
 
438
            shutil.rmtree('translations/')
 
439
        if os.path.exists('po'):
 
440
            shutil.rmtree('po/')
 
441
        os.makedirs('translations')
 
442
        os.makedirs('po')
 
443
        filename, headers = urllib.urlretrieve('http://wicd.sourceforge.net/translator/idlist/')
 
444
        id_file = open(filename, 'r')
 
445
        lines = id_file.readlines()
 
446
        # remove the \n from the end of lines, and remove blank entries
 
447
        lines = [ x.strip() for x in lines if not x.strip() is '' ]
 
448
        for id in lines:
 
449
            pofile, poheaders = urllib.urlretrieve('http://wicd.sourceforge.net/translator/download/'+str(id)+'/')
 
450
            try:
 
451
                lang_identifier = open(pofile,'r').readlines()[0].strip()
 
452
                first_line = lang_identifier
 
453
                lang_identifier = lang_identifier[lang_identifier.rindex('(')+1:lang_identifier.rindex(')')]
 
454
                print first_line
 
455
            except:
 
456
                print >> sys.stderr, 'error downloading language %s' % id
 
457
            else:
 
458
                shutil.move(pofile, 'po/'+lang_identifier+'.po')
 
459
                os.makedirs('translations/'+lang_identifier+'/LC_MESSAGES')
 
460
                os.system('msgfmt --output-file=translations/' + lang_identifier +
 
461
                          '/LC_MESSAGES/wicd.mo po/' + lang_identifier + '.po')
 
462
 
 
463
 
 
464
class uninstall(Command):
 
465
    description = "remove Wicd using uninstall.sh and install.log"
 
466
         
 
467
    user_options = []
 
468
 
 
469
    def initialize_options(self):
 
470
        pass
 
471
 
 
472
    def finalize_options(self):
 
473
        pass
 
474
 
 
475
    def run(self):
 
476
        os.system("./uninstall.sh")
 
477
try:
 
478
    import wpath
 
479
except ImportError:
 
480
    print '''Error importing wpath.py. You can safely ignore this
 
481
message. It is probably because you haven't run python setup.py
 
482
configure yet or you are running it for the first time.'''
 
483
 
 
484
data = []
 
485
py_modules=['wicd.networking','wicd.misc','wicd.wnettools',
 
486
           'wicd.wpath','wicd.dbusmanager',
 
487
           'wicd.logfile','wicd.backend','wicd.configmanager',
 
488
           'wicd.translations']
 
489
 
 
490
# path to the file to put in empty directories
 
491
# fixes https://bugs.launchpad.net/wicd/+bug/503028
 
492
empty_file = 'other/.empty_on_purpose'
 
493
 
 
494
try:
 
495
    print "Using init file",(wpath.init, wpath.initfile)
 
496
    data = [
 
497
    (wpath.dbus, ['other/wicd.conf']),
 
498
    (wpath.log, [empty_file]), 
 
499
    (wpath.etc, ['other/dhclient.conf.template.default']),
 
500
    (wpath.encryption, [('encryption/templates/' + b) for b in 
 
501
                        os.listdir('encryption/templates') if not b.startswith('.')]),
 
502
    (wpath.networks, [empty_file]),
 
503
    (wpath.sbin,  ['scripts/wicd']),  
 
504
    (wpath.daemon, ['wicd/monitor.py', 'wicd/wicd-daemon.py',
 
505
                 'wicd/suspend.py', 'wicd/autoconnect.py']), 
 
506
    (wpath.backends, ['wicd/backends/be-external.py', 'wicd/backends/be-ioctl.py']),
 
507
    (wpath.scripts, [empty_file]),
 
508
    (wpath.predisconnectscripts, [empty_file]),
 
509
    (wpath.postdisconnectscripts, [empty_file]),
 
510
    (wpath.preconnectscripts, [empty_file]),
 
511
    (wpath.postconnectscripts, [empty_file]),
 
512
    ]
 
513
    if not wpath.no_install_gtk:
 
514
        data.append((wpath.desktop, ['other/wicd.desktop']))
 
515
        data.append((wpath.bin, ['scripts/wicd-client']))
 
516
        data.append((wpath.bin, ['scripts/wicd-gtk']))
 
517
        data.append((wpath.gtk, ['gtk/wicd-client.py', 'gtk/netentry.py', 'gtk/prefs.py',
 
518
                                 'gtk/gui.py', 'gtk/guiutil.py', 'data/wicd.glade',
 
519
                                 'gtk/configscript.py']))
 
520
        data.append((wpath.autostart, ['other/wicd-tray.desktop']))
 
521
        if not wpath.no_install_man:
 
522
            data.append((wpath.mandir + 'man1/', [ 'man/wicd-client.1' ]))
 
523
        data.append((wpath.icons + 'scalable/apps/', ['icons/scalable/wicd-gtk.svg']))
 
524
        data.append((wpath.icons + '192x192/apps/', ['icons/192px/wicd-gtk.png']))
 
525
        data.append((wpath.icons + '128x128/apps/', ['icons/128px/wicd-gtk.png']))
 
526
        data.append((wpath.icons + '96x96/apps/', ['icons/96px/wicd-gtk.png']))
 
527
        data.append((wpath.icons + '72x72/apps/', ['icons/72px/wicd-gtk.png']))
 
528
        data.append((wpath.icons + '64x64/apps/', ['icons/64px/wicd-gtk.png']))
 
529
        data.append((wpath.icons + '48x48/apps/', ['icons/48px/wicd-gtk.png']))
 
530
        data.append((wpath.icons + '36x36/apps/', ['icons/36px/wicd-gtk.png']))
 
531
        data.append((wpath.icons + '32x32/apps/', ['icons/32px/wicd-gtk.png']))
 
532
        data.append((wpath.icons + '24x24/apps/', ['icons/24px/wicd-gtk.png']))
 
533
        data.append((wpath.icons + '22x22/apps/', ['icons/22px/wicd-gtk.png']))
 
534
        data.append((wpath.icons + '16x16/apps/', ['icons/16px/wicd-gtk.png']))
 
535
        data.append((wpath.images, [('images/' + b) for b in os.listdir('images') if not b.startswith('.')]))
 
536
        data.append((wpath.pixmaps, ['other/wicd-gtk.xpm']))
 
537
    if not wpath.no_install_ncurses:
 
538
        data.append((wpath.curses, ['curses/curses_misc.py']))
 
539
        data.append((wpath.curses, ['curses/prefs_curses.py']))
 
540
        data.append((wpath.curses, ['curses/wicd-curses.py']))
 
541
        data.append((wpath.curses, ['curses/netentry_curses.py']))
 
542
        data.append((wpath.curses, ['curses/configscript_curses.py']))
 
543
        data.append((wpath.bin, ['scripts/wicd-curses'])) 
 
544
        if not wpath.no_install_man:
 
545
            data.append(( wpath.mandir + 'man8/', ['man/wicd-curses.8'])) 
 
546
        if not wpath.no_install_man and not wpath.no_install_i18n_man:
 
547
            data.append(( wpath.mandir + 'nl/man8/', ['man/nl/wicd-curses.8'])) 
 
548
        if not wpath.no_install_docs:
 
549
            data.append(( wpath.docdir, ['curses/README.curses'])) 
 
550
    if not wpath.no_install_cli:
 
551
        data.append((wpath.cli, ['cli/wicd-cli.py']))
 
552
        data.append((wpath.bin, ['scripts/wicd-cli'])) 
 
553
        if not wpath.no_install_man:
 
554
            data.append(( wpath.mandir + 'man8/', ['man/wicd-cli.8'])) 
 
555
        if not wpath.no_install_docs:
 
556
            data.append(( wpath.docdir, ['cli/README.cli'])) 
 
557
    piddir = os.path.dirname(wpath.pidfile)
 
558
    if not piddir.endswith('/'):
 
559
        piddir += '/'
 
560
    if not wpath.no_install_docs:
 
561
        data.append((wpath.docdir, ['INSTALL', 'LICENSE', 'AUTHORS',
 
562
                                     'README', 'CHANGES', ]))
 
563
        data.append((wpath.varlib, ['other/WHEREAREMYFILES']))
 
564
    if not wpath.no_install_kde:
 
565
        if not wpath.no_install_gtk:
 
566
            data.append((wpath.kdedir, ['other/wicd-tray.desktop']))
 
567
    if not wpath.no_install_init:
 
568
        data.append((wpath.init, [ wpath.initfile ]))
 
569
    if not wpath.no_install_man:
 
570
        data.append((wpath.mandir + 'man8/', [ 'man/wicd.8' ]))
 
571
        data.append((wpath.mandir + 'man5/', [ 'man/wicd-manager-settings.conf.5' ]))
 
572
        data.append((wpath.mandir + 'man5/', [ 'man/wicd-wired-settings.conf.5' ]))
 
573
        data.append((wpath.mandir + 'man5/', [ 'man/wicd-wireless-settings.conf.5' ]))
 
574
        data.append((wpath.mandir + 'man1/', [ 'man/wicd-client.1' ]))
 
575
    if not wpath.no_install_man and not wpath.no_install_i18n_man:
 
576
        # Dutch translations of the man
 
577
        data.append((wpath.mandir + 'nl/man8/', [ 'man/nl/wicd.8' ]))
 
578
        data.append((wpath.mandir + 'nl/man5/', [ 'man/nl/wicd-manager-settings.conf.5' ]))
 
579
        data.append((wpath.mandir + 'nl/man5/', [ 'man/nl/wicd-wired-settings.conf.5' ]))
 
580
        data.append((wpath.mandir + 'nl/man5/', [ 'man/nl/wicd-wireless-settings.conf.5' ]))
 
581
        data.append((wpath.mandir + 'nl/man1/', [ 'man/nl/wicd-client.1' ]))
 
582
    if not wpath.no_install_acpi:
 
583
        data.append((wpath.resume, ['other/80-wicd-connect.sh' ]))
 
584
        data.append((wpath.suspend, ['other/50-wicd-suspend.sh' ]))
 
585
    if not wpath.no_install_pmutils:
 
586
        data.append((wpath.pmutils, ['other/91wicd' ]))
 
587
    print 'Using pid path', os.path.basename(wpath.pidfile)
 
588
    print 'Language support for',
 
589
    for language in os.listdir('translations/'):
 
590
        print language,
 
591
        data.append((wpath.translations + language + '/LC_MESSAGES/',
 
592
                    ['translations/' + language + '/LC_MESSAGES/wicd.mo']))
 
593
    print
 
594
except Exception, e:
 
595
    print str(e)
 
596
    print '''Error setting up data array. This is normal if 
 
597
python setup.py configure has not yet been run.'''
 
598
 
 
599
 
 
600
wpactrl_ext = Extension(name='wpactrl', 
 
601
                        sources=['depends/python-wpactrl/wpa_ctrl.c',
 
602
                                 'depends/python-wpactrl/wpactrl.c'],
 
603
                        extra_compile_args=["-fno-strict-aliasing"])
 
604
 
 
605
iwscan_ext = Extension(name='iwscan', libraries=['iw'],
 
606
                       sources=['depends/python-iwscan/pyiwscan.c'])
 
607
    
 
608
setup(cmdclass={'configure' : configure, 'get_translations' : get_translations,
 
609
                'uninstall' : uninstall, 'test' : test, 'clear_generated' :
 
610
                clear_generated, 'update_translations_py' :
 
611
                update_translations_py},
 
612
      name="Wicd",
 
613
      version=VERSION_NUM,
 
614
      description="A wireless and wired network manager",
 
615
      long_description="""A complete network connection manager
 
616
Wicd supports wired and wireless networks, and capable of
 
617
creating and tracking profiles for both.  It has a 
 
618
template-based wireless encryption system, which allows the user
 
619
to easily add encryption methods used.  It ships with some common
 
620
encryption types, such as WPA and WEP. Wicd will automatically
 
621
connect at startup to any preferred network within range.
 
622
""",
 
623
      author="Adam Blackburn, Dan O'Reilly, Andrew Psaltis",
 
624
      author_email="compwiz18@gmail.com, oreilldf@gmail.com, ampsaltis@gmail.com",
 
625
      url="http://wicd.net",
 
626
      license="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html",
 
627
      py_modules=py_modules,
 
628
      data_files=data
 
629
      )