dist: use git describe to get git version information
This commit is contained in:
parent
91b9a3a472
commit
b5b6152e06
|
@ -16,11 +16,15 @@
|
||||||
## with this program; if not, write to the Free Software Foundation, Inc.,
|
## with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
__version_short__ = '1.1.7'
|
import subprocess as _subprocess
|
||||||
NAME = 'Solaar'
|
import sys as _sys
|
||||||
|
|
||||||
|
from solaar.version import NAME as _NAME
|
||||||
|
from solaar.version import version as _version
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import gitinfo
|
__version__ = _subprocess.check_output(['git', 'describe', '--always'], cwd=_sys.path[0],
|
||||||
__version__ = __version_short__ + '-' + gitinfo.get_git_info()['commit'][:8]
|
stderr=_subprocess.DEVNULL).strip().decode()
|
||||||
except Exception:
|
except Exception:
|
||||||
__version__ = __version_short__
|
__version__ = _version
|
||||||
|
NAME = _NAME
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
NAME = 'Solaar'
|
||||||
|
version = '1.1.7-19-gcf26ac6e'
|
19
setup.py
19
setup.py
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from glob import glob as _glob
|
from glob import glob as _glob
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -7,11 +9,16 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
|
||||||
main_ns = {}
|
NAME = 'Solaar'
|
||||||
with open('lib/solaar/__init__.py') as ver_file:
|
version = '1.1.7'
|
||||||
exec(ver_file.read(), main_ns)
|
|
||||||
NAME = main_ns['NAME']
|
try:
|
||||||
__version__ = main_ns['__version_short__']
|
cver = max(version, subprocess.check_output(['git', 'describe', '--always'], stderr=subprocess.DEVNULL).strip().decode())
|
||||||
|
except Exception:
|
||||||
|
cver = version
|
||||||
|
with open('lib/solaar/version.py', 'w') as vfile:
|
||||||
|
vfile.write(f'NAME = \'{NAME}\'\n')
|
||||||
|
vfile.write(f'version = \'{cver}\'\n')
|
||||||
|
|
||||||
|
|
||||||
def _data_files():
|
def _data_files():
|
||||||
|
@ -33,7 +40,7 @@ def _data_files():
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name=NAME.lower(),
|
name=NAME.lower(),
|
||||||
version=__version__,
|
version=version,
|
||||||
description='Linux device manager for Logitech receivers, keyboards, mice, and tablets.',
|
description='Linux device manager for Logitech receivers, keyboards, mice, and tablets.',
|
||||||
long_description='''
|
long_description='''
|
||||||
Solaar is a Linux device manager for many Logitech peripherals that connect through
|
Solaar is a Linux device manager for many Logitech peripherals that connect through
|
||||||
|
|
Loading…
Reference in New Issue