From 8a22cbfce7c8dc3b3bb155529e61c76fcc81c5b0 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 23 Aug 2021 14:20:58 +0200 Subject: [PATCH] pyln: Materialize setup.py and requirements.txt in pyln-spec When downloading a python package from the PyPI repository the links where pointing to a non-existent parent directory, thus breaking the packages. The files don't ever change, and are really simple, so let's just materialize them. --- contrib/pyln-spec/bolt1/requirements.txt | 2 +- contrib/pyln-spec/bolt1/setup.py | 54 +++++++++++++++++++++++- contrib/pyln-spec/bolt2/requirements.txt | 2 +- contrib/pyln-spec/bolt2/setup.py | 54 +++++++++++++++++++++++- contrib/pyln-spec/bolt4/requirements.txt | 2 +- contrib/pyln-spec/bolt4/setup.py | 54 +++++++++++++++++++++++- contrib/pyln-spec/bolt7/requirements.txt | 2 +- contrib/pyln-spec/bolt7/setup.py | 54 +++++++++++++++++++++++- contrib/pyln-spec/requirements.txt | 1 - contrib/pyln-spec/setup.py | 53 ----------------------- 10 files changed, 216 insertions(+), 62 deletions(-) mode change 120000 => 100644 contrib/pyln-spec/bolt1/requirements.txt mode change 120000 => 100644 contrib/pyln-spec/bolt1/setup.py mode change 120000 => 100644 contrib/pyln-spec/bolt2/requirements.txt mode change 120000 => 100644 contrib/pyln-spec/bolt2/setup.py mode change 120000 => 100644 contrib/pyln-spec/bolt4/requirements.txt mode change 120000 => 100644 contrib/pyln-spec/bolt4/setup.py mode change 120000 => 100644 contrib/pyln-spec/bolt7/requirements.txt mode change 120000 => 100644 contrib/pyln-spec/bolt7/setup.py delete mode 100644 contrib/pyln-spec/requirements.txt delete mode 100644 contrib/pyln-spec/setup.py diff --git a/contrib/pyln-spec/bolt1/requirements.txt b/contrib/pyln-spec/bolt1/requirements.txt deleted file mode 120000 index dc833dd4b..000000000 --- a/contrib/pyln-spec/bolt1/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -../requirements.txt \ No newline at end of file diff --git a/contrib/pyln-spec/bolt1/requirements.txt b/contrib/pyln-spec/bolt1/requirements.txt new file mode 100644 index 000000000..a939f32cb --- /dev/null +++ b/contrib/pyln-spec/bolt1/requirements.txt @@ -0,0 +1 @@ +pyln.proto >= 0.9.3 diff --git a/contrib/pyln-spec/bolt1/setup.py b/contrib/pyln-spec/bolt1/setup.py deleted file mode 120000 index f8f80fc25..000000000 --- a/contrib/pyln-spec/bolt1/setup.py +++ /dev/null @@ -1 +0,0 @@ -../setup.py \ No newline at end of file diff --git a/contrib/pyln-spec/bolt1/setup.py b/contrib/pyln-spec/bolt1/setup.py new file mode 100644 index 000000000..c30d18d22 --- /dev/null +++ b/contrib/pyln-spec/bolt1/setup.py @@ -0,0 +1,53 @@ +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 +) diff --git a/contrib/pyln-spec/bolt2/requirements.txt b/contrib/pyln-spec/bolt2/requirements.txt deleted file mode 120000 index dc833dd4b..000000000 --- a/contrib/pyln-spec/bolt2/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -../requirements.txt \ No newline at end of file diff --git a/contrib/pyln-spec/bolt2/requirements.txt b/contrib/pyln-spec/bolt2/requirements.txt new file mode 100644 index 000000000..a939f32cb --- /dev/null +++ b/contrib/pyln-spec/bolt2/requirements.txt @@ -0,0 +1 @@ +pyln.proto >= 0.9.3 diff --git a/contrib/pyln-spec/bolt2/setup.py b/contrib/pyln-spec/bolt2/setup.py deleted file mode 120000 index f8f80fc25..000000000 --- a/contrib/pyln-spec/bolt2/setup.py +++ /dev/null @@ -1 +0,0 @@ -../setup.py \ No newline at end of file diff --git a/contrib/pyln-spec/bolt2/setup.py b/contrib/pyln-spec/bolt2/setup.py new file mode 100644 index 000000000..c30d18d22 --- /dev/null +++ b/contrib/pyln-spec/bolt2/setup.py @@ -0,0 +1,53 @@ +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 +) diff --git a/contrib/pyln-spec/bolt4/requirements.txt b/contrib/pyln-spec/bolt4/requirements.txt deleted file mode 120000 index dc833dd4b..000000000 --- a/contrib/pyln-spec/bolt4/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -../requirements.txt \ No newline at end of file diff --git a/contrib/pyln-spec/bolt4/requirements.txt b/contrib/pyln-spec/bolt4/requirements.txt new file mode 100644 index 000000000..a939f32cb --- /dev/null +++ b/contrib/pyln-spec/bolt4/requirements.txt @@ -0,0 +1 @@ +pyln.proto >= 0.9.3 diff --git a/contrib/pyln-spec/bolt4/setup.py b/contrib/pyln-spec/bolt4/setup.py deleted file mode 120000 index f8f80fc25..000000000 --- a/contrib/pyln-spec/bolt4/setup.py +++ /dev/null @@ -1 +0,0 @@ -../setup.py \ No newline at end of file diff --git a/contrib/pyln-spec/bolt4/setup.py b/contrib/pyln-spec/bolt4/setup.py new file mode 100644 index 000000000..c30d18d22 --- /dev/null +++ b/contrib/pyln-spec/bolt4/setup.py @@ -0,0 +1,53 @@ +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 +) diff --git a/contrib/pyln-spec/bolt7/requirements.txt b/contrib/pyln-spec/bolt7/requirements.txt deleted file mode 120000 index dc833dd4b..000000000 --- a/contrib/pyln-spec/bolt7/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -../requirements.txt \ No newline at end of file diff --git a/contrib/pyln-spec/bolt7/requirements.txt b/contrib/pyln-spec/bolt7/requirements.txt new file mode 100644 index 000000000..a939f32cb --- /dev/null +++ b/contrib/pyln-spec/bolt7/requirements.txt @@ -0,0 +1 @@ +pyln.proto >= 0.9.3 diff --git a/contrib/pyln-spec/bolt7/setup.py b/contrib/pyln-spec/bolt7/setup.py deleted file mode 120000 index f8f80fc25..000000000 --- a/contrib/pyln-spec/bolt7/setup.py +++ /dev/null @@ -1 +0,0 @@ -../setup.py \ No newline at end of file diff --git a/contrib/pyln-spec/bolt7/setup.py b/contrib/pyln-spec/bolt7/setup.py new file mode 100644 index 000000000..c30d18d22 --- /dev/null +++ b/contrib/pyln-spec/bolt7/setup.py @@ -0,0 +1,53 @@ +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 +) diff --git a/contrib/pyln-spec/requirements.txt b/contrib/pyln-spec/requirements.txt deleted file mode 100644 index a939f32cb..000000000 --- a/contrib/pyln-spec/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -pyln.proto >= 0.9.3 diff --git a/contrib/pyln-spec/setup.py b/contrib/pyln-spec/setup.py deleted file mode 100644 index c30d18d22..000000000 --- a/contrib/pyln-spec/setup.py +++ /dev/null @@ -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 -)