contrib/python-zstandard/setup.py
changeset 30822 b54a2984cdd4
parent 30435 b86a448a2965
child 30895 c32454d69b85
equal deleted inserted replaced
30821:7005c03f7387 30822:b54a2984cdd4
     3 # All rights reserved.
     3 # All rights reserved.
     4 #
     4 #
     5 # This software may be modified and distributed under the terms
     5 # This software may be modified and distributed under the terms
     6 # of the BSD license. See the LICENSE file for details.
     6 # of the BSD license. See the LICENSE file for details.
     7 
     7 
       
     8 import sys
     8 from setuptools import setup
     9 from setuptools import setup
     9 
    10 
    10 try:
    11 try:
    11     import cffi
    12     import cffi
    12 except ImportError:
    13 except ImportError:
    13     cffi = None
    14     cffi = None
    14 
    15 
    15 import setup_zstd
    16 import setup_zstd
    16 
    17 
       
    18 SUPPORT_LEGACY = False
       
    19 
       
    20 if "--legacy" in sys.argv:
       
    21     SUPPORT_LEGACY = True
       
    22     sys.argv.remove("--legacy")
       
    23 
    17 # Code for obtaining the Extension instance is in its own module to
    24 # Code for obtaining the Extension instance is in its own module to
    18 # facilitate reuse in other projects.
    25 # facilitate reuse in other projects.
    19 extensions = [setup_zstd.get_c_extension()]
    26 extensions = [setup_zstd.get_c_extension(SUPPORT_LEGACY, 'zstd')]
    20 
    27 
    21 if cffi:
    28 if cffi:
    22     import make_cffi
    29     import make_cffi
    23     extensions.append(make_cffi.ffi.distutils_extension())
    30     extensions.append(make_cffi.ffi.distutils_extension())
    24 
    31