Fix mkdir error in ajax/spot.in.
* wrap/python/ajax/spot.in: Do not print an error when attempting to create an existing directory. Reported by Étienne Renault.
This commit is contained in:
parent
1e7cda5e05
commit
a804c88e1b
2 changed files with 18 additions and 6 deletions
|
|
@ -1,3 +1,11 @@
|
||||||
|
2011-12-01 Alexandre Duret-Lutz <adl@lrde.epita.fr>
|
||||||
|
|
||||||
|
Fix mkdir error in ajax/spot.in.
|
||||||
|
|
||||||
|
* wrap/python/ajax/spot.in: Do not print an error
|
||||||
|
when attempting to create an existing directory.
|
||||||
|
Reported by Étienne Renault.
|
||||||
|
|
||||||
2011-11-29 Alexandre Duret-Lutz <adl@lrde.epita.fr>
|
2011-11-29 Alexandre Duret-Lutz <adl@lrde.epita.fr>
|
||||||
|
|
||||||
Fix build failure during "make check" on MacOS X.
|
Fix build failure during "make check" on MacOS X.
|
||||||
|
|
|
||||||
|
|
@ -94,13 +94,17 @@ sys.stdout.flush()
|
||||||
# Reopen stdout without buffering
|
# Reopen stdout without buffering
|
||||||
sys.stdout = os.fdopen(sys.stdout.fileno(), "w", 0)
|
sys.stdout = os.fdopen(sys.stdout.fileno(), "w", 0)
|
||||||
|
|
||||||
# Redirect stderr to stdout at a low-level (so that
|
# Redirect stderr to stdout at a low level (so that
|
||||||
# even errors from subprocesses get printed).
|
# even errors from subprocesses get printed).
|
||||||
os.dup2(sys.stdout.fileno(), sys.stderr.fileno())
|
os.dup2(sys.stdout.fileno(), sys.stderr.fileno())
|
||||||
|
|
||||||
# Redirect stdout to the cache file, at a low-level
|
# Create a cache directory if one does not already exist.
|
||||||
|
try:
|
||||||
|
os.mkdir(imgprefix, 0755)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
# Redirect stdout to the cache file, at a low level
|
||||||
# for similar reason.
|
# for similar reason.
|
||||||
os.mkdir(imgprefix, 0755)
|
|
||||||
fd = os.open(cachename, os.O_CREAT | os.O_WRONLY, 0644)
|
fd = os.open(cachename, os.O_CREAT | os.O_WRONLY, 0644)
|
||||||
os.dup2(fd, sys.stdout.fileno())
|
os.dup2(fd, sys.stdout.fileno())
|
||||||
|
|
||||||
|
|
@ -195,8 +199,8 @@ def render_dot(basename):
|
||||||
|
|
||||||
def render_dot_maybe(dotsrc, dont_run_dot):
|
def render_dot_maybe(dotsrc, dont_run_dot):
|
||||||
# The dot output is named after the SHA1 of the dot source.
|
# The dot output is named after the SHA1 of the dot source.
|
||||||
# This way we can cache two different request that generate
|
# This way we can cache two different requests that generate
|
||||||
# the same automaton (e.g. when changing a simplification
|
# the same automaton (e.g., when changing a simplification
|
||||||
# option that has no influence).
|
# option that has no influence).
|
||||||
autprefix = imgdir + '/' + hashlib.sha1(dotsrc).hexdigest()
|
autprefix = imgdir + '/' + hashlib.sha1(dotsrc).hexdigest()
|
||||||
dotname = autprefix + '.txt'
|
dotname = autprefix + '.txt'
|
||||||
|
|
@ -204,7 +208,7 @@ def render_dot_maybe(dotsrc, dont_run_dot):
|
||||||
dotout = open(dotname, "w", 0)
|
dotout = open(dotname, "w", 0)
|
||||||
dotout.write(dotsrc)
|
dotout.write(dotsrc)
|
||||||
dotout.close()
|
dotout.close()
|
||||||
# Create an unused hardlink that point to the output picture
|
# Create an unused hardlink that points to the output picture
|
||||||
# just to remember how many cache entries are sharing it.
|
# just to remember how many cache entries are sharing it.
|
||||||
os.link(dotname, imgprefix + "/txt")
|
os.link(dotname, imgprefix + "/txt")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue