-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathhatch_build.py
More file actions
54 lines (42 loc) · 1.7 KB
/
hatch_build.py
File metadata and controls
54 lines (42 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python
import sys
import json
import os
import os.path
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
from hatchling.metadata.plugin.interface import MetadataHookInterface
class JSONMetaDataHook(MetadataHookInterface):
# Parse requirements.txt file in order to use it in setup.py
def requirements(self, fname):
with open(fname) as f:
return [line.strip() for line in f if line.strip() and not line.startswith("#")]
def update(self, metadata):
meta = {}
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "noWord", "__init__.py"), encoding="utf-8") as f:
exec(f.read(), meta)
metadata["version"] = meta["__version__"]
metadata["description"] = meta["__description__"]
metadata["readme"] = {
"file": "README.md",
"content-type": "text/markdown"
}
metadata["requires-python"] = ">=3.9"
metadata["license"] = meta["__license__"]
metadata["license-files"] = ["LICEN[CS]E*"]
metadata["authors"] = [
{"name": meta["__author__"], "email": meta["__author_email__"]},
]
metadata["classifiers"] = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
]
metadata["urls"] = {
"Homepage": "https://github.com/mmuellersk/noWord",
"Issues": "https://github.com/mmuellersk/noWord/issues"
}
metadata["scripts"] = {
"noWord": "noWord.nw_proc:main"
}
metadata["dependencies"] = self.requirements(os.path.join(
os.path.dirname(__file__), 'requirements.txt'))