"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "SetupTools.py" between
cheetah3-3.1.0.tar.gz and cheetah3-3.2.0.tar.gz

About: Cheetah3 is a template engine and code generation tool for e.g. for Web development or Java, SQL, LaTeX, form email ... (written in Python).

SetupTools.py  (cheetah3-3.1.0):SetupTools.py  (cheetah3-3.2.0)
from glob import glob from glob import glob
import os import os
import os.path import os.path
import sys import sys
from distutils.command.build_ext import build_ext
from distutils.command.install_data import install_data from distutils.command.install_data import install_data
from distutils.core import setup
from distutils.errors import CCompilerError, DistutilsExecError, \ from distutils.errors import CCompilerError, DistutilsExecError, \
DistutilsPlatformError DistutilsPlatformError
from setuptools import setup
from setuptools.command.build_ext import build_ext
# imports from Cheetah ... # imports from Cheetah ...
from Cheetah.FileUtils import findFiles from Cheetah.FileUtils import findFiles
from Cheetah.compat import string_type from Cheetah.compat import string_type
if not os.getenv('CHEETAH_INSTALL_WITHOUT_SETUPTOOLS'):
try:
from setuptools import setup # noqa: F811
except ImportError:
pass
if sys.platform == 'win32': if sys.platform == 'win32':
# 2.6's distutils.msvc9compiler can raise an IOError when failing to # 2.6's distutils.msvc9compiler can raise an IOError when failing to
# find the compiler # find the compiler
ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError, ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError,
IOError) IOError)
else: else:
ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError) ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
################################################## ##################################################
# CLASSES ## # CLASSES ##
class BuildFailed(Exception): class BuildFailed(Exception):
pass pass
class mod_build_ext(build_ext): class mod_build_ext(build_ext):
"""A modified version of the distutils build_ext command that raises an """A modified version of build_ext command that raises an
exception when building of the extension fails. exception when building of the extension fails.
""" """
def run(self): def run(self):
try: try:
build_ext.run(self) build_ext.run(self)
except DistutilsPlatformError as x: except DistutilsPlatformError as x:
raise BuildFailed(x) raise BuildFailed(x)
def build_extension(self, ext): def build_extension(self, ext):
skipping to change at line 117 skipping to change at line 111
self.mkpath(dstdir) self.mkpath(dstdir)
outfile = self.copy_file(filename, dstPath)[0] outfile = self.copy_file(filename, dstPath)[0]
else: else:
outfile = dstPath outfile = dstPath
self.outfiles.append(outfile) self.outfiles.append(outfile)
################################################## ##################################################
# FUNCTIONS ## # FUNCTIONS ##
def run_setup(configurations): def run_setup(configurations):
"""Run distutils setup. """Run distutils/setuptools setup.
The parameters passed to setup() are extracted from the list of modules, The parameters passed to setup() are extracted from the list of modules,
classes or instances given in configurations. classes or instances given in configurations.
Names with leading underscore are removed from the parameters. Names with leading underscore are removed from the parameters.
Parameters which are not strings, lists, tuples, or dicts are removed as Parameters which are not strings, lists, tuples, or dicts are removed as
well. Configurations which occur later in the configurations list well. Configurations which occur later in the configurations list
override settings of configurations earlier in the list. override settings of configurations earlier in the list.
""" """
# Build parameter dictionary # Build parameter dictionary
skipping to change at line 144 skipping to change at line 138
continue continue
if not isinstance(value, (string_type, list, tuple, dict, int)): if not isinstance(value, (string_type, list, tuple, dict, int)):
continue continue
newkws[name] = value newkws[name] = value
kws = newkws kws = newkws
# Add setup extensions # Add setup extensions
cmdclasses = { cmdclasses = {
'build_ext': mod_build_ext, 'build_ext': mod_build_ext,
'install_data': mod_install_data, 'install_data': mod_install_data,
} }
kws['cmdclass'] = cmdclasses kws['cmdclass'] = cmdclasses
# Invoke distutils setup
try: try:
setup(**kws) setup(**kws)
except BuildFailed as x: except BuildFailed as x:
print("One or more C extensions failed to build.") print("One or more C extensions failed to build.")
print("Details: %s" % x) print("Details: %s" % x)
if os.environ.get('CHEETAH_C_EXTENSIONS_REQUIRED'): if os.environ.get('CHEETAH_C_EXTENSIONS_REQUIRED'):
raise x raise x
print("Retrying without C extensions enabled.") print("Retrying without C extensions enabled.")
del kws['ext_modules'] del kws['ext_modules']
 End of changes. 8 change blocks. 
12 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)