diff --git a/.travis.yml b/.travis.yml index 7f1c66d9c5563e398caddba03372f9d007d0bcf2..e9163856c4ed4191ff33d61ab83dd41451e249b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,15 +5,48 @@ python: - "3.7" - "3.8" - "nightly" +jobs: + include: + - stage: test + python: "3.5" + env: + - DEBUG=1 + script: + - cd example + - python setup.py test + - stage: test + python: "3.6" + env: + - DEBUG=1 + script: + - cd example + - python setup.py test + - stage: test + python: "3.7" + env: + - DEBUG=1 + script: + - cd example + - python setup.py test + - stage: test + python: "3.8" + env: + - DEBUG=1 + script: + - cd example + - python setup.py test + - stage: test + python: "nightly" + env: + - DEBUG=1 + script: + - cd example + - python setup.py test cache: pip -script: - - cd example - - python setup.py test install: - pip install -r requirements.txt - python setup.py install after_success: - cd .. - bash build.sh -env: - - DEBUG=true + diff --git a/README.md b/README.md index 60ec4425a4145966650a64994c4fb0e9ce2f1b29..d8ad23f12ba9f7d5042ae6e980e2b7d8efed1a87 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,17 @@ a part of your pull request as well! Note what have you changed in [CHANGELOG.md](/CHANGELOG.md) as well! -Usage ------ +Usage notes +----------- Take a look at [example](example/) on how to multi-build your Cython extensions. Don't place modules compiled that way in root .py file's top level imports. Wrap them in a layer of indirection instead! This applies to unit tests as well! + +When something goes wrong (eg. the application throws an unhandled exception) +the built module has a tendency to dump core. +Try to debug it first by passing `dont_snakehouse=True` to your +modules in the debug mode. + diff --git a/snakehouse/multibuild.py b/snakehouse/multibuild.py index 7a1137a0262e64c5294387acd9d17730371e4e82..5ef09af8ceac62a541852bcc7c93fd95f8f775fb 100644 --- a/snakehouse/multibuild.py +++ b/snakehouse/multibuild.py @@ -56,7 +56,7 @@ class Multibuild: as a separate extension. It is for these cases when you're testing and something segfaults. """ def __init__(self, extension_name: str, files: tp.Iterator[str], - dont_snakehouse: bool = False,**kwargs): + dont_snakehouse: bool = False, **kwargs): # sanitize path separators so that Linux-style paths are supported on Windows files = list(files) self.dont_snakehouse = dont_snakehouse @@ -202,9 +202,11 @@ class Multibuild: def for_cythonize(self, *args, **kwargs): if self.dont_snakehouse: extensions = [] + common_path = os.path.commonpath(self.pyx_files) for pyx_file in self.pyx_files: - ext = Extension(pyx_file.replace(os.pathsep, '.')[:-4], - [pyx_file]) + file_name = pyx_file[len(common_path)+len(os.pathsep):-4] + ext = Extension(file_name.replace(os.pathsep, '.'), + [file_name]) extensions.append(ext) return extensions else: