forked from xpybuild/xpybuild
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release-xpy.xpybuild.py
executable file
·86 lines (74 loc) · 2.89 KB
/
release-xpy.xpybuild.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
# Build script for releasing xpybuild itself
#
# Copyright (c) 2013 - 2018 Software AG, Darmstadt, Germany and/or its licensors
# Copyright (c) 2013 - 2019 Ben Spiller and Matthew Johnson
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# $Id: root.xpybuild.py 301527 2017-02-06 15:31:43Z matj $
# xpybuild release build file. Creates pydoc API docs and versioned zip file for releases.
from xpybuild.propertysupport import *
from xpybuild.buildcommon import *
from xpybuild.pathsets import *
from xpybuild.targets.archive import Zip
from xpybuild.targets.copy import Copy
from xpybuild.targets.writefile import WriteFile
from xpybuild.targets.custom import CustomCommand
from xpybuild.utils.outputhandler import ProcessOutputHandler
requireXpybuildVersion('3.0')
try:
import sphinx
except ImportError:
raise Exception('Cannot build the xpybuild release as sphinx documentation library is not installed into this Python installation: %s (see .travis.yml for details of how to install)'%sys.executable)
defineOutputDirProperty('OUTPUT_DIR', '_build_output')
with open('xpybuild/XPYBUILD_VERSION') as f: defineStringProperty('VERSION', f.read().strip())
CustomCommand('${OUTPUT_DIR}/docs/',
command=[
sys.executable,
'-Wignore', # since we get some FutureWarnings from Sphinx in some versions
'-m', 'sphinx',
'-M', 'html',
PathSet('./docs/'), # source dir
'${OUTPUT_DIR}/docs/', # output dir
],
dependencies=[
FindPaths('docs/', excludes=['autodocgen/**']),
FindPaths('./xpybuild/', includes=['**/*.py']),
'xpybuild/XPYBUILD_VERSION',
'CHANGELOG.rst',
],
stderr='${OUTPUT_DIR}/doc_warnings.txt',
).tags('docs'
).option(
# ProcessOutputHandler converts stderr lines from sphinx into target ERRORs
'CustomCommand.outputHandlerFactory', ProcessOutputHandler
).option(
# workaround for https://github.com/readthedocs/sphinx_rtd_theme/issues/739
'ProcessOutputHandler.regexIgnore', '.*(RemovedInSphinx30Warning| [{][{] super[(][)] [}][}]).*'
)
Zip('${OUTPUT_DIR}/xpybuild_${VERSION}_docs.zip', [
FindPaths(DirGeneratedByTarget('${OUTPUT_DIR}/docs/')+'html/'),
'LICENSE.txt',
'README.rst',
])
# Zip all the distributables into a release zip files
Zip('${OUTPUT_DIR}/xpybuild_${VERSION}.zip', [
AddDestPrefix('xpybuild/',[
FindPaths('./xpybuild/', includes=['**/*.py']),
'xpybuild/XPYBUILD_VERSION',
'LICENSE.txt',
'README.rst',
'CHANGELOG.rst',
]),
'xpybuild.py',
])