|
25 | 25 | from ..utils.helpers import normalize_file_permissions
|
26 | 26 | from ..utils.package_include import PackageInclude
|
27 | 27 | from .builder import Builder
|
| 28 | +from .sdist import SdistBuilder |
28 | 29 |
|
29 | 30 |
|
30 | 31 | wheel_file_template = """\
|
@@ -92,39 +93,38 @@ def build(self):
|
92 | 93 |
|
93 | 94 | def _build(self, wheel):
|
94 | 95 | if self._package.build:
|
95 |
| - setup = self._path / "setup.py" |
96 |
| - |
97 |
| - # We need to place ourselves in the temporary |
98 |
| - # directory in order to build the package |
99 |
| - current_path = os.getcwd() |
100 |
| - try: |
101 |
| - os.chdir(str(self._path)) |
102 |
| - self._run_build_command(setup) |
103 |
| - finally: |
104 |
| - os.chdir(current_path) |
105 |
| - |
106 |
| - build_dir = self._path / "build" |
107 |
| - lib = list(build_dir.glob("lib.*")) |
108 |
| - if not lib: |
109 |
| - # The result of building the extensions |
110 |
| - # does not exist, this may due to conditional |
111 |
| - # builds, so we assume that it's okay |
112 |
| - return |
113 |
| - |
114 |
| - lib = lib[0] |
115 |
| - |
116 |
| - for pkg in lib.glob("**/*"): |
117 |
| - if pkg.is_dir() or self.is_excluded(pkg): |
118 |
| - continue |
119 |
| - |
120 |
| - rel_path = str(pkg.relative_to(lib)) |
121 |
| - |
122 |
| - if rel_path in wheel.namelist(): |
123 |
| - continue |
124 |
| - |
125 |
| - logger.debug(" - Adding: {}".format(rel_path)) |
126 |
| - |
127 |
| - self._add_file(wheel, pkg, rel_path) |
| 96 | + with SdistBuilder(poetry=self._poetry).setup_py() as setup: |
| 97 | + # We need to place ourselves in the temporary |
| 98 | + # directory in order to build the package |
| 99 | + current_path = os.getcwd() |
| 100 | + try: |
| 101 | + os.chdir(str(self._path)) |
| 102 | + self._run_build_command(setup) |
| 103 | + finally: |
| 104 | + os.chdir(current_path) |
| 105 | + |
| 106 | + build_dir = self._path / "build" |
| 107 | + lib = list(build_dir.glob("lib.*")) |
| 108 | + if not lib: |
| 109 | + # The result of building the extensions |
| 110 | + # does not exist, this may due to conditional |
| 111 | + # builds, so we assume that it's okay |
| 112 | + return |
| 113 | + |
| 114 | + lib = lib[0] |
| 115 | + |
| 116 | + for pkg in lib.glob("**/*"): |
| 117 | + if pkg.is_dir() or self.is_excluded(pkg): |
| 118 | + continue |
| 119 | + |
| 120 | + rel_path = str(pkg.relative_to(lib)) |
| 121 | + |
| 122 | + if rel_path in wheel.namelist(): |
| 123 | + continue |
| 124 | + |
| 125 | + logger.debug(" - Adding: {}".format(rel_path)) |
| 126 | + |
| 127 | + self._add_file(wheel, pkg, rel_path) |
128 | 128 |
|
129 | 129 | def _run_build_command(self, setup):
|
130 | 130 | subprocess.check_call(
|
|
0 commit comments