Skip to content

Commit

Permalink
first package
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Oberstein committed Oct 26, 2013
1 parent 3e3cdf7 commit 0ee944c
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 2 deletions.
16 changes: 14 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,31 @@
from setuptools import setup, find_packages

LONGSDESC = """
Taschenmesser is a toolbelt containing builders for SCons. It helps you getting stuff done.
It contains builders for:
- SVG optimization (Scour-based)
- Amazon Web Service (S3 Delta Uploads etc)
- Google Closure (JavaScript optimization)
- File utils (GZip etc)
"""

setup (
name = 'taschenmesser',
version = '0.0.1',
description = 'Taschenmesser',
description = 'Taschenmesser, a toolbelt with plugins for SCons',
long_description = LONGSDESC,
license = 'Apache License 2.0',
author = 'Tavendo GmbH',
author_email = 'contact@tavendo.de',
url = 'http://www.tavendo.de',
platforms = ('Any'),
install_requires = ['setuptools'],
extras_require = {
'aws': ["boto"],
'svg': ["scour>=0.27"]
},
packages = find_packages(),
include_package_data = True,
zip_safe = False,
Expand All @@ -53,5 +65,5 @@
"Topic :: Software Development :: Testing",
"Topic :: System :: Systems Administration",
"Topic :: Utilities"],
keywords = ''
keywords = 'scons svg s3 aws'
)
4 changes: 4 additions & 0 deletions taschenmesser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import gclosure
import aws
import fileutil
import svg


def generate(env):
Expand All @@ -31,6 +32,9 @@ def generate(env):
if fileutil.exists(env):
fileutil.generate(env)

if svg.exists(env):
svg.generate(env)


def exists(env):
return True
67 changes: 67 additions & 0 deletions taschenmesser/svg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
###############################################################################
##
## Copyright 2013 (C) 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.
##
###############################################################################

__all__ = ['exists', 'generate']


def exists(env):
try:
import scour
return True
except:
print "Taschenmesser: scour missing"
return False



def generate(env):
from SCons.Builder import Builder
import scour

def Scour(target, source, env):
if len(source) > 1:
raise Exception("cannot SVG multiple files")

options = scour.scour.generateDefaultOptions()

## override defaults for max cleansing
##
options.enable_viewboxing = True
options.strip_comments = True
options.strip_ids = True
options.remove_metadata = True
options.indent_type = None
options.shorten_ids = True

if env.has_key('SCOUR_OPTIONS'):
options.__dict__.update(env['SCOUR_OPTIONS'])

from pprint import pprint
print
print "Using Scour options:"
print
print pprint(options.__dict__)
print

instream = open(source[0].path, 'rb')
outstream = open(target[0].path, 'wb')

scour.scour.start(options, instream, outstream)


env.Append(BUILDERS = {'Scour': Builder(action = Scour)})

0 comments on commit 0ee944c

Please sign in to comment.