webapp: autocompile script: use portable subprocess
we added shell=True so that on Windows, yarn would be found. however, using the list syntax to define the command and its arguments to Python's subprocess is broken on GNU/Linux by shell=True. instead, use a single string (command and arguments), which works on both Windows and GNU/Linux.
This commit is contained in:
parent
d1aad0b8e0
commit
a2092e66c4
@ -39,20 +39,20 @@ def check_files(directories, filepaths, hash_file):
|
|||||||
# shell=True is fine.
|
# shell=True is fine.
|
||||||
yarn = "yarn"
|
yarn = "yarn"
|
||||||
try:
|
try:
|
||||||
subprocess.check_output([yarn, "--version"], shell=True)
|
subprocess.check_output(yarn + " --version", shell=True)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
yarn = "yarnpkg"
|
yarn = "yarnpkg"
|
||||||
try:
|
try:
|
||||||
subprocess.check_output([yarn, "--version"], shell=True)
|
subprocess.check_output(yarn + " --version", shell=True)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
raise Exception("it seems neither 'yarn' nor 'yarnpkg' is installed/available on your system")
|
raise Exception("it seems neither 'yarn' nor 'yarnpkg' is available on your system")
|
||||||
|
|
||||||
# if these commands fail, an exception will prevent us from
|
# if these commands fail, an exception will prevent us from
|
||||||
# persisting the current hashes => commands will be executed again
|
# persisting the current hashes => commands will be executed again
|
||||||
subprocess.run([yarn, "--cwd", "webapp", "install", "--frozen-lockfile"],
|
subprocess.run(yarn + " --cwd webapp install --frozen-lockfile",
|
||||||
check=True, shell=True)
|
check=True, shell=True)
|
||||||
|
|
||||||
subprocess.run([yarn, "--cwd", "webapp", "build"], check=True, shell=True)
|
subprocess.run(yarn + " --cwd webapp build", check=True, shell=True)
|
||||||
|
|
||||||
with open(hash_file, 'wb') as f:
|
with open(hash_file, 'wb') as f:
|
||||||
pickle.dump(file_hashes, f)
|
pickle.dump(file_hashes, f)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user