95 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			95 lines
		
	
	
		
			2.4 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.
 | 
						|
##
 | 
						|
###############################################################################
 | 
						|
 | 
						|
## Image file names to process
 | 
						|
SVG_FILES = [
 | 
						|
   "autobahn.svg",
 | 
						|
   "autobahnpython.svg"
 | 
						|
]
 | 
						|
 | 
						|
## 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'
 | 
						|
 | 
						|
### END OF CONFIG #############################################################
 | 
						|
 | 
						|
 | 
						|
import os
 | 
						|
import json
 | 
						|
import pkg_resources
 | 
						|
 | 
						|
os.environ['PYTHONPATH'] = '../autobahn'
 | 
						|
 | 
						|
taschenmesser = pkg_resources.resource_filename('taschenmesser', '..')
 | 
						|
#taschenmesser = "../../../infrequent/taschenmesser"
 | 
						|
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
 | 
						|
##
 | 
						|
docs = env.Command(DOCSDIR, [], "sphinx-build -b html . $TARGET")
 | 
						|
 | 
						|
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)
 | 
						|
 | 
						|
 | 
						|
## Run a test Web server
 | 
						|
##
 | 
						|
test = env.Command(None, [imgs, docs], 'twistd.py web -n -p 8080 --path="./_build/"')
 | 
						|
#test = env.Command(None, [imgs, docs], 'python -m SimpleHTTPServer 8080') # cannot set path here =(
 | 
						|
 | 
						|
env.AlwaysBuild(test)
 | 
						|
Alias("test", test)
 |