mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-22 11:40:05 +00:00
Avoid race on mkdir
Should fix https://github.com/KhronosGroup/SPIRV-Tools/issues/340
This commit is contained in:
parent
097ff25ea7
commit
033b7d00f0
1
CHANGES
1
CHANGES
@ -9,6 +9,7 @@ v2016.3-dev 2016-08-11
|
||||
- Add optimization pass: Eliminate dead constants.
|
||||
- Fixes issues:
|
||||
#288: Check def-use dominance rules for OpPhi (variable,parent) operands
|
||||
#340: Avoid race on mkdir during build
|
||||
|
||||
v2016.2 2016-08-05
|
||||
- Validator is incomplete
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import errno
|
||||
import functools
|
||||
import json
|
||||
import os.path
|
||||
@ -24,8 +25,11 @@ def make_path_to_file(f):
|
||||
dir = os.path.dirname(os.path.abspath(f))
|
||||
try:
|
||||
os.makedirs(dir)
|
||||
except:
|
||||
pass
|
||||
except OSError as e:
|
||||
if e.errno == errno.EEXIST and os.path.isdir(dir):
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
def populate_capability_bit_mapping_dict(cap_dict):
|
||||
|
@ -32,12 +32,26 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
import errno
|
||||
import os.path
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def mkdir_p(directory):
|
||||
"""Make the directory, and all its ancestors as required. Any of the
|
||||
directories are allowed to already exist."""
|
||||
|
||||
try:
|
||||
os.makedirs(directory)
|
||||
except OSError as e:
|
||||
if e.errno == errno.EEXIST and os.path.isdir(directory):
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
def command_output(cmd, directory):
|
||||
"""Runs a command in a directory and returns its standard output stream.
|
||||
|
||||
@ -99,9 +113,7 @@ def main():
|
||||
sys.exit(1)
|
||||
|
||||
output_file = sys.argv[2]
|
||||
output_dir = os.path.dirname(output_file)
|
||||
if not os.path.isdir(output_dir):
|
||||
os.makedirs(output_dir)
|
||||
mkdir_p(os.path.dirname(output_file))
|
||||
|
||||
software_version = deduce_software_version(sys.argv[1])
|
||||
new_content = '"{}", "SPIRV-Tools {} {}"\n'.format(
|
||||
|
Loading…
Reference in New Issue
Block a user