Skip to content

Commit

Permalink
fix bug that was making hancho tutorial build dirs collide
Browse files Browse the repository at this point in the history
  • Loading branch information
aappleby committed Apr 12, 2024
1 parent 3347467 commit 39b782e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
5 changes: 3 additions & 2 deletions hancho.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ class Config:

def __init__(self, *args, **kwargs):
for arg in args:
self.__dict__.update(arg.__dict__ if isinstance(arg, Config) else arg)
if arg is not None:
self.__dict__.update(arg.__dict__ if isinstance(arg, Config) else arg)
self.__dict__.update(kwargs)

def __getitem__(self, key):
Expand All @@ -275,7 +276,7 @@ def __call__(self, source_files, build_files = None, *, config = None):
kwargs['source_files'] = source_files
if build_files is not None:
kwargs['build_files'] = build_files
return Task(self, kwargs)
return Task(self, config, kwargs)

def expand(self, variant):
return expand(self, variant)
Expand Down
24 changes: 12 additions & 12 deletions tutorial/build.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ test_build = hancho.Config(
build_files = "{swap_ext(source_files, '.pass')}",
)

test_build(source_files = "tut00.hancho")
test_build(source_files = "tut01.hancho")
test_build(source_files = "tut02.hancho")
test_build(source_files = "tut03.hancho")
test_build(source_files = "tut04.hancho")
test_build("tut00.hancho")
test_build("tut01.hancho")
test_build("tut02.hancho")
test_build("tut03.hancho")
test_build("tut04.hancho")

test_build(source_files = "tut10.hancho")
test_build(source_files = "tut11.hancho")
test_build(source_files = "tut12.hancho")
test_build(source_files = "tut13.hancho")
test_build(source_files = "tut14.hancho")
test_build(source_files = "tut15.hancho")
test_build(source_files = "tut16.hancho")
test_build("tut10.hancho")
test_build("tut11.hancho")
test_build("tut12.hancho")
test_build("tut13.hancho")
test_build("tut14.hancho")
test_build("tut15.hancho")
test_build("tut16.hancho")

test_build("tut20.hancho")
test_build("tut30.hancho")
Expand Down
5 changes: 1 addition & 4 deletions tutorial/tut40_rules.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,5 @@ link = hancho.Config(
)

def c_binary(source_files, build_files, *, config = None):
objs = [
compile(file, config = config)
for file in source_files
]
objs = [compile(file, config = config) for file in source_files]
return link(objs, build_files, config = config)

0 comments on commit 39b782e

Please sign in to comment.