-
Notifications
You must be signed in to change notification settings - Fork 9
/
setup.py
78 lines (67 loc) · 2.5 KB
/
setup.py
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
from importlib.machinery import SourceFileLoader
from pathlib import Path
from subprocess import check_call
from setuptools import find_packages, setup
from setuptools.command.develop import develop
pwd = Path(__file__).parent
# Get the long description from the README file
with pwd.joinpath("README.md").open(encoding="utf-8") as f:
long_description = f.read()
def requirements_to_list(filename):
return [
dep
for dep in pwd.joinpath(filename).open(encoding="utf-8").read().split("\n")
if (dep and not dep.startswith("#"))
]
class LintCommand(develop):
"""Run linting"""
def run(self):
try:
check_call("black .".split())
check_call("isort --profile black .".split())
check_call("autoflake -ir .".split())
except CalledProcessError as err:
if "non-zero" in str(err):
print("linting failed with warnings", file=sys.stderr)
sys.exit(1)
# Allows us to import the file without executing imports in module __init__
meta = SourceFileLoader("meta", str(pwd.joinpath("ledgereth/_meta.py"))).load_module()
setup(
name="ledgereth",
version=meta.version,
description="Library to interface with ledger-app-eth on Ledger hardware wallets",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/mikeshultz/ledger-eth-lib",
author=meta.author,
author_email=meta.email,
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
keywords="solidity ethereum development",
packages=find_packages(exclude=["docs", "tests", "scripts", "build"]),
install_requires=requirements_to_list("requirements.txt"),
extras_require={
"dev": requirements_to_list("requirements.dev.txt"),
"docs": requirements_to_list("requirements.dev.txt")
+ requirements_to_list("requirements.docs.txt"),
},
package_data={
"": [
"README.md",
"LICENSE",
],
"ledgereth": ["py.typed"],
},
cmdclass={
"lint": LintCommand,
},
)