From 8a9fc6c8520177b695dc7b9cfd3dcb931b7ad5c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl>
Date: Fri, 27 Mar 2020 17:15:21 +0100
Subject: [PATCH] v1.1.2: bugfix release

---
 CHANGELOG.md                                   |  5 +++++
 example/example3/example3/example3/__init__.py |  2 ++
 snakehouse/__init__.py                         |  2 +-
 snakehouse/multibuild.py                       | 12 ++++++++----
 4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f396b2e..3507f4a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+# v1.1.2
+
+* bugfix release: fixed behaviour if there was only
+  a single file in Multibuild
+
 # v1.1.1
 
 * allowed Linux-style paths on Windows build environments
diff --git a/example/example3/example3/example3/__init__.py b/example/example3/example3/example3/__init__.py
index fa84e47..7d924a0 100644
--- a/example/example3/example3/example3/__init__.py
+++ b/example/example3/example3/example3/__init__.py
@@ -1,3 +1,5 @@
+from example3.example3.example3.__bootstrap__ import bootstrap_cython_submodules
+bootstrap_cython_submodules()
 import logging
 import typing as tp
 
diff --git a/snakehouse/__init__.py b/snakehouse/__init__.py
index 982a623..8ee34e4 100644
--- a/snakehouse/__init__.py
+++ b/snakehouse/__init__.py
@@ -1,4 +1,4 @@
 from .build import build
 from .multibuild import Multibuild
 
-__version__ = '1.1.1'
+__version__ = '1.1.2'
diff --git a/snakehouse/multibuild.py b/snakehouse/multibuild.py
index c9d7bb9..52d998e 100644
--- a/snakehouse/multibuild.py
+++ b/snakehouse/multibuild.py
@@ -1,5 +1,6 @@
 import os
 import collections
+import typing as tp
 import pkg_resources
 from satella.files import split
 from mako.template import Template
@@ -21,7 +22,7 @@ class Multibuild:
     """
     This specifies a single Cython extension, called {extension_name}.__bootstrap__
     """
-    def __init__(self, extension_name: str, files):
+    def __init__(self, extension_name: str, files: tp.Iterator[str]):
         """
         :param extension_name: the module name
         :param files: list of pyx and c files
@@ -36,9 +37,12 @@ class Multibuild:
 
         self.pyx_files = [file for file in files if file.endswith('.pyx')]
 
-        self.extension_name = extension_name
-        self.bootstrap_directory = os.path.commonpath(self.files)
-        self.modules = set()    # tp.Set[tp.Tuple[str, str]]
+        self.extension_name = extension_name        # type: str
+        if len(self.files) == 1:
+            self.bootstrap_directory, _ = os.path.split(self.files[0])      # type: str
+        else:
+            self.bootstrap_directory = os.path.commonpath(self.files)       # type: str
+        self.modules = set()    # type: tp.Set[tp.Tuple[str, str]]
 
     def generate_header_files(self):
         for filename in self.pyx_files:
-- 
GitLab