Make update-on-ox not depend on remote script
This commit is contained in:
parent
4c566ee37f
commit
47ed1a4dca
36
update-on-ox
36
update-on-ox
@ -2,10 +2,35 @@
|
|||||||
# vim:fileencoding=utf-8
|
# vim:fileencoding=utf-8
|
||||||
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
|
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
|
|
||||||
|
import glob
|
||||||
import os
|
import os
|
||||||
import shlex
|
import shlex
|
||||||
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
import tempfile
|
||||||
|
import atexit
|
||||||
|
|
||||||
|
|
||||||
|
if False:
|
||||||
|
dmg = sys.argv[-1]
|
||||||
|
mp = tempfile.mkdtemp()
|
||||||
|
atexit.register(os.rmdir, mp)
|
||||||
|
subprocess.check_call('hdiutil attach {} -mountpoint {}'.format(dmg, mp).split())
|
||||||
|
try:
|
||||||
|
os.chdir(mp)
|
||||||
|
for app in glob.glob('*.app'):
|
||||||
|
d = os.path.join('/Applications', app)
|
||||||
|
if os.path.exists(d):
|
||||||
|
shutil.rmtree(d)
|
||||||
|
subprocess.check_call('ditto -v {} {}'.format(app, os.path.join('/Applications', app)).split())
|
||||||
|
finally:
|
||||||
|
os.chdir('/')
|
||||||
|
subprocess.check_call('hdiutil detach {}'.format(mp).split())
|
||||||
|
|
||||||
|
# EOF_REMOTE
|
||||||
|
|
||||||
|
HOST = 'macos-test'
|
||||||
|
|
||||||
base = os.path.dirname(os.path.abspath(__file__))
|
base = os.path.dirname(os.path.abspath(__file__))
|
||||||
if True:
|
if True:
|
||||||
@ -21,7 +46,12 @@ def run(what):
|
|||||||
raise SystemExit(ret.returncode)
|
raise SystemExit(ret.returncode)
|
||||||
|
|
||||||
|
|
||||||
|
script = open(__file__, 'rb').read().decode('utf-8')
|
||||||
|
script = script[:script.find('# EOF_REMOTE')].replace('if False:', 'if True:', 1)
|
||||||
os.chdir(os.path.expanduser('~/work/build-kitty'))
|
os.chdir(os.path.expanduser('~/work/build-kitty'))
|
||||||
run('./osx kitty --debug-build')
|
with tempfile.NamedTemporaryFile(prefix='install-dmg-', suffix='.py') as f:
|
||||||
run(f'scp build/osx/dist/{dmg} ox:/tmp')
|
run('./osx kitty --debug-build')
|
||||||
run(f'ssh ox /Users/kovid/install-dmg /tmp/{dmg}')
|
f.write(script.encode('utf-8'))
|
||||||
|
f.flush()
|
||||||
|
run(f'scp build/osx/dist/{dmg} {f.name} {HOST}:/tmp')
|
||||||
|
run(f'ssh {HOST} python /tmp/{os.path.basename(f.name)} /tmp/{dmg}')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user