Commit e3cdeae4 authored by Paweł Szostek's avatar Paweł Szostek

logging: change from in-house to python standard

parent 01309173
...@@ -9,15 +9,21 @@ ...@@ -9,15 +9,21 @@
import os import os
from connection import Connection from connection import Connection
import global_mod import global_mod
import msg as p
import optparse import optparse
import logging
from fetch import ModulePool from fetch import ModulePool
from env import Env from env import Env
try:
from build_hash import BUILD_ID
except:
BUILD_ID = "unrecognized"
def main(): def main():
usage = "usage: %prog [options]\n" usage = "usage: %prog [options]\n"
usage += "type %prog --help to get help message" usage += "type %prog --help to get help message"
parser = optparse.OptionParser(usage=usage) parser = optparse.OptionParser(usage=usage)
parser.add_option("--manifest-help", action="store_true", parser.add_option("--manifest-help", action="store_true",
...@@ -78,8 +84,8 @@ def main(): ...@@ -78,8 +84,8 @@ def main():
parser.add_option("--py", dest="arbitrary_code", parser.add_option("--py", dest="arbitrary_code",
default="", help="add arbitrary code to all manifests' evaluation") default="", help="add arbitrary code to all manifests' evaluation")
parser.add_option("-v", "--verbose", dest="verbose", action="store_true", parser.add_option("--log", dest="log",
default="false", help="verbose mode") default="info", help="set logging level (one of debug, info, warning, error, critical")
parser.add_option("--version", dest="print_version", action="store_true", parser.add_option("--version", dest="print_version", action="store_true",
default="false", help="print version id of this Hdlmake build") default="false", help="print version id of this Hdlmake build")
...@@ -96,18 +102,21 @@ def main(): ...@@ -96,18 +102,21 @@ def main():
quit() quit()
if options.print_version is True: if options.print_version is True:
p.print_version() print("Hdlmake build " + BUILD_ID)
quit() quit()
p.vprint("LoadTopManifest") numeric_level = getattr(logging, options.log.upper(), None)
if not isinstance(numeric_level, int):
print('Invalid log level: %s' % options.log)
logging.basicConfig(level=numeric_level)
pool = ModulePool() pool = ModulePool()
pool.new_module(parent=None, url=os.getcwd(), source="local", fetchto=".") pool.new_module(parent=None, url=os.getcwd(), source="local", fetchto=".")
# Setting top_module as top module of design (ModulePool class) # Setting top_module as top module of design (ModulePool class)
if pool.get_top_module().manifest is None: if pool.get_top_module().manifest is None:
p.rawprint("No manifest found. At least an empty one is needed") logging.info("No manifest found. At least an empty one is needed")
p.rawprint("To see some help, type hdlmake --help") logging.info("To see some help, type hdlmake --help")
quit() quit()
# Setting global variable (global_mod.py) # Setting global variable (global_mod.py)
...@@ -148,14 +157,14 @@ def main(): ...@@ -148,14 +157,14 @@ def main():
sth_chosen = True sth_chosen = True
getattr(kernel, function)() getattr(kernel, function)()
except Exception, unknown_error: except Exception, unknown_error:
p.echo("Oooops! We've got an error. Here is the appropriate info:\n") logging.error("Oooops! We've got an error. Here is the appropriate info:\n")
p.print_version() print("Hdlmake build " + BUILD_ID)
print(unknown_error) print(str(unknown_error))
traceback.print_exc() traceback.print_exc()
if not sth_chosen: if not sth_chosen:
p.rawprint("No option selected. Running automatic flow") logging.info("No option selected. Running automatic flow")
p.rawprint("To see some help, type hdlmake --help") logging.info("To see some help, type hdlmake --help")
kernel.run() kernel.run()
if __name__ == "__main__": if __name__ == "__main__":
......
...@@ -19,11 +19,13 @@ ...@@ -19,11 +19,13 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
# #
import msg as p from __future__ import print_function
import logging
import sys import sys
import StringIO import StringIO
import contextlib import contextlib
@contextlib.contextmanager @contextlib.contextmanager
def stdoutIO(stdout=None): def stdoutIO(stdout=None):
old = sys.stdout old = sys.stdout
...@@ -33,6 +35,7 @@ def stdoutIO(stdout=None): ...@@ -33,6 +35,7 @@ def stdoutIO(stdout=None):
yield stdout yield stdout
sys.stdout = old sys.stdout = old
class ConfigParser(object): class ConfigParser(object):
"""Class for parsing python configuration files """Class for parsing python configuration files
...@@ -144,15 +147,14 @@ class ConfigParser(object): ...@@ -144,15 +147,14 @@ class ConfigParser(object):
elif key == "default": elif key == "default":
self.default = others["default"] self.default = others["default"]
elif key == "type": elif key == "type":
self.add_type(type_obj=others["type"]) self.add_type(type_obj=others["type"])
else: else:
raise ValueError("Option not recognized: " + key) raise ValueError("Option not recognized: " + key)
def add_type(self, type_obj): def add_type(self, type_obj):
self.types.append(type(type_obj)) self.types.append(type(type_obj))
def __init__(self, description=None):
def __init__(self, description = None):
if description is not None: if description is not None:
if not isinstance(description, str): if not isinstance(description, str):
raise ValueError("Description should be a string!") raise ValueError("Description should be a string!")
...@@ -174,10 +176,10 @@ class ConfigParser(object): ...@@ -174,10 +176,10 @@ class ConfigParser(object):
raise RuntimeError("No such option as " + str(name)) raise RuntimeError("No such option as " + str(name))
def help(self): def help(self):
p.rawprint("Variables available in a manifest:") print("Variables available in a manifest:")
for opt in self.options: for opt in self.options:
if opt is None: if opt is None:
p.rawprint("") print("")
continue continue
line = ' {0:15}; {1:29}; {2:45}{3}{4:10}' line = ' {0:15}; {1:29}; {2:45}{3}{4:10}'
...@@ -188,7 +190,7 @@ class ConfigParser(object): ...@@ -188,7 +190,7 @@ class ConfigParser(object):
line = line.format(opt.name, str(opt.types), opt.help, ', default=', tmp_def) line = line.format(opt.name, str(opt.types), opt.help, ', default=', tmp_def)
except AttributeError: # no default value except AttributeError: # no default value
line = line.format(opt.name, str(opt.types), opt.help, "", "") line = line.format(opt.name, str(opt.types), opt.help, "", "")
p.rawprint(line) print(line)
def add_option(self, name, **others): def add_option(self, name, **others):
if name in self.__names(): if name in self.__names():
...@@ -237,7 +239,7 @@ class ConfigParser(object): ...@@ -237,7 +239,7 @@ class ConfigParser(object):
if self.config_file is not None: if self.config_file is not None:
with open(self.config_file, "r") as config_file: with open(self.config_file, "r") as config_file:
content = open(self.config_file, "r").readlines() content = config_file.readlines()
content = ''.join(content) content = ''.join(content)
else: else:
content = '' content = ''
...@@ -258,11 +260,11 @@ class ConfigParser(object): ...@@ -258,11 +260,11 @@ class ConfigParser(object):
if printed: if printed:
print(printed) print(printed)
except SyntaxError as e: except SyntaxError as e:
p.error("Invalid syntax in the arbitraty code:\n" + str(e)) logging.error("Invalid syntax in the arbitraty code:\n" + str(e))
quit() quit()
except: except:
p.error("Unexpected error while parsing arbitrary code:") logging.error("Unexpected error while parsing arbitrary code:")
p.rawprint(str(sys.exc_info()[0])+':'+str(sys.exc_info()[1])) print(str(sys.exc_info()[0])+':'+str(sys.exc_info()[1]))
quit() quit()
try: try:
...@@ -270,19 +272,19 @@ class ConfigParser(object): ...@@ -270,19 +272,19 @@ class ConfigParser(object):
exec(content, options) exec(content, options)
printed = s.getvalue() printed = s.getvalue()
if len(printed) > 0: if len(printed) > 0:
p.info("The manifest inside " + self.config_file + " tried to print something:") logging.info("The manifest inside " + self.config_file + " tried to print something:")
for line in printed.split('\n'): for line in printed.split('\n'):
p.rawprint("> " + line) print("> " + line)
#print "out:", s.getvalue() #print "out:", s.getvalue()
except SyntaxError as e: except SyntaxError as e:
p.error("Invalid syntax in the manifest file " + self.config_file+ ":\n" + str(e)) logging.error("Invalid syntax in the manifest file " + self.config_file + ":\n" + str(e))
quit() quit()
except: except:
p.error("Encountered unexpected error while parsing " + self.config_file) logging.error("Encountered unexpected error while parsing " + self.config_file)
p.rawprint(str(sys.exc_info()[0]) +':'+ str(sys.exc_info()[1])) print(str(sys.exc_info()[0]) + ':' + str(sys.exc_info()[1]))
quit() quit()
for opt_name, val in list(options.items()): #check delivered options for opt_name, val in list(options.items()): # check delivered options
if opt_name.startswith('__'): if opt_name.startswith('__'):
continue continue
if opt_name not in self.__names(): if opt_name not in self.__names():
...@@ -294,22 +296,22 @@ class ConfigParser(object): ...@@ -294,22 +296,22 @@ class ConfigParser(object):
raise NameError("Unrecognized option: " + opt_name) raise NameError("Unrecognized option: " + opt_name)
opt = self[opt_name] opt = self[opt_name]
if type(val) not in opt.types: if type(val) not in opt.types:
raise RuntimeError("Given option: "+str(type(val))+" doesn't match specified types:"+str(opt.types)) raise RuntimeError("Given option: %s doesn't match specified types: %s" % (str(type(val)), str(opt.types)))
ret[opt_name] = val ret[opt_name] = val
# print("Opt_name ", opt_name) # print("Opt_name ", opt_name)
if type(val) == type(dict()): if type(val) == type(dict()):
try: try:
for key in val: for key in val:
if key not in self[opt_name].allowed_keys: if key not in self[opt_name].allowed_keys:
raise RuntimeError("Encountered unallowed key: " +key+ " for options '"+opt_name+"'") raise RuntimeError("Encountered unallowed key: %s for option '%s'" % (key, opt_name))
except AttributeError: #no allowed_keys member - don't perform any check except AttributeError: # no allowed_keys member - don't perform any check
pass pass
for opt in self.options: #set values for not listed items with defaults for opt in self.options: # set values for not listed items with defaults
try: try:
if opt.name not in ret: if opt.name not in ret:
ret[opt.name] = opt.default ret[opt.name] = opt.default
except AttributeError: #no default value in the option except AttributeError: # no default value in the option
pass pass
return ret return ret
...@@ -319,4 +321,4 @@ def _test(): ...@@ -319,4 +321,4 @@ def _test():
doctest.testmod() doctest.testmod()
if __name__ == "__main__": if __name__ == "__main__":
_test() _test()
\ No newline at end of file
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
import os import os
import random import random
import string import string
import msg as p import logging
class Connection: class Connection:
def __init__(self, ssh_user, ssh_server): def __init__(self, ssh_user, ssh_server):
...@@ -42,7 +43,7 @@ class Connection: ...@@ -42,7 +43,7 @@ class Connection:
def __check(self): def __check(self):
if not self.__data_given(): if not self.__data_given():
p.echo("Error: no data for connection given") logging.info("Error: no data for connection given")
quit() quit()
def system(self, cmd): def system(self, cmd):
...@@ -59,10 +60,9 @@ class Connection: ...@@ -59,10 +60,9 @@ class Connection:
self.__check() self.__check()
#create a new catalogue on remote machine #create a new catalogue on remote machine
if dest_folder is None: if dest_folder is None:
dest_folder = ''.join(random.choice(string.ascii_letters + string.digits) for x in range(8)) dest_folder = ''.join(random.choice(string.ascii_letters + string.digits) for x in range(8))
mkdir_cmd = 'mkdir -p ' + dest_folder mkdir_cmd = 'mkdir -p ' + dest_folder
import msg as p logging.debug("Connecting to " + str(self) + " and creating directory " + dest_folder + ": " + mkdir_cmd)
p.vprint("Connecting to " + str(self) + " and creating directory " + dest_folder + ": " + mkdir_cmd)
self.system(mkdir_cmd) self.system(mkdir_cmd)
#create a string with filenames #create a string with filenames
...@@ -71,16 +71,16 @@ class Connection: ...@@ -71,16 +71,16 @@ class Connection:
rsync_cmd = "rsync -Rav " + local_files_str + " " + self.ssh_user + "@" + self.ssh_server + ":" + dest_folder rsync_cmd = "rsync -Rav " + local_files_str + " " + self.ssh_user + "@" + self.ssh_server + ":" + dest_folder
#rsync_cmd += " > /dev/null" #rsync_cmd += " > /dev/null"
p.vprint("Coping files to remote machine: "+rsync_cmd) logging.debug("Coping files to remote machine: " + rsync_cmd)
import subprocess import subprocess
p = subprocess.Popen(rsync_cmd, shell=True) process = subprocess.Popen(rsync_cmd, shell=True)
os.waitpid(p.pid, 0)[1] os.waitpid(process.pid, 0)[1]
return dest_folder return dest_folder
def transfer_files_back(self, what, where): def transfer_files_back(self, what, where):
self.__check() self.__check()
rsync_cmd = "rsync -av " + self.ssh_user + "@" + self.ssh_server + ":" + what + ' ' + where rsync_cmd = "rsync -av " + self.ssh_user + "@" + self.ssh_server + ":" + what + ' ' + where
p.vprint(rsync_cmd) logging.debug(rsync_cmd)
os.system(rsync_cmd) os.system(rsync_cmd)
def is_good(self): def is_good(self):
...@@ -93,11 +93,11 @@ class Connection: ...@@ -93,11 +93,11 @@ class Connection:
p = self.popen("uname -a") p = self.popen("uname -a")
p = p.readlines() p = p.readlines()
if not len(p): if not len(p):
p.echo("Checking address length failed") logging.warning("Checking address length failed")
return None return None
elif "i686" in p[0]: elif "i686" in p[0]:
return 32 return 32
elif "x86_64" in p[0]: elif "x86_64" in p[0]:
return 64 return 64
else: else:
return None return None
\ No newline at end of file
...@@ -20,10 +20,11 @@ ...@@ -20,10 +20,11 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
# #
import msg as p import logging
import global_mod import global_mod
import os.path import os.path
class IDependable: class IDependable:
def __init__(self): def __init__(self):
self.dep_index = 0 self.dep_index = 0
...@@ -116,7 +117,7 @@ class DependencySolver: ...@@ -116,7 +117,7 @@ class DependencySolver:
for dir in inc_dirs: for dir in inc_dirs:
dir = os.path.join(os.getcwd(), dir) dir = os.path.join(os.getcwd(), dir)
if not os.path.exists(dir) or not os.path.isdir(dir): if not os.path.exists(dir) or not os.path.isdir(dir):
p.warning("Include path "+dir+" doesn't exist") logging.warning("Include path "+dir+" doesn't exist")
continue continue
h_file = os.path.join(dir, req) h_file = os.path.join(dir, req)
if os.path.exists(h_file) and not os.path.isdir(h_file): if os.path.exists(h_file) and not os.path.isdir(h_file):
...@@ -167,7 +168,7 @@ class DependencySolver: ...@@ -167,7 +168,7 @@ class DependencySolver:
else: else:
break break
p.vprint ("Include paths are: " + ' '.join(ret)) logging.debug("Include paths are: " + ' '.join(ret))
return ret return ret
def solve(self, fileset): def solve(self, fileset):
...@@ -193,8 +194,8 @@ class DependencySolver: ...@@ -193,8 +194,8 @@ class DependencySolver:
fset[idx], fset[k] = fset[k], fset[idx] fset[idx], fset[k] = fset[k], fset[idx]
if(n_iter == max_iter): if(n_iter == max_iter):
p.error("Maximum number of iterations reached when trying to solve the dependencies.\n" logging.error("Maximum number of iterations reached when trying to solve the dependencies.\n"
"Perhaps a cyclic inter-dependency problem.") "Perhaps a cyclic inter-dependency problem.")
return None return None
for f in fset: for f in fset:
...@@ -205,14 +206,14 @@ class DependencySolver: ...@@ -205,14 +206,14 @@ class DependencySolver:
f_nondep.sort(key=lambda f: f.dep_index) f_nondep.sort(key=lambda f: f.dep_index)
from srcfile import VHDLFile, VerilogFile from srcfile import VHDLFile, VerilogFile
for f in [file for file in fset if isinstance(file, VHDLFile)]: for f in [file for file in fset if isinstance(file, VHDLFile)]:
p.vprint(f.path) logging.debug(f.path)
if f.dep_requires: if f.dep_requires:
for req in f.dep_requires: for req in f.dep_requires:
pf = self.__find_provider_vhdl_file([file for file in fset if isinstance(file, VHDLFile)], req) pf = self.__find_provider_vhdl_file([file for file in fset if isinstance(file, VHDLFile)], req)
if not pf: if not pf:
p.error("Missing dependency in file "+str(f)+": " + req[0]+'.'+req[1]) logging.error("Missing dependency in file "+str(f)+": " + req[0]+'.'+req[1])
else: else:
p.vprint("--> " + pf.path) logging.debug("--> " + pf.path)
if pf.path != f.path: if pf.path != f.path:
f.dep_depends_on.append(pf) f.dep_depends_on.append(pf)
#get rid of duplicates by making a set from the list and vice versa #get rid of duplicates by making a set from the list and vice versa
...@@ -222,20 +223,18 @@ class DependencySolver: ...@@ -222,20 +223,18 @@ class DependencySolver:
acc = [] acc = []
for f in [file for file in fset if isinstance(file, VerilogFile)]: for f in [file for file in fset if isinstance(file, VerilogFile)]:
p.vprint(f.path) logging.debug(f.path)
if f.dep_requires: if f.dep_requires:
for req in f.dep_requires: for req in f.dep_requires:
pf = self.__find_provider_verilog_file(req, f, fset+acc) pf = self.__find_provider_verilog_file(req, f, fset+acc)
if not pf: if not pf:
p.warning("Cannot find depending for file "+str(f)+": "+req) logging.warning("Cannot find depending for file "+str(f)+": "+req)
else: else:
p.vprint("--> " + pf.path) logging.debug("--> " + pf.path)
f.dep_depends_on.append(pf) f.dep_depends_on.append(pf)
#get rid of duplicates by making a set from the list and vice versa #get rid of duplicates by making a set from the list and vice versa
f.dep_depends_on = list(set(f.dep_depends_on)) f.dep_depends_on = list(set(f.dep_depends_on))
newobj = sf.SourceFileSet() newobj = sf.SourceFileSet()
newobj.add(f_nondep) newobj.add(f_nondep)
for f in fset: for f in fset:
...@@ -256,14 +255,14 @@ class DependencySolver: ...@@ -256,14 +255,14 @@ class DependencySolver:
for req in qf.dep_requires: for req in qf.dep_requires:
pf = self.__find_provider_verilog_file(req, f, []) pf = self.__find_provider_verilog_file(req, f, [])
if not pf: if not pf:
p.warning("Cannot find include for file "+str(f)+": "+req) logging.warning("Cannot find include for file "+str(f)+": "+req)
else: else:
p.vprint("--> " + pf.path) logging.debug("--> " + pf.path)
f.dep_depends_on.append(pf) f.dep_depends_on.append(pf)
stack.append(pf) stack.append(pf)
#get rid of duplicates by making a set from the list and vice versa #get rid of duplicates by making a set from the list and vice versa
f.dep_depends_on = list(set(f.dep_depends_on)) f.dep_depends_on = list(set(f.dep_depends_on))
for k in newobj: for k in newobj:
p.vprint(str(k.dep_index) + " " + k.path + str(k._dep_fixed)) logging.debug(str(k.dep_index) + " " + k.path + str(k._dep_fixed))
return newobj return newobj
...@@ -20,11 +20,12 @@ ...@@ -20,11 +20,12 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import print_function
import os import os
import sys import sys
import msg as p
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
import re import re
import logging
class _IsePath(object): class _IsePath(object):
...@@ -78,7 +79,7 @@ class _IsePath(object): ...@@ -78,7 +79,7 @@ class _IsePath(object):
class Env(dict): class Env(dict):
def __init__(self, options, top_module): def __init__(self, options, top_module):
self.options = options self.options = options
self.top_module = top_module self.top_module = top_module
def check(self): def check(self):
platform = sys.platform platform = sys.platform
...@@ -86,7 +87,6 @@ class Env(dict): ...@@ -86,7 +87,6 @@ class Env(dict):
#1: determine path for ise #1: determine path for ise
print("--- ISE synthesis ---") print("--- ISE synthesis ---")
xilinx = os.environ.get("XILINX") xilinx = os.environ.get("XILINX")
if xilinx: if xilinx:
print("Environmental variable %s is set: %s." % ("XILINX", xilinx)) print("Environmental variable %s is set: %s." % ("XILINX", xilinx))
...@@ -128,7 +128,6 @@ class Env(dict): ...@@ -128,7 +128,6 @@ class Env(dict):
####### #######
self.report_and_set_var("top_module") self.report_and_set_var("top_module")
#3: determine modelsim path #3: determine modelsim path
print("--- Modelsim simulation ---") print("--- Modelsim simulation ---")
self.report_and_set_var("modelsim_path") self.report_and_set_var("modelsim_path")
...@@ -207,8 +206,8 @@ class Env(dict): ...@@ -207,8 +206,8 @@ class Env(dict):
if match: if match:
ise_version = (int(match.group('major')), int(match.group('minor'))) ise_version = (int(match.group('major')), int(match.group('minor')))
else: else:
p.error("xst output is not in expected format: %s\n" % xst_output + logging.error("xst output is not in expected format: %s\n" % xst_output +
"Can't determine ISE version") "Can't determine ISE version")
return None return None
return ise_version return ise_version
...@@ -271,5 +270,5 @@ class Env(dict): ...@@ -271,5 +270,5 @@ class Env(dict):
return False return False
if __name__ == "__main__": if __name__ == "__main__":
ec = EnvChecker({}, {}) ec = Env({}, {})
ec.check() ec.check()
...@@ -20,31 +20,33 @@ ...@@ -20,31 +20,33 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import print_function
import os import os
import msg as p import logging
import path import path
import global_mod import global_mod
class ModulePool(list): class ModulePool(list):
class ModuleFetcher: class ModuleFetcher:
def __init__(self): def __init__(self):
pass pass
def fetch_single_module(self, module): def fetch_single_module(self, module):
import global_mod
new_modules = [] new_modules = []
p.vprint("Fetching module: " + str(module)) logging.debug("Fetching module: " + str(module))
if module.source == "local": if module.source == "local":
p.vprint("ModPath: " + module.path) logging.debug("ModPath: " + module.path)
else: else:
p.printhr() logging.info("Fetching module: " + str(module) +
p.info("Fetching module: " + str(module) +\ "[parent: " + str(module.parent) + "]")
" [parent: " + str(module.parent) + "]")
if module.source == "svn": if module.source == "svn":
p.info("[svn] Fetching to " + module.fetchto) logging.info("[svn] Fetching to " + module.fetchto)
self.__fetch_from_svn(module) self.__fetch_from_svn(module)
if module.source == "git": if module.source == "git":
p.info("[git] Fetching to " + module.fetchto) logging.info("[git] Fetching to " + module.fetchto)
self.__fetch_from_git(module) self.__fetch_from_git(module)
module.parse_manifest() module.parse_manifest()
...@@ -69,7 +71,7 @@ class ModulePool(list): ...@@ -69,7 +71,7 @@ class ModulePool(list):
rval = True rval = True
p.vprint(cmd) logging.debug(cmd)
if os.system(cmd) != 0: if os.system(cmd) != 0:
rval = False rval = False
os.chdir(cur_dir) os.chdir(cur_dir)
...@@ -90,7 +92,7 @@ class ModulePool(list): ...@@ -90,7 +92,7 @@ class ModulePool(list):
mod_path = os.path.join(module.fetchto, basename) mod_path = os.path.join(module.fetchto, basename)
if basename.endswith(".git"): if basename.endswith(".git"):
basename = basename[:-4] #remove trailing .git basename = basename[:-4] # remove trailing .git
if module.isfetched: if module.isfetched:
update_only = True update_only = True
...@@ -106,14 +108,14 @@ class ModulePool(list): ...@@ -106,14 +108,14 @@ class ModulePool(list):
rval = True rval = True
p.vprint(cmd) logging.debug(cmd)
if os.system(cmd) != 0: if os.system(cmd) != 0:
rval = False rval = False
if module.revision and rval: if module.revision and rval:
os.chdir(mod_path) os.chdir(mod_path)
cmd = "git checkout " + module.revision cmd = "git checkout " + module.revision
p.vprint(cmd) logging.debug(cmd)
if os.system(cmd) != 0: if os.system(cmd) != 0:
rval = False rval = False
os.chdir(cur_dir) os.chdir(cur_dir)
...@@ -122,7 +124,6 @@ class ModulePool(list): ...@@ -122,7 +124,6 @@ class ModulePool(list):
module.path = mod_path module.path = mod_path
return rval return rval
def __init__(self, *args): def __init__(self, *args):
list.__init__(self, *args) list.__init__(self, *args)
self.top_module = None self.top_module = None
...@@ -146,7 +147,7 @@ class ModulePool(list): ...@@ -146,7 +147,7 @@ class ModulePool(list):
return [m for m in self if m.url == url][0] return [m for m in self if m.url == url][0]
else: else:
if self.global_fetch: # if there is global fetch parameter (HDLMAKE_COREDIR env variable) if self.global_fetch: # if there is global fetch parameter (HDLMAKE_COREDIR env variable)
fetchto = self.global_fetch # screw module's particular fetchto fetchto = self.global_fetch # screw module's particular fetchto
elif global_mod.top_module: elif global_mod.top_module:
fetchto = global_mod.top_module.fetchto fetchto = global_mod.top_module.fetchto
...@@ -186,11 +187,11 @@ class ModulePool(list): ...@@ -186,11 +187,11 @@ class ModulePool(list):
new_modules = fetcher.fetch_single_module(cur_mod) new_modules = fetcher.fetch_single_module(cur_mod)
for mod in new_modules: for mod in new_modules:
if not mod.isfetched: if not mod.isfetched:
p.vprint("Appended to fetch queue: " +str(mod.url)) logging.debug("Appended to fetch queue: " + str(mod.url))
self._add(mod) self._add(mod)
fetch_queue.append(mod) fetch_queue.append(mod)
else: else:
p.vprint("NOT appended to fetch queue: " +str(mod.url)) logging.debug("NOT appended to fetch queue: " + str(mod.url))
def build_global_file_list(self): def build_global_file_list(self):
from srcfile import SourceFileSet from srcfile import SourceFileSet
...@@ -230,9 +231,9 @@ class ModulePool(list): ...@@ -230,9 +231,9 @@ class ModulePool(list):
if nvl: if nvl:
extra_verilog_files.add(nvl) extra_verilog_files.add(nvl)
p.vprint("Extra verilog files, not listed in manifests:") logging.debug("Extra verilog files, not listed in manifests:")
for extra_vl in extra_verilog_files: for extra_vl in extra_verilog_files:
p.vprint(str(extra_vl)) logging.debug(str(extra_vl))
for extra_vl in extra_verilog_files: for extra_vl in extra_verilog_files:
files.add(extra_vl) files.add(extra_vl)
return files return files
......
...@@ -22,15 +22,16 @@ ...@@ -22,15 +22,16 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import print_function
import xml.dom.minidom import xml.dom.minidom
import xml.parsers.expat import xml.parsers.expat
import msg as p import logging
import re import re
XmlImpl = xml.dom.minidom.getDOMImplementation() XmlImpl = xml.dom.minidom.getDOMImplementation()
ISE_STANDARD_LIBS = ['ieee', 'ieee_proposed', 'iSE', 'simprims', 'std', ISE_STANDARD_LIBS = ['ieee', 'ieee_proposed', 'iSE', 'simprims', 'std',
'synopsys','unimacro', 'unisim', 'XilinxCoreLib'] 'synopsys', 'unimacro', 'unisim', 'XilinxCoreLib']
QUARTUS_STANDARD_LIBS = ['altera', 'altera_mf', 'lpm', 'ieee', 'std'] QUARTUS_STANDARD_LIBS = ['altera', 'altera_mf', 'lpm', 'ieee', 'std']
MODELSIM_STANDARD_LIBS = ['ieee', 'std'] MODELSIM_STANDARD_LIBS = ['ieee', 'std']
ISIM_STARDAND_LIBS = ['std', 'ieee', 'ieee_proposed', 'vl', 'synopsys', ISIM_STARDAND_LIBS = ['std', 'ieee', 'ieee_proposed', 'vl', 'synopsys',
...@@ -39,6 +40,7 @@ ISIM_STARDAND_LIBS = ['std', 'ieee', 'ieee_proposed', 'vl', 'synopsys', ...@@ -39,6 +40,7 @@ ISIM_STARDAND_LIBS = ['std', 'ieee', 'ieee_proposed', 'vl', 'synopsys',
'simprims_ver', 'unisims_ver', 'uni9000_ver', 'simprims_ver', 'unisims_ver', 'uni9000_ver',
'unimacro_ver', 'xilinxcorelib_ver', 'secureip'] 'unimacro_ver', 'xilinxcorelib_ver', 'secureip']
class ISEProjectProperty: class ISEProjectProperty:
def __init__(self, name, value, is_default=False): def __init__(self, name, value, is_default=False):
self.name = name self.name = name
...@@ -108,14 +110,13 @@ class ISEProject: ...@@ -108,14 +110,13 @@ class ISEProject:
def add_initial_properties(self, syn_device, syn_grade, syn_package, syn_top): def add_initial_properties(self, syn_device, syn_grade, syn_package, syn_top):
family_names = { family_names = {
"XC6S": "Spartan6", "XC6S": "Spartan6",
"XC3S": "Spartan3", "XC3S": "Spartan3",
"XC6V": "Virtex6", "XC6V": "Virtex6",
"XC5V": "Virtex5", "XC5V": "Virtex5",
"XC4V": "Virtex4", "XC4V": "Virtex4",
"XC7K": "Kintex7", "XC7K": "Kintex7",
"XC7A": "Artix7"} "XC7A": "Artix7"}
self.add_property(ISEProjectProperty("Device", syn_device)) self.add_property(ISEProjectProperty("Device", syn_device))
self.add_property(ISEProjectProperty("Device Family", family_names[syn_device[0:4].upper()])) self.add_property(ISEProjectProperty("Device Family", family_names[syn_device[0:4].upper()]))
...@@ -132,10 +133,10 @@ class ISEProject: ...@@ -132,10 +133,10 @@ class ISEProject:
def __parse_props(self): def __parse_props(self):
for xmlp in self.xml_project.getElementsByTagName("properties")[0].getElementsByTagName("property"): for xmlp in self.xml_project.getElementsByTagName("properties")[0].getElementsByTagName("property"):
prop = ISEProjectProperty( prop = ISEProjectProperty(
xmlp.getAttribute("xil_pn:name"), xmlp.getAttribute("xil_pn:name"),
xmlp.getAttribute("xil_pn:value"), xmlp.getAttribute("xil_pn:value"),
xmlp.getAttribute("xil_pn:valueState") == "default" xmlp.getAttribute("xil_pn:valueState") == "default"
) )
self.props.append(prop) self.props.append(prop)
self.xml_props = self.__purge_dom_node(name="properties", where=self.xml_doc.documentElement) self.xml_props = self.__purge_dom_node(name="properties", where=self.xml_doc.documentElement)
...@@ -148,20 +149,20 @@ class ISEProject: ...@@ -148,20 +149,20 @@ class ISEProject:
def load_xml(self, filename): def load_xml(self, filename):
f = open(filename) f = open(filename)
self.xml_doc = xml.dom.minidom.parse(f) self.xml_doc = xml.dom.minidom.parse(f)
self.xml_project = self.xml_doc.getElementsByTagName("project")[0] self.xml_project = self.xml_doc.getElementsByTagName("project")[0]
import sys import sys
try: try:
self.__parse_props() self.__parse_props()
except xml.parsers.expat.ExpatError: except xml.parsers.expat.ExpatError:
p.rawprint("Error while parsing existng file's properties:") print("Error while parsing existng file's properties:")
p.rawprint(str(sys.exc_info())) print(str(sys.exc_info()))
quit() quit()
try: try:
self.__parse_libs() self.__parse_libs()
except xml.parsers.expat.ExpatError: except xml.parsers.expat.ExpatError:
p.rawprint("Error while parsing existng file's libraries:") print("Error while parsing existng file's libraries:")
p.rawprint(str(sys.exc_info())) print(str(sys.exc_info()))
quit() quit()
where = self.xml_doc.documentElement where = self.xml_doc.documentElement
...@@ -190,7 +191,7 @@ class ISEProject: ...@@ -190,7 +191,7 @@ class ISEProject:
from srcfile import UCFFile, VHDLFile, VerilogFile, CDCFile, NGCFile from srcfile import UCFFile, VHDLFile, VerilogFile, CDCFile, NGCFile
for f in self.files: for f in self.files:
p.vprint("Writing .xise file for version " + str(self.ise)) logging.debug("Writing .xise file for version " + str(self.ise))
fp = self.xml_doc.createElement("file") fp = self.xml_doc.createElement("file")
fp.setAttribute("xil_pn:name", os.path.relpath(f.path)) fp.setAttribute("xil_pn:name", os.path.relpath(f.path))
if isinstance(f, VHDLFile): if isinstance(f, VHDLFile):
...@@ -245,7 +246,7 @@ class ISEProject: ...@@ -245,7 +246,7 @@ class ISEProject:
i.setAttribute("xil_pn:schema_version", "2") i.setAttribute("xil_pn:schema_version", "2")
node.appendChild(i) node.appendChild(i)
def emit_xml(self, filename = None): def emit_xml(self, filename=None):
if not self.xml_doc: if not self.xml_doc:
self.create_empty_project() self.create_empty_project()
else: else:
...@@ -256,7 +257,7 @@ class ISEProject: ...@@ -256,7 +257,7 @@ class ISEProject:
self.__output_libs(self.xml_libs) self.__output_libs(self.xml_libs)
output_file = open(filename, "w") output_file = open(filename, "w")
string_buffer = self.StringBuffer() string_buffer = self.StringBuffer()
self.xml_doc.writexml(string_buffer, newl = "\n", addindent="\t") self.xml_doc.writexml(string_buffer, newl="\n", addindent="\t")
output_file.write('\n'.join(string_buffer)) output_file.write('\n'.join(string_buffer))
output_file.close() output_file.close()
...@@ -291,8 +292,7 @@ class ISEProject: ...@@ -291,8 +292,7 @@ class ISEProject:
class ModelsiminiReader(object): class ModelsiminiReader(object):
def __init__(self, path=None):
def __init__(self, path = None):
if path is None: if path is None:
path = self.modelsim_ini_dir() + "/modelsim.ini" path = self.modelsim_ini_dir() + "/modelsim.ini"
self.path = path self.path = path
...@@ -312,7 +312,8 @@ class ModelsiminiReader(object): ...@@ -312,7 +312,8 @@ class ModelsiminiReader(object):
for line in ini: for line in ini:
line = line.split(" ")[0] line = line.split(" ")[0]
line = line.strip() line = line.strip()
if line == "": continue if line == "":
continue
if line.lower() == "[library]": if line.lower() == "[library]":
reading_libraries = True reading_libraries = True
continue continue
...@@ -336,7 +337,7 @@ class ModelsiminiReader(object): ...@@ -336,7 +337,7 @@ class ModelsiminiReader(object):
return os.path.abspath(bin_path+"/../") return os.path.abspath(bin_path+"/../")
class XilinxsiminiReader(object): class XilinxsiminiReader(object):
def __init__(self, path = None): def __init__(self, path=None):
if path is None: if path is None:
path = self.xilinxsim_ini_dir() + "/xilinxsim.ini" path = self.xilinxsim_ini_dir() + "/xilinxsim.ini"
self.path = path self.path = path
...@@ -359,7 +360,8 @@ class XilinxsiminiReader(object): ...@@ -359,7 +360,8 @@ class XilinxsiminiReader(object):
# Read line by line, skipping comments and striping newline # Read line by line, skipping comments and striping newline
line = line.split('--')[0].strip() line = line.split('--')[0].strip()
# Still in comments section # Still in comments section
if line == "": continue if line == "":
continue
# Not in comments section. Library section: # Not in comments section. Library section:
#<logical_library> = <phisical_path> #<logical_library> = <phisical_path>
...@@ -375,7 +377,7 @@ class XilinxsiminiReader(object): ...@@ -375,7 +377,7 @@ class XilinxsiminiReader(object):
try: try:
xilinx_path = os.environ["XILINX"] xilinx_path = os.environ["XILINX"]
except KeyError: except KeyError:
p.error("Please set the environment variable XILINX") logging.error("Please set the environment variable XILINX")
# Fail completely for now # Fail completely for now
quit() quit()
...@@ -383,7 +385,7 @@ class XilinxsiminiReader(object): ...@@ -383,7 +385,7 @@ class XilinxsiminiReader(object):
try: try:
host_platform = os.environ["HOST_PLATFORM"] host_platform = os.environ["HOST_PLATFORM"]
except KeyError: except KeyError:
p.error("Please set the environment variable HOST_PLATFORM") logging.error("Please set the environment variable HOST_PLATFORM")
# Fail completely for now # Fail completely for now
quit() quit()
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -20,24 +20,10 @@ ...@@ -20,24 +20,10 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import print_function
import os import os
import msg as p import logging
ise_path_64 = {
"10.0":"/opt/Xilinx/10.0/ISE/bin/lin",
"10.1":"/opt/Xilinx/10.1/ISE/bin/lin",
"12.2":"/opt/Xilinx/12.2/ISE_DS/ISE/bin/lin64",
"12.1":"/opt/Xilinx/12.1/ISE_DS/ISE/bin/lin",
"12.4":"/opt/Xilinx/12.4/ISE_DS/ISE/bin/lin64",
"13.1":"/opt/Xilinx/13.1/ISE_DS/ISE/bin/lin64"
}
ise_path_32 = {"10.0":"/opt/Xilinx/10.0/ISE/bin/lin",
"10.1":"/opt/Xilinx/10.1/ISE/bin/lin",
"12.2":"/opt/Xilinx/12.2/ISE_DS/ISE/bin/lin64",
"12.1":"/opt/Xilinx/12.1/ISE_DS/ISE/bin/lin",
"12.4":"/opt/Xilinx/12.4/ISE_DS/ISE/bin/lin64",
"13.1":"/opt/Xilinx/13.1/ISE_DS/ISE/bin/lin64"}
def url_parse(url): def url_parse(url):
""" """
...@@ -46,7 +32,7 @@ def url_parse(url): ...@@ -46,7 +32,7 @@ def url_parse(url):
"""url_pat = re.compile("[ \t]*([^ \t]+?)[ \t]*(::)?([^ \t@]+)?(@[ \t]*(.+))?[ \t]*") """url_pat = re.compile("[ \t]*([^ \t]+?)[ \t]*(::)?([^ \t@]+)?(@[ \t]*(.+))?[ \t]*")
url_match = re.match(url_pat, url) url_match = re.match(url_pat, url)
if url_match is None: if url_match is None:
p.echo("Not a correct repo url: {0}. Skipping".format(url)) print("Not a correct repo url: {0}. Skipping".format(url))
url_clean = url_match.group(1) url_clean = url_match.group(1)
if url_match.group(3) is not None: #there is a branch if url_match.group(3) is not None: #there is a branch
branch = url_match.group(3) branch = url_match.group(3)
...@@ -62,6 +48,7 @@ def url_parse(url): ...@@ -62,6 +48,7 @@ def url_parse(url):
return (url_clean, branch, rev) return (url_clean, branch, rev)
def url_basename(url): def url_basename(url):
""" """
Get basename from an url Get basename from an url
...@@ -75,6 +62,7 @@ def url_basename(url): ...@@ -75,6 +62,7 @@ def url_basename(url):
ret = os.path.basename(url) ret = os.path.basename(url)
return ret return ret
def svn_basename(url): def svn_basename(url):
words = url.split('//') words = url.split('//')
try: try:
...@@ -83,22 +71,30 @@ def svn_basename(url): ...@@ -83,22 +71,30 @@ def svn_basename(url):
except IndexError: except IndexError:
return None return None
def pathsplit(p, rest=None): def pathsplit(p, rest=None):
if rest is None: if rest is None:
rest = [] rest = []
(h, t) = os.path.split(p) (h, t) = os.path.split(p)
if len(h) < 1: return [t]+rest if len(h) < 1:
if len(t) < 1: return [h]+rest return [t]+rest
if len(t) < 1:
return [h]+rest
return pathsplit(h, [t]+rest) return pathsplit(h, [t]+rest)
def commonpath(l1, l2, common=None): def commonpath(l1, l2, common=None):
if common is None: if common is None:
common = [] common = []
if len(l1) < 1: return (common, l1, l2) if len(l1) < 1:
if len(l2) < 1: return (common, l1, l2) return (common, l1, l2)
if l1[0] != l2[0]: return (common, l1, l2) if len(l2) < 1:
return (common, l1, l2)
if l1[0] != l2[0]:
return (common, l1, l2)
return commonpath(l1[1:], l2[1:], common+[l1[0]]) return commonpath(l1[1:], l2[1:], common+[l1[0]])
def is_rel_path(path): def is_rel_path(path):
path = str(path) path = str(path)
s = path[0] s = path[0]
...@@ -106,6 +102,7 @@ def is_rel_path(path): ...@@ -106,6 +102,7 @@ def is_rel_path(path):
return False return False
return True return True
def is_abs_path(path): def is_abs_path(path):
path = str(path) path = str(path)
s = path[0] s = path[0]
...@@ -113,7 +110,8 @@ def is_abs_path(path): ...@@ -113,7 +110,8 @@ def is_abs_path(path):
return True return True
return False return False
def relpath(p1, p2 = None):
def relpath(p1, p2=None):
if p2 is None: if p2 is None:
p2 = os.getcwd() p2 = os.getcwd()
if p1 == p2: if p1 == p2:
...@@ -127,12 +125,12 @@ def relpath(p1, p2 = None): ...@@ -127,12 +125,12 @@ def relpath(p1, p2 = None):
(_, l1, l2) = commonpath(pathsplit(p1), pathsplit(p2)) (_, l1, l2) = commonpath(pathsplit(p1), pathsplit(p2))
p = [] p = []
if len(l1) > 0: if len(l1) > 0:
p = [ '../' * len(l1) ] p = ['../' * len(l1)]
p = p + l2 p = p + l2
return os.path.join(*p) return os.path.join(*p)
def rel2abs(path, base = None): def rel2abs(path, base=None):
""" """
converts a relative path to an absolute path. converts a relative path to an absolute path.
...@@ -147,11 +145,12 @@ def rel2abs(path, base = None): ...@@ -147,11 +145,12 @@ def rel2abs(path, base = None):
retval = os.path.join(base, path) retval = os.path.join(base, path)
return os.path.abspath(retval) return os.path.abspath(retval)
def search_for_manifest(search_path): def search_for_manifest(search_path):
""" """
Look for manifest in the given folder Look for manifest in the given folder
""" """
p.vprint("Looking for manifest in " + search_path) logging.debug("Looking for manifest in " + search_path)
for filename in os.listdir(search_path): for filename in os.listdir(search_path):
if filename == "manifest.py" and not os.path.isdir(filename): if filename == "manifest.py" and not os.path.isdir(filename):
return os.path.abspath(os.path.join(search_path, filename)) return os.path.abspath(os.path.join(search_path, filename))
......
...@@ -19,10 +19,11 @@ ...@@ -19,10 +19,11 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import print_function
from dep_solver import IDependable from dep_solver import IDependable
import os import os
import msg as p
import global_mod import global_mod
import logging
import flow import flow
import path as path_mod import path as path_mod
...@@ -42,7 +43,7 @@ class File(object): ...@@ -42,7 +43,7 @@ class File(object):
@property @property
def dirname(self): def dirname(self):
return os.path.dirname(self.path) return os.path.dirname(self.path)
def rel_path(self, dir=None): def rel_path(self, dir=None):
import path import path
if dir is None: if dir is None:
...@@ -54,7 +55,7 @@ class File(object): ...@@ -54,7 +55,7 @@ class File(object):
def __eq__(self, other): def __eq__(self, other):
_NOTFOUND = object() _NOTFOUND = object()
v1, v2 = [getattr(obj, "path", _NOTFOUND) for obj in [self, other]] v1, v2 = [getattr(obj, "path", _NOTFOUND) for obj in [self, other]]
if v1 is _NOTFOUND or v2 is _NOTFOUND: if v1 is _NOTFOUND or v2 is _NOTFOUND:
return False return False
elif v1 != v2: elif v1 != v2:
...@@ -79,14 +80,14 @@ class File(object): ...@@ -79,14 +80,14 @@ class File(object):
return os.path.isdir(self.path) return os.path.isdir(self.path)
def show(self): def show(self):
p.rawprint(self.path) print(self.path)
def extension(self): def extension(self):
tmp = self.path.rsplit('.') tmp = self.path.rsplit('.')
ext = tmp[len(tmp)-1] ext = tmp[len(tmp)-1]
return ext return ext
class SourceFile(IDependable, File): class SourceFile(IDependable, File):
cur_index = 0 cur_index = 0
...@@ -128,8 +129,8 @@ class VHDLFile(SourceFile): ...@@ -128,8 +129,8 @@ class VHDLFile(SourceFile):
else: else:
self.dep_requires = list(self.__search_use_clauses()) self.dep_requires = list(self.__search_use_clauses())
self.dep_provides = list(self.__search_packages()) self.dep_provides = list(self.__search_packages())
p.vprint(self.path + " provides " + str(self.dep_provides)) logging.debug(self.path + " provides " + str(self.dep_provides))
p.vprint(self.path + " requires " + str(self.dep_requires)) logging.debug(self.path + " requires " + str(self.dep_requires))
def __search_use_clauses(self): def __search_use_clauses(self):
""" """
...@@ -148,12 +149,12 @@ class VHDLFile(SourceFile): ...@@ -148,12 +149,12 @@ class VHDLFile(SourceFile):
elif global_mod.top_module.sim_tool == "vsim": elif global_mod.top_module.sim_tool == "vsim":
std_libs = flow.ModelsiminiReader().get_libraries() std_libs = flow.ModelsiminiReader().get_libraries()
else: else:
p.warning("Could not determine simulation tool. Defaulting to Modelsim") logging.warning("Could not determine simulation tool. Defaulting to Modelsim")
std_libs = flow.MODELSIM_STANDARD_LIBS std_libs = flow.MODELSIM_STANDARD_LIBS
except RuntimeError as e: except RuntimeError as e:
#std_libs = flow.MODELSIM_STANDARD_LIBS #std_libs = flow.MODELSIM_STANDARD_LIBS
print "I/O error: ({0})".format(e.message) logging.error("I/O error: ({0})".format(e.message))
p.error("Picking standard Modelsim simulation libraries. Try to fix the error.") logging.error("Picking standard Modelsim simulation libraries. Try to fix the error.")
std_libs = flow.MODELSIM_STARDAND_LIBS std_libs = flow.MODELSIM_STARDAND_LIBS
elif global_mod.top_module.action == "synthesis": elif global_mod.top_module.action == "synthesis":
print("setting std libs for synthesis...") print("setting std libs for synthesis...")
...@@ -180,7 +181,7 @@ class VHDLFile(SourceFile): ...@@ -180,7 +181,7 @@ class VHDLFile(SourceFile):
if m is not None: if m is not None:
use_lines.append(m.group(1)) use_lines.append(m.group(1))
ret = set() ret = set()
for line in use_lines: for line in use_lines:
m = re.match(lib_pattern, line) m = re.match(lib_pattern, line)
if m is not None: if m is not None:
...@@ -214,7 +215,7 @@ class VHDLFile(SourceFile): ...@@ -214,7 +215,7 @@ class VHDLFile(SourceFile):
package_pattern = re.compile("^[ \t]*package[ \t]+([^ \t]+)[ \t]+is[ \t]*.*$") package_pattern = re.compile("^[ \t]*package[ \t]+([^ \t]+)[ \t]+is[ \t]*.*$")
ret = set() ret = set()
for line in text: for line in text:
#identifiers and keywords are case-insensitive in VHDL #identifiers and keywords are case-insensitive in VHDL
line = line.lower() line = line.lower()
...@@ -274,13 +275,13 @@ class VerilogFile(SourceFile): ...@@ -274,13 +275,13 @@ class VerilogFile(SourceFile):
command += " " + vlog_opt + " " + self.rel_path() command += " " + vlog_opt + " " + self.rel_path()
retOsSystem = os.system(command) retOsSystem = os.system(command)
if retOsSystem and retOsSystem != 256: if retOsSystem and retOsSystem != 256:
print "Dependencies not Met" logging.error("Dependencies not Met")
print command, self.include_dirs, inc_dirs, global_mod.mod_pool logging.debug(command, self.include_dirs, inc_dirs, global_mod.mod_pool)
quit() quit()
elif retOsSystem == 256: elif retOsSystem == 256:
print command logging.debug(command)
pass pass
depFile = open(depFileName,"r") depFile = open(depFileName, "r")
depFiles = list(set([l.strip() for l in depFile.readlines()])) depFiles = list(set([l.strip() for l in depFile.readlines()]))
depFile.close() depFile.close()
return depFiles return depFiles
...@@ -361,7 +362,7 @@ class SourceFileSet(list): ...@@ -361,7 +362,7 @@ class SourceFileSet(list):
if isinstance(files, str): if isinstance(files, str):
raise RuntimeError("Expected object, not a string") raise RuntimeError("Expected object, not a string")
elif files is None: elif files is None:
p.vprint("Got None as a file.\n Ommiting") logging.debug("Got None as a file.\n Ommiting")
else: else:
try: try:
for f in files: for f in files:
...@@ -403,7 +404,7 @@ class SourceFileFactory: ...@@ -403,7 +404,7 @@ class SourceFileFactory:
path = os.path.abspath(path) path = os.path.abspath(path)
tmp = path.rsplit('.') tmp = path.rsplit('.')
extension = tmp[len(tmp)-1] extension = tmp[len(tmp)-1]
p.vprint("SFF> " + path) logging.debug("SFF> " + path)
nf = None nf = None
if extension == 'vhd' or extension == 'vhdl' or extension == 'vho': if extension == 'vhd' or extension == 'vhdl' or extension == 'vho':
......
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