|
| 1 | +#MenuTitle: Update the preflight libraries from releases (pysilfont from master) py3 |
| 2 | +# -*- coding: utf-8 -*- |
| 3 | +__doc__=""" |
| 4 | +Update the preflight libraries from releases (pysilfont from master) py3 |
| 5 | +""" |
| 6 | + |
| 7 | +__copyright__ = 'Copyright (c) 2018, SIL International (http://www.sil.org)' |
| 8 | +__license__ = 'Released under the MIT License (http://opensource.org/licenses/MIT)' |
| 9 | +__author__ = 'Nicolas Spalinger' |
| 10 | + |
| 11 | +# using brew and sudo we expect launchers to be put into /usr/local/bin/ and the libs in /usr/local/lib |
| 12 | +# but if you install manually with --user you will need to add ~/Library/Python/3.*/bin to your PATH in ~/.bash_profile |
| 13 | + |
| 14 | + |
| 15 | +import GlyphsApp |
| 16 | +from subprocess import Popen, PIPE |
| 17 | + |
| 18 | + |
| 19 | +def runAppleScript(scpt, args=[]): |
| 20 | + p = Popen(['osascript', '-'] + args, stdin=PIPE, stdout=PIPE, stderr=PIPE) |
| 21 | + stdout, stderr = p.communicate(scpt) |
| 22 | + if stderr: |
| 23 | + print "AppleScript Error:" |
| 24 | + print stderr.decode('utf-8') |
| 25 | + return stdout |
| 26 | + |
| 27 | + |
| 28 | +preflightupdate = """ |
| 29 | +
|
| 30 | +tell application "Finder" |
| 31 | +
|
| 32 | + tell application "Terminal" |
| 33 | +
|
| 34 | + activate |
| 35 | +
|
| 36 | + tell window 1 |
| 37 | +
|
| 38 | + 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/GlyphsLib.git@v3.1.4#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" |
| 39 | +
|
| 40 | + end tell |
| 41 | +
|
| 42 | + end tell |
| 43 | +
|
| 44 | +end tell |
| 45 | +
|
| 46 | +tell application "Finder" |
| 47 | + display notification "Updating, enter your password." with title "Preflight dependencies" sound name "default" |
| 48 | +end tell |
| 49 | +
|
| 50 | +tell application "Finder" |
| 51 | + display notification "Libraries versions: see output" with title "Preflight dependencies versions" |
| 52 | +end tell |
| 53 | +
|
| 54 | +tell application "Finder" |
| 55 | + display notification "Watch for issues, when done close the window" with title "Installation issues" |
| 56 | +end tell |
| 57 | +
|
| 58 | +
|
| 59 | +
|
| 60 | +""" |
| 61 | + |
| 62 | +save = runAppleScript( preflightupdate ) |
0 commit comments