Copy JS files to tempdir before packing asar
This commit is contained in:
parent
ed63441688
commit
ab73f4c94a
2 changed files with 19 additions and 1 deletions
|
@ -9,4 +9,6 @@ autoUpdater = process.platform === 'win32' ? require('./auto-updater/auto-update
|
||||||
|
|
||||||
deprecate.rename(autoUpdater, 'setFeedUrl', 'setFeedURL');
|
deprecate.rename(autoUpdater, 'setFeedUrl', 'setFeedURL');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = autoUpdater;
|
module.exports = autoUpdater;
|
||||||
|
|
|
@ -1,22 +1,30 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import errno
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
|
||||||
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
|
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
archive = sys.argv[1]
|
archive = sys.argv[1]
|
||||||
|
js_source_files = sys.argv[2:]
|
||||||
|
|
||||||
output_dir = tempfile.mkdtemp()
|
output_dir = tempfile.mkdtemp()
|
||||||
|
copy_js(js_source_files, output_dir)
|
||||||
call_asar(archive, output_dir)
|
call_asar(archive, output_dir)
|
||||||
shutil.rmtree(output_dir)
|
shutil.rmtree(output_dir)
|
||||||
|
|
||||||
|
def copy_js(js_source_files, output_dir):
|
||||||
|
for source_file in js_source_files:
|
||||||
|
output_filename = os.path.splitext(source_file)[0] + '.js'
|
||||||
|
output_path = os.path.join(output_dir, output_filename)
|
||||||
|
safe_mkdir(os.path.dirname(output_path))
|
||||||
|
shutil.copy2(source_file, output_path)
|
||||||
|
|
||||||
def call_asar(archive, output_dir):
|
def call_asar(archive, output_dir):
|
||||||
js_dir = os.path.join(output_dir, 'atom')
|
js_dir = os.path.join(output_dir, 'atom')
|
||||||
|
@ -37,5 +45,13 @@ def find_node():
|
||||||
return full_path
|
return full_path
|
||||||
return 'node'
|
return 'node'
|
||||||
|
|
||||||
|
def safe_mkdir(path):
|
||||||
|
try:
|
||||||
|
os.makedirs(path)
|
||||||
|
except OSError as e:
|
||||||
|
if e.errno != errno.EEXIST:
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue