diff --git a/setup.py b/setup.py index a3e85e1..01814dc 100755 --- a/setup.py +++ b/setup.py @@ -39,7 +39,7 @@ setup_kwargs['options'] = {} # metadata # -# Utility function to read the README file. +# Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw # string in below ... @@ -62,7 +62,7 @@ doc_files = ['COPYING.txt', 'README.rst', 'CONTRIBUTORS.rst', 'sample_config.py' def recursive_data_files(src, dest=None): if dest is None: dest = src - + ret = [] for dirpath, dirnames, filenames in os.walk(src): current_dest = os.path.relpath(dirpath, src) @@ -70,9 +70,9 @@ def recursive_data_files(src, dest=None): current_dest = dest else: current_dest = os.path.join(dest, current_dest) - + current_sources = map(lambda p: os.path.join(dirpath, p), filenames) - + ret.append((current_dest, current_sources)) return ret @@ -84,7 +84,7 @@ def recursive_package_data(src, package_dir='overviewer_core'): current_path = os.path.relpath(dirpath, package_dir) for filename in filenames: ret.append(os.path.join(current_path, filename)) - + return ret # @@ -147,7 +147,7 @@ except Exception: pil_include = [ os.path.join(get_python_inc(plat_specific=1), 'Imaging') ] if not os.path.exists(pil_include[0]): pil_include = [ ] - + # used to figure out what files to compile # auto-created from files in primitives/, but we need the raw names so @@ -179,28 +179,28 @@ class CustomClean(clean): def run(self): # do the normal cleanup clean.run(self) - + # try to remove '_composite.{so,pyd,...}' extension, # regardless of the current system's extension name convention build_ext = self.get_finalized_command('build_ext') ext_fname = build_ext.get_ext_filename('overviewer_core.c_overviewer') versionpath = os.path.join("overviewer_core", "overviewer_version.py") primspath = os.path.join("overviewer_core", "src", "primitives.h") - + for fname in [ext_fname, primspath]: if os.path.exists(fname): try: log.info("removing '%s'", fname) if not self.dry_run: os.remove(fname) - + except OSError: log.warn("'%s' could not be cleaned -- permission denied", fname) else: log.debug("'%s' does not exist -- can't clean it", fname) - + # now try to purge all *.pyc files for root, dirs, files in os.walk(os.path.join(os.path.dirname(__file__), ".")): for f in files: @@ -227,7 +227,7 @@ def generate_version_py(): def generate_primitives_h(): global primitives prims = [p.lower().replace('-', '_') for p in primitives] - + outstr = "/* this file is auto-generated by setup.py */\n" for p in prims: outstr += "extern RenderPrimitiveInterface primitive_{0};\n".format(p) @@ -236,7 +236,7 @@ def generate_primitives_h(): outstr += " &primitive_{0},\n".format(p) outstr += " NULL\n" outstr += "};\n" - + with open("overviewer_core/src/primitives.h", "w") as f: f.write(outstr) @@ -268,7 +268,9 @@ class CustomBuildExt(build_ext): e.extra_compile_args.append("-Wno-unused-variable") # quell some annoying warnings e.extra_compile_args.append("-Wno-unused-function") # quell some annoying warnings e.extra_compile_args.append("-Wdeclaration-after-statement") - e.extra_compile_args.append("-Werror=declaration-after-statement") + p = platform.linux_distribution() + if not (p[0] == 'CentOS' and p[1][0] == '5'): + e.extra_compile_args.append("-Werror=declaration-after-statement") # build in place, and in the build/ tree @@ -276,7 +278,7 @@ class CustomBuildExt(build_ext): build_ext.build_extensions(self) self.inplace = True build_ext.build_extensions(self) - + setup_kwargs['cmdclass']['clean'] = CustomClean setup_kwargs['cmdclass']['sdist'] = CustomSDist