# GRCC generation

**URL:** <https://www.ruby-forum.com/t/grcc-generation/236163>\
**Category:** GNU Radio\
**Created:** [August 11, 2013, 11:02pm UTC](https://www.ruby-forum.com/t/grcc-generation/236163 "2013-08-11T23:02:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [August 11, 2013, 11:02pm UTC](https://www.ruby-forum.com/t/grcc-generation/236163/1 "2013-08-11T23:02:35Z")

</div>

Hi!

I would like to add a CMAKE rule to my out of tree module to generate  
hierarchical blocks from GRC files using the GRCC tool. However, GRCC  
refuses to pus the generated py and xml files to the right directory,  
and instead it always places them into the $HOME/.grc\_modules  
directory even if another one is specified with the --directory  
option. The problem (I think) is in the Generator.py file, where

```
    self._generate_options = 

```

self.\_flow\_graph.get\_option(‘generate\_options’)  
if self.\_generate\_options == ‘hb’:  
self.\_mode = HIER\_BLOCK\_FILE\_MODE  
dirname = HIER\_BLOCKS\_LIB\_DIR  
else:  
self.\_mode = TOP\_BLOCK\_FILE\_MODE  
dirname = os.path.dirname(file\_path)  
#handle the case where the directory is read-only  
#in this case, use the system’s temp directory  
if not os.access(dirname, os.W\_OK):  
dirname = tempfile.gettempdir()

So all hierarchical blocks are placed to HIEAR\_BLOCKS\_LIB\_DIR, and the  
file path argument is discarded. So how can I generate python code and  
xml files for hierarchical blocks from grc sources in an automated  
way?

Miklos
