-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·129 lines (117 loc) · 6.1 KB
/
setup.py
File metadata and controls
executable file
·129 lines (117 loc) · 6.1 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
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
#!/usr/bin/env python
################################################################################
## ##
## This file is a part of TADEK. ##
## ##
## TADEK - Test Automation in a Distributed Environment ##
## (http://tadek.comarch.com) ##
## ##
## Copyright (C) 2011,2012 Comarch S.A. ##
## All rights reserved. ##
## ##
## TADEK is free software for non-commercial purposes. For commercial ones ##
## we offer a commercial license. Please check http://tadek.comarch.com for ##
## details or write to tadek-licenses@comarch.com ##
## ##
## You can redistribute it and/or modify it under the terms of the ##
## GNU General Public License as published by the Free Software Foundation, ##
## either version 3 of the License, or (at your option) any later version. ##
## ##
## TADEK is distributed in the hope that it will be useful, ##
## but WITHOUT ANY WARRANTY; without even the implied warranty of ##
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ##
## GNU General Public License for more details. ##
## ##
## You should have received a copy of the GNU General Public License ##
## along with TADEK bundled with this file in the file LICENSE. ##
## If not, see http://www.gnu.org/licenses/. ##
## ##
## Please notice that Contributor Agreement applies to any contribution ##
## you make to TADEK. The Agreement must be completed, signed and sent ##
## to Comarch before any contribution is made. You should have received ##
## a copy of Contribution Agreement along with TADEK bundled with this file ##
## in the file CONTRIBUTION_AGREEMENT.pdf or see http://tadek.comarch.com ##
## or write to tadek-licenses@comarch.com ##
## ##
################################################################################
import os
import sys
from glob import glob
from subprocess import check_call
from distutils import log
from distutils.core import setup
from distutils.dir_util import remove_tree
from distutils.command.build import build as _build
from distutils.command.clean import clean as _clean
from distutils.command.install import install as _install
try:
from tadek.core.config import DATA_DIR, DOC_DIR, VERSION
except ImportError:
print >> sys.stderr, "Required tadek-common package is not installed"
exit(1)
DATA_FILES = []
BUILD_HTML_DIR = os.path.join("build", "html")
BUILD_DOC_TREES_DIR = os.path.join("build", "doctrees")
API_DOC_DIR = os.path.join(DOC_DIR, "api", "html")
HTML_DOC_DIR = os.path.join(DOC_DIR, "tutorial", "html")
def getExamplesPaths(files, dirname, names):
files.append((os.path.join(DATA_DIR, dirname),
[os.path.join(dirname, name) for name in names
if os.path.isfile(os.path.join(dirname, name))
and (name.endswith(".py") or name.endswith(".mo"))]))
os.path.walk("examples", getExamplesPaths, DATA_FILES)
class build(_build):
def run(self):
_build.run(self)
if not os.path.exists(BUILD_HTML_DIR):
os.makedirs(BUILD_HTML_DIR)
SPHINX = ["sphinx-build", "-b", "html",
"-d", os.path.join("build", "doctrees"),
"-D", "epylink_output_dir=" + API_DOC_DIR,
"-D", "epylink_api_dir=" + os.path.join(
os.pardir, os.pardir, "api", "html"),
os.path.join("doc", "source"),
BUILD_HTML_DIR]
check_call(SPHINX)
DATA_FILES.extend([
(HTML_DOC_DIR, glob(os.path.join("build", "html", "[!_]*"))),
(os.path.join(HTML_DOC_DIR, "_images"),
glob(os.path.join("build", "html", "_images", '*'))),
(os.path.join(HTML_DOC_DIR, "_sources"),
glob(os.path.join("build", "html", "_sources", '*'))),
(os.path.join(HTML_DOC_DIR, "_static"),
glob(os.path.join("build", "html", "_static", '*'))),
])
class install(_install):
sub_commands = []
# Skip the install_egg_info sub-command
for name, method in _install.sub_commands:
if name != "install_egg_info":
sub_commands.append((name, method))
del name, method
class clean(_clean):
def run(self):
if self.all:
if os.path.exists(BUILD_HTML_DIR):
remove_tree(BUILD_HTML_DIR, dry_run=self.dry_run)
else:
log.warn("'%s' does not exist -- can't clean it",
BUILD_HTML_DIR)
if os.path.exists(BUILD_DOC_TREES_DIR):
remove_tree(BUILD_DOC_TREES_DIR, dry_run=self.dry_run)
else:
log.warn("'%s' does not exist -- can't clean it",
BUILD_DOC_TREES_DIR)
_clean.run(self)
setup(
name="tadek-tutorial",
version=VERSION,
description="TADEK tutorial source files and examples",
long_description=''.join(['\n', open("README").read()]),
author="Comarch TADEK Team",
author_email="tadek@comarch.com",
license="http://tadek.comarch.com/licensing",
url="http://tadek.comarch.com/",
cmdclass={"build": build, "install": install, "clean": clean},
data_files=DATA_FILES,
)