Join check_condition and check_manifest into ActionCheck

parent 969a2617
......@@ -108,7 +108,7 @@ def _action_runner(modules_pool):
modules_pool.env.check_env(verbose=True)
quit()
elif options.command == "check-manifest":
modules_pool.env.check_manifest(top_mod.manifest, verbose=True)
modules_pool.check_manifest()
quit()
elif options.command == "manifest-help":
ManifestParser().print_help()
......
......@@ -20,8 +20,7 @@
# You should have received a copy of the GNU General Public License
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from .check_condition import CheckCondition
from .check_manifest import CheckManifest
from .check import ActionCheck
from .core import ActionCore
from .merge import ActionMerge
from .tree import ActionTree
......
......@@ -27,22 +27,28 @@ import re
from .action import Action
class CheckCondition(Action):
def _compare(self, 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)
class ActionCheck(Action):
def check_manifest(self):
logging.error("This action is not implemented yet!")
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
if tool == "ise":
ver = self.env["ise_version"]
......@@ -79,5 +85,5 @@ class CheckCondition(Action):
logging.error("Unknown tool: %s" % tool)
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))
#!/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
from .util import path as path_mod
from . import fetch
from .env import Env
from .action import (CheckManifest, CheckCondition, ActionCore,
from .action import (ActionCheck, ActionCore,
ActionMerge, ActionTree, GenerateSimulationMakefile,
ActionSynthesis,
QsysHwTclUpdate)
class ModulePool(list, CheckManifest, CheckCondition, ActionCore,
class ModulePool(list, ActionCheck, ActionCore,
ActionMerge, ActionTree, GenerateSimulationMakefile,
ActionSynthesis,
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