From f637dcdd81c17a71534d2b7d754de2945446070b Mon Sep 17 00:00:00 2001 From: Tobias Oberstein Date: Mon, 25 Nov 2013 11:24:18 +0100 Subject: [PATCH] Python Egg builder --- taschenmesser/__init__.py | 4 ++++ taschenmesser/pyegg.py | 42 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 taschenmesser/pyegg.py diff --git a/taschenmesser/__init__.py b/taschenmesser/__init__.py index 4576dab..340480d 100644 --- a/taschenmesser/__init__.py +++ b/taschenmesser/__init__.py @@ -20,6 +20,7 @@ import aws import fileutil import svg +import pyegg def generate(env): @@ -35,6 +36,9 @@ def generate(env): if svg.exists(env): svg.generate(env) + if pyegg.exists(env): + pyegg.generate(env) + def exists(env): return True diff --git a/taschenmesser/pyegg.py b/taschenmesser/pyegg.py new file mode 100644 index 0000000..3f42d0d --- /dev/null +++ b/taschenmesser/pyegg.py @@ -0,0 +1,42 @@ +############################################################################### +## +## 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 setuptools + return True + except: + print "Taschenmesser: Setuptools missing. Python Egg creation won't be available." + return False + + + +def generate(env): + from SCons.Builder import Builder + + #import setuptools + #from setuptools import setup + from setuptools.sandbox import run_setup + + def python_egg_builder(target, source, env): + run_setup(source[0].path, ["bdist_egg"]) + + env.Append(BUILDERS = {'Egg': Builder(action = python_egg_builder)})