|
1 | 1 | import logging
|
2 | 2 | import os
|
3 | 3 | import shutil
|
| 4 | +import sys |
4 | 5 | import tempfile
|
5 | 6 | from contextlib import contextmanager
|
6 | 7 |
|
| 8 | +import wurlitzer |
| 9 | + |
7 | 10 | from conda_forge_tick.os_utils import chmod_plus_rwX, sync_dirs
|
8 | 11 | from conda_forge_tick.utils import CB_CONFIG, run_container_task
|
9 | 12 |
|
@@ -97,23 +100,37 @@ def provide_source_code_local(recipe_dir):
|
97 | 100 | str
|
98 | 101 | The path to the source code directory.
|
99 | 102 | """
|
100 |
| - try: |
101 |
| - from conda_build.api import render |
102 |
| - from conda_build.config import Config |
103 |
| - from conda_build.source import provide |
104 |
| - |
105 |
| - # Use conda build to do all the downloading/extracting bits |
106 |
| - md = render( |
107 |
| - recipe_dir, |
108 |
| - config=Config(**CB_CONFIG), |
109 |
| - finalize=False, |
110 |
| - bypass_env_check=True, |
111 |
| - ) |
112 |
| - if not md: |
113 |
| - return None |
114 |
| - md = md[0][0] |
| 103 | + out = None |
| 104 | + err = None |
115 | 105 |
|
116 |
| - # provide source dir |
117 |
| - yield provide(md) |
| 106 | + try: |
| 107 | + with wurlitzer.pipes() as (out, err): |
| 108 | + from conda_build.api import render |
| 109 | + from conda_build.config import Config |
| 110 | + from conda_build.source import provide |
| 111 | + |
| 112 | + # Use conda build to do all the downloading/extracting bits |
| 113 | + md = render( |
| 114 | + recipe_dir, |
| 115 | + config=Config(**CB_CONFIG), |
| 116 | + finalize=False, |
| 117 | + bypass_env_check=True, |
| 118 | + ) |
| 119 | + if not md: |
| 120 | + return None |
| 121 | + md = md[0][0] |
| 122 | + |
| 123 | + # provide source dir |
| 124 | + yield provide(md) |
118 | 125 | except (SystemExit, Exception) as e:
|
119 |
| - raise RuntimeError("conda build src exception:" + str(e)) |
| 126 | + if out: |
| 127 | + sys.stdout.write(out.getvalue()) |
| 128 | + if err: |
| 129 | + sys.stderr.write(err.getvalue()) |
| 130 | + |
| 131 | + raise RuntimeError("conda build src exception: " + str(e)) |
| 132 | + |
| 133 | + if out: |
| 134 | + sys.stdout.write(out.getvalue()) |
| 135 | + if err: |
| 136 | + sys.stderr.write(err.getvalue()) |
0 commit comments