pyln: Derive version from git for pyln-client

This commit is contained in:
Christian Decker 2021-09-22 15:56:12 +02:00
parent c8a360b81a
commit fe9949ce0b
4 changed files with 12 additions and 9 deletions

View File

@ -22,7 +22,7 @@ export FUZZING=${FUZZING:-0}
env
pip3 install --user -U -r requirements.txt
pip3 install --user -U -r requirements.txt --use-feature=in-tree-build
# Install utilities that aren't dependencies, but make
# running tests easier/feasible on CI (and pytest which

1
contrib/pyln-client/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
pyln/client/__version__.py

View File

@ -1,8 +1,7 @@
from .lightning import LightningRpc, RpcError, Millisatoshi
from .plugin import Plugin, monkey_patch, RpcException
from .gossmap import Gossmap, GossmapNode, GossmapChannel, GossmapNodeId
__version__ = "0.10.1"
from .__version__ import __version__
__all__ = [

View File

@ -8,14 +8,8 @@ with io.open('README.md', encoding='utf-8') as f:
with io.open('requirements.txt', encoding='utf-8') as f:
requirements = [r for r in f.read().split('\n') if len(r)]
# setup shouldn't try to load module, so we hack-parse __init__.py
with io.open('pyln/client/__init__.py', encoding='utf-8') as f:
for line in f.read().split('\n'):
if line.startswith('__version__ = "'):
version = line.split('"')[1]
setup(name='pyln-client',
version=version,
description='Client library for lightningd',
long_description=long_description,
long_description_content_type='text/markdown',
@ -26,4 +20,13 @@ setup(name='pyln-client',
packages=['pyln.client'],
scripts=[],
zip_safe=True,
use_scm_version={
"root": "../..",
"relative_to": __file__,
"write_to": "contrib/pyln-client/pyln/client/__version__.py",
"write_to_template": "__version__ = \"{version}\"\n",
"version_scheme": "post-release",
"local_scheme": "no-local-version",
},
setup_requires=["setuptools_scm"],
install_requires=requirements)