65 lines
1.9 KiB
Python
65 lines
1.9 KiB
Python
###############################################################################
|
|
##
|
|
## Copyright (C) 2014 Tavendo GmbH
|
|
##
|
|
## 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.
|
|
##
|
|
###############################################################################
|
|
|
|
import os
|
|
import json
|
|
import pkg_resources
|
|
|
|
taschenmesser = pkg_resources.resource_filename('taschenmesser', '..')
|
|
#taschenmesser = "../../../infrequent/taschenmesser"
|
|
env = Environment(tools = ['default', 'taschenmesser'],
|
|
toolpath = [taschenmesser],
|
|
ENV = os.environ)
|
|
|
|
DOCSDIR = '_build'
|
|
S3DIR = '_upload'
|
|
|
|
##
|
|
## Sphinx Build
|
|
##
|
|
docs = env.Command(DOCSDIR, [], "sphinx-build -b html . $TARGET")
|
|
env.AlwaysBuild(docs)
|
|
Clean(docs, DOCSDIR)
|
|
Default(docs)
|
|
|
|
|
|
##
|
|
## Upload to Amazon S3
|
|
##
|
|
env['S3_RELPATH'] = DOCSDIR
|
|
env['S3_BUCKET'] = 'autobahn.ws'
|
|
env['S3_BUCKET_PREFIX'] = 'python/' # note the trailing slash!
|
|
env['S3_OBJECT_ACL'] = 'public-read'
|
|
|
|
|
|
uploaded = []
|
|
import fnmatch
|
|
|
|
for root, dirnames, filenames in os.walk(DOCSDIR):
|
|
if not root.endswith('.doctrees'):
|
|
for filename in filenames:
|
|
if not fnmatch.fnmatch(filename, '*.s3'):
|
|
source = os.path.join(root, filename)
|
|
target = os.path.join(S3DIR, source)
|
|
uploaded.append(env.S3('{}.s3'.format(target), source))
|
|
|
|
Depends(uploaded, docs)
|
|
Clean(docs, S3DIR)
|
|
Alias("publish", uploaded)
|
|
|