Skip to content

Commit c32193e

Browse files
authored
fix(yarn): Fix yarn path in distutils (#13647)
1 parent 9916a58 commit c32193e

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/sentry/utils/distutils/commands/base.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
from subprocess import check_output
1010
from distutils.core import Command
1111

12+
import sentry # We just need its path via __file__
13+
14+
15+
SENTRY_ROOT_PATH = os.path.abspath(os.path.join(sentry.__file__, '..', '..', '..'))
16+
17+
18+
YARN_PATH = os.path.join(SENTRY_ROOT_PATH, 'bin', 'yarn')
19+
1220

1321
class BaseBuildCommand(Command):
1422
user_options = [
@@ -132,8 +140,8 @@ def _setup_js_deps(self):
132140

133141
if node_version[2] is not None:
134142
log.info(u'using node ({0}))'.format(node_version))
135-
self._run_command(
136-
['./bin/yarn', 'install', '--production', '--pure-lockfile', '--quiet']
143+
self._run_yarn_command(
144+
['install', '--production', '--pure-lockfile', '--quiet']
137145
)
138146

139147
def _run_command(self, cmd, env=None):
@@ -144,6 +152,12 @@ def _run_command(self, cmd, env=None):
144152
log.error('command failed [%s] via [%s]' % (' '.join(cmd), self.work_path, ))
145153
raise
146154

155+
def _run_yarn_command(self, cmd, env=None):
156+
log.debug(u'yarn path: ({0}))'.format(YARN_PATH))
157+
self._run_command(
158+
[YARN_PATH] + cmd, env=env
159+
)
160+
147161
def update_manifests(self):
148162
# if we were invoked from sdist, we need to inform sdist about
149163
# which files we just generated. Otherwise they will be missing

src/sentry/utils/distutils/commands/build_assets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def _build_static(self):
135135
env = dict(os.environ)
136136
env['SENTRY_STATIC_DIST_PATH'] = self.sentry_static_dist_path
137137
env['NODE_ENV'] = 'production'
138-
self._run_command(['./bin/yarn', 'webpack', '--bail'], env=env)
138+
self._run_yarn_command(['webpack', '--bail'], env=env)
139139

140140
def _write_version_file(self, version_info):
141141
manifest = {

0 commit comments

Comments
 (0)