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 .invoice import Invoice
from .onion import OnionPayload, TlvPayload, LegacyOnionPayload from .onion import OnionPayload, TlvPayload, LegacyOnionPayload
from .wire import LightningConnection, LightningServerSocket from .wire import LightningConnection, LightningServerSocket
from .__version__ import __version__
__version__ = '0.10.1'
__all__ = [ __all__ = [
"Invoice", "Invoice",
@@ -16,4 +15,5 @@ __all__ = [
"bech32_decode", "bech32_decode",
"ShortChannelId", "ShortChannelId",
"PublicKey", "PublicKey",
"__version__",
] ]

View File

@@ -19,17 +19,7 @@ def read(rel_path):
return fp.read() 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', setup(name='pyln-proto',
version=get_version("pyln/proto/__init__.py"),
description='Pure python implementation of the Lightning Network protocol', description='Pure python implementation of the Lightning Network protocol',
long_description=long_description, long_description=long_description,
long_description_content_type='text/markdown', long_description_content_type='text/markdown',
@@ -41,4 +31,13 @@ setup(name='pyln-proto',
package_data={'pyln.proto.message': ['py.typed']}, package_data={'pyln.proto.message': ['py.typed']},
scripts=[], scripts=[],
zip_safe=True, 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) install_requires=requirements)