-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetup.py
133 lines (115 loc) · 3.88 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
from __future__ import absolute_import
import os
import platform
import re
from codecs import open
from pkg_resources import parse_version
from setuptools import setup, find_packages
current_platform = platform.system().lower()
extra_includes = []
__version__ = "v1.0.1.dev"
with open(os.path.join("pydataweaver", "_version.py"), "w") as version_file:
version_file.write("__version__ = " + "'" + __version__ + "'\n")
version_file.close()
def clean_version(v):
return parse_version(v).__repr__().lstrip("<Version('").rstrip("')>")
def read(*names, **kwargs):
return open(os.path.join(os.path.dirname(__file__), *names)).read()
current_platform = platform.system().lower()
extra_includes = []
if current_platform == "windows":
extra_includes += ["pypyodbc", "inspect"]
packages = ["pydataweaver.lib", "pydataweaver.engines", "pydataweaver"]
includes = [
"xlrd",
"future",
"argcomplete",
"pymysql",
"psycopg2-binary",
"sqlite3",
] + extra_includes
excludes = [
"pyreadline",
"doctest",
"pickle",
"pdb",
"pywin",
"pywin.debugger",
"pywin.debugger.dbgcon",
"pywin.dialogs",
"pywin.dialogs.list",
"Tkconstants",
"Tkinter",
"tcl",
"tk",
]
setup(
name="pydataweaver",
version=clean_version(__version__),
description="Data pydataweaver",
long_description="{a}\n{b}".format(
a=read("README.md"),
b=re.sub(":[a-z]+:`~?(.*?)`", r"``\1``", read("CHANGES.md")),
),
author="Henry Senyondo, Ethan White",
author_email="[email protected]",
url="https://github.com/weecology/pydataweaver",
classifiers=[
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License"
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: Unix",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Scientific/Engineering :: GIS",
"Topic :: Scientific/Engineering :: Data",
"Topic :: Data Processing",
"Topic :: Data integration",
"Topic :: Database",
],
packages=find_packages(
exclude=["hooks", "docs", "tests", "scripts", "docker", ".cache"]
),
entry_points={"console_scripts": ["pydataweaver = pydataweaver.__main__:main"]},
install_requires=["xlrd", "future", "argcomplete"],
# py2app flags
app=["__main__.py"],
data_files=[("", ["CITATION"])],
setup_requires=[],
)
# windows doesn't have bash. No point in using bash-completion
if current_platform != "windows":
# if platform is OS X use "~/.bash_profile"
if current_platform == "darwin":
bash_file = "~/.bash_profile"
# if platform is Linux use "~/.bashrc
elif current_platform == "linux":
bash_file = "~/.bashrc"
# else write and discard
else:
bash_file = "/dev/null"
argcomplete_command = 'eval "$(register-python-argcomplete pydataweaver)"'
with open(os.path.expanduser(bash_file), "a+") as bashrc:
bashrc.seek(0)
# register pydataweaver for arg-completion if not already registered
# when a new shell is spawned
if argcomplete_command not in bashrc.read():
bashrc.write(argcomplete_command + "\n")
bashrc.close()
os.system("activate-global-python-argcomplete")
# register for the current shell
os.system(argcomplete_command)
try:
from pydataweaver.compile import compile
from pydataweaver.lib.repository import check_for_updates
check_for_updates()
compile()
except:
pass