summaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-04-19 23:48:00 -0700
committerJosh Blum <josh@joshknows.com>2010-04-19 23:48:00 -0700
commit6b015b1c517733e85cb0c08a379e8d20377bf2fa (patch)
tree4c94d069b809bf7ad1f8aaf95542b7cbbdc6e4dc /host/lib
parent97b288f7d3ee0fc0fd596f6ba454cf07304474e0 (diff)
downloaduhd-6b015b1c517733e85cb0c08a379e8d20377bf2fa.tar.gz
uhd-6b015b1c517733e85cb0c08a379e8d20377bf2fa.tar.bz2
uhd-6b015b1c517733e85cb0c08a379e8d20377bf2fa.zip
added comments to cmakelists, makedir in file generation script so python doesnt have to
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/CMakeLists.txt7
-rw-r--r--host/lib/ic_reg_maps/common.py4
-rwxr-xr-xhost/lib/ic_reg_maps/gen_ad5624_regs.py2
-rwxr-xr-xhost/lib/ic_reg_maps/gen_ad7922_regs.py2
-rwxr-xr-xhost/lib/ic_reg_maps/gen_ad9510_regs.py2
-rwxr-xr-xhost/lib/ic_reg_maps/gen_ad9777_regs.py2
-rwxr-xr-xhost/lib/ic_reg_maps/gen_adf4360_regs.py2
7 files changed, 7 insertions, 14 deletions
diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt
index 7b8149802..7cb74d30a 100644
--- a/host/lib/CMakeLists.txt
+++ b/host/lib/CMakeLists.txt
@@ -66,11 +66,18 @@ SET(libuhd_sources
# Generate Files
########################################################################
MACRO(UHD_PYTHON_GEN_SOURCE_FILE pyfile outfile)
+ #ensure that the directory exists for outfile
+ GET_FILENAME_COMPONENT(outfile_dir ${outfile} PATH)
+ FILE(MAKE_DIRECTORY ${outfile_dir})
+
+ #make the outfile depend on the python script
ADD_CUSTOM_COMMAND(
OUTPUT ${outfile} DEPENDS ${pyfile}
COMMAND ${PYTHON_EXECUTABLE} ${pyfile} ${outfile}
COMMENT "Generating ${outfile}"
)
+
+ #make libuhd depend on the outfile
LIST(APPEND libuhd_sources ${outfile})
ENDMACRO(UHD_PYTHON_GEN_SOURCE_FILE)
diff --git a/host/lib/ic_reg_maps/common.py b/host/lib/ic_reg_maps/common.py
index b7fa27bbe..bf51073ae 100644
--- a/host/lib/ic_reg_maps/common.py
+++ b/host/lib/ic_reg_maps/common.py
@@ -19,16 +19,12 @@
# Boston, MA 02110-1301, USA.
import re
-import os
import math
from Cheetah.Template import Template
def parse_tmpl(_tmpl_text, **kwargs):
return str(Template(_tmpl_text, kwargs))
-def safe_makedirs(path):
- not os.path.isdir(path) and os.makedirs(path)
-
class reg:
def __init__(self, reg_des):
x = re.match('^(\w*)\s*(\w*)\[(.*)\]\s*(\w*)\s*(.*)$', reg_des)
diff --git a/host/lib/ic_reg_maps/gen_ad5624_regs.py b/host/lib/ic_reg_maps/gen_ad5624_regs.py
index 378a6912f..a809d2f47 100755
--- a/host/lib/ic_reg_maps/gen_ad5624_regs.py
+++ b/host/lib/ic_reg_maps/gen_ad5624_regs.py
@@ -19,7 +19,6 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-import os
import sys
from common import *
@@ -83,5 +82,4 @@ struct ad5624_regs_t{
if __name__ == '__main__':
regs = map(reg, parse_tmpl(REGS_DATA_TMPL).splitlines())
- safe_makedirs(os.path.dirname(sys.argv[1]))
open(sys.argv[1], 'w').write(parse_tmpl(HEADER_TEXT, regs=regs, file=__file__))
diff --git a/host/lib/ic_reg_maps/gen_ad7922_regs.py b/host/lib/ic_reg_maps/gen_ad7922_regs.py
index e1e67d617..512dcdc46 100755
--- a/host/lib/ic_reg_maps/gen_ad7922_regs.py
+++ b/host/lib/ic_reg_maps/gen_ad7922_regs.py
@@ -19,7 +19,6 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-import os
import sys
from common import *
@@ -89,5 +88,4 @@ struct ad7922_regs_t{
if __name__ == '__main__':
regs = map(reg, parse_tmpl(REGS_DATA_TMPL).splitlines())
- safe_makedirs(os.path.dirname(sys.argv[1]))
open(sys.argv[1], 'w').write(parse_tmpl(HEADER_TEXT, regs=regs, file=__file__))
diff --git a/host/lib/ic_reg_maps/gen_ad9510_regs.py b/host/lib/ic_reg_maps/gen_ad9510_regs.py
index 32a8a04c6..4f28d5597 100755
--- a/host/lib/ic_reg_maps/gen_ad9510_regs.py
+++ b/host/lib/ic_reg_maps/gen_ad9510_regs.py
@@ -19,7 +19,6 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-import os
import sys
from common import *
@@ -174,5 +173,4 @@ struct ad9510_regs_t{
if __name__ == '__main__':
regs = map(reg, parse_tmpl(REGS_DATA_TMPL).splitlines())
- safe_makedirs(os.path.dirname(sys.argv[1]))
open(sys.argv[1], 'w').write(parse_tmpl(HEADER_TEXT, regs=regs, file=__file__))
diff --git a/host/lib/ic_reg_maps/gen_ad9777_regs.py b/host/lib/ic_reg_maps/gen_ad9777_regs.py
index e4369291a..65a9657a4 100755
--- a/host/lib/ic_reg_maps/gen_ad9777_regs.py
+++ b/host/lib/ic_reg_maps/gen_ad9777_regs.py
@@ -19,7 +19,6 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-import os
import sys
from common import *
@@ -152,5 +151,4 @@ struct ad9777_regs_t{
if __name__ == '__main__':
regs = map(reg, parse_tmpl(REGS_DATA_TMPL).splitlines())
- safe_makedirs(os.path.dirname(sys.argv[1]))
open(sys.argv[1], 'w').write(parse_tmpl(HEADER_TEXT, regs=regs, file=__file__))
diff --git a/host/lib/ic_reg_maps/gen_adf4360_regs.py b/host/lib/ic_reg_maps/gen_adf4360_regs.py
index f82e8c7c5..c659766dc 100755
--- a/host/lib/ic_reg_maps/gen_adf4360_regs.py
+++ b/host/lib/ic_reg_maps/gen_adf4360_regs.py
@@ -19,7 +19,6 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-import os
import sys
from common import *
@@ -123,5 +122,4 @@ struct adf4360_regs_t{
if __name__ == '__main__':
regs = map(reg, parse_tmpl(REGS_DATA_TMPL).splitlines())
- safe_makedirs(os.path.dirname(sys.argv[1]))
open(sys.argv[1], 'w').write(parse_tmpl(HEADER_TEXT, regs=regs, file=__file__))