Skip to content

Commit

Permalink
Better error (#132)
Browse files Browse the repository at this point in the history
Minor: Add better error messages for mismatched dependencies.
  • Loading branch information
mortenvp authored Jun 22, 2023
1 parent 3c3d99f commit 235d9b1
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 36 deletions.
1 change: 1 addition & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ of every change, see the Git log.

Latest
------
* Minor: Add better error messages for mismatched dependencies.
* Minor: Recursively pull submodules
* Minor: Adding ensure_build function to Waf's Context object.
* Minor: Added a pip_compile helper function on Waf's Context object.
Expand Down
12 changes: 8 additions & 4 deletions src/wurf/dependency_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def add_dependency(self, **kwargs):
self.dependency_cache[dependency.name] = {
"path": path,
"recurse": dependency.recurse,
"added_by": self.ctx.path.abspath(),
}

def __skip_dependency(self, dependency):
Expand Down Expand Up @@ -149,11 +150,14 @@ def __skip_dependency(self, dependency):

if seen_dependency.sha1 != dependency.sha1:

current = self.ctx.path.abspath()
added_by = self.dependency_cache[dependency.name]["added_by"]

raise WurfError(
"SHA1 mismatch when adding:\n{}\n"
"the previous definition was:\n{}".format(
dependency, seen_dependency
)
f"Adding {dependency.name} in {current}:\n"
f"First added by {added_by}:\n"
f"SHA1 mismatch:\n{dependency}\n"
f"the previous definition was:\n{seen_dependency}"
)

# If the current dependency is non-optional and we have already
Expand Down
7 changes: 4 additions & 3 deletions test/requirements.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Pin pytest since it does not support Python 3.6 which we still use in some
# some places
pytest==7.0.1
#pytest#==7.0.1
pytest
mock
vcrpy
pytest-testdirectory
Expand All @@ -11,5 +12,5 @@ schema
# Pin dependencies of our dependencies since they dropped support
# for python 3.6 which we still use in some places. Try removing this from time
# to time :)
multidict==5.2.0
tomli==1.2.3
#multidict==5.2.0
#tomli==1.2.3
44 changes: 16 additions & 28 deletions test/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,54 +1,42 @@
#
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=test/requirements.txt test/requirements.in
#
attrs==21.4.0
# via pytest
contextlib2==21.6.0
# via schema
idna==3.3
idna==3.4
# via yarl
iniconfig==1.1.1
iniconfig==2.0.0
# via pytest
mock==4.0.3
mock==5.0.2
# via -r test/requirements.in
multidict==5.2.0
# via
# -r test/requirements.in
# yarl
packaging==21.3
# via pytest
pluggy==1.0.0
multidict==6.0.4
# via yarl
packaging==23.1
# via pytest
py==1.11.0
pluggy==1.2.0
# via pytest
pycodestyle==2.8.0
pycodestyle==2.10.0
# via -r test/requirements.in
pyflakes==2.4.0
pyflakes==3.0.1
# via -r test/requirements.in
pyparsing==3.0.7
# via packaging
pytest==7.0.1
pytest==7.3.2
# via
# -r test/requirements.in
# pytest-testdirectory
pytest-testdirectory==4.0.0
pytest-testdirectory==5.0.0
# via -r test/requirements.in
pyyaml==6.0
# via vcrpy
schema==0.7.5
# via -r test/requirements.in
six==1.16.0
# via vcrpy
tomli==1.2.3
# via
# -r test/requirements.in
# pytest
vcrpy==4.1.1
vcrpy==4.3.1
# via -r test/requirements.in
wrapt==1.14.0
wrapt==1.15.0
# via vcrpy
yarl==1.7.2
yarl==1.9.2
# via vcrpy
2 changes: 1 addition & 1 deletion wscript
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def _build_waf_binary(bld):
# Run with ./waf --zones wurf to see the print
waflib.Logs.debug("wurf: tools_dir={}".format(tools_dir))

waf_extras = ["clang_compilation_database"]
waf_extras = ["clang_compilation_database", "c_dumbpreproc"]

# Get the absolute path to all the tools (passed as input to the task)
tools = ",".join(tools_dir + waf_extras)
Expand Down

0 comments on commit 235d9b1

Please sign in to comment.