-
Notifications
You must be signed in to change notification settings - Fork 1
/
leo-install.py
33 lines (26 loc) · 909 Bytes
/
leo-install.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
#!/usr/bin/env python
''' Postinstall housekeeping
@url http://docs.python.org/2.7/distutils/builtdist.html#creating-windows-installers
'''
import os
import sys
def rewrite_launchers():
'''replace `entry_points` code generated by Distribute in foo-script.py with our own '''
path = os.path.join(sys.prefix, 'Scripts')
for script in ['leoc-script.py', 'leo-script.pyw']:
if script[-1] == 'w': pyexe = 'pythonw'
else: pyexe = 'python'
script = os.path.join(path, script)
with open(script, 'w') as f:
f.write('''#!%s
""" Leo launcher script
A minimal script to launch leo.
"""
import leo.core.runLeo
leo.core.runLeo.run()
''' % (pyexe)
)
#register file in installed-files manifest
file_created(script)
if sys.argv[1] == '-install':
rewrite_launchers()