Skip to content

Commit

Permalink
Only build extensions against known good releases
Browse files Browse the repository at this point in the history
  • Loading branch information
mjschultz committed Apr 19, 2014
1 parent f12c68b commit 7359052
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Or with the standard Python distutils incantation: ::
python setup.py build
python setup.py install

The C extension will be built for supported python versions. If you do not
want the C extension, set the environment variable ``RADIX_NO_EXT=1``.

Tests are in the ``tests/`` directory and can be run with
``python setup.py test``.

Expand Down
17 changes: 14 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@

import codecs
import re
import sys
import os

from setuptools import setup, find_packages, Extension
from os.path import abspath, dirname, join

here = abspath(dirname(__file__))

# determine the python version
IS_PYPY = hasattr(sys, 'pypy_version_info')
IS_PY3K = (sys.version_info.major == 3)
RADIX_NO_EXT = os.environ.get('RADIX_NO_EXT', False)


# Read the version number from a source file.
def find_version(*file_paths):
Expand All @@ -28,8 +35,12 @@ def find_version(*file_paths):
with codecs.open(join(here, 'README.rst'), encoding='utf-8') as f:
README = f.read()

sources = ['radix/_radix.c', 'radix/_radix/radix.c']
radix = Extension('radix._radix', sources=sources)
# introduce some extra setup_args if Python 2.x
extra_kwargs = {}
if not IS_PYPY and not IS_PY3K and not RADIX_NO_EXT:
sources = ['radix/_radix.c', 'radix/_radix/radix.c']
radix = Extension('radix._radix', sources=sources)
extra_kwargs['ext_modules'] = [radix]


setup(
Expand All @@ -53,6 +64,6 @@ def find_version(*file_paths):
],
setup_requires=['nose', 'coverage'],
packages=find_packages(exclude=['tests', 'tests.*']),
ext_modules=[radix],
test_suite='nose.collector',
**extra_kwargs
)

0 comments on commit 7359052

Please sign in to comment.