Build script
This commit is contained in:
parent
3db5e10882
commit
d09e1f8757
4 changed files with 61 additions and 3 deletions
|
@ -10,22 +10,24 @@ import logging.handlers
|
|||
import stat
|
||||
import time
|
||||
|
||||
VERSION = "0.7.10+"
|
||||
|
||||
class Config:
|
||||
|
||||
def __init__(self, argv):
|
||||
try:
|
||||
from . import Build
|
||||
except ImportError:
|
||||
print('cannot find build')
|
||||
from .util import Git
|
||||
self.build_type = 'source'
|
||||
self.branch = Git.branch() or 'unknown'
|
||||
self.commit = Git.commit() or 'unknown'
|
||||
self.version = VERSION
|
||||
else:
|
||||
self.build_type = Build.build_type
|
||||
self.branch = Build.branch
|
||||
self.commit = Build.commit
|
||||
self.version = "0.7.10+"
|
||||
self.version = Build.version or VERSION
|
||||
self.version_full = f'{self.version} ({self.build_type} from {self.branch}-{self.commit})'
|
||||
self.user_agent = "conservancy"
|
||||
# for compatibility
|
||||
|
|
|
@ -48,7 +48,7 @@ def _gitted(f):
|
|||
return lambda *args, **kwargs: None
|
||||
|
||||
@_gitted
|
||||
def commit() -> str:
|
||||
def commit() -> Optional[str]:
|
||||
"""Returns git revision, possibly suffixed with -dirty"""
|
||||
dirty = '-dirty' if _repo.is_dirty() else ''
|
||||
return f'{_repo.head.commit}{dirty}'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue