-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
154 lines (135 loc) · 5.64 KB
/
setup.py
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
#!/usr/bin/env python
import sys, os
from stat import *
from setuptools import find_packages
from distutils.core import setup
from distutils.command.install import install as _install
try:
from DistUtilsExtra.command import *
except ImportError:
print 'Cannot install ubukey :('
print 'Would you please install package "python-distutils-extra and python-setuptools" first?'
sys.exit()
import glob
INSTALLED_FILES = '.installed_files'
#stolen from ccsm
class install (_install):
def run (self):
_install.run(self)
outputs = self.get_outputs()
data = '\n'.join(outputs)
try:
f = open(INSTALLED_FILES, 'w')
except:
self.warn ('Could not write installed files list %s' %INSTALLED_FILES)
return
f.write(data)
f.close()
class uninstall(_install):
def run(self):
try:
files = file(INSTALLED_FILES, 'r').readlines()
except:
self.warn('Could not read installed files list %s' %INSTALLED_FILES)
return
for f in files:
print 'Uninstalling %s' %f.strip()
try:
os.unlink(f.strip())
except:
self.warn('Could not remove file %s' %f)
os.remove(INSTALLED_FILES)
version = open('VERSION', 'r').read().strip()
packages = ['Ubukey','Ubukey/lib']
data_files = [
('share/icons/hicolor/22x22/apps',['images/22x22/ubukey.png']),
('share/icons/hicolor/24x24/apps',['images/24x24/ubukey.png']),
('share/icons/hicolor/48x48/apps',['images/48x48/ubukey.png']),
('share/applications',['ubukey.desktop']),
('share/ubukey/data/glade',['data/glade/gui.glade']),
('share/ubukey/data/grub/i386',['data/grub/i386/stage2_eltorito']),
('share/ubukey/data/grub/x86_64',['data/grub/x86_64/stage2_eltorito']),
('share/ubukey/images', ['images/logo_xfce4.png',
'images/vbox.png', 'images/splash.jpg', 'images/usbkey.png',
'images/logo_kde4.png', 'images/logo_gnome.png',
'images/home-rw.png', 'images/logo_lxde.png', 'images/ubukeymaker.png','images/multisystem-liveusb.png','images/paypal.jpg',
]),
('share/ubukey/conf_files', ['conf_files/syslinux.cfg','conf_files/extlinux.conf']),
('share/ubukey/deboot-modules', ['deboot-modules/lxde',
'deboot-modules/gnome', 'deboot-modules/xfce4', 'deboot-modules/kde4','deboot-modules/cinnamon','deboot-modules/gnome-shell',
]),
('share/ubukey/scripts', ['scripts/dochroot.sh', 'scripts/ubusrc-gen', 'scripts/create_dist.sh',
'scripts/debootstrap_dist.sh', 'scripts/mkbootcd.sh', 'scripts/ubukey-addons_manager.sh',
'scripts/clone_dist.sh', 'scripts/themescan.sh', 'scripts/localiser-kde.sh','scripts/export_dist.sh',
'scripts/localiser.sh', 'scripts/scankey.sh', 'scripts/vbox.sh','scripts/include.sh','scripts/setres.sh',
'scripts/virtualbox.sh', 'scripts/remove_dist.sh',
'scripts/debootstrap-packages.sh','scripts/debootstrap_packages_chooser.sh','scripts/multiboot.sh','scripts/shareclipboard.sh',
]),
('share/ubukey/launchers', ['launchers/gfx', 'launchers/Ubukeymaker.desktop',
'launchers/wicd', 'launchers/mountrw.sh', 'launchers/sizer', 'launchers/gc.desktop',
'launchers/ubukey.desktop'
]),
('share/ubukey/addons/all', ['addons/all/fix-tty.sh',
'addons/all/utilisateur-live.sh', 'addons/all/installer.sh', 'addons/all/clone-pkglist.sh',
'addons/all/live-homerw.sh'
]),
('share/ubukey/addons/raring/lxde', ['addons/raring/lxde/codecs-gstreamer.sh']),
('share/ubukey/addons/raring/gnome', ['addons/raring/gnome/codecs-gstreamer.sh']),
('share/ubukey/addons/raring/xfce4', ['addons/raring/xfce4/codecs-gstreamer.sh']),
('share/ubukey/addons/quantal/lxde', ['addons/quantal/lxde/codecs-gstreamer.sh']),
('share/ubukey/addons/quantal/gnome', ['addons/quantal/gnome/codecs-gstreamer.sh']),
('share/ubukey/addons/quantal/xfce4', ['addons/quantal/xfce4/codecs-gstreamer.sh']),
('share/ubukey/addons/precise/lxde', ['addons/precise/lxde/codecs-gstreamer.sh']),
('share/ubukey/addons/precise/gnome', ['addons/precise/gnome/codecs-gstreamer.sh']),
('share/ubukey/addons/precise/xfce4', ['addons/precise/xfce4/codecs-gstreamer.sh'])]
for lang in os.listdir('lang'):
if os.path.isdir(os.path.join('lang',lang)):
lang_dir = os.path.join('share', 'locale', lang, 'LC_MESSAGES')
lang_file = os.path.join('lang', lang, 'LC_MESSAGES', 'ubukey.mo')
data_files.append((lang_dir, [lang_file]))
setup(
name='ubukey',
version=version,
description='Create or customize ubuntu based distributions',
author='Laguillaumie sylvain',
author_email='[email protected]',
url='http://penguincape.org',
packages=packages,
scripts=['ubukey'],
data_files=data_files,
cmdclass={'build' : build_extra.build_extra,
'build_i18n' : build_i18n.build_i18n,
'build_help' : build_help.build_help,
'build_icons' : build_icons.build_icons,
'uninstall': uninstall,
'install': install,
},
)
#Stolen from ccsm's setup.py
if sys.argv[1] == 'install':
prefix = None
if len (sys.argv) > 2:
i = 0
for o in sys.argv:
if o.startswith ("--prefix"):
if o == "--prefix":
if len (sys.argv) >= i:
prefix = sys.argv[i + 1]
sys.argv.remove (prefix)
elif o.startswith ("--prefix=") and len (o[9:]):
prefix = o[9:]
sys.argv.remove (o)
break
i += 1
if not prefix:
prefix = '/usr'
gtk_update_icon_cache = '''gtk-update-icon-cache -f -t \
%s/share/icons/hicolor''' % prefix
root_specified = [s for s in sys.argv if s.startswith('--root')]
if not root_specified or root_specified[0] == '--root=/':
print 'Updating Gtk icon cache.'
os.system(gtk_update_icon_cache)
else:
print '''*** Icon cache not updated. After install, run this:
*** %s''' % gtk_update_icon_cache
os.system('xdg-desktop-menu install --novendor ubukey.desktop')