diff options
author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2016-08-05 15:07:55 +0200 |
---|---|---|
committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2016-08-05 15:07:55 +0200 |
commit | 4e725d8cafeaca969082beb0b5fa7d48f7f738fe (patch) | |
tree | 675f433bf80903d191e9b6cf1500d621ef6ba0ce | |
parent | 95ca8b68a38a0612086ddd725eabef2ea340fed5 (diff) | |
download | rabbitmq-codegen-git-4e725d8cafeaca969082beb0b5fa7d48f7f738fe.tar.gz |
amqp_codegen.py: Create the parent directories of the output filerabbitmq_v3_7_0_milestone8rabbitmq_v3_7_0_milestone7rabbitmq_v3_7_0_milestone6rabbitmq_v3_6_7_milestone2rabbitmq_v3_6_7_milestone1rabbitmq_v3_6_6_rc2rabbitmq_v3_6_6_rc1rabbitmq_v3_6_6_milestone5rabbitmq_v3_6_6_milestone4rabbitmq_v3_6_6_milestone3rabbitmq_v3_6_6_milestone2rabbitmq_v3_6_6_milestone1rabbitmq_v3_6_6
[#127354185]
-rw-r--r-- | amqp_codegen.py | 11 |
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: |