dist: use separate data files for version and commit information
This commit is contained in:
parent
fe65ce936f
commit
8765089d43
|
@ -6,6 +6,7 @@ __pycache__/
|
|||
|
||||
/lib/Solaar.egg-info/
|
||||
/lib/solaar.egg-info/
|
||||
/lib/solaar/commit
|
||||
/build/
|
||||
/sdist/
|
||||
/dist/
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
include COPYRIGHT COPYING README.md ChangeLog.md
|
||||
include COPYRIGHT COPYING README.md ChangeLog.md lib/solaar/version lib/solaar/commit
|
||||
recursive-include rules.d *
|
||||
recursive-include share/locale *
|
||||
|
|
|
@ -7,7 +7,7 @@ candidates (ex. `1.0.0rc1`). Release candidates must have a `rcX` suffix.
|
|||
|
||||
Release routine:
|
||||
|
||||
- Update `lib/solaar/__init__.py` to the new release
|
||||
- Update version in `lib/solaar/version`
|
||||
- Add release changes to `ChangeLog.md`
|
||||
- Add release information to `share/solaar/io.github.pwr_solaar.solaar.metainfo.xml`
|
||||
- Create a commit that starts with `release VERSION`
|
||||
|
|
|
@ -16,15 +16,17 @@
|
|||
## with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
import pkgutil as _pkgutil
|
||||
import subprocess as _subprocess
|
||||
import sys as _sys
|
||||
|
||||
from solaar.version import NAME as _NAME
|
||||
from solaar.version import version as _version
|
||||
NAME = 'solaar'
|
||||
|
||||
try:
|
||||
__version__ = _subprocess.check_output(['git', 'describe', '--always'], cwd=_sys.path[0],
|
||||
stderr=_subprocess.DEVNULL).strip().decode()
|
||||
except Exception:
|
||||
__version__ = _version
|
||||
NAME = _NAME
|
||||
try:
|
||||
__version__ = _pkgutil.get_data('solaar', 'commit').strip().decode()
|
||||
except Exception:
|
||||
__version__ = _pkgutil.get_data('solaar', 'version').strip().decode()
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
1.1.7
|
|
@ -1,2 +0,0 @@
|
|||
NAME = 'Solaar'
|
||||
version = '1.1.7-19-gcf26ac6e'
|
15
setup.py
15
setup.py
|
@ -1,5 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import subprocess
|
||||
|
||||
from glob import glob as _glob
|
||||
|
@ -10,15 +9,16 @@ except ImportError:
|
|||
from distutils.core import setup
|
||||
|
||||
NAME = 'Solaar'
|
||||
version = '1.1.7'
|
||||
|
||||
with open('lib/solaar/version', 'r') as vfile:
|
||||
version = vfile.read().strip()
|
||||
|
||||
try:
|
||||
cver = max(version, subprocess.check_output(['git', 'describe', '--always'], stderr=subprocess.DEVNULL).strip().decode())
|
||||
commit = subprocess.check_output(['git', 'describe', '--always'], stderr=subprocess.DEVNULL).strip().decode()
|
||||
with open('lib/solaar/commit', 'w') as vfile:
|
||||
vfile.write(f'{commit}\n')
|
||||
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')
|
||||
pass
|
||||
|
||||
|
||||
def _data_files():
|
||||
|
@ -84,5 +84,6 @@ For instructions on installing Solaar see https://pwr-solaar.github.io/Solaar/in
|
|||
package_dir={'': 'lib'},
|
||||
packages=['keysyms', 'hidapi', 'logitech_receiver', 'solaar', 'solaar.ui', 'solaar.cli'],
|
||||
data_files=list(_data_files()),
|
||||
include_package_data=True,
|
||||
scripts=_glob('bin/*'),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue