-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
208 lines (160 loc) · 7.33 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#!/usr/bin/env python
# linstaller setup (using distutils)
# Copyright (C) 2011 Eugenio "g7" Paolantonio. All rights reserved.
# Work released under the GNU GPL license, version 3.
import os
import sys
from distutils.core import setup
from distutils import cmd
## FIXME: Need to properly get the install-lib variable from setup.cfg or command line
install_to = "/usr/share/linstaller"
class what_I_should_do_to_get_an_heck_of_a_configuration_variable(cmd.Command):
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
return self.get_finalized_command("install").install_lib
def search_for_glade():
""" Searches for glade files, and creates a properly-syntaxed list object to be added to data_files. """
data_files = []
symlinks = {}
for directory, dirnames, filenames in os.walk("."):
this_dir = [os.path.join(install_to, directory), []]
this_dir_changed = False
for file in filenames:
if ".glade" in file:
# We got it!
if not os.path.islink(os.path.join(directory, file)):
this_dir[1].append(os.path.join(directory, file))
this_dir_changed = True
else:
symlinks[os.path.join(directory, file)] = os.readlink(os.path.join(directory, file))
if this_dir_changed: data_files.append(tuple(this_dir))
return data_files, symlinks
data, symlinks = search_for_glade()
data_files = [
("/usr/bin", ["linstaller_wrapper.sh", "linstaller_crash_wrapper.sh", "session/linstaller_session.sh", "mount_nolive.sh"]),
("/etc/linstaller", ["config/semplice", "config/semplice.glade", "config/semplice-base", "config/semplice-nolive", "config/semplice-nolive.glade", "config/ubuntu", "config/ubuntu-nolive", "config/semplice-persistent", "config/semplice-persistent-nolive", "config/semplice-raspberrypi", "config/semplice-fullscreen", "config/semplice-fullscreen.glade"]),
("/usr/share/applications", ["linstaller.desktop"]),
("/usr/share/xsessions", ["session/linstaller.desktop"]),
("/usr/share/linstaller/data", ["data/semplice.icns"]),
]
data_files += data
distrib = setup(name='linstaller',
version='7.0.6',
description='Modular, preseedable, GNU/Linux distribution installer',
author='Eugenio Paolantonio and the Semplice Team',
author_email='[email protected]',
url='http://launchpad.net/linstaller',
scripts=['linstaller.py'],
packages=["crash", "linstaller", "linstaller.core", "linstaller.frontends", "linstaller.core.libmodules",
"linstaller.core.libmodules.chroot",
"linstaller.core.libmodules.partdisks",
"linstaller.core.libmodules.unsquash",
"linstaller.services",
"linstaller.services.glade",
"linstaller.frontends.glade",
"linstaller.modules",
"linstaller.modules.bootloader",
"linstaller.modules.bootloader.front",
"linstaller.modules.bootloader.front.glade",
"linstaller.modules.bootloader.inst",
"linstaller.modules.bootloader.inst.glade",
"linstaller.modules.debian",
"linstaller.modules.debian.inst",
"linstaller.modules.debian.inst.glade",
"linstaller.modules.virtualclean",
"linstaller.modules.virtualclean.inst",
"linstaller.modules.virtualclean.inst.glade",
"linstaller.modules.mirrorselect",
"linstaller.modules.mirrorselect.front",
"linstaller.modules.mirrorselect.front.glade",
"linstaller.modules.mirrorselect.inst",
"linstaller.modules.mirrorselect.inst.glade",
"linstaller.modules.clean",
"linstaller.modules.clean.inst",
"linstaller.modules.end",
"linstaller.modules.end.front",
"linstaller.modules.end.front.glade",
"linstaller.modules.fstab",
"linstaller.modules.fstab.inst",
"linstaller.modules.language",
"linstaller.modules.language.front",
"linstaller.modules.language.front.glade",
"linstaller.modules.language.inst",
"linstaller.modules.language.inst.glade",
"linstaller.modules.network",
"linstaller.modules.network.inst",
"linstaller.modules.partdisks",
"linstaller.modules.partdisks.front",
"linstaller.modules.partdisks.front.glade",
"linstaller.modules.partdisks.inst",
"linstaller.modules.semplice",
# "linstaller.modules.semplice.inst",
"linstaller.modules.ubuntu",
"linstaller.modules.ubuntu.inst",
"linstaller.modules.summary",
"linstaller.modules.summary.front",
"linstaller.modules.summary.front.glade",
"linstaller.modules.timezone",
"linstaller.modules.timezone.front",
"linstaller.modules.timezone.front.glade",
"linstaller.modules.timezone.inst",
"linstaller.modules.timezone.inst.glade",
"linstaller.modules.uefidetect",
"linstaller.modules.uefidetect.inst",
"linstaller.modules.unsquash",
"linstaller.modules.unsquash.inst",
"linstaller.modules.unsquash.inst.glade",
"linstaller.modules.update",
"linstaller.modules.update.front",
"linstaller.modules.update.front.glade",
"linstaller.modules.userhost",
"linstaller.modules.userhost.inst",
"linstaller.modules.userhost.inst.glade",
"linstaller.modules.userhost.front",
"linstaller.modules.userhost.front.glade",
"linstaller.modules.finish",
"linstaller.modules.finish.inst",
"linstaller.modules.welcome",
"linstaller.modules.welcome.front",
"linstaller.modules.welcome.front.glade",
"linstaller.modules.raspberrypi",
"linstaller.modules.raspberrypi.inst",
"linstaller.modules.bricks",
"linstaller.modules.bricks.front",
"linstaller.modules.bricks.front.glade",
"linstaller.modules.bricks.inst",
"linstaller.modules.bricks.inst.glade",
"linstaller.modules.supportrepo",
"linstaller.modules.supportrepo.inst",
"linstaller.modules.virtualpartitions",
"linstaller.modules.virtualpartitions.inst",
"linstaller.modules.echo",
"linstaller.modules.echo.bootloader",
"linstaller.modules.echo.bootloader.inst",
"linstaller.modules.echo.bootloader.inst.glade",
"linstaller.modules.echo.configure",
"linstaller.modules.echo.configure.inst",
"linstaller.modules.echo.copy",
"linstaller.modules.echo.copy.inst",
"linstaller.modules.echo.copy.inst.glade",
"linstaller.modules.echo.partusb",
"linstaller.modules.echo.partusb.front",
"linstaller.modules.echo.partusb.front.glade",
"linstaller.modules.echo.partusb.inst",
"linstaller.modules.echo.partusb.inst.glade",
],
data_files=data_files,
requires=['gi.repository.Gtk', 'gi.repository.GObject', 'gi.repository.Gdk', 'apt.cache', 'ConfigParser', 'commands', 'copy', 'getpass', 'os', 'progressbar', 'subprocess', 'threading', 'traceback', 'debconf', 'exceptions', 'keeptalking', 'libbricks', 'operator', 'parted', 'sys', 't9n.library', 'time'],
)
clss = what_I_should_do_to_get_an_heck_of_a_configuration_variable(distrib)
install_lib = clss.run()
# Recreate symlinks
if "install" in sys.argv:
for path, linktarget in symlinks.items():
path = os.path.join(install_lib, path)
if not os.path.exists(os.path.dirname(path)): os.makedirs(os.path.dirname(path))
print("symlinking %s -> %s..." % (linktarget, path))
os.symlink(linktarget, path)