Join check_condition and check_manifest into ActionCheck

parent 969a2617
...@@ -108,7 +108,7 @@ def _action_runner(modules_pool): ...@@ -108,7 +108,7 @@ def _action_runner(modules_pool):
modules_pool.env.check_env(verbose=True) modules_pool.env.check_env(verbose=True)
quit() quit()
elif options.command == "check-manifest": elif options.command == "check-manifest":
modules_pool.env.check_manifest(top_mod.manifest, verbose=True) modules_pool.check_manifest()
quit() quit()
elif options.command == "manifest-help": elif options.command == "manifest-help":
ManifestParser().print_help() ManifestParser().print_help()
......
...@@ -20,8 +20,7 @@ ...@@ -20,8 +20,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from .check_condition import CheckCondition from .check import ActionCheck
from .check_manifest import CheckManifest
from .core import ActionCore from .core import ActionCore
from .merge import ActionMerge from .merge import ActionMerge
from .tree import ActionTree from .tree import ActionTree
......
...@@ -27,22 +27,28 @@ import re ...@@ -27,22 +27,28 @@ import re
from .action import Action from .action import Action
class CheckCondition(Action): class ActionCheck(Action):
def _compare(self, local, reference, cond):
if cond == "==": def check_manifest(self):
return local == reference logging.error("This action is not implemented yet!")
elif cond == "<":
return local < reference
elif cond == ">":
return local > reference
elif cond == "<=":
return local <= reference
elif cond == ">=":
return local >= reference
else:
sys.exit(1)
def check_condition(self): def check_condition(self):
def _compare(local, reference, cond):
if cond == "==":
return local == reference
elif cond == "<":
return local < reference
elif cond == ">":
return local > reference
elif cond == "<=":
return local <= reference
elif cond == ">=":
return local >= reference
else:
sys.exit(1)
tool = self.env.options.tool tool = self.env.options.tool
if tool == "ise": if tool == "ise":
ver = self.env["ise_version"] ver = self.env["ise_version"]
...@@ -79,5 +85,5 @@ class CheckCondition(Action): ...@@ -79,5 +85,5 @@ class CheckCondition(Action):
logging.error("Unknown tool: %s" % tool) logging.error("Unknown tool: %s" % tool)
sys.exit("\nExiting") sys.exit("\nExiting")
comparison = self._compare(ver, ref, self.env.options.condition) comparison = _compare(ver, ref, self.env.options.condition)
sys.exit(int(not comparison)) sys.exit(int(not comparison))
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
import logging
from .action import Action
class CheckManifest(Action):
def _check_options(self):
if not self.env.options.top:
logging.info("--top is not specified. Current manifest will be treated as the top manifest")
def check_manifest(self):
###
### THIS IS JUST A STUB
###
pass
...@@ -34,13 +34,13 @@ from . import new_dep_solver as dep_solver ...@@ -34,13 +34,13 @@ from . import new_dep_solver as dep_solver
from .util import path as path_mod from .util import path as path_mod
from . import fetch from . import fetch
from .env import Env from .env import Env
from .action import (CheckManifest, CheckCondition, ActionCore, from .action import (ActionCheck, ActionCore,
ActionMerge, ActionTree, GenerateSimulationMakefile, ActionMerge, ActionTree, GenerateSimulationMakefile,
ActionSynthesis, ActionSynthesis,
QsysHwTclUpdate) QsysHwTclUpdate)
class ModulePool(list, CheckManifest, CheckCondition, ActionCore, class ModulePool(list, ActionCheck, ActionCore,
ActionMerge, ActionTree, GenerateSimulationMakefile, ActionMerge, ActionTree, GenerateSimulationMakefile,
ActionSynthesis, ActionSynthesis,
QsysHwTclUpdate): QsysHwTclUpdate):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment