-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
96 lines (82 loc) · 2.65 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import os
import subprocess
import sys
from pathlib import Path
from setuptools import find_packages, setup
from setuptools.command.develop import develop
from setuptools.command.install import install
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
class InstallSystemDependencies(install):
"""Post-installation for installation mode."""
def run(self):
"""Run post-install hook."""
try:
subprocess.check_call([sys.executable, "-m", "package.python.extras.pre_install"])
except subprocess.CalledProcessError as e:
print(f"Pre-install script failed: {e}", file=sys.stderr)
sys.exit(1)
install.run(self)
class InstallDevelopmentSystemDependencies(develop):
"""Post-installation for development mode."""
def run(self):
"""Run post-install hook."""
try:
subprocess.check_call([sys.executable, "-m", "package.python.extras.pre_install"])
except subprocess.CalledProcessError as e:
print(f"Pre-install script failed: {e}", file=sys.stderr)
sys.exit(1)
install.run(self) # type: ignore
def parse_requirements(filename):
with open(filename, "r") as f:
return [
line.split("--hash=")[0].strip()
for line in f
if line.strip() and not line.startswith("#")
]
requirements_path = os.path.join("requirements", "requirements.in")
requirements = parse_requirements(requirements_path)
packages = find_packages(
where="package/python",
exclude=[
# Exclude tests if present
"*.tests",
"*.tests.*",
"tests.*",
"tests",
# Exclude __pycache__ directories
"*.__pycache__",
"*.__pycache__.*",
],
)
setup(
name="cyyrus",
description="Transform Unstructured Data into Usable Datasets",
author="wizenheimer",
version="0.21.0",
long_description=long_description,
long_description_content_type="text/markdown",
author_email="[email protected]",
url="https://github.com/wizenheimer/cyyrus",
packages=packages,
package_dir={
"": "package/python",
},
install_requires=requirements,
cmdclass={
"install": InstallSystemDependencies,
"develop": InstallDevelopmentSystemDependencies,
},
entry_points={
"console_scripts": [
"cyyrus=cyyrus.cli.main:cli",
],
},
include_package_data=True,
exclude_package_data={
"": [".DS_Store"],
"package": [".DS_Store"],
"package/python": [".DS_Store"],
"package/python/cyyrus": [".DS_Store"],
},
)