diff --git a/src/sentry/utils/distutils/commands/base.py b/src/sentry/utils/distutils/commands/base.py index 40ef636d51ad..4c9da2fd6be7 100644 --- a/src/sentry/utils/distutils/commands/base.py +++ b/src/sentry/utils/distutils/commands/base.py @@ -9,6 +9,14 @@ from subprocess import check_output from distutils.core import Command +import sentry # We just need its path via __file__ + + +SENTRY_ROOT_PATH = os.path.abspath(os.path.join(sentry.__file__, '..', '..', '..')) + + +YARN_PATH = os.path.join(SENTRY_ROOT_PATH, 'bin', 'yarn') + class BaseBuildCommand(Command): user_options = [ @@ -132,8 +140,8 @@ def _setup_js_deps(self): if node_version[2] is not None: log.info(u'using node ({0}))'.format(node_version)) - self._run_command( - ['./bin/yarn', 'install', '--production', '--pure-lockfile', '--quiet'] + self._run_yarn_command( + ['install', '--production', '--pure-lockfile', '--quiet'] ) def _run_command(self, cmd, env=None): @@ -144,6 +152,12 @@ def _run_command(self, cmd, env=None): log.error('command failed [%s] via [%s]' % (' '.join(cmd), self.work_path, )) raise + def _run_yarn_command(self, cmd, env=None): + log.debug(u'yarn path: ({0}))'.format(YARN_PATH)) + self._run_command( + [YARN_PATH] + cmd, env=env + ) + def update_manifests(self): # if we were invoked from sdist, we need to inform sdist about # which files we just generated. Otherwise they will be missing diff --git a/src/sentry/utils/distutils/commands/build_assets.py b/src/sentry/utils/distutils/commands/build_assets.py index bc796357c523..896063259c72 100644 --- a/src/sentry/utils/distutils/commands/build_assets.py +++ b/src/sentry/utils/distutils/commands/build_assets.py @@ -135,7 +135,7 @@ def _build_static(self): env = dict(os.environ) env['SENTRY_STATIC_DIST_PATH'] = self.sentry_static_dist_path env['NODE_ENV'] = 'production' - self._run_command(['./bin/yarn', 'webpack', '--bail'], env=env) + self._run_yarn_command(['webpack', '--bail'], env=env) def _write_version_file(self, version_info): manifest = {