Skip to content

Commit

Permalink
change the way ignore_list is processed: no new glob scan is done, ju…
Browse files Browse the repository at this point in the history
…st Path.match checks
  • Loading branch information
jhidding committed Sep 30, 2024
1 parent 57f3eae commit 563327a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 21 deletions.
11 changes: 3 additions & 8 deletions entangled/commands/stitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from ..document import ReferenceMap, Content, PlainText, ReferenceId
from ..transaction import transaction, TransactionMode
from ..errors.user import UserError
from .tangle import get_input_files


def stitch_markdown(reference_map: ReferenceMap, content: list[Content]) -> str:
Expand All @@ -32,14 +33,8 @@ def stitch(*, force: bool = False, show: bool = False):
from ..markdown_reader import read_markdown_file
from ..code_reader import CodeReader
from ..hooks import get_hooks

include_file_list = chain.from_iterable(map(Path(".").glob, config.watch_list))
exclude_file_list = list(
chain.from_iterable(map(Path(".").glob, config.ignore_list))
)
input_file_list = [
path for path in include_file_list if not path in exclude_file_list
]

input_file_list = get_input_files()
hooks = get_hooks()

if show:
Expand Down
10 changes: 2 additions & 8 deletions entangled/commands/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from ..filedb import file_db
from ..config import config
from .stitch import stitch
from .stitch import stitch, get_input_files
from .tangle import tangle


Expand All @@ -16,13 +16,7 @@ def _stitch_then_tangle():


def sync_action() -> Optional[Callable[[], None]]:
include_file_list = set(
chain.from_iterable(map(Path().glob, config.watch_list))
)
exclude_file_list = set(
chain.from_iterable(map(Path().glob, config.ignore_list))
)
input_file_list = include_file_list - exclude_file_list
input_file_list = get_input_files()

with file_db(readonly=True) as db:
changed = set(db.changed())
Expand Down
6 changes: 2 additions & 4 deletions entangled/commands/tangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@

def get_input_files() -> list[Path]:
include_file_list = chain.from_iterable(map(Path(".").glob, config.watch_list))
exclude_file_list = list(
chain.from_iterable(map(Path(".").glob, config.ignore_list))
)
input_file_list = [
path for path in include_file_list if not path in exclude_file_list
path for path in include_file_list
if not any(path.match(pat) for pat in config.ignore_list)
]
return input_file_list

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "entangled-cli"
version = "2.1.9"
version = "2.1.10"
description = "Literate Programming toolbox"
repository = "https://github.com/entangled/entangled.py"
homepage = "https://entangled.github.io/"
Expand Down

0 comments on commit 563327a

Please sign in to comment.