Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/sentry/utils/distutils/commands/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
from subprocess import check_output
from distutils.core import Command

import sentry # We just need its path via __file__

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any side effects of importing sentry into the base distutils module like this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not as far as I know. Matt suggested this showing a similar usage in another place.



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 = [
Expand Down Expand Up @@ -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):
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/utils/distutils/commands/build_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down