Skip to content

Commit e30b630

Browse files
committed
Build: include requirements.txt for PEP517 isolated builds
1 parent 77af1b5 commit e30b630

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include README.md
2+
include LICENSE
3+
include requirements.txt
4+
recursive-include knockpy/wordlist *.txt
5+

setup.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
from setuptools import find_packages, setup
22
import os
33

4-
def load_requirements(path):
5-
with open(path, "r") as f:
6-
return [line.strip() for line in f if line.strip() and not line.startswith("#")]
4+
HERE = os.path.abspath(os.path.dirname(__file__))
5+
6+
7+
def load_requirements(path: str) -> list[str]:
8+
"""Load requirements from a local file.
9+
10+
Must work under PEP 517 isolated builds (wheel-from-sdist), so resolve the
11+
path relative to this file and fail gracefully if the file isn't present.
12+
"""
13+
req_path = os.path.join(HERE, path)
14+
try:
15+
with open(req_path, "r", encoding="utf-8") as f:
16+
return [line.strip() for line in f if line.strip() and not line.startswith("#")]
17+
except FileNotFoundError:
18+
return []
719

820
wordlist = 'wordlist' + os.sep + 'wordlist.txt'
921

0 commit comments

Comments
 (0)