From 0def04a19ff7a92dfc7a9513da8c6635a36c6ad6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl>
Date: Sun, 15 Mar 2020 23:23:53 +0100
Subject: [PATCH] bugfix wherein directory that would be named the same would
 be replaced out of the path

---
 cython_multibuild/__init__.py   | 2 +-
 cython_multibuild/multibuild.py | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/cython_multibuild/__init__.py b/cython_multibuild/__init__.py
index 1b207f7..17ada25 100644
--- a/cython_multibuild/__init__.py
+++ b/cython_multibuild/__init__.py
@@ -1,4 +1,4 @@
 from .build import build
 from .multibuild import Multibuild
 
-__version__ = '0.3'
+__version__ = '0.4'
diff --git a/cython_multibuild/multibuild.py b/cython_multibuild/multibuild.py
index e41ba7d..ab0c0fd 100644
--- a/cython_multibuild/multibuild.py
+++ b/cython_multibuild/multibuild.py
@@ -62,7 +62,8 @@ cdef extern from "Python.h":
 """]
         for filename in self.files:
             path, name = os.path.split(filename)
-            path = path.replace(self.bootstrap_directory, '')
+            if path.startswith(self.bootstrap_directory):
+                path = path[len(self.bootstrap_directory):]
             module_name = name.replace('.pyx', '')
             if path:
                 h_path_name = os.path.join(path[1:], name.replace('.pyx', '.h')).replace('\\', '\\\\')
@@ -71,8 +72,6 @@ cdef extern from "Python.h":
             bootstrap_contents.append('cdef extern from "%s":\n' % (h_path_name, ))
             bootstrap_contents.append('    object PyInit_%s()\n\n' % (module_name, ))
 
-            module_py_name = '.'.join([self.extension_name] + h_path_name.split(os.path.sep))
-
             if path:
                 complete_module_name = self.extension_name+'.'+'.'.join(path[1:].split(os.path.sep))+'.'+module_name
             else:
-- 
GitLab