# Name:		setup.py
# Author:	Dave Renner		dmrenne.comcast.net
# Date:		08/31/11	1215
# Rev:		09/24/12	1945
# Note:		this is part of the 'pyDemo.py' Python Demo suite
# Note:		'setup.py' should be run before 'pyDemo.py'
#
#
from distutils.core import setup, Extension

# ################################# BOILERPLATE ############################# 
import pickle

myConfigFile = 'pyDemoConfig.dat'

# version has been stored in our calling module 'renner.py'
PythonVersFile = 'version.obj'
versfile = open(PythonVersFile, 'rb')
PythonVers = pickle.load(versfile)
versfile.close()

if PythonVers == '30':
    import configparser
    config = configparser.ConfigParser()
    input_cmd = 'input'
else:
    import ConfigParser
    config = ConfigParser.ConfigParser()
    input_cmd = 'raw_input'

config.read(myConfigFile)
interactive = config.get('Mode', 'interactive')
continue_cmd = config.get('Strings', 'continue_cmd')

# easier to just include this boilerplate function into every module 
# than to import it
def printf(arg):
    cmdText = "print "
    arg_nonSlash = arg.strip('\\')
    if PythonVers == '30':
        cmdFull = cmdText + '("' + arg_nonSlash + '")'
    else:
        cmdFull = cmdText + '"' + arg_nonSlash + '"'
    exec( cmdFull )

# ##########################################################################

if PythonVers == '30':
    setup(name = "C30PyIntegrate", version = "2.0",
        ext_modules = [ Extension( "C30PyIntegrate", ["C30PyIntegrate.c"] ) ] )
else:
    setup(name = "C26PyIntegrate", version = "2.0",
        ext_modules = [ Extension( "C26PyIntegrate", ["C26PyIntegrate.c"] ) ] )
