summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2016-08-05 15:07:55 +0200
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2016-08-05 15:07:55 +0200
commit4e725d8cafeaca969082beb0b5fa7d48f7f738fe (patch)
tree675f433bf80903d191e9b6cf1500d621ef6ba0ce
parent95ca8b68a38a0612086ddd725eabef2ea340fed5 (diff)
downloadrabbitmq-codegen-git-4e725d8cafeaca969082beb0b5fa7d48f7f738fe.tar.gz
[#127354185]
-rw-r--r--amqp_codegen.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/amqp_codegen.py b/amqp_codegen.py
index 843bcdf2..e4de0e0a 100644
--- a/amqp_codegen.py
+++ b/amqp_codegen.py
@@ -15,6 +15,7 @@
##
from __future__ import nested_scopes
+import errno
import re
import sys
import os
@@ -253,8 +254,18 @@ def do_main_dict(funcDict):
print >> sys.stderr , " %s <function> <path_to_amqp_spec.json>... <path_to_output_file>" % (sys.argv[0])
print >> sys.stderr , " where <function> is one of %s" % ", ".join([k for k in funcDict.keys()])
+ def mkdir_p(path):
+ try:
+ os.makedirs(path)
+ except OSError as exc: # Python >2.5
+ if exc.errno == errno.EEXIST and os.path.isdir(path):
+ pass
+ else:
+ raise
+
def execute(fn, amqp_specs, out_file):
stdout = sys.stdout
+ mkdir_p(os.path.dirname(out_file))
f = open(out_file, 'w')
success = False
try: