-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-preflight-libraries-from-releases-py3.py
62 lines (39 loc) · 2.17 KB
/
update-preflight-libraries-from-releases-py3.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
#MenuTitle: Update the preflight libraries from releases (pysilfont from master) py3
# -*- coding: utf-8 -*-
__doc__="""
Update the preflight libraries from releases (pysilfont from master) py3
"""
__copyright__ = 'Copyright (c) 2018, SIL International (http://www.sil.org)'
__license__ = 'Released under the MIT License (http://opensource.org/licenses/MIT)'
__author__ = 'Nicolas Spalinger'
# using brew and sudo we expect launchers to be put into /usr/local/bin/ and the libs in /usr/local/lib
# but if you install manually with --user you will need to add ~/Library/Python/3.*/bin to your PATH in ~/.bash_profile
import GlyphsApp
from subprocess import Popen, PIPE
def runAppleScript(scpt, args=[]):
p = Popen(['osascript', '-'] + args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate(scpt)
if stderr:
print "AppleScript Error:"
print stderr.decode('utf-8')
return stdout
preflightupdate = """
tell application "Finder"
tell application "Terminal"
activate
tell window 1
do script "which python3; python3 --version; python3 -m pip --version; sudo python3 -m pip uninstall --yes pysilfont glyphsLib fontTools mutatorMath ufoLib defcon fontMath; sudo python3 -m pip install --upgrade --no-cache-dir git+https://github.com/silnrsi/pysilfont.git@master#egg=pysilfont git+https://github.com/googlei18n/[email protected]#egg=glyphsLib fontTools fs mutatorMath defcon fontMath ; echo 'Please check to make sure these dependencies have been installed correctly: defcon, fontMath, fontTools, glyphsLib, MutatorMath and pysilfont. Only these dependencies are needed for preflight, other libraries can be reported as missing without problems. '; psfversion"
end tell
end tell
end tell
tell application "Finder"
display notification "Updating, enter your password." with title "Preflight dependencies" sound name "default"
end tell
tell application "Finder"
display notification "Libraries versions: see output" with title "Preflight dependencies versions"
end tell
tell application "Finder"
display notification "Watch for issues, when done close the window" with title "Installation issues"
end tell
"""
save = runAppleScript( preflightupdate )