Skip to content

Commit 72329a4

Browse files
committed
BUG redirect right at the source
1 parent 2d642da commit 72329a4

File tree

2 files changed

+36
-26
lines changed

2 files changed

+36
-26
lines changed

conda_forge_tick/provide_source_code.py

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import logging
22
import os
33
import shutil
4+
import sys
45
import tempfile
56
from contextlib import contextmanager
67

8+
import wurlitzer
9+
710
from conda_forge_tick.os_utils import chmod_plus_rwX, sync_dirs
811
from conda_forge_tick.utils import CB_CONFIG, run_container_task
912

@@ -97,23 +100,37 @@ def provide_source_code_local(recipe_dir):
97100
str
98101
The path to the source code directory.
99102
"""
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
115105

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)
118125
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())

docker/run_bot_task.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
from contextlib import contextmanager, redirect_stdout
2626

2727
import click
28-
import wurlitzer
2928

3029
existing_feedstock_node_attrs_option = click.option(
3130
"--existing-feedstock-node-attrs",
@@ -154,19 +153,13 @@ def _provide_source_code():
154153
output_source_code = "/cf_tick_dir/source_dir"
155154
os.makedirs(output_source_code, exist_ok=True)
156155

157-
with (
158-
wurlitzer.pipes(stderr=wurlitzer.STDOUT) as (out, _),
159-
provide_source_code_local(recipe_dir) as cb_work_dir,
160-
):
156+
with provide_source_code_local(recipe_dir) as cb_work_dir:
161157
chmod_plus_rwX(cb_work_dir, recursive=True, skip_on_error=True)
162158
sync_dirs(
163159
cb_work_dir, output_source_code, ignore_dot_git=True, update_git=False
164160
)
165161
chmod_plus_rwX(output_source_code, recursive=True, skip_on_error=True)
166162

167-
# report even if not live
168-
sys.stderr.write(out.read())
169-
170163
return dict()
171164

172165

0 commit comments

Comments
 (0)