Resolve full yarn path before calling subprocess

This commit is contained in:
Tiago Koji Castro Shibata 2018-07-20 14:31:34 -07:00
Родитель e973116f1e
Коммит 4b5a701877
1 изменённых файлов: 7 добавлений и 8 удалений

Просмотреть файл

@ -3,6 +3,7 @@ import os
from pathlib import Path
from unittest.mock import patch
import re
import shutil
import subprocess
@ -41,7 +42,7 @@ def bundle_scripts(files):
def minify(input_file, output_file):
subprocess.check_call(['yarn', 'minify', str(input_file), '-o', str(output_file)])
subprocess.check_call([shutil.which('yarn'), 'minify', str(input_file), '-o', str(output_file)])
def main():
@ -67,6 +68,11 @@ def main():
ignored_extensions = ['.css', '.html', '.ico']
package_data = [src / filename for filename in package_data if not Path(filename).suffix in ignored_extensions]
for package_file in package_data:
try:
os.link(package_file, public / package_file.name)
except FileExistsError:
pass
public = Path('public')
bundle_destination = public / 'netron_bundle.js'
@ -78,12 +84,5 @@ def main():
else:
print('Bundle is already up to date')
for package_file in package_data:
try:
os.link(package_file, public / package_file.name)
except FileExistsError:
pass
if __name__ == '__main__':
main()