Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ sdist-only = []
git-only = []
default-ignore = true
recurse-submodules = true
mode = "git"
```

You can add `.gitignore` style lines here, and you can turn off the default
Expand All @@ -92,6 +93,10 @@ By default, check-sdist recursively scans the contents of Git submodules, but
you can disable this behavior (e.g. to support older Git versions that don't
have this capability).

You can also select `mode = "all"`, which will instead check every file on your
system. Be prepared to ignore lots of things manually, like `*.pyc` files, if
you use this.

### See also

- [check-manifest](https://github.com/mgedmin/check-manifest): A (currently)
Expand Down
8 changes: 7 additions & 1 deletion scripts/generate_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
items:
type: string
git-only:
description: Files that are only in Git. Gitignore style lines.
description: Files that are only in Git (or whatever mode you use). Gitignore style lines.
type: array
items:
type: string
Expand All @@ -34,6 +34,12 @@
description: Look in all submodules too.
default: true
type: boolean
mode:
description: What to use as baseline
default: git
enum:
- git
- all
"""

schema = yaml.safe_load(starter)
Expand Down
11 changes: 10 additions & 1 deletion src/check_sdist/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,20 @@ def compare(
git_only_patterns = config.get("git-only", [])
default_ignore = config.get("default-ignore", True)
recurse_submodules = config.get("recurse-submodules", True)
mode = config.get("mode", "git")

sdist = sdist_files(source_dir, isolated=isolated, installer=installer) - {
"PKG-INFO"
}
git = git_files(source_dir, recurse_submodules=recurse_submodules)
if mode == "git":
git = git_files(source_dir, recurse_submodules=recurse_submodules)
elif mode == "all":
git = frozenset(
str(p.relative_to(source_dir)) for p in source_dir.rglob("*") if p.is_file()
)
else:
msg = "Only 'all' and 'git' supported for 'mode'"
raise ValueError(msg)

if default_ignore:
with resources.joinpath("default-ignore.txt").open("r", encoding="utf-8") as f:
Expand Down
7 changes: 6 additions & 1 deletion src/check_sdist/resources/check-sdist.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
},
"git-only": {
"description": "Files that are only in Git. Gitignore style lines.",
"description": "Files that are only in Git (or whatever mode you use). Gitignore style lines.",
"type": "array",
"items": {
"type": "string"
Expand All @@ -28,6 +28,11 @@
"description": "Look in all submodules too.",
"default": true,
"type": "boolean"
},
"mode": {
"description": "What to use as baseline",
"default": "git",
"enum": ["git", "all"]
}
}
}
1 change: 1 addition & 0 deletions src/check_sdist/resources/default-ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ noxfile.py
.coverage
codecov.yml
*.dist-info
*.pyc