SUPPORT_LEGACY = False SYSTEM_ZSTD = False if '--legacy' in sys.argv: SUPPORT_LEGACY = True sys.argv.remove('--legacy') if '--system-zstd' in sys.argv: SYSTEM_ZSTD = True sys.argv.remove('--system-zstd') # Code for obtaining the Extension instance is in its own module to # facilitate reuse in other projects. extensions = [ setup_zstd.get_c_extension(name='zstd', support_legacy=SUPPORT_LEGACY, system_zstd=SYSTEM_ZSTD), ] install_requires = [] if cffi: import make_cffi extensions.append(make_cffi.ffi.distutils_extension()) # Need change in 1.8 for ffi.from_buffer() behavior. install_requires.append('cffi>=1.8') version = None with open('c-ext/python-zstandard.h', 'r') as fh:
'mercurial/cext/revlog.c' ], include_dirs=common_include_dirs, depends=common_depends), Extension('mercurial.cext.osutil', ['mercurial/cext/osutil.c'], include_dirs=common_include_dirs, extra_compile_args=osutil_cflags, extra_link_args=osutil_ldflags, depends=common_depends), Extension('hgext.fsmonitor.pywatchman.bser', ['hgext/fsmonitor/pywatchman/bser.c']), ] sys.path.insert(0, 'contrib/python-zstandard') import setup_zstd extmodules.append(setup_zstd.get_c_extension(name='mercurial.zstd')) 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): 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
try: import cffi except ImportError: cffi = None import setup_zstd SUPPORT_LEGACY = False if "--legacy" in sys.argv: SUPPORT_LEGACY = True sys.argv.remove("--legacy") # Code for obtaining the Extension instance is in its own module to # facilitate reuse in other projects. extensions = [setup_zstd.get_c_extension(SUPPORT_LEGACY, 'zstd')] install_requires = [] if cffi: import make_cffi extensions.append(make_cffi.ffi.distutils_extension()) # Need change in 1.8 for ffi.from_buffer() behavior. install_requires.append('cffi>=1.8') version = None with open('c-ext/python-zstandard.h', 'r') as fh: for line in fh: if not line.startswith('#define PYTHON_ZSTANDARD_VERSION'):
SUPPORT_LEGACY = True sys.argv.remove('--legacy') if '--system-zstd' in sys.argv: SYSTEM_ZSTD = True sys.argv.remove('--system-zstd') if '--warnings-as-errors' in sys.argv: WARNINGS_AS_ERRORS = True sys.argv.remove('--warning-as-errors') # Code for obtaining the Extension instance is in its own module to # facilitate reuse in other projects. extensions = [ setup_zstd.get_c_extension(name='zstd', support_legacy=SUPPORT_LEGACY, system_zstd=SYSTEM_ZSTD, warnings_as_errors=WARNINGS_AS_ERRORS), ] install_requires = [] if cffi: import make_cffi extensions.append(make_cffi.ffi.distutils_extension()) # Need change in 1.10 for ffi.from_buffer() to handle all buffer types # (like memoryview). # Need feature in 1.11 for ffi.gc() to declare size of objects so we avoid # garbage collection pitfalls. install_requires.append('cffi>=1.11')
extra_compile_args=osutil_cflags, extra_link_args=osutil_ldflags, depends=common_depends), Extension( 'mercurial.thirdparty.zope.interface._zope_interface_coptimizations', [ 'mercurial/thirdparty/zope/interface/_zope_interface_coptimizations.c', ]), Extension('hgext.fsmonitor.pywatchman.bser', ['hgext/fsmonitor/pywatchman/bser.c']), ] sys.path.insert(0, 'contrib/python-zstandard') import setup_zstd extmodules.append( setup_zstd.get_c_extension(name='mercurial.zstd', root=os.path.abspath( os.path.dirname(__file__)))) try: from distutils import cygwinccompiler # the -mno-cygwin option has been deprecated for years mingw32compilerclass = cygwinccompiler.Mingw32CCompiler class HackedMingw32CCompiler(cygwinccompiler.Mingw32CCompiler): def __init__(self, *args, **kwargs): mingw32compilerclass.__init__(self, *args, **kwargs) for i in 'compiler compiler_so linker_exe linker_so'.split(): try: getattr(self, i).remove('-mno-cygwin') except ValueError: