Merge pull request #5625 from keymanapp/chore/linux/cherry/sentry

chore(linux): Fix uploading to Sentry 🍒
This commit is contained in:
Eberhard Beilharz 2021-08-25 15:06:11 +02:00 committed by GitHub
commit b353b65eb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 7 deletions

View file

@ -11,7 +11,7 @@ export PYBUILD_INSTALL_ARGS=--install-scripts=/usr/share/keyman-config/
override_dh_auto_build:
make man
sed -i -e "s/^__pkgversion__ = \"\"/__pkgversion__ = \"$(DEB_VERSION)\"/g" keyman_config/version.py
sed -i -e "s/^__pkgversion__ = \"[^\"]*\"/__pkgversion__ = \"$(DEB_VERSION)\"/g" keyman_config/version.py && \
make compile-po
dh_auto_build $@

View file

@ -13,6 +13,7 @@ from .version import __releaseversion__
from .version import __tier__
from .version import __pkgversion__
from .version import __environment__
from .version import __uploadsentry__
def _(txt):
@ -39,9 +40,11 @@ else:
KeymanDownloadsUrl = 'https://downloads.keyman.com'
if 'unittest' in sys.modules.keys():
print('Not reporting to Sentry')
print('Not reporting to Sentry', file=sys.stderr)
elif os.environ.get('KEYMAN_NOSENTRY'):
print('Not reporting to Sentry because KEYMAN_NOSENTRY environment variable set')
print('Not reporting to Sentry because KEYMAN_NOSENTRY environment variable set', file=sys.stderr)
elif not __uploadsentry__:
print('Not reporting to Sentry because UPLOAD_SENTRY is false (%s)' % __environment__, file=sys.stderr)
else:
try:
# Try new sentry-sdk first
@ -51,8 +54,8 @@ else:
HaveSentryNewSdk = True
sentry_logging = LoggingIntegration(
level=logging.INFO, # Capture info and above as breadcrumbs
event_level=logging.CRITICAL # Send critical errors as events
level=logging.INFO, # Capture info and above as breadcrumbs
event_level=logging.CRITICAL # Send critical errors as events
)
SentryUrl = "https://1d0edbf2d0dc411b87119b6e92e2c357@sentry.keyman.com/12"
sentry_sdk.init(
@ -87,4 +90,4 @@ else:
})
except ImportError:
# even raven is not available. This is the case on Ubuntu 16.04. Just ignore.
print(_('Neither sentry-sdk nor raven is available. Not enabling Sentry error reporting.'))
print(_('Neither sentry-sdk nor raven is available. Not enabling Sentry error reporting.'), file=sys.stderr)

View file

@ -9,5 +9,6 @@ __versionwithtag__ = "_VERSIONWITHTAG_"
__majorversion__ = "_MAJORVERSION_"
__releaseversion__ = "_RELEASEVERSION_"
__tier__ = "_TIER_"
__pkgversion__ = ""
__pkgversion__ = "(local)"
__environment__ = "_ENVIRONMENT_"
__uploadsentry__ = "_UPLOADSENTRY_"

View file

@ -67,6 +67,7 @@ for proj in ${extra_projects}; do
-e "s/_RELEASEVERSION_/${VERSION_RELEASE}/g" \
-e "s/_TIER_/${TIER}/g" \
-e "s/_ENVIRONMENT_/${VERSION_ENVIRONMENT}/g" \
-e "s/_UPLOADSENTRY_/${UPLOAD_SENTRY}/g" \
version.py.in > version.py
cd ../buildtools && python3 ./build-langtags.py