mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
pyln: Migrate pyln-bolt7 to PEP517 (poetry)
This commit is contained in:
committed by
Rusty Russell
parent
74fd685219
commit
b0f8a99310
1
contrib/pyln-spec/bolt7/.gitignore
vendored
Normal file
1
contrib/pyln-spec/bolt7/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
poetry.lock
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../../subinit.py
|
|
||||||
25
contrib/pyln-spec/bolt7/pyln/spec/bolt7/__init__.py
Normal file
25
contrib/pyln-spec/bolt7/pyln/spec/bolt7/__init__.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# This is the same __init__.py for all bolt dirs.
|
||||||
|
from .csv import csv
|
||||||
|
from .text import text, desc
|
||||||
|
from .gen_csv_version import __csv_version__
|
||||||
|
from .gen_version import __base_version__, __post_version__, __gitversion__
|
||||||
|
from .bolt import namespace
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# eg. 1.0.1.137.
|
||||||
|
__version__ = '{}.{}.{}'.format(__base_version__, __csv_version__, __post_version__)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
'csv',
|
||||||
|
'text',
|
||||||
|
'desc',
|
||||||
|
'namespace',
|
||||||
|
'__version__',
|
||||||
|
'__gitversion__',
|
||||||
|
]
|
||||||
|
|
||||||
|
mod = sys.modules[__name__]
|
||||||
|
for d in namespace.subtypes, namespace.tlvtypes, namespace.messagetypes:
|
||||||
|
for name in d:
|
||||||
|
setattr(mod, name, d[name])
|
||||||
|
__all__.append(name)
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../../bolt.py
|
|
||||||
5
contrib/pyln-spec/bolt7/pyln/spec/bolt7/bolt.py
Normal file
5
contrib/pyln-spec/bolt7/pyln/spec/bolt7/bolt.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
from pyln.proto.message import MessageNamespace
|
||||||
|
from .csv import csv
|
||||||
|
|
||||||
|
|
||||||
|
namespace = MessageNamespace(csv_lines=csv)
|
||||||
20
contrib/pyln-spec/bolt7/pyproject.toml
Normal file
20
contrib/pyln-spec/bolt7/pyproject.toml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
[tool.poetry]
|
||||||
|
name = "pyln-bolt7"
|
||||||
|
version = "1.0.186"
|
||||||
|
description = "BOLT7"
|
||||||
|
authors = ["Rusty Russell"]
|
||||||
|
license = "BSD-MIT"
|
||||||
|
|
||||||
|
packages = [
|
||||||
|
{ include = "pyln/spec/bolt7" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.poetry.dependencies]
|
||||||
|
python = "^3.7"
|
||||||
|
pyln-proto = { path = "../../pyln-proto" }
|
||||||
|
|
||||||
|
[tool.poetry.dev-dependencies]
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["poetry-core>=1.0.0"]
|
||||||
|
build-backend = "poetry.core.masonry.api"
|
||||||
@@ -1 +0,0 @@
|
|||||||
pyln-proto
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
from setuptools import setup
|
|
||||||
import io
|
|
||||||
import os
|
|
||||||
|
|
||||||
base = os.path.dirname(__file__)
|
|
||||||
with io.open(os.path.join(base, 'requirements.txt'), encoding='utf-8') as f:
|
|
||||||
requirements = [r for r in f.read().split('\n') if len(r)]
|
|
||||||
|
|
||||||
|
|
||||||
def bolt_meta(bolt_num):
|
|
||||||
ctx = {}
|
|
||||||
pkg_dir = os.path.join(base, 'pyln', 'spec', 'bolt{}'.format(bolt_num))
|
|
||||||
|
|
||||||
files = ['gen_version.py', 'gen_csv_version.py', 'text.py']
|
|
||||||
|
|
||||||
for f in files:
|
|
||||||
f = os.path.join(pkg_dir, f)
|
|
||||||
with open(f, 'r') as fd:
|
|
||||||
exec(fd.read(), ctx)
|
|
||||||
|
|
||||||
__version__ = '{__base_version__}.{__csv_version__}.{__post_version__}'.format(**ctx)
|
|
||||||
return {
|
|
||||||
'description': ctx['desc'],
|
|
||||||
'version': __version__,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def bolt_num():
|
|
||||||
"""Look into the pyln/spec/ directory to see which subpackages we provide.
|
|
||||||
"""
|
|
||||||
dirlist = os.listdir(os.path.join('pyln', 'spec'))
|
|
||||||
assert(len(dirlist) == 1) # Should only be the boltX directory
|
|
||||||
b = dirlist[0]
|
|
||||||
assert(b[:4] == 'bolt')
|
|
||||||
return int(b[4])
|
|
||||||
|
|
||||||
|
|
||||||
boltnum = bolt_num()
|
|
||||||
meta = bolt_meta(boltnum)
|
|
||||||
|
|
||||||
setup(
|
|
||||||
**meta,
|
|
||||||
name='pyln-bolt{}'.format(boltnum),
|
|
||||||
url='http://github.com/ElementsProject/lightning',
|
|
||||||
author='Rusty Russell',
|
|
||||||
author_email='rusty@rustcorp.com.au',
|
|
||||||
license='MIT',
|
|
||||||
packages=['pyln.spec.bolt{}'.format(boltnum)],
|
|
||||||
package_data={'pyln.proto.message': ['py.typed']},
|
|
||||||
scripts=[],
|
|
||||||
zip_safe=True,
|
|
||||||
install_requires=requirements
|
|
||||||
)
|
|
||||||
Reference in New Issue
Block a user