Mercurial > hg
changeset 23677:6bc1702e7333
setup: don't fail when Python doesn't have the cygwinccompiler package
Some Python installations like the ones available from the optware
project
for the Synology DiskStation NASes don't have that package, which means
running the setup script will crash and exit right away. Instead, we now
just use an empty/fake class for the HackedMingw32CCompiler, which we
likely won't use anyway.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 23 Dec 2014 19:54:48 -0800 |
parents | e8b09f920fe6 |
children | 194d2f185008 |
files | setup.py |
diffstat | 1 files changed, 21 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/setup.py Sun Dec 28 23:50:08 2014 +0100 +++ b/setup.py Tue Dec 23 19:54:48 2014 -0800 @@ -76,7 +76,7 @@ from distutils.command.install_lib import install_lib from distutils.command.install_scripts import install_scripts from distutils.spawn import spawn, find_executable -from distutils import cygwinccompiler, file_util +from distutils import file_util from distutils.errors import CCompilerError, DistutilsExecError from distutils.sysconfig import get_python_inc, get_config_var from distutils.version import StrictVersion @@ -509,19 +509,28 @@ extra_link_args=osutil_ldflags, depends=common_depends)) -# the -mno-cygwin option has been deprecated for years -Mingw32CCompiler = cygwinccompiler.Mingw32CCompiler +try: + from distutils import cygwinccompiler + + # the -mno-cygwin option has been deprecated for years + compiler = cygwinccompiler.Mingw32CCompiler -class HackedMingw32CCompiler(cygwinccompiler.Mingw32CCompiler): - def __init__(self, *args, **kwargs): - Mingw32CCompiler.__init__(self, *args, **kwargs) - for i in 'compiler compiler_so linker_exe linker_so'.split(): - try: - getattr(self, i).remove('-mno-cygwin') - except ValueError: - pass + class HackedMingw32CCompiler(cygwinccompiler.Mingw32CCompiler): + def __init__(self, *args, **kwargs): + compiler.__init__(self, *args, **kwargs) + for i in 'compiler compiler_so linker_exe linker_so'.split(): + try: + getattr(self, i).remove('-mno-cygwin') + except ValueError: + pass -cygwinccompiler.Mingw32CCompiler = HackedMingw32CCompiler + cygwinccompiler.Mingw32CCompiler = HackedMingw32CCompiler +except ImportError: + # the cygwinccompiler package is not available on some Python + # distributions like the ones from the optware project for Synology + # DiskStation boxes + class HackedMingw32CCompiler(object): + pass packagedata = {'mercurial': ['locale/*/LC_MESSAGES/hg.mo', 'help/*.txt',