From 64ac1e4b0ce96680179ec5839b2805499f49acec Mon Sep 17 00:00:00 2001 From: Pawel Szostek <pawel.szostek@gmail.com> Date: Wed, 2 Oct 2013 01:31:33 +0200 Subject: [PATCH] remove errors found by Pychecker --- hdlmake/action/check_manifest.py | 11 +++++++---- hdlmake/env.py | 8 ++++---- hdlmake/module.py | 19 ++++++++----------- hdlmake/module_pool.py | 3 +-- hdlmake/new_dep_solver.py | 19 +++++-------------- hdlmake/tools/iverilog.py | 2 +- 6 files changed, 26 insertions(+), 36 deletions(-) diff --git a/hdlmake/action/check_manifest.py b/hdlmake/action/check_manifest.py index ff3f3464..c6474be0 100644 --- a/hdlmake/action/check_manifest.py +++ b/hdlmake/action/check_manifest.py @@ -20,6 +20,8 @@ # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. from action import Action +import logging +import global_mod from manifest_parser import ManifestParser @@ -32,9 +34,10 @@ class CheckManifest(Action): ### ### THIS IS JUST A STUB ### - manifest_parser = ManifestParser() + pass + #manifest_parser = ManifestParser() - manifest_parser.add_arbitrary_code("__manifest=\""+self.path+"\"") - manifest_parser.add_arbitrary_code(global_mod.options.arbitrary_code) + #manifest_parser.add_arbitrary_code("__manifest=\""+self.path+"\"") + #manifest_parser.add_arbitrary_code(global_mod.options.arbitrary_code) - opt_map = manifest_parser.parse() + #opt_map = manifest_parser.parse() diff --git a/hdlmake/env.py b/hdlmake/env.py index c771151d..921f51e6 100644 --- a/hdlmake/env.py +++ b/hdlmake/env.py @@ -53,13 +53,13 @@ print = _PrintClass() class _IsePath(object): - _ise_path_64 = { + _ise_path_32 = { 10: {0: "/opt/Xilinx/10.0/ISE/bin/lin", 1: "/opt/Xilinx/10.1/ISE/bin/lin"}, 12: {1: "/opt/Xilinx/12.1/ISE_DS/ISE/bin/lin", - 2: "/opt/Xilinx/12.2/ISE_DS/ISE/bin/lin64", - 4: "/opt/Xilinx/12.4/ISE_DS/ISE/bin/lin64"}, - 13: {1: "/opt/Xilinx/13.1/ISE_DS/ISE/bin/lin64"} + 2: "/opt/Xilinx/12.2/ISE_DS/ISE/bin/lin", + 4: "/opt/Xilinx/12.4/ISE_DS/ISE/bin/lin"}, + 13: {1: "/opt/Xilinx/13.1/ISE_DS/ISE/bin/lin"} } _ise_path_64 = { diff --git a/hdlmake/module.py b/hdlmake/module.py index c08df6ca..19fb3256 100644 --- a/hdlmake/module.py +++ b/hdlmake/module.py @@ -54,8 +54,6 @@ class Module(object): #PLEASE don't use this constructor. Create all modules with ModulePool.new_module() def __init__(self, parent, url, source, fetchto, pool): - from util import path - assert url is not None assert source is not None @@ -98,7 +96,7 @@ class Module(object): self.raw_url = url if source != fetch.LOCAL: - self.url, self.branch, self.revision = path.url_parse(url) + self.url, self.branch, self.revision = path_mod.url_parse(url) else: self.url, self.branch, self.revision = url, None, None @@ -168,7 +166,6 @@ class Module(object): return import shutil - import os logging.debug("Removing " + self.path) shutil.rmtree(self.path) @@ -305,11 +302,11 @@ class Module(object): self.manifest_dict["include_dirs"]) self.include_dirs.extend(ll) - for dir in self.include_dirs: - if path_mod.is_abs_path(dir): - logging.warning("%s contains absolute path to an include directory: %s" % (self.path, dir)) - if not os.path.exists(dir): - logging.warning(self.path + " has an unexisting include directory: " + dir) + for dir_ in self.include_dirs: + if path_mod.is_abs_path(dir_): + logging.warning("%s contains absolute path to an include directory: %s" % (self.path, dir_)) + if not os.path.exists(dir_): + logging.warning(self.path + " has an unexisting include directory: " + dir_) if self.manifest_dict["files"] == []: self.files = SourceFileSet() @@ -478,8 +475,8 @@ class Module(object): srcs = SourceFileSet() for p in paths: if os.path.isdir(p): - dir = os.listdir(p) - for f_dir in dir: + dir_ = os.listdir(p) + for f_dir in dir_: f_dir = os.path.join(self.path, p, f_dir) if not os.path.isdir(f_dir): srcs.add(sff.new(path=f_dir, diff --git a/hdlmake/module_pool.py b/hdlmake/module_pool.py index d25d232e..d9712857 100644 --- a/hdlmake/module_pool.py +++ b/hdlmake/module_pool.py @@ -27,7 +27,6 @@ import global_mod import sys import new_dep_solver as dep_solver from util import path as path_mod -from fetch import BackendFactory import fetch from subprocess import PIPE, Popen @@ -150,7 +149,7 @@ class ModulePool(list): new_modules = [] logging.debug("Fetching module: " + str(module)) - bf = BackendFactory() + bf = fetch.BackendFactory() fetcher = bf.get_backend(module) result = fetcher.fetch(module) if result is False: diff --git a/hdlmake/new_dep_solver.py b/hdlmake/new_dep_solver.py index 788f9173..47699350 100755 --- a/hdlmake/new_dep_solver.py +++ b/hdlmake/new_dep_solver.py @@ -30,7 +30,7 @@ class DepParser(object): def __init__(self, dep_file): self.dep_file = dep_file - def parse(): + def parse(self, dep_file): raise @@ -73,7 +73,7 @@ class ParserFactory(object): def solve(fileset): from srcfile import SourceFileSet - from dep_file import DepFile, DepRelation + from dep_file import DepRelation assert isinstance(fileset, SourceFileSet) fset = fileset.filter(DepFile) @@ -107,7 +107,9 @@ def solve(fileset): logging.warning("Relation %s in %s not satisfied by any source file" % (str(rel), investigated_file.name)) not_satisfied += 1 if not_satisfied != 0: - logging.info("Dependencies solved, but %d relations were not satisfied." % not_satisfied) + logging.info("Dependencies solved, but %d relations were not satisfied.\n" + "It doesn't necessarily mean that there is some file missing, as it might be defined\n" + "internally in the compiler." % not_satisfied) else: logging.info("Dependencies solved") @@ -149,14 +151,3 @@ def make_dependency_sorted_list(fileset, purge_unused=True): ret = sorted(dependable, cmp=compare_dep_files) ret.extend(non_depednable) return ret - -if __name__ == "__main__": - logging.basicConfig(format="%(levelname)s %(funcName)s() %(filename)s:%(lineno)d: %(message)s", level=logging.DEBUG) - df = DepFile("/home/pawel/cern/hdl-make/tests/lr_test/wr-cores/modules/wrc_lm32/lm32_shifter.v", []) - df.show_relations() - - print("-----------------------\n" - "---------- VHDL -------\n" - "-----------------------\n") - df1 = DepFile("/home/pawel/cern/hdl-make/examples/fine_delay/hdl/testbench/top/wr-cores/testbench/top_level/gn4124_bfm/mem_model.vhd") - df1.show_relations() diff --git a/hdlmake/tools/iverilog.py b/hdlmake/tools/iverilog.py index f1cdca6d..becead36 100644 --- a/hdlmake/tools/iverilog.py +++ b/hdlmake/tools/iverilog.py @@ -2,7 +2,7 @@ from subprocess import Popen, PIPE -IVERILOG_STARDAND_LIBS = ['std', 'ieee', 'ieee_proposed', 'vl', 'synopsys', +IVERILOG_STANDARD_LIBS = ['std', 'ieee', 'ieee_proposed', 'vl', 'synopsys', 'simprim', 'unisim', 'unimacro', 'aim', 'cpld', 'pls', 'xilinxcorelib', 'aim_ver', 'cpld_ver', 'simprims_ver', 'unisims_ver', 'uni9000_ver', -- GitLab