commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 07/18: grc-refactor: cmake fixes and more r


From: git
Subject: [Commit-gnuradio] [gnuradio] 07/18: grc-refactor: cmake fixes and more reorganizing
Date: Sun, 24 Apr 2016 19:19:37 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch master
in repository gnuradio.

commit 9023d2ad1ad5d1704bbe7fe942e42156a1f273a4
Author: Sebastian Koslowski <address@hidden>
Date:   Fri Feb 5 16:44:10 2016 +0100

    grc-refactor: cmake fixes and more reorganizing
---
 grc/core/Block.py                       |  6 ++----
 grc/core/CMakeLists.txt                 | 20 +++++++++++---------
 grc/core/Connection.py                  |  3 +--
 grc/core/FlowGraph.py                   | 11 +++++------
 grc/core/Param.py                       | 10 ++++------
 grc/core/ParseXML.py                    |  3 ++-
 grc/core/Platform.py                    |  8 +++++---
 grc/core/{ => generator}/CMakeLists.txt | 20 ++++----------------
 grc/core/generator/Generator.py         |  7 +++----
 grc/core/generator/__init__.py          | 19 ++++++++++++++++++-
 grc/core/{ => utils}/CMakeLists.txt     | 25 ++++---------------------
 grc/core/utils/__init__.py              | 26 +++++++++++++++++++++-----
 grc/core/{ => utils}/epy_block_io.py    |  0
 grc/core/{ => utils}/expr_utils.py      |  0
 grc/core/{ => utils}/extract_docs.py    |  0
 grc/core/{ => utils}/odict.py           |  0
 grc/gui/Block.py                        |  2 +-
 17 files changed, 81 insertions(+), 79 deletions(-)

diff --git a/grc/core/Block.py b/grc/core/Block.py
index 8af3e98..d36fe3b 100644
--- a/grc/core/Block.py
+++ b/grc/core/Block.py
@@ -23,17 +23,15 @@ import itertools
 from Cheetah.Template import Template
 from UserDict import UserDict
 
+from .utils import epy_block_io, odict
 from . Constants import (
     BLOCK_FLAG_NEED_QT_GUI, BLOCK_FLAG_NEED_WX_GUI,
     ADVANCED_PARAM_TAB, DEFAULT_PARAM_TAB,
     BLOCK_FLAG_THROTTLE, BLOCK_FLAG_DISABLE_BYPASS,
     BLOCK_ENABLED, BLOCK_BYPASSED, BLOCK_DISABLED
 )
-
-from . import epy_block_io
-from . odict import odict
-from . FlowGraph import _variable_matcher
 from . Element import Element
+from . FlowGraph import _variable_matcher
 
 
 class TemplateArg(UserDict):
diff --git a/grc/core/CMakeLists.txt b/grc/core/CMakeLists.txt
index 123bad2..623d912 100644
--- a/grc/core/CMakeLists.txt
+++ b/grc/core/CMakeLists.txt
@@ -19,28 +19,30 @@
 
 ########################################################################
 GR_PYTHON_INSTALL(FILES
-    expr_utils.py
-    extract_docs.py
-    epy_block_io.py
     Block.py
     Connection.py
     Constants.py
+    Element.py
     FlowGraph.py
-    Generator.py
+    __init__.py
+    odict.py
     Param.py
+    ParseXML.py
     Platform.py
     Port.py
-    __init__.py
-    DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/python
+    DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core
     COMPONENT "grc"
 )
 
 install(FILES
     block.dtd
+    block_tree.dtd
     default_flow_graph.grc
-    flow_graph.tmpl
-    DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/python
+    domain.dtd
+    flow_graph.dtd
+    DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core
     COMPONENT "grc"
 )
 
-add_subdirectory(base)
+add_subdirectory(generator)
+add_subdirectory(utils)
diff --git a/grc/core/Connection.py b/grc/core/Connection.py
index a7b428d..b55ba7e 100644
--- a/grc/core/Connection.py
+++ b/grc/core/Connection.py
@@ -18,9 +18,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
 02110-1301, USA
 """
 
 from . import Constants
-
 from .Element import Element
-from .odict import odict
+from .utils import odict
 
 
 class Connection(Element):
diff --git a/grc/core/FlowGraph.py b/grc/core/FlowGraph.py
index fd391c6..e7a4b10 100644
--- a/grc/core/FlowGraph.py
+++ b/grc/core/FlowGraph.py
@@ -15,18 +15,17 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
 
-import re
 import imp
 import time
-from operator import methodcaller
 from itertools import ifilter, chain
+from operator import methodcaller
 
-from ..gui import Messages
+import re
 
-from . import expr_utils
-from .odict import odict
-from .Element import Element
+from .utils import odict, expr_utils
 from .Constants import FLOW_GRAPH_FILE_FORMAT_VERSION
+from .Element import Element
+from ..gui import Messages
 
 _variable_matcher = re.compile('^(variable\w*)$')
 _parameter_matcher = re.compile('^(parameter)$')
diff --git a/grc/core/Param.py b/grc/core/Param.py
index f064097..0be3097 100644
--- a/grc/core/Param.py
+++ b/grc/core/Param.py
@@ -20,14 +20,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
MA  02110-1301, USA
 import ast
 
 import re
-from gnuradio import eng_notation
-from gnuradio import gr
+from gnuradio import eng_notation, gr
 
-import Constants
-from Constants import VECTOR_TYPES, COMPLEX_TYPES, REAL_TYPES, INT_TYPES
-
-from .odict import odict
+from . import Constants
+from .Constants import VECTOR_TYPES, COMPLEX_TYPES, REAL_TYPES, INT_TYPES
 from .Element import Element
+from .utils import odict
 
 # Blacklist certain ids, its not complete, but should help
 import __builtin__
diff --git a/grc/core/ParseXML.py b/grc/core/ParseXML.py
index adf5cc9..987fa2a 100644
--- a/grc/core/ParseXML.py
+++ b/grc/core/ParseXML.py
@@ -18,7 +18,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
 02110-1301, USA
 """
 
 from lxml import etree
-from .odict import odict
+
+from .utils import odict
 
 xml_failures = {}
 
diff --git a/grc/core/Platform.py b/grc/core/Platform.py
index f04dd04..7aa1cae 100644
--- a/grc/core/Platform.py
+++ b/grc/core/Platform.py
@@ -21,14 +21,14 @@ import os
 import sys
 from gnuradio import gr
 
-from . import ParseXML, extract_docs
+from . import ParseXML
 from .Constants import (
     BLOCK_TREE_DTD, FLOW_GRAPH_DTD, DOMAIN_DTD,
     HIER_BLOCKS_LIB_DIR, BLOCK_DTD, DEFAULT_FLOW_GRAPH, BLOCKS_DIRS,
     PREFS_FILE, CORE_TYPES, PREFS_FILE_OLD,
 )
 from .Element import Element
-from .odict import odict
+from .utils import odict, extract_docs
 from ..gui import Messages
 from .generator import Generator
 
@@ -70,7 +70,7 @@ class Platform(Element):
 
         Element.__init__(self)
         self._name = 'GNU Radio Companion'
-        # Save the verion string to the first
+        # Save the version string to the first
         version = (gr.version(), gr.major_version(), gr.api_version(), 
gr.minor_version())
         self._version = version[0]
         self._version_major = version[1]
@@ -88,6 +88,7 @@ class Platform(Element):
         self._colors = [(name, color) for name, key, sizeof, color in 
CORE_TYPES]
         # Create a dummy flow graph for the blocks
         self._flow_graph = Element(self)
+        self._flow_graph.connections = []
 
         self._blocks = None
         self._blocks_n = None
@@ -206,6 +207,7 @@ class Platform(Element):
                 # print >> sys.stderr, 'Warning: Block validation 
failed:\n\t%s\n\tIgnoring: %s' % (e, xml_file)
                 pass
             except Exception as e:
+                raise
                 print >> sys.stderr, 'Warning: XML parsing 
failed:\n\t%r\n\tIgnoring: %s' % (e, xml_file)
 
     def iter_xml_files(self):
diff --git a/grc/core/CMakeLists.txt b/grc/core/generator/CMakeLists.txt
similarity index 74%
copy from grc/core/CMakeLists.txt
copy to grc/core/generator/CMakeLists.txt
index 123bad2..c129d60 100644
--- a/grc/core/CMakeLists.txt
+++ b/grc/core/generator/CMakeLists.txt
@@ -19,28 +19,16 @@
 
 ########################################################################
 GR_PYTHON_INSTALL(FILES
-    expr_utils.py
-    extract_docs.py
-    epy_block_io.py
-    Block.py
-    Connection.py
-    Constants.py
-    FlowGraph.py
-    Generator.py
-    Param.py
-    Platform.py
-    Port.py
     __init__.py
-    DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/python
+    Generator.py
+    DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core/generator
     COMPONENT "grc"
 )
 
 install(FILES
-    block.dtd
-    default_flow_graph.grc
     flow_graph.tmpl
-    DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/python
+    DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core/generator
     COMPONENT "grc"
 )
 
-add_subdirectory(base)
+add_subdirectory(utils)
diff --git a/grc/core/generator/Generator.py b/grc/core/generator/Generator.py
index b1fb73b..4cb04bd 100644
--- a/grc/core/generator/Generator.py
+++ b/grc/core/generator/Generator.py
@@ -28,9 +28,8 @@ from distutils.spawn import find_executable
 
 from Cheetah.Template import Template
 
-from .. import ParseXML, expr_utils
-from ..odict import odict
-
+from .. import ParseXML
+from ..utils import expr_utils, odict
 from ..Constants import (
     TOP_BLOCK_FILE_MODE, BLOCK_FLAG_NEED_QT_GUI,
     XTERM_EXECUTABLE, HIER_BLOCK_FILE_MODE, HIER_BLOCKS_LIB_DIR, BLOCK_DTD
@@ -262,7 +261,7 @@ class TopBlockGenerator(object):
         callbacks = [
             expr_utils.expr_replace(cb, replace_dict)
             for cb in sum([block.get_callbacks() for block in 
fg.get_enabled_blocks()], [])
-        ]
+            ]
         # Map var id to callbacks
         var_id2cbs = dict([
             (var_id, filter(lambda c: expr_utils.get_variable_dependencies(c, 
[var_id]), callbacks))
diff --git a/grc/core/generator/__init__.py b/grc/core/generator/__init__.py
index fb1e441..f44b94a 100644
--- a/grc/core/generator/__init__.py
+++ b/grc/core/generator/__init__.py
@@ -1 +1,18 @@
-from .Generator import Generator
+# Copyright 2008-2015 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
+
+from Generator import Generator
diff --git a/grc/core/CMakeLists.txt b/grc/core/utils/CMakeLists.txt
similarity index 69%
copy from grc/core/CMakeLists.txt
copy to grc/core/utils/CMakeLists.txt
index 123bad2..fbbfbf6 100644
--- a/grc/core/CMakeLists.txt
+++ b/grc/core/utils/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2015 Free Software Foundation, Inc.
 #
 # This file is part of GNU Radio
 #
@@ -19,28 +19,11 @@
 
 ########################################################################
 GR_PYTHON_INSTALL(FILES
+    complexity.py
+    epy_block_io.py
     expr_utils.py
     extract_docs.py
-    epy_block_io.py
-    Block.py
-    Connection.py
-    Constants.py
-    FlowGraph.py
-    Generator.py
-    Param.py
-    Platform.py
-    Port.py
     __init__.py
-    DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/python
-    COMPONENT "grc"
-)
-
-install(FILES
-    block.dtd
-    default_flow_graph.grc
-    flow_graph.tmpl
-    DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/python
+    DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core/utils
     COMPONENT "grc"
 )
-
-add_subdirectory(base)
diff --git a/grc/core/utils/__init__.py b/grc/core/utils/__init__.py
index 805d6f4..6b23da2 100644
--- a/grc/core/utils/__init__.py
+++ b/grc/core/utils/__init__.py
@@ -1,6 +1,22 @@
-# -*- coding: utf-8 -*-
-""""""
+# Copyright 2008-2015 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
 
-__author__ = "Sebastian Koslowski"
-__email__ = "address@hidden"
-__copyright__ = "Copyright 2015, Sebastian Koslowski"
+import expr_utils
+import epy_block_io
+import extract_docs
+
+from odict import odict
diff --git a/grc/core/epy_block_io.py b/grc/core/utils/epy_block_io.py
similarity index 100%
rename from grc/core/epy_block_io.py
rename to grc/core/utils/epy_block_io.py
diff --git a/grc/core/expr_utils.py b/grc/core/utils/expr_utils.py
similarity index 100%
rename from grc/core/expr_utils.py
rename to grc/core/utils/expr_utils.py
diff --git a/grc/core/extract_docs.py b/grc/core/utils/extract_docs.py
similarity index 100%
rename from grc/core/extract_docs.py
rename to grc/core/utils/extract_docs.py
diff --git a/grc/core/odict.py b/grc/core/utils/odict.py
similarity index 100%
rename from grc/core/odict.py
rename to grc/core/utils/odict.py
diff --git a/grc/gui/Block.py b/grc/gui/Block.py
index 9d718bc..9513531 100644
--- a/grc/gui/Block.py
+++ b/grc/gui/Block.py
@@ -30,8 +30,8 @@ from .Constants import (
     BORDER_PROXIMITY_SENSITIVITY
 )
 from . Element import Element
-from ..core.odict import odict
 from ..core.Param import num_to_str
+from ..core.utils import odict
 from ..core.utils.complexity import calculate_flowgraph_complexity
 from ..core.Block import Block as _Block
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]