summaryrefslogtreecommitdiff
path: root/grc/python
diff options
context:
space:
mode:
authorSebastian Koslowski <koslowski@kit.edu>2015-03-17 21:50:38 +0100
committerSebastian Koslowski <koslowski@kit.edu>2015-04-02 09:20:25 +0200
commitbcdcfd8b8f6bc17129e28a36d2c034e29ccbcf00 (patch)
treeb7fdf9497d7f741676f00116825a227a17315a0c /grc/python
parenta1e7743b33eb3cc2c94775e95e5fc436a4d3f7ae (diff)
grc: set permissions for generated files
Reported by Marcus Mueller
Diffstat (limited to 'grc/python')
-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):
"""