From de308abded8a260a4b739f0f5790ebbdb4e7074c Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 14 Dec 2016 11:42:25 +0100 Subject: [PATCH] Fix #9: Warning message for duplicate providers --- src/cython_setup.py | 2 +- src/variables.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cython_setup.py b/src/cython_setup.py index 6bb2e85..c80f46f 100755 --- a/src/cython_setup.py +++ b/src/cython_setup.py @@ -29,7 +29,7 @@ from distutils.extension import Extension from Cython.Distutils import build_ext import os -to_remove = """cython_setup.py version.py command_line.py""".split() +to_remove = """__init__.py cython_setup.py version.py command_line.py""".split() ext_modules = [] files = os.listdir('.') diff --git a/src/variables.py b/src/variables.py index cf2a409..bc5cf58 100644 --- a/src/variables.py +++ b/src/variables.py @@ -47,8 +47,18 @@ def create_variables(): inside = False icount += 1 v = Variable(buffer,icount) + if v.name in result: + print "Warning: Duplicate provider for %s in"%(v.name) + print "- ", v.line.filename[0], " line ", v.line.i + print "- ", result[v.name].line.filename[0], " line ", result[v.name].line.i + print "Choosing first version" result[v.name] = v for other in v.others: + if other in result: + print "Warning: Duplicate provider for %s in"%(other) + print "- ", v.line.filename[0], " line ", v.line.i + print "- ", result[other].line.filename[0], " line ", result[other].line.i + print "Choosing first version" result[other] = Variable(buffer,icount,other) buffer = [] return result