Skip to content

Commit

Permalink
lint & format
Browse files Browse the repository at this point in the history
  • Loading branch information
aappleby committed Mar 11, 2024
1 parent 6859d47 commit e63fbc5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
17 changes: 11 additions & 6 deletions hancho.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def swap_ext(name, new_ext):
return Path(name).with_suffix(new_ext)
return [swap_ext(n, new_ext) for n in flatten(name)]


def mtime(filename):
"""Gets the file's mtime and tracks how many times we called it"""
this.mtime_calls += 1
Expand Down Expand Up @@ -89,6 +90,7 @@ def maybe_as_number(text):
except ValueError:
return text


################################################################################

this.line_dirty = False
Expand Down Expand Up @@ -251,6 +253,7 @@ async def async_main():
# The .hancho file loader does a small amount of work to keep track of the
# stack of .hancho files that have been loaded.


def load(mod_path):
"""
Searches the loaded Hancho module stack for a module whose directory
Expand Down Expand Up @@ -502,17 +505,19 @@ async def dispatch(self):
# If they're already absolute, this does nothing.

build_dir = Path(await expand_async(self, self.build_dir))
build_dir = this.hancho_root / build_dir / self.abs_cwd.relative_to(this.hancho_root)
src_dir = this.hancho_root / self.abs_cwd.relative_to(this.hancho_root)
build_dir = (
this.hancho_root / build_dir / self.abs_cwd.relative_to(this.hancho_root)
)
src_dir = this.hancho_root / self.abs_cwd.relative_to(this.hancho_root)

self.abs_files_in = [(src_dir / f).absolute() for f in self.files_in]
self.abs_files_in = [(src_dir / f).absolute() for f in self.files_in]
self.abs_files_out = [(build_dir / f).absolute() for f in self.files_out]
self.abs_deps = [(src_dir / f).absolute() for f in self.deps]
self.abs_deps = [(src_dir / f).absolute() for f in self.deps]

# Strip hancho_root off the absolute paths to produce root-relative paths
self.files_in = [f.relative_to(this.hancho_root) for f in self.abs_files_in]
self.files_in = [f.relative_to(this.hancho_root) for f in self.abs_files_in]
self.files_out = [f.relative_to(this.hancho_root) for f in self.abs_files_out]
self.deps = [f.relative_to(this.hancho_root) for f in self.abs_deps]
self.deps = [f.relative_to(this.hancho_root) for f in self.abs_deps]

# Check for duplicate task outputs
for file in self.abs_files_out:
Expand Down
4 changes: 0 additions & 4 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@
import subprocess
import unittest
import shutil
import sys
from pathlib import Path

sys.path.append("..")
import hancho # pylint: disable=wrong-import-position, import-error

# tests still needed -
# calling hancho in src dir
# meta deps changed
Expand Down

0 comments on commit e63fbc5

Please sign in to comment.