Rename project
This commit is contained in:
parent
49da8a2602
commit
e780024140
8 changed files with 24 additions and 20 deletions
39
transip_client/__init__.py
Normal file
39
transip_client/__init__.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import os
|
||||
import subprocess
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
|
||||
env_path = Path("..") / ".env"
|
||||
|
||||
load_dotenv(dotenv_path=env_path)
|
||||
|
||||
|
||||
def get_current_version():
|
||||
if "VERSION" in os.environ:
|
||||
return os.environ["VERSION"]
|
||||
|
||||
try:
|
||||
output = subprocess.check_output(
|
||||
["git", "describe", "--tags"], universal_newlines=True
|
||||
)
|
||||
return output.strip()
|
||||
except (subprocess.CalledProcessError, OSError):
|
||||
return ""
|
||||
|
||||
|
||||
VERSION = get_current_version()
|
||||
|
||||
# Optionally use sentry integration
|
||||
try:
|
||||
from sentry_sdk import init as sentry_init
|
||||
|
||||
sentry_init(
|
||||
dsn=os.environ.get("SENTRY_DSN"),
|
||||
send_default_pii=False,
|
||||
release=VERSION,
|
||||
)
|
||||
except ImportError:
|
||||
pass
|
||||
Loading…
Add table
Add a link
Reference in a new issue