pyln: Derive version from git for pyln-proto

This commit is contained in:
Christian Decker 2021-09-23 14:48:07 +02:00
parent 5efa7659f9
commit 478c43cd9c
2 changed files with 11 additions and 12 deletions

View file

@ -3,8 +3,7 @@ from .primitives import ShortChannelId, PublicKey
from .invoice import Invoice
from .onion import OnionPayload, TlvPayload, LegacyOnionPayload
from .wire import LightningConnection, LightningServerSocket
__version__ = '0.10.1'
from .__version__ import __version__
__all__ = [
"Invoice",
@ -16,4 +15,5 @@ __all__ = [
"bech32_decode",
"ShortChannelId",
"PublicKey",
"__version__",
]

View file

@ -19,17 +19,7 @@ def read(rel_path):
return fp.read()
def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith('__version__'):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")
setup(name='pyln-proto',
version=get_version("pyln/proto/__init__.py"),
description='Pure python implementation of the Lightning Network protocol',
long_description=long_description,
long_description_content_type='text/markdown',
@ -41,4 +31,13 @@ setup(name='pyln-proto',
package_data={'pyln.proto.message': ['py.typed']},
scripts=[],
zip_safe=True,
use_scm_version={
"root": "../..",
"relative_to": __file__,
"write_to": "contrib/pyln-proto/pyln/proto/__version__.py",
"write_to_template": "__version__ = \"{version}\"\n",
"version_scheme": "post-release",
"local_scheme": "no-local-version",
},
setup_requires=["setuptools_scm"],
install_requires=requirements)