mirror of
https://github.com/sezanzeb/input-remapper
synced 2024-11-04 12:00:16 +00:00
logging the commit hash
This commit is contained in:
parent
f94f878649
commit
bbe4217aad
@ -34,6 +34,8 @@ start = time.time()
|
||||
|
||||
previous_key_spam = None
|
||||
|
||||
COMMIT_HASH = ''
|
||||
|
||||
|
||||
def spam(self, message, *args, **kwargs):
|
||||
"""Log a more-verbose message than debug."""
|
||||
@ -149,7 +151,7 @@ def log_info():
|
||||
try:
|
||||
name = pkg_resources.require('key-mapper')[0].project_name
|
||||
version = pkg_resources.require('key-mapper')[0].version
|
||||
logger.info('%s %s', name, version)
|
||||
logger.info('%s %s %s', name, version, COMMIT_HASH)
|
||||
|
||||
evdev_version = pkg_resources.require('evdev')[0].version
|
||||
logger.info('python-evdev %s', evdev_version)
|
||||
|
24
setup.py
24
setup.py
@ -20,7 +20,28 @@
|
||||
|
||||
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
from setuptools import setup
|
||||
from setuptools.command.install import install
|
||||
|
||||
|
||||
class Install(install):
|
||||
"""Add the current commit hash to logger.py."""
|
||||
def run(self):
|
||||
commit = os.popen('git rev-parse HEAD').read().replace('\n', '')
|
||||
if re.match(r'^([a-z]|[0-9])+$', commit):
|
||||
with open('keymapper/logger.py', 'r') as f:
|
||||
contents = f.read()
|
||||
contents = contents.replace(
|
||||
"COMMIT_HASH = ''",
|
||||
f"COMMIT_HASH = '{commit}'"
|
||||
)
|
||||
|
||||
with open('keymapper/logger.py', 'w') as f:
|
||||
f.write(contents)
|
||||
|
||||
install.run(self)
|
||||
|
||||
|
||||
setup(
|
||||
@ -54,4 +75,7 @@ setup(
|
||||
'evdev',
|
||||
'pydbus'
|
||||
],
|
||||
cmdclass={
|
||||
'install': Install,
|
||||
},
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user