summaryrefslogtreecommitdiff
path: root/grc/python/Generator.py
diff options
context:
space:
mode:
Diffstat (limited to 'grc/python/Generator.py')
-rw-r--r--grc/python/Generator.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/grc/python/Generator.py b/grc/python/Generator.py
index 191ec18f35..a3f9f10fc1 100644
--- a/grc/python/Generator.py
+++ b/grc/python/Generator.py
@@ -101,9 +101,12 @@ class TopBlockGenerator(object):
"This is usually undesired. Consider "
"removing the throttle block.")
# generate
- open(self.get_file_path(), 'w').write(
- self._build_python_code_from_template()
- )
+ with open(self.get_file_path(), 'w') as fp:
+ fp.write(self._build_python_code_from_template())
+ try:
+ os.chmod(self.get_file_path(), self._mode)
+ except:
+ pass
def get_popen(self):
"""
@@ -231,6 +234,10 @@ class HierBlockGenerator(TopBlockGenerator):
TopBlockGenerator.write(self)
ParseXML.to_file(self._build_block_n_from_flow_graph_io(), self.get_file_path_xml())
ParseXML.validate_dtd(self.get_file_path_xml(), BLOCK_DTD)
+ try:
+ os.chmod(self.get_file_path_xml(), self._mode)
+ except:
+ pass
def _build_block_n_from_flow_graph_io(self):
"""