108 lines
3.1 KiB
Python
108 lines
3.1 KiB
Python
###############################################################################
|
|
#
|
|
# The MIT License (MIT)
|
|
#
|
|
# Copyright (c) Tavendo GmbH
|
|
#
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
# in the Software without restriction, including without limitation the rights
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
# furnished to do so, subject to the following conditions:
|
|
#
|
|
# The above copyright notice and this permission notice shall be included in
|
|
# all copies or substantial portions of the Software.
|
|
#
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
# THE SOFTWARE.
|
|
#
|
|
###############################################################################
|
|
|
|
## Image file names to process
|
|
SVG_FILES = [
|
|
]
|
|
|
|
## Directory with image files to process
|
|
IMG_SOURCE_DIR = "design"
|
|
|
|
## Processed image files are placed here
|
|
IMG_GEN_DIR = "_static/img/gen"
|
|
|
|
## Directory to upload
|
|
DOCSDIR = '_build'
|
|
|
|
## Contains fingerprints of uploaded files
|
|
UPLOADED = '_build_uploaded'
|
|
|
|
## The Tavendo S3 Bucket to upload to
|
|
BUCKET = 'autobahn.ws'
|
|
|
|
## The Bucket Prefix to upload files to
|
|
BUCKET_PREFIX = 'python'
|
|
|
|
## Tavendo shared static assets
|
|
CSTATIC = "//tavendo-common-static.s3-eu-west-1.amazonaws.com"
|
|
CSTATIC_LOCAL = "http://127.0.0.1:8888"
|
|
|
|
|
|
### END OF CONFIG #############################################################
|
|
|
|
|
|
import os
|
|
import json
|
|
import pkg_resources
|
|
|
|
os.environ['PYTHONPATH'] = '../autobahn'
|
|
|
|
taschenmesser = pkg_resources.resource_filename('taschenmesser', '..')
|
|
#taschenmesser = "../../../infrequent/taschenmesser"
|
|
|
|
AddOption('--no_network', dest = 'no_network', action = 'store_true', default = False,
|
|
help = "Run locally and disable anything doing network access")
|
|
|
|
env = Environment(tools = ['default', 'taschenmesser'],
|
|
toolpath = [taschenmesser],
|
|
ENV = os.environ)
|
|
|
|
## Process SVGs
|
|
##
|
|
imgs = env.process_svg(SVG_FILES, IMG_SOURCE_DIR, IMG_GEN_DIR)
|
|
|
|
Alias("img", imgs)
|
|
|
|
|
|
## Sphinx Build
|
|
##
|
|
if GetOption('no_network'):
|
|
print("Building for no network")
|
|
docs = env.Command(DOCSDIR, [], 'sphinx-build -A no_network=1 -D no_network=1 -A cstatic="{}" -b html . $TARGET'.format(CSTATIC_LOCAL))
|
|
else:
|
|
docs = env.Command(DOCSDIR, [], 'sphinx-build -A cstatic="{}" -b html . $TARGET'.format(CSTATIC))
|
|
|
|
|
|
# sphinx-build -b spelling . _spelling
|
|
|
|
env.AlwaysBuild(docs)
|
|
Clean(docs, DOCSDIR)
|
|
Alias("doc", docs)
|
|
|
|
Default([imgs, docs])
|
|
|
|
|
|
## Upload to Amazon S3
|
|
##
|
|
uploaded = env.s3_dir_uploader(UPLOADED, DOCSDIR, BUCKET, BUCKET_PREFIX)
|
|
|
|
Depends(uploaded, docs)
|
|
Depends(uploaded, imgs)
|
|
|
|
Clean(uploaded, UPLOADED)
|
|
|
|
Alias("publish", uploaded)
|