-
Notifications
You must be signed in to change notification settings - Fork 86
/
setup.py
130 lines (117 loc) · 3.72 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
#!/usr/bin/env python
import ast
import os
import re
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.version_info < (3, 7):
sys.stderr.write("ERROR: planemo requires at least Python version 3.7\n")
sys.exit(1)
# Allow installer to turn off dependency on lxml by setting the environment variable
# PLANEMO_REQUIRE_LXML to "0". lxml should be considered optional if xmllint is
# available on the PATH - but python doesn't really provide me a fantastic way to
# express that.
DEFAULT_PLANEMO_REQUIRE_LXML = 1
PLANEMO_REQUIRE_LXML = os.environ.get("PLANEMO_REQUIRE_LXML", "%d" % DEFAULT_PLANEMO_REQUIRE_LXML) != "0"
SOURCE_DIR = "planemo"
_version_re = re.compile(r"__version__\s+=\s+(.*)")
with open("%s/__init__.py" % SOURCE_DIR, "rb") as f:
init_contents = f.read().decode("utf-8")
def get_var(var_name):
pattern = re.compile(r"%s\s+=\s+(.*)" % var_name)
match = pattern.search(init_contents).group(1)
return str(ast.literal_eval(match))
version = get_var("__version__")
PROJECT_NAME = get_var("PROJECT_NAME")
PROJECT_URL = get_var("PROJECT_URL")
PROJECT_AUTHOR = get_var("PROJECT_AUTHOR")
PROJECT_EMAIL = get_var("PROJECT_EMAIL")
PROJECT_DESCRIPTION = (
"Command-line utilities to assist in building tools for the Galaxy project (http://galaxyproject.org/)."
)
PACKAGES = [
"planemo",
"planemo.autopygen",
"planemo.autopygen.commands",
"planemo.autopygen.source_file_parsing",
"planemo.autopygen.xml",
"planemo.cwl",
"planemo.commands",
"planemo.database",
"planemo.engine",
"planemo.galaxy",
"planemo.galaxy.test",
"planemo.linters",
"planemo.reports",
"planemo.shed",
"planemo.shed2tap",
"planemo.test",
"planemo.training",
"planemo.xml",
]
ENTRY_POINTS = """
[console_scripts]
planemo=planemo.cli:planemo
"""
PACKAGE_DATA = {
"planemo": [
"xml/xsd/repository_dependencies.xsd",
"xml/xsd/tool_dependencies.xsd",
"reports/*",
"scripts/*",
],
}
PACKAGE_DIR = {
SOURCE_DIR: SOURCE_DIR,
}
with open("README.rst") as fh:
readme = fh.read()
with open("HISTORY.rst") as fh:
history = fh.read().replace(".. :changelog:", "")
if os.path.exists("requirements.txt"):
with open("requirements.txt") as fh:
requirements = [r for r in fh.read().split("\n")]
if not PLANEMO_REQUIRE_LXML:
requirements.remove("lxml")
else:
# In tox, it will cover them anyway.
requirements = []
setup(
name=PROJECT_NAME,
version=version,
description=PROJECT_DESCRIPTION,
long_description=readme + "\n\n" + history,
long_description_content_type="text/x-rst",
author=PROJECT_AUTHOR,
author_email=PROJECT_EMAIL,
url=PROJECT_URL,
packages=PACKAGES,
entry_points=ENTRY_POINTS,
package_data=PACKAGE_DATA,
package_dir=PACKAGE_DIR,
include_package_data=True,
install_requires=requirements,
license="MIT",
zip_safe=False,
keywords="planemo",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Environment :: Console",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX",
"Topic :: Software Development",
"Topic :: Software Development :: Code Generators",
"Topic :: Software Development :: Testing",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
)