Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cython support with pure python fallback, pypy tests

  • Loading branch information...
commit 1d6918d0ca97619f67a67e18da50e6b35d6d9877 1 parent 618988f
James Casbon authored
View
4 .gitignore
@@ -7,4 +7,6 @@ docs/_build
1kg.prof
.noseids
.tox
-.DS_Store`
+.DS_Store
+vcf/cparse.c
+vcf/cparse.so
View
1  .travis.yml
@@ -4,6 +4,7 @@ python:
- "2.6"
- "2.7"
- "3.2"
+ - "pypy"
install:
- "if [[ $TRAVIS_PYTHON_VERSION != '2.7' ]]; then pip install --use-mirrors argparse ordereddict; fi"
- "if [[ $TRAVIS_PYTHON_VERSION != '3.2' ]]; then pip install --use-mirrors pysam; fi"
View
14 setup.py
@@ -1,7 +1,12 @@
from setuptools import setup
from distutils.core import setup
from distutils.extension import Extension
-from Cython.Distutils import build_ext
+
+try:
+ from Cython.Distutils import build_ext
+ CYTHON = True
+except:
+ CYTHON = False
requires = []
@@ -31,6 +36,10 @@
if (line.startswith('VERSION')):
exec(line.strip())
+extras = {}
+if CYTHON:
+ extras['cmdclass'] = {'build_ext': build_ext}
+ extras['ext_modules'] = [Extension("vcf.cparse", ["vcf/cparse.pyx"])]
setup(
name='PyVCF',
@@ -70,6 +79,5 @@
package_data = {
'': ['*.vcf', '*.gz', '*.tbi'],
},
- cmdclass = {'build_ext': build_ext},
- ext_modules = [Extension("vcf.cparse", ["vcf/cparse.pyx"])]
+ **extras
)
View
9 tox.ini
@@ -19,11 +19,10 @@ deps =
[testenv:py27]
deps =
- argparse
- ordereddict
pysam
+ cython
[testenv:py32]
-deps =
- argparse
- ordereddict
+deps =
+ cython
+
View
6 vcf/cparse.pyx
@@ -5,9 +5,9 @@ cdef _map(func, iterable, bad='.'):
return [func(x) if x != bad else None
for x in iterable]
-cdef char *INTEGER = 'Integer'
-cdef char *FLOAT = 'Float'
-cdef char *NUMERIC = 'Numeric'
+INTEGER = 'Integer'
+FLOAT = 'Float'
+NUMERIC = 'Numeric'
def parse_samples(
list names, list samples, list samp_fmt,
Please sign in to comment.
Something went wrong with that request. Please try again.