From 20471504c7f1bcb76937caec488583f74c578f1f Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 3 Oct 2024 18:37:25 -0400 Subject: [PATCH 01/11] Start separting code into verison branches --- admin-tools/merge-for-2.4.sh | 9 +++++++++ admin-tools/merge-for-3.0.sh | 11 +++++++++++ admin-tools/merge-for-3.3.sh | 9 +++++++++ admin-tools/merge-for-3.6.sh | 9 +++++++++ admin-tools/pyenv-2.4-2.7-versions | 9 +++++++++ admin-tools/pyenv-3.0-3.2-versions | 9 +++++++++ admin-tools/pyenv-3.3-3.5-versions | 8 ++++++++ admin-tools/pyenv-3.6-3.10-versions | 8 ++++++++ admin-tools/setup-python-3.0.sh | 10 ++++++++++ admin-tools/setup-python-3.3.sh | 10 ++++++++++ admin-tools/setup-python-3.6.sh | 10 ++++++++++ 11 files changed, 102 insertions(+) create mode 100755 admin-tools/merge-for-2.4.sh create mode 100755 admin-tools/merge-for-3.0.sh create mode 100755 admin-tools/merge-for-3.3.sh create mode 100755 admin-tools/merge-for-3.6.sh create mode 100644 admin-tools/pyenv-2.4-2.7-versions create mode 100644 admin-tools/pyenv-3.0-3.2-versions create mode 100644 admin-tools/pyenv-3.3-3.5-versions create mode 100644 admin-tools/pyenv-3.6-3.10-versions create mode 100755 admin-tools/setup-python-3.0.sh create mode 100755 admin-tools/setup-python-3.3.sh create mode 100755 admin-tools/setup-python-3.6.sh diff --git a/admin-tools/merge-for-2.4.sh b/admin-tools/merge-for-2.4.sh new file mode 100755 index 0000000..ef0766b --- /dev/null +++ b/admin-tools/merge-for-2.4.sh @@ -0,0 +1,9 @@ +#/bin/bash +# Setup for running Python 2.4 .. 2.7, merging python-3.0-to-3.2 into this branch +spark_24_owd=$(pwd) +cd $(dirname ${BASH_SOURCE[0]}) +(cd .. && PYTHON_VERSION=2.4 && pyenv local $PYTHON_VERSION) +if . ./setup-python-2.4.sh; then + git merge python-3.0-to-3.2 +fi +cd $spark_24_owd diff --git a/admin-tools/merge-for-3.0.sh b/admin-tools/merge-for-3.0.sh new file mode 100755 index 0000000..a381599 --- /dev/null +++ b/admin-tools/merge-for-3.0.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Setup for running Python 3.0 .. 3.2, merging 3.3-3.5 into this branch +spark_30_owd=$(pwd) +PYTHON_VERSION=3.1 +pyenv local $PYTHON_VERSION +cd $(dirname ${BASH_SOURCE[0]}) +(cd .. && PYTHON_VERSION=3.1 && pyenv local $PYTHON_VERSION) +if . ./setup-python-3.0.sh; then + git merge python-3.3-to-3.5 +fi +cd $spark_30_owd diff --git a/admin-tools/merge-for-3.3.sh b/admin-tools/merge-for-3.3.sh new file mode 100755 index 0000000..b6a45f0 --- /dev/null +++ b/admin-tools/merge-for-3.3.sh @@ -0,0 +1,9 @@ +#/bin/bash +# Setup for running Python 3.3 .. 3.5, merging Python 3.6-to-3.10 into this branch +spark_33_owd=$(pwd) +cd $(dirname ${BASH_SOURCE[0]}) +(cd .. && PYTHON_VERSION=3.3 && pyenv local $PYTHON_VERSION) +if . ./setup-python-3.3.sh; then + git merge python-3.6-to-3.10 +fi +cd $spark_33_owd diff --git a/admin-tools/merge-for-3.6.sh b/admin-tools/merge-for-3.6.sh new file mode 100755 index 0000000..babd24f --- /dev/null +++ b/admin-tools/merge-for-3.6.sh @@ -0,0 +1,9 @@ +#/bin/bash +# Setup for running Python 3.6 .. 3.10, merging master into this branch +spark_36_owd=$(pwd) +cd $(dirname ${BASH_SOURCE[0]}) +(cd .. && PYTHON_VERSION=3.6 && pyenv local $PYTHON_VERSION) +if . ./setup-python-3.6.sh; then + git merge master +fi +cd $spark_36_owd diff --git a/admin-tools/pyenv-2.4-2.7-versions b/admin-tools/pyenv-2.4-2.7-versions new file mode 100644 index 0000000..c513cb8 --- /dev/null +++ b/admin-tools/pyenv-2.4-2.7-versions @@ -0,0 +1,9 @@ +# -*- shell-script -*- +# Sets PYVERSIONS to be pyenv versions that +# we can use in the python-2.4-to-2.7 branch. + +if [[ $0 == ${BASH_SOURCE[0]} ]] ; then + echo "This script should be *sourced* rather than run directly through bash" + exit 1 +fi +export PYVERSIONS='2.4 2.5 2.6 pypy2.7-7.3.8 2.7' diff --git a/admin-tools/pyenv-3.0-3.2-versions b/admin-tools/pyenv-3.0-3.2-versions new file mode 100644 index 0000000..7410049 --- /dev/null +++ b/admin-tools/pyenv-3.0-3.2-versions @@ -0,0 +1,9 @@ +# -*- shell-script -*- +# Sets PYVERSIONS to be pyenv versions that +# we can use in the python-3.1-to-3.2 branch. + +if [[ $0 == ${BASH_SOURCE[0]} ]] ; then + echo "This script should be *sourced* rather than run directly through bash" + exit 1 +fi +export PYVERSIONS='3.0.1 3.1.5 3.2.6' diff --git a/admin-tools/pyenv-3.3-3.5-versions b/admin-tools/pyenv-3.3-3.5-versions new file mode 100644 index 0000000..e5792c2 --- /dev/null +++ b/admin-tools/pyenv-3.3-3.5-versions @@ -0,0 +1,8 @@ +# -*- shell-script -*- +# Sets PYVERSIONS to be pyenv versions that +# we can use in the python-3.3-to-3.5 branch. +if [[ $0 == ${BASH_SOURCE[0]} ]] ; then + echo "This script should be *sourced* rather than run directly through bash" + exit 1 +fi +export PYVERSIONS='3.5 3.3 3.4 pypy3.5-7.0.0' diff --git a/admin-tools/pyenv-3.6-3.10-versions b/admin-tools/pyenv-3.6-3.10-versions new file mode 100644 index 0000000..0a4bcdf --- /dev/null +++ b/admin-tools/pyenv-3.6-3.10-versions @@ -0,0 +1,8 @@ +# -*- shell-script -*- +# Sets PYVERSIONS to be pyenv versions that +# we can use in the python-3.6-to-3.10 branch. +if [[ $0 == ${BASH_SOURCE[0]} ]] ; then + echo "This script should be *sourced* rather than run directly through bash" + exit 1 +fi +export PYVERSIONS='3.6 pypy3.6-7.3.1 3.7 pypy3.7-7.3.9 pypy3.8-7.3.11 pypy3.9-7.3.13 3.8 pyston-2.3.5 3.9 3.10' diff --git a/admin-tools/setup-python-3.0.sh b/admin-tools/setup-python-3.0.sh new file mode 100755 index 0000000..89c8789 --- /dev/null +++ b/admin-tools/setup-python-3.0.sh @@ -0,0 +1,10 @@ +#!/bin/bash +if [[ $0 == $${BASH_SOURCE[0]} ]] ; then + echo "This script should be *sourced* rather than run directly through bash" + exit 1 +fi + +PYTHON_VERSION=3.0.1 +pyenv local $PYTHON_VERSION + +git checkout python-3.0-to-3.2 && git pull && pyenv local $PYTHON_VERSION diff --git a/admin-tools/setup-python-3.3.sh b/admin-tools/setup-python-3.3.sh new file mode 100755 index 0000000..a48d3f5 --- /dev/null +++ b/admin-tools/setup-python-3.3.sh @@ -0,0 +1,10 @@ +#!/bin/bash +PYTHON_VERSION=3.3.7 +pyenv local $PYTHON_VERSION + +if [[ $0 == $${BASH_SOURCE[0]} ]] ; then + echo "This script should be *sourced* rather than run directly through bash" + exit 1 +fi + +git checkout python-3.3-to-3.5 && git pull && pyenv local $PYTHON_VERSION diff --git a/admin-tools/setup-python-3.6.sh b/admin-tools/setup-python-3.6.sh new file mode 100755 index 0000000..92781ac --- /dev/null +++ b/admin-tools/setup-python-3.6.sh @@ -0,0 +1,10 @@ +#!/bin/bash +if [[ $0 == $${BASH_SOURCE[0]} ]] ; then + echo "This script should be *sourced* rather than run directly through bash" + exit 1 +fi + +PYTHON_VERSION=3.6 +pyenv local $PYTHON_VERSION + +git checkout python-3.6-to-3.10 && git pull && pyenv local $PYTHON_VERSION From 67492dbbbe1fc6b4b14dd6e03a63322a59d35fcf Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 3 Oct 2024 22:05:32 -0400 Subject: [PATCH 02/11] Adjust example tests for 3.10 vs pre 3.10 --- example/python2/py2_format.py | 19 ++++++++----------- example/python2/py2_parser.py | 9 ++++++--- example/python2/py2_scan.py | 9 ++++++--- example/python2/test/helper.py | 5 ++++- example/python2/test/test_parse.py | 7 ++++++- example/python2/test/test_scan.py | 8 +++++++- 6 files changed, 37 insertions(+), 20 deletions(-) diff --git a/example/python2/py2_format.py b/example/python2/py2_format.py index 35c6ec2..eb1dd85 100644 --- a/example/python2/py2_format.py +++ b/example/python2/py2_format.py @@ -96,22 +96,19 @@ import re import sys +from io import StringIO +from sys import version_info -from example.python2.py2_parser import parse_python2 from spark_parser import GenericASTTraversal # , DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG -PYTHON3 = sys.version_info >= (3, 0) - -if PYTHON3: - from io import StringIO - - minint = -sys.maxsize - 1 - maxint = sys.maxsize +if version_info[:2] < (3, 10): + from py2_parser import parse_python2 else: - from StringIO import StringIO + from example.python2.py2_parser import parse_python2 + - minint = -sys.maxint - 1 - maxint = sys.maxint +minint = -sys.maxsize - 1 +maxint = sys.maxsize TAB = " " * 4 # is less spacy than "\t" INDENT_PER_LEVEL = " " # additional intent per pretty-print level diff --git a/example/python2/py2_parser.py b/example/python2/py2_parser.py index 4753c99..50cdc00 100644 --- a/example/python2/py2_parser.py +++ b/example/python2/py2_parser.py @@ -3,14 +3,17 @@ More complex expression parsing """ -# from __future__ import print_function - import sys +from sys import version_info -from example.python2.py2_scan import ENDMARKER, Python2Scanner from spark_parser import GenericASTBuilder from spark_parser.ast import AST +if version_info[:2] < (3, 10): + from py2_scan import ENDMARKER, Python2Scanner +else: + from example.python2.py2_scan import ENDMARKER, Python2Scanner + DEFAULT_DEBUG = { "rules": False, "transition": False, diff --git a/example/python2/py2_scan.py b/example/python2/py2_scan.py index 5ed1ce2..f36aa0b 100644 --- a/example/python2/py2_scan.py +++ b/example/python2/py2_scan.py @@ -1,13 +1,16 @@ """ Simple SPARK-style scanner -Copyright (c) 2016 Rocky Bernstein +Copyright (c) 2016, 2024 Rocky Bernstein """ import re +from sys import version_info -from example.python2.py2_token import PythonToken +if version_info[:2] < (3, 10): + from py2_token import PythonToken +else: + from example.python2.py2_token import PythonToken -# from __future__ import print_function from spark_parser.scanner import GenericScanner RESERVED_WORDS = re.split( diff --git a/example/python2/test/helper.py b/example/python2/test/helper.py index 4c06a96..b831e47 100644 --- a/example/python2/test/helper.py +++ b/example/python2/test/helper.py @@ -12,7 +12,10 @@ def helper_init(file, subdir): def compare_one(func, python_file, verbose=True): - from example.python2.py2_scan import ENDMARKER + if sys.version_info[:2] < (3, 10): + from py2_scan import ENDMARKER + else: + from example.python2.py2_scan import ENDMARKER right_file = python_file[:-2] + "right" got_file = python_file[:-2] + "got" diff --git a/example/python2/test/test_parse.py b/example/python2/test/test_parse.py index 311ff9c..069a8ca 100755 --- a/example/python2/test/test_parse.py +++ b/example/python2/test/test_parse.py @@ -1,11 +1,16 @@ #!/usr/bin/env python +import sys import unittest from helper import helper_init, run_tests_unit parse_dir = helper_init(__file__, "parse") -from example.python2.py2_parser import parse_python2 + +if sys.version_info[:2] < (3, 11): + from example.python2.py2_parser import parse_python2 +else: + from py2_parser import parse_python2 def run_parse(python2_stmts): diff --git a/example/python2/test/test_scan.py b/example/python2/test/test_scan.py index ed2f517..33d0621 100755 --- a/example/python2/test/test_scan.py +++ b/example/python2/test/test_scan.py @@ -1,11 +1,17 @@ #!/usr/bin/env python import unittest +from sys import version_info from helper import helper_init, run_tests_unit +if version_info[:2] < (3, 10): + from py2_scan import Python2Scanner +else: + from example.python2.py2_scan import Python2Scanner + + scan_dir = helper_init(__file__, "scan") -from example.python2.py2_scan import Python2Scanner def run_scan(python_file): From 830f679d50d2c8f6c59e2466e7adb196b87a5156 Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 3 Oct 2024 22:17:27 -0400 Subject: [PATCH 03/11] Adjust how to run tests on various Python versions --- admin-tools/.gitignore | 1 + admin-tools/check-2.4-2.7-versions.sh | 23 +++++++++++++++++++++++ admin-tools/check-3.3-3.5-versions.sh | 24 ++++++++++++++++++++++++ admin-tools/check-3.6-3.10-versions.sh | 24 ++++++++++++++++++++++++ admin-tools/check-newest-versions.sh | 25 +++++++++++++++++++++++++ admin-tools/pyenv-3.6-3.10-versions | 2 +- admin-tools/pyenv-older-versions | 6 ------ example/__init__.py | 0 example/python2/py2_format.py | 2 +- example/python2/py2_parser.py | 2 +- example/python2/py2_scan.py | 2 +- example/python2/test/__init__.py | 0 example/python2/test/helper.py | 2 +- example/python2/test/test_format.py | 7 ++++++- example/python2/test/test_parse.py | 6 +++--- example/python2/test/test_scan.py | 7 +++---- 16 files changed, 114 insertions(+), 19 deletions(-) create mode 100644 admin-tools/.gitignore create mode 100755 admin-tools/check-2.4-2.7-versions.sh create mode 100755 admin-tools/check-3.3-3.5-versions.sh create mode 100755 admin-tools/check-3.6-3.10-versions.sh create mode 100755 admin-tools/check-newest-versions.sh delete mode 100644 admin-tools/pyenv-older-versions create mode 100644 example/__init__.py create mode 100644 example/python2/test/__init__.py diff --git a/admin-tools/.gitignore b/admin-tools/.gitignore new file mode 100644 index 0000000..183700b --- /dev/null +++ b/admin-tools/.gitignore @@ -0,0 +1 @@ +/.python-version diff --git a/admin-tools/check-2.4-2.7-versions.sh b/admin-tools/check-2.4-2.7-versions.sh new file mode 100755 index 0000000..1125147 --- /dev/null +++ b/admin-tools/check-2.4-2.7-versions.sh @@ -0,0 +1,23 @@ +#!/bin/bash +check_spark_24_owd=$(pwd) + +cd $(dirname ${BASH_SOURCE[0]}) +if ! source ./pyenv-2.4-2.7-versions ; then + exit $? +fi +if ! source ./setup-python-2.4.sh ; then + exit $? +fi + +cd .. +for version in $PYVERSIONS; do + if ! pyenv local $version ; then + exit $? + fi + make clean && python setup.py develop + if ! make check ; then + exit $? + fi + echo === $version === +done +cd $check_spark_24_owd diff --git a/admin-tools/check-3.3-3.5-versions.sh b/admin-tools/check-3.3-3.5-versions.sh new file mode 100755 index 0000000..ec5bd51 --- /dev/null +++ b/admin-tools/check-3.3-3.5-versions.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +check_spark_33_owd=$(pwd) + +cd $(dirname ${BASH_SOURCE[0]}) +if ! source ./pyenv-3.3-3.5-versions ; then + exit $? +fi +if ! source ./setup-python-3.3.sh ; then + exit $? +fi +cd .. +for version in $PYVERSIONS; do + echo --- $version --- + if ! pyenv local $version ; then + exit $? + fi + make clean && pip install -e . + if ! make check; then + exit $? + fi + echo === $version === +done +cd $check_spark_33_owd diff --git a/admin-tools/check-3.6-3.10-versions.sh b/admin-tools/check-3.6-3.10-versions.sh new file mode 100755 index 0000000..3d7115b --- /dev/null +++ b/admin-tools/check-3.6-3.10-versions.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +check_spark_36_owd=$(pwd) + +cd $(dirname ${BASH_SOURCE[0]}) +if ! source ./pyenv-3.6-3.10-versions ; then + exit $? +fi +if ! source ./setup-python-3.6.sh ; then + exit $? +fi +cd .. +for version in $PYVERSIONS; do + echo --- $version --- + if ! pyenv local $version ; then + exit $? + fi + make clean && pip install -e . + if ! make check; then + exit $? + fi + echo === $version === +done +cd $check_spark_36_owd diff --git a/admin-tools/check-newest-versions.sh b/admin-tools/check-newest-versions.sh new file mode 100755 index 0000000..73b3e8e --- /dev/null +++ b/admin-tools/check-newest-versions.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# FIXME put some of the below in a common routine +spark_check_newest_owd=$(pwd) + +cd $(dirname ${BASH_SOURCE[0]}) +if ! source ./pyenv-newest-versions ; then + exit $? +fi +if ! source ./setup-master.sh ; then + exit $? +fi +cd .. +for version in $PYVERSIONS; do + echo --- $version --- + if ! pyenv local $version ; then + exit $? + fi + make clean && pip install -e . + if ! make check; then + exit $? + fi + echo === $version === +done +cd $spark_check_newest_owd diff --git a/admin-tools/pyenv-3.6-3.10-versions b/admin-tools/pyenv-3.6-3.10-versions index 0a4bcdf..236aa96 100644 --- a/admin-tools/pyenv-3.6-3.10-versions +++ b/admin-tools/pyenv-3.6-3.10-versions @@ -5,4 +5,4 @@ if [[ $0 == ${BASH_SOURCE[0]} ]] ; then echo "This script should be *sourced* rather than run directly through bash" exit 1 fi -export PYVERSIONS='3.6 pypy3.6-7.3.1 3.7 pypy3.7-7.3.9 pypy3.8-7.3.11 pypy3.9-7.3.13 3.8 pyston-2.3.5 3.9 3.10' +export PYVERSIONS='3.6 3.7 3.8 pyston-2.3.5 3.9 3.10' diff --git a/admin-tools/pyenv-older-versions b/admin-tools/pyenv-older-versions deleted file mode 100644 index 63e4e20..0000000 --- a/admin-tools/pyenv-older-versions +++ /dev/null @@ -1,6 +0,0 @@ -# -*- shell-script -*- -if [[ $0 == ${BASH_SOURCE[0]} ]] ; then - echo "This script should be *sourced* rather than run directly through bash" - exit 1 -fi -export PYVERSIONS='2.4.6 2.5.6' diff --git a/example/__init__.py b/example/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/example/python2/py2_format.py b/example/python2/py2_format.py index eb1dd85..41b343b 100644 --- a/example/python2/py2_format.py +++ b/example/python2/py2_format.py @@ -101,7 +101,7 @@ from spark_parser import GenericASTTraversal # , DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG -if version_info[:2] < (3, 10): +if version_info[:2] < (3, 9): from py2_parser import parse_python2 else: from example.python2.py2_parser import parse_python2 diff --git a/example/python2/py2_parser.py b/example/python2/py2_parser.py index 50cdc00..856e625 100644 --- a/example/python2/py2_parser.py +++ b/example/python2/py2_parser.py @@ -9,7 +9,7 @@ from spark_parser import GenericASTBuilder from spark_parser.ast import AST -if version_info[:2] < (3, 10): +if version_info[:2] < (3, 9): from py2_scan import ENDMARKER, Python2Scanner else: from example.python2.py2_scan import ENDMARKER, Python2Scanner diff --git a/example/python2/py2_scan.py b/example/python2/py2_scan.py index f36aa0b..0fac7c5 100644 --- a/example/python2/py2_scan.py +++ b/example/python2/py2_scan.py @@ -6,7 +6,7 @@ import re from sys import version_info -if version_info[:2] < (3, 10): +if version_info[:2] < (3, 9): from py2_token import PythonToken else: from example.python2.py2_token import PythonToken diff --git a/example/python2/test/__init__.py b/example/python2/test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/example/python2/test/helper.py b/example/python2/test/helper.py index b831e47..90e0ad6 100644 --- a/example/python2/test/helper.py +++ b/example/python2/test/helper.py @@ -12,7 +12,7 @@ def helper_init(file, subdir): def compare_one(func, python_file, verbose=True): - if sys.version_info[:2] < (3, 10): + if sys.version_info[:2] < (3, 9): from py2_scan import ENDMARKER else: from example.python2.py2_scan import ENDMARKER diff --git a/example/python2/test/test_format.py b/example/python2/test/test_format.py index bd2a0a0..947f242 100755 --- a/example/python2/test/test_format.py +++ b/example/python2/test/test_format.py @@ -1,11 +1,16 @@ #!/usr/bin/env python +import sys import unittest from helper import helper_init, run_tests_unit format_dir = helper_init(__file__, "format") -from example.python2.py2_format import format_python2_stmts + +if sys.version_info[:2] < (3, 9): + from py2_format import format_python2_stmts +else: + from example.python2.py2_format import format_python2_stmts def run_format(python2_stmts): diff --git a/example/python2/test/test_parse.py b/example/python2/test/test_parse.py index 069a8ca..225532f 100755 --- a/example/python2/test/test_parse.py +++ b/example/python2/test/test_parse.py @@ -7,10 +7,10 @@ parse_dir = helper_init(__file__, "parse") -if sys.version_info[:2] < (3, 11): - from example.python2.py2_parser import parse_python2 -else: +if sys.version_info[:2] < (3, 9): from py2_parser import parse_python2 +else: + from example.python2.py2_parser import parse_python2 def run_parse(python2_stmts): diff --git a/example/python2/test/test_scan.py b/example/python2/test/test_scan.py index 33d0621..510a6e6 100755 --- a/example/python2/test/test_scan.py +++ b/example/python2/test/test_scan.py @@ -5,15 +5,14 @@ from helper import helper_init, run_tests_unit -if version_info[:2] < (3, 10): +scan_dir = helper_init(__file__, "scan") + +if version_info[:2] < (3, 9): from py2_scan import Python2Scanner else: from example.python2.py2_scan import Python2Scanner -scan_dir = helper_init(__file__, "scan") - - def run_scan(python_file): # Note: need to initialize scanner each time. return Python2Scanner().tokenize(python_file) From a91e2c1aef79635ed68b01bb715edded497f1b0c Mon Sep 17 00:00:00 2001 From: rocky Date: Fri, 4 Oct 2024 21:02:20 -0400 Subject: [PATCH 04/11] More ignore --- admin-tools/.gitignore | 4 ---- 1 file changed, 4 deletions(-) diff --git a/admin-tools/.gitignore b/admin-tools/.gitignore index 81b49c8..183700b 100644 --- a/admin-tools/.gitignore +++ b/admin-tools/.gitignore @@ -1,5 +1 @@ /.python-version -<<<<<<< HEAD -======= -/.python-version ->>>>>>> master From bda77cc9964fe278410be94f5a1b22576d4b9c60 Mon Sep 17 00:00:00 2001 From: rocky Date: Mon, 7 Oct 2024 13:01:32 -0400 Subject: [PATCH 05/11] Merge hell --- Makefile | 2 +- pyproject.toml | 66 ------------- setup.py | 98 ++++++++++++++++++- spark_parser/example/python2/py2_format.py | 6 +- spark_parser/example/python2/py2_parser.py | 5 +- spark_parser/example/python2/py2_scan.py | 6 +- spark_parser/example/python2/test/helper.py | 2 +- .../example/python2/test/test_format.py | 2 +- .../example/python2/test/test_parse.py | 2 +- .../example/python2/test/test_scan.py | 2 +- 10 files changed, 104 insertions(+), 87 deletions(-) delete mode 100644 pyproject.toml diff --git a/Makefile b/Makefile index 402ba0b..8694de4 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ all: check #: Run all tests with several Python versions via tox check-full: check flake8 spark_parser && flake8 test \ - && flake8 example \ + && flake8 spark_parser/example \ --exclude spark_parser/example/python2/test \ #: Run tests (one version of Python) diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index 4f10bb8..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,66 +0,0 @@ -[build-system] -requires = [ - "setuptools>=61.2", -] -[project] -name = "spark-parser" -authors = [ - {name = "John Aycock"}, - {name = "Rocky Bernstein", email="rocky@gnu.org"} -] - -description = "An Earley-Algorithm Context-free grammar Parser Toolkit" -dependencies = [ - "click", -] -readme = "README.rst" -license = {text = "GPL"} -maintainers = [ - {name = "Rocky Bernstein"}, -] -classifiers = [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python", - "Topic :: Software Development :: Libraries :: Python Modules", - "Programming Language :: Python :: 2.4", - "Programming Language :: Python :: 2.5", - "Programming Language :: Python :: 2.6", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3.0", - "Programming Language :: Python :: 3.1", - "Programming Language :: Python :: 3.2", - "Programming Language :: Python :: 3.3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", -] -dynamic = ["version"] - -[project.urls] -Homepage = "https://github.com/rocky/python-spark" - -[project.optional-dependencies] -dev = [ - "pytest", - "pre-commit", -] - -[tool.setuptools] -packages = [ - "spark_parser", -] - -py-modules = [ - "example", -] - -[tool.setuptools.dynamic] -version = {attr = "spark_parser.version.__version__"} diff --git a/setup.py b/setup.py index c5f365f..f06d617 100755 --- a/setup.py +++ b/setup.py @@ -14,6 +14,100 @@ Copyright (C) 2016, 2022, 2024 Rocky Bernstein . """ -from setuptools import setup +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2.4", + "Programming Language :: Python :: 2.5", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3.0", + "Programming Language :: Python :: 3.1", + "Programming Language :: Python :: 3.2", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Software Development :: Code Generators", + "Topic :: Software Development :: Libraries :: Python Modules", +] -setup() +# The rest in alphabetic order +author = "John Aycock" +ftp_url = None +license = "MIT" +maintainer = "Rocky Bernstein" +maintainer_email = "rb@dustyfeet.com" +modname = "spark_parser" +name = "spark_parser" +py_modules = ["example",] + +None +short_desc = "An Earley-Algorithm Context-free grammar Parser Toolkit" +web = "https://github.com/rocky/python-spark/" + +# tracebacks in zip files are funky and not debuggable +zip_safe = True + +# Python-version | package | last-version | +# ----------------------------------------- +# 3.2 | click | 4.0 | +# 3.2 | pip | 8.1.2 | +# 3.3 | pip | 10.0.1 | +# 3.4 | pip | 19.1.1 | + +import os.path as osp + + +def get_srcdir(): + filename = osp.normcase(osp.dirname(osp.abspath(__file__))) + return osp.realpath(filename) + + +srcdir = get_srcdir() + + +def read(*rnames): + return open(osp.join(srcdir, *rnames)).read() + + +# Get info from files; set: long_description and VERSION +long_description = read("README.rst") + "\n" +exec(read("spark_parser/version.py")) + +import sys + +if (3, 0) <= sys.version_info[:2] <= (3, 2): + click_version = "<= 4.0" +else: + click_version = "" + +from setuptools import find_packages, setup + +setup( + classifiers=classifiers, + description=short_desc, + install_requires=["click%s" % click_version], + license=license, + long_description=long_description, + long_description_content_type="text/x-rst", + maintainer=maintainer, + maintainer_email=maintainer_email, + packages=find_packages(), + py_modules=py_modules, + name=name, + scripts=["bin/spark-parser-coverage"], + test_suite="nose.collector", + url=web, + tests_require=["nose>=1.0"], + version=__version__, + zip_safe=zip_safe, +) diff --git a/spark_parser/example/python2/py2_format.py b/spark_parser/example/python2/py2_format.py index 7b5d395..fa2368c 100644 --- a/spark_parser/example/python2/py2_format.py +++ b/spark_parser/example/python2/py2_format.py @@ -99,16 +99,12 @@ from io import StringIO from sys import version_info -<<<<<<< HEAD:example/python2/py2_format.py -======= -from spark_parser.example.python2.py2_parser import parse_python2 ->>>>>>> master:spark_parser/example/python2/py2_format.py from spark_parser import GenericASTTraversal # , DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG if version_info[:2] < (3, 9): from py2_parser import parse_python2 else: - from example.python2.py2_parser import parse_python2 + from spark_parser.example.python2.py2_parser import parse_python2 minint = -sys.maxsize - 1 diff --git a/spark_parser/example/python2/py2_parser.py b/spark_parser/example/python2/py2_parser.py index 8b3ec8c..105541e 100644 --- a/spark_parser/example/python2/py2_parser.py +++ b/spark_parser/example/python2/py2_parser.py @@ -6,17 +6,14 @@ import sys from sys import version_info -<<<<<<< HEAD:example/python2/py2_parser.py -======= from spark_parser.example.python2.py2_scan import ENDMARKER, Python2Scanner ->>>>>>> master:spark_parser/example/python2/py2_parser.py from spark_parser import GenericASTBuilder from spark_parser.ast import AST if version_info[:2] < (3, 9): from py2_scan import ENDMARKER, Python2Scanner else: - from example.python2.py2_scan import ENDMARKER, Python2Scanner + from spark_parser.example.python2.py2_scan import ENDMARKER, Python2Scanner DEFAULT_DEBUG = { "rules": False, diff --git a/spark_parser/example/python2/py2_scan.py b/spark_parser/example/python2/py2_scan.py index 96b5145..b6ea0be 100644 --- a/spark_parser/example/python2/py2_scan.py +++ b/spark_parser/example/python2/py2_scan.py @@ -6,14 +6,10 @@ import re from sys import version_info -<<<<<<< HEAD:example/python2/py2_scan.py if version_info[:2] < (3, 9): from py2_token import PythonToken else: - from example.python2.py2_token import PythonToken -======= -from spark_parser.example.python2.py2_token import PythonToken ->>>>>>> master:spark_parser/example/python2/py2_scan.py + from spark_parser.example.python2.py2_token import PythonToken from spark_parser.scanner import GenericScanner diff --git a/spark_parser/example/python2/test/helper.py b/spark_parser/example/python2/test/helper.py index 90e0ad6..20f03cf 100644 --- a/spark_parser/example/python2/test/helper.py +++ b/spark_parser/example/python2/test/helper.py @@ -15,7 +15,7 @@ def compare_one(func, python_file, verbose=True): if sys.version_info[:2] < (3, 9): from py2_scan import ENDMARKER else: - from example.python2.py2_scan import ENDMARKER + from spark_parser.example.python2.py2_scan import ENDMARKER right_file = python_file[:-2] + "right" got_file = python_file[:-2] + "got" diff --git a/spark_parser/example/python2/test/test_format.py b/spark_parser/example/python2/test/test_format.py index 947f242..eeb6649 100755 --- a/spark_parser/example/python2/test/test_format.py +++ b/spark_parser/example/python2/test/test_format.py @@ -10,7 +10,7 @@ if sys.version_info[:2] < (3, 9): from py2_format import format_python2_stmts else: - from example.python2.py2_format import format_python2_stmts + from spark_parser.example.python2.py2_format import format_python2_stmts def run_format(python2_stmts): diff --git a/spark_parser/example/python2/test/test_parse.py b/spark_parser/example/python2/test/test_parse.py index 225532f..3a5ea31 100755 --- a/spark_parser/example/python2/test/test_parse.py +++ b/spark_parser/example/python2/test/test_parse.py @@ -10,7 +10,7 @@ if sys.version_info[:2] < (3, 9): from py2_parser import parse_python2 else: - from example.python2.py2_parser import parse_python2 + from spark_parser.example.python2.py2_parser import parse_python2 def run_parse(python2_stmts): diff --git a/spark_parser/example/python2/test/test_scan.py b/spark_parser/example/python2/test/test_scan.py index 510a6e6..11f86e2 100755 --- a/spark_parser/example/python2/test/test_scan.py +++ b/spark_parser/example/python2/test/test_scan.py @@ -10,7 +10,7 @@ if version_info[:2] < (3, 9): from py2_scan import Python2Scanner else: - from example.python2.py2_scan import Python2Scanner + from spark_parser.example.python2.py2_scan import Python2Scanner def run_scan(python_file): From ed184222d2930ea5c63f00874600dfbce5c0f464 Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 8 Oct 2024 07:44:40 -0400 Subject: [PATCH 06/11] Get ready for release 1.9.0. --- .gitignore | 5 +- .pre-commit-config.yaml | 2 +- ChangeLog-spell-corrected.diff | 155 +++++++++++++++++++++++++++++++++ NEWS.md | 21 ++++- admin-tools/make-dist-older.sh | 39 --------- 5 files changed, 176 insertions(+), 46 deletions(-) create mode 100644 ChangeLog-spell-corrected.diff delete mode 100755 admin-tools/make-dist-older.sh diff --git a/.gitignore b/.gitignore index ed75d30..9b7393b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,11 @@ *.pyc *~ +.cache /.eggs /.python-version /.tox +/ChangeLog +/ChangeLog-spell-corrected /build /dist /how-to-make-a-release.txt @@ -10,5 +13,3 @@ /spark3_parser.egg-info /spark_parser.egg-info /tmp -.cache -/ChangeLog diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 675d793..b3dc0e6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,4 +21,4 @@ repos: - id: black language_version: python3 stages: [commit] - exclude: 'trepan/version.py' + exclude: 'spark_parser/version.py' diff --git a/ChangeLog-spell-corrected.diff b/ChangeLog-spell-corrected.diff new file mode 100644 index 0000000..d00bde2 --- /dev/null +++ b/ChangeLog-spell-corrected.diff @@ -0,0 +1,155 @@ +--- ChangeLog 2024-10-08 07:34:12.955418050 -0400 ++++ ChangeLog-spell-corrected 2024-10-08 07:35:49.302374064 -0400 +@@ -156,7 +156,7 @@ + * admin-tools/{check-older-versions.sh => + check-2.4-2.7-versions.sh}, admin-tools/check-3.3-3.5-versions.sh, + admin-tools/check-3.6-3.10-versions.sh, +- admin-tools/{check-newer-versions.sh => check-newest-versions.sh}: ++ admin-tools/{check-newer-versions.sh => check-newest-versions.sh}: + Administrivia: Add check programs + + 2024-10-04 rocky +@@ -188,7 +188,7 @@ + admin-tools/pyenv-3.3-3.5-versions, + admin-tools/pyenv-3.6-3.10-versions, admin-tools/setup-master.sh, + admin-tools/setup-python-3.0.sh, admin-tools/setup-python-3.3.sh, +- admin-tools/setup-python-3.6.sh: Start separting code into verison ++ admin-tools/setup-python-3.6.sh: Start separating code into version + branches + + 2024-10-02 gdesmar <75089569+gdesmar@users.noreply.github.com> +@@ -215,11 +215,11 @@ + + 2023-05-29 rocky + +- * spark_parser/spark.py: lint a litle bit ++ * spark_parser/spark.py: lint a little bit + + 2022-03-09 rocky + +- * spark_parser/__init__.py, test/test_grammar.py, test/test_misc.py: ++ * spark_parser/__init__.py, test/test_grammar.py, test/test_misc.py: + __init__.py lint + + 2022-02-11 rocky +@@ -290,7 +290,7 @@ + + 2019-11-16 rocky + +- * admin-tools/pyenv-newer-versions, admin-tools/setup-master.sh: ++ * admin-tools/pyenv-newer-versions, admin-tools/setup-master.sh: + Administriva - bump testing versions + + 2019-11-16 rocky +@@ -404,7 +404,7 @@ + 2018-03-28 rocky + + * bin/spark-parser-coverage: Canonicalize to reduce false-positive +- unused rules Specifically we remove the epsilon transition marks. Note we don't bother doing this for all rules, just the unsed ones ++ unused rules Specifically we remove the epsilon transition marks. Note we don't bother doing this for all rules, just the unused ones + + 2018-02-18 rocky + +@@ -428,7 +428,7 @@ + + 2017-12-07 rocky + +- * test/test_misc.py: Python 2.6 compatability ++ * test/test_misc.py: Python 2.6 compatibility + + 2017-12-07 rocky + +@@ -491,7 +491,7 @@ + + * example/gdb-loc/gdbloc/semantics.py, + example/python2/py2_format.py, spark_parser/spark.py, +- test/test_checker.py, test/test_grammar.py, test/test_spark.py: ++ test/test_checker.py, test/test_grammar.py, test/test_spark.py: + Check for rules with the same non-nul RHS + + 2017-11-16 rocky +@@ -546,7 +546,7 @@ + 2017-10-24 rocky + + * ChangeLog, NEWS, example/gdb-loc/gdbloc/semantics.py, +- example/gdb-loc/pytest/test_semantics.py, spark_parser/version.py: ++ example/gdb-loc/pytest/test_semantics.py, spark_parser/version.py: + Get ready for release 1.7.1 + + 2017-10-24 rocky +@@ -559,14 +559,14 @@ + example/gdb-loc/gdbloc/scanner.py, + example/gdb-loc/gdbloc/semantics.py, + example/gdb-loc/pytest/test_parser.py, +- example/gdb-loc/pytest/test_semantics.py, spark_parser/spark.py: ++ example/gdb-loc/pytest/test_semantics.py, spark_parser/spark.py: + parser: handle errorstack better; better gdbloc + + 2017-10-12 rocky + + * example/README.md, example/expr2/eval.py, + example/expr2/{parser.py => expr_parser.py}, +- example/expr2/test_grammar.py, example/python2/py2_format.py: ++ example/expr2/test_grammar.py, example/python2/py2_format.py: + Improve examples. + + 2017-10-12 rocky +@@ -615,7 +615,7 @@ + + * example/gdb-loc/README.md, example/gdb-loc/gdbloc/parser.py, + example/gdb-loc/gdbloc/scanner.py, +- example/gdb-loc/gdbloc/semantics.py: Pretty much coplete the gdbloc ++ example/gdb-loc/gdbloc/semantics.py: Pretty much complete the gdbloc + example Now I just need to add it to trepan2 and trepan3k... + + 2017-10-08 rocky +@@ -801,7 +801,7 @@ + + 2017-01-28 rocky + +- * spark_parser/spark.py, test/test_spark.py: Banc on coverage a ++ * spark_parser/spark.py, test/test_spark.py: Bang on coverage a + little more + + 2017-01-28 rocky +@@ -957,7 +957,7 @@ + 2016-11-22 rocky + + * example/python2/test/helper.py, spark_parser/spark.py: Fix bug +- introdoced in last release... guard agains self.debug == None Reinstate "with ..." will handle 2.4-2.5 in a branch ++ introdoced in last release... guard against self.debug == None Reinstate "with ..." will handle 2.4-2.5 in a branch + + 2016-11-21 rocky + +@@ -1043,7 +1043,7 @@ + example/python2/test/parse/exec.right, + example/python2/test/parse/if.right, + example/python2/test/parse/imports.right, +- example/python2/test/parse/while.right: Python 2 start Handlin '==' ++ example/python2/test/parse/while.right: Python 2 start Handling '==' + and subscripts + + 2016-06-12 rocky +@@ -1090,7 +1090,7 @@ + 2016-06-10 rocky + + * example/python2/py2_format.py, example/python2/py2_parser.py, +- example/python2/py2_scan.py, example/python2/test/format/expr.right: ++ example/python2/py2_scan.py, example/python2/test/format/expr.right: + Almost all of the grammar added. py2_scan.py: add "and" and "or" reserved words + + 2016-06-10 rocky +@@ -1447,7 +1447,7 @@ + 2016-04-28 rocky + + * NEWS, example/expr/expr.py, setup.py, spark/__init__.py, +- spark/ast.py, spark/scanner.py, spark/spark.py, test/test_spark.py: ++ spark/ast.py, spark/scanner.py, spark/spark.py, test/test_spark.py: + Get ready for release 1.0.2 + + 2016-04-27 rocky +@@ -1539,4 +1539,3 @@ + 2016-04-20 rocky + + * Initial guess at Spark package +- diff --git a/NEWS.md b/NEWS.md index af98197..4c727e4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,18 @@ +1.9.0 2024-10-8 Has it been that long? +====================================== + +Revamp for more modern Python style in the 3.12 era: + - start adding type annotations to code. + - use pyproject.toml + - remove illegal escape sequences + +BuildTree now builds trees iteratively rather than recursively. With this we can handle larger trees which are needed in the decompielrs. + +Revise README.rst for above and go over spelling and grammar + +Internally, more git branches have been created to supoprt older Python. + + 1.8.9 2018-07-28 S ====================================== @@ -16,9 +31,7 @@ 1.8.6 2018-04-06 ================ -* spark-parser-coverage: Canonicalize to reduce false-positive - unused rules. Specifically we remove epsilon - transition marks +* spark-parser-coverage: Canonicalize to reduce false-positive unused rules. Specifically we remove epsilon transition marks 1.8.5 2017-12-10 Dr Gecko @@ -28,7 +41,7 @@ Those are nonterminals used in *, +, and ? rules * example/python2/py2_parser.py: Pull constant out of nonterminal function -* test/test_misc.py: Python 2.6 compatability +* test/test_misc.py: Python 2.6 compatibility * example/gdb-loc/README.md, example/python2/README.md, example/python2/format-python.py, spark_parser/spark.py, test/test_misc.py: Create set of list-like nonterminals diff --git a/admin-tools/make-dist-older.sh b/admin-tools/make-dist-older.sh deleted file mode 100755 index e9eafa6..0000000 --- a/admin-tools/make-dist-older.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -PACKAGE=spark_parser - -# FIXME put some of the below in a common routine -function finish { - cd $owd -} -owd=$(pwd) -trap finish EXIT - -cd $(dirname ${BASH_SOURCE[0]}) -if ! source ./pyenv-older-versions ; then - exit $? -fi -if ! source ./setup-python-2.4.sh ; then - exit $? -fi - -cd .. -source $PACKAGE/version.py -echo $VERSION - -for pyversion in $PYVERSIONS; do - if ! pyenv local $pyversion ; then - exit $? - fi - - rm -fr build - python setup.py bdist_egg -done - -# Pypi can only have one source tarball. -# Tarballs can get created from the above setup, so make sure to remove them since we want -# the tarball from master. - -tarball=dist/${PACKAGE}-$VERSION-tar.gz -if [[ -f $tarball ]]; then - rm -v dist/${PACKAGE}-$VERSION-tar.gz -fi From f9770ca582cc200006d6c18be89710e71f503a09 Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 8 Oct 2024 07:44:40 -0400 Subject: [PATCH 07/11] Get ready for release 1.9.0. --- admin-tools/make-dist-2.4-2.7.sh | 55 ++++++++++++++++++++++++++++ admin-tools/make-dist-3.0-3.2.sh | 62 ++++++++++++++++++++++++++++++++ admin-tools/make-dist-older.sh | 39 -------------------- admin-tools/pyenv-newer-versions | 6 ---- spark_parser/version.py | 2 +- 5 files changed, 118 insertions(+), 46 deletions(-) create mode 100644 admin-tools/make-dist-2.4-2.7.sh create mode 100644 admin-tools/make-dist-3.0-3.2.sh delete mode 100755 admin-tools/make-dist-older.sh delete mode 100644 admin-tools/pyenv-newer-versions diff --git a/admin-tools/make-dist-2.4-2.7.sh b/admin-tools/make-dist-2.4-2.7.sh new file mode 100644 index 0000000..6946b69 --- /dev/null +++ b/admin-tools/make-dist-2.4-2.7.sh @@ -0,0 +1,55 @@ +#!/bin/bash +PACKAGE=spark_parser + +# FIXME put some of the below in a common routine +function finish { + cd $make_spark_dist_24_owd +} +make_spark_dist_24_owd=$(pwd) +trap finish EXIT + +cd $(dirname ${BASH_SOURCE[0]}) +if ! source ./pyenv-2.4-2.7-versions ; then + exit $? +fi +if ! source ./setup-python-2.4.sh ; then + exit $? +fi + +cd .. +source $PACKAGE/version.py +if [[ ! -n $__version__ ]]; then + echo "You need to set __version__ first" + exit 1 +fi +echo $__version__ + +for pyversion in $PYVERSIONS; do + echo --- $pyversion --- + if [[ ${pyversion:0:4} == "pypy" ]] ; then + echo "$pyversion - PyPy does not get special packaging" + continue + fi + if ! pyenv local $pyversion ; then + exit $? + fi + + rm -fr build + python setup.py bdist_egg + echo === $pyversion === +done + +echo "--- python 2.7 wheel ---" +pyenv local 2.7.18 +python setup.py bdist_wheel +echo === $pyversion === + +# PyPI can only have one source tarball. +# Tarballs can get created from the above setup, so make sure to remove them since we want +# the tarball from master. + +tarball=dist/${PACKAGE}-$__version__-tar.gz +if [[ -f $tarball ]]; then + rm -v dist/${PACKAGE}-$__version__-tar.gz +fi +finish diff --git a/admin-tools/make-dist-3.0-3.2.sh b/admin-tools/make-dist-3.0-3.2.sh new file mode 100644 index 0000000..8ac4ef3 --- /dev/null +++ b/admin-tools/make-dist-3.0-3.2.sh @@ -0,0 +1,62 @@ +#!/bin/bash +PACKAGE=spark_parser + +# FIXME put some of the below in a common routine +function finish { + cd $make_spark_dist_30_owd +} + +make_spark_dist_30_owd=$(pwd) +cd $(dirname ${BASH_SOURCE[0]}) +trap finish EXIT + +if ! source ./pyenv-3.0-3.2-versions ; then + exit $? +fi +if ! source ./setup-python-3.0.sh ; then + exit $? +fi + +cd .. +source $PACKAGE/version.py +if [[ ! -n $__version__ ]]; then + echo "You need to set __version__ first" + exit 1 +fi +echo $__version__ + +for pyversion in $PYVERSIONS; do + echo --- $pyversion --- + if [[ ${pyversion:0:4} == "pypy" ]] ; then + echo "$pyversion - PyPy does not get special packaging" + continue + fi + if ! pyenv local $pyversion ; then + exit $? + fi + # pip bdist_egg create too-general wheels. So + # we narrow that by moving the generated wheel. + + # Pick out first two numbers of version, e.g. 3.5.1 -> 35 + first_two=$(echo $pyversion | cut -d'.' -f 1-2 | sed -e 's/\.//') + rm -fr build + python setup.py bdist_egg bdist_wheel + if [[ $first_two =~ py* ]]; then + if [[ $first_two =~ pypy* ]]; then + # For PyPy, remove the what is after the dash, e.g. pypy37-none-any.whl instead of pypy37-7-none-any.whl + first_two=${first_two%-*} + fi + mv -v dist/${PACKAGE}-$__version__-{py3,$first_two}-none-any.whl + else + mv -v dist/${PACKAGE}-$__version__-{py3,py$first_two}-none-any.whl + fi + echo === $pyversion === +done + +python ./setup.py sdist + +tarball=dist/${PACKAGE}-${__version__}.tar.gz +if [[ -f $tarball ]]; then + mv -v $tarball dist/${PACKAGE}_31-${__version__}.tar.gz +fi +finish diff --git a/admin-tools/make-dist-older.sh b/admin-tools/make-dist-older.sh deleted file mode 100755 index e9eafa6..0000000 --- a/admin-tools/make-dist-older.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -PACKAGE=spark_parser - -# FIXME put some of the below in a common routine -function finish { - cd $owd -} -owd=$(pwd) -trap finish EXIT - -cd $(dirname ${BASH_SOURCE[0]}) -if ! source ./pyenv-older-versions ; then - exit $? -fi -if ! source ./setup-python-2.4.sh ; then - exit $? -fi - -cd .. -source $PACKAGE/version.py -echo $VERSION - -for pyversion in $PYVERSIONS; do - if ! pyenv local $pyversion ; then - exit $? - fi - - rm -fr build - python setup.py bdist_egg -done - -# Pypi can only have one source tarball. -# Tarballs can get created from the above setup, so make sure to remove them since we want -# the tarball from master. - -tarball=dist/${PACKAGE}-$VERSION-tar.gz -if [[ -f $tarball ]]; then - rm -v dist/${PACKAGE}-$VERSION-tar.gz -fi diff --git a/admin-tools/pyenv-newer-versions b/admin-tools/pyenv-newer-versions deleted file mode 100644 index b5c4ed6..0000000 --- a/admin-tools/pyenv-newer-versions +++ /dev/null @@ -1,6 +0,0 @@ -# -*- shell-script -*- -if [[ $0 == ${BASH_SOURCE[0]} ]] ; then - echo "This script should be *sourced* rather than run directly through bash" - exit 1 -fi -export PYVERSIONS='3.5.9 3.6.9 2.6.9 3.3.7 2.7.17 3.2.6 3.1.5 3.4.10 3.7.6 3.8.18, 3.11.7 3.12.1' diff --git a/spark_parser/version.py b/spark_parser/version.py index 80a4dd7..c66b9ae 100644 --- a/spark_parser/version.py +++ b/spark_parser/version.py @@ -4,4 +4,4 @@ # This file should define a variable VERSION which we use as the # package version number. -__version__ = "1.9.0" # noqa +__version__="1.9.0" # noqa From 7680ee5abd0c91cdb61a91508b6def5617d64f85 Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 8 Oct 2024 07:44:40 -0400 Subject: [PATCH 08/11] Get ready for release 1.9.0. --- admin-tools/make-dist-2.4-2.7.sh | 55 ++++++++++++++++++++++++++++ admin-tools/make-dist-3.0-3.2.sh | 62 ++++++++++++++++++++++++++++++++ admin-tools/pyenv-newer-versions | 6 ---- 3 files changed, 117 insertions(+), 6 deletions(-) create mode 100755 admin-tools/make-dist-2.4-2.7.sh create mode 100755 admin-tools/make-dist-3.0-3.2.sh delete mode 100644 admin-tools/pyenv-newer-versions diff --git a/admin-tools/make-dist-2.4-2.7.sh b/admin-tools/make-dist-2.4-2.7.sh new file mode 100755 index 0000000..6946b69 --- /dev/null +++ b/admin-tools/make-dist-2.4-2.7.sh @@ -0,0 +1,55 @@ +#!/bin/bash +PACKAGE=spark_parser + +# FIXME put some of the below in a common routine +function finish { + cd $make_spark_dist_24_owd +} +make_spark_dist_24_owd=$(pwd) +trap finish EXIT + +cd $(dirname ${BASH_SOURCE[0]}) +if ! source ./pyenv-2.4-2.7-versions ; then + exit $? +fi +if ! source ./setup-python-2.4.sh ; then + exit $? +fi + +cd .. +source $PACKAGE/version.py +if [[ ! -n $__version__ ]]; then + echo "You need to set __version__ first" + exit 1 +fi +echo $__version__ + +for pyversion in $PYVERSIONS; do + echo --- $pyversion --- + if [[ ${pyversion:0:4} == "pypy" ]] ; then + echo "$pyversion - PyPy does not get special packaging" + continue + fi + if ! pyenv local $pyversion ; then + exit $? + fi + + rm -fr build + python setup.py bdist_egg + echo === $pyversion === +done + +echo "--- python 2.7 wheel ---" +pyenv local 2.7.18 +python setup.py bdist_wheel +echo === $pyversion === + +# PyPI can only have one source tarball. +# Tarballs can get created from the above setup, so make sure to remove them since we want +# the tarball from master. + +tarball=dist/${PACKAGE}-$__version__-tar.gz +if [[ -f $tarball ]]; then + rm -v dist/${PACKAGE}-$__version__-tar.gz +fi +finish diff --git a/admin-tools/make-dist-3.0-3.2.sh b/admin-tools/make-dist-3.0-3.2.sh new file mode 100755 index 0000000..8ac4ef3 --- /dev/null +++ b/admin-tools/make-dist-3.0-3.2.sh @@ -0,0 +1,62 @@ +#!/bin/bash +PACKAGE=spark_parser + +# FIXME put some of the below in a common routine +function finish { + cd $make_spark_dist_30_owd +} + +make_spark_dist_30_owd=$(pwd) +cd $(dirname ${BASH_SOURCE[0]}) +trap finish EXIT + +if ! source ./pyenv-3.0-3.2-versions ; then + exit $? +fi +if ! source ./setup-python-3.0.sh ; then + exit $? +fi + +cd .. +source $PACKAGE/version.py +if [[ ! -n $__version__ ]]; then + echo "You need to set __version__ first" + exit 1 +fi +echo $__version__ + +for pyversion in $PYVERSIONS; do + echo --- $pyversion --- + if [[ ${pyversion:0:4} == "pypy" ]] ; then + echo "$pyversion - PyPy does not get special packaging" + continue + fi + if ! pyenv local $pyversion ; then + exit $? + fi + # pip bdist_egg create too-general wheels. So + # we narrow that by moving the generated wheel. + + # Pick out first two numbers of version, e.g. 3.5.1 -> 35 + first_two=$(echo $pyversion | cut -d'.' -f 1-2 | sed -e 's/\.//') + rm -fr build + python setup.py bdist_egg bdist_wheel + if [[ $first_two =~ py* ]]; then + if [[ $first_two =~ pypy* ]]; then + # For PyPy, remove the what is after the dash, e.g. pypy37-none-any.whl instead of pypy37-7-none-any.whl + first_two=${first_two%-*} + fi + mv -v dist/${PACKAGE}-$__version__-{py3,$first_two}-none-any.whl + else + mv -v dist/${PACKAGE}-$__version__-{py3,py$first_two}-none-any.whl + fi + echo === $pyversion === +done + +python ./setup.py sdist + +tarball=dist/${PACKAGE}-${__version__}.tar.gz +if [[ -f $tarball ]]; then + mv -v $tarball dist/${PACKAGE}_31-${__version__}.tar.gz +fi +finish diff --git a/admin-tools/pyenv-newer-versions b/admin-tools/pyenv-newer-versions deleted file mode 100644 index b5c4ed6..0000000 --- a/admin-tools/pyenv-newer-versions +++ /dev/null @@ -1,6 +0,0 @@ -# -*- shell-script -*- -if [[ $0 == ${BASH_SOURCE[0]} ]] ; then - echo "This script should be *sourced* rather than run directly through bash" - exit 1 -fi -export PYVERSIONS='3.5.9 3.6.9 2.6.9 3.3.7 2.7.17 3.2.6 3.1.5 3.4.10 3.7.6 3.8.18, 3.11.7 3.12.1' From ce2135dab547cbb190321235620c33a6f68539d0 Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 8 Oct 2024 07:44:40 -0400 Subject: [PATCH 09/11] Get ready for release 1.9.0. --- admin-tools/make-dist-2.4-2.7.sh | 55 +++++++++++++++++++++++++++ admin-tools/make-dist-3.0-3.2.sh | 62 +++++++++++++++++++++++++++++++ admin-tools/make-dist-3.3-3.5.sh | 62 +++++++++++++++++++++++++++++++ admin-tools/make-dist-3.6-3.10.sh | 62 +++++++++++++++++++++++++++++++ admin-tools/pyenv-newer-versions | 6 --- 5 files changed, 241 insertions(+), 6 deletions(-) create mode 100755 admin-tools/make-dist-2.4-2.7.sh create mode 100755 admin-tools/make-dist-3.0-3.2.sh create mode 100755 admin-tools/make-dist-3.3-3.5.sh create mode 100755 admin-tools/make-dist-3.6-3.10.sh delete mode 100644 admin-tools/pyenv-newer-versions diff --git a/admin-tools/make-dist-2.4-2.7.sh b/admin-tools/make-dist-2.4-2.7.sh new file mode 100755 index 0000000..6946b69 --- /dev/null +++ b/admin-tools/make-dist-2.4-2.7.sh @@ -0,0 +1,55 @@ +#!/bin/bash +PACKAGE=spark_parser + +# FIXME put some of the below in a common routine +function finish { + cd $make_spark_dist_24_owd +} +make_spark_dist_24_owd=$(pwd) +trap finish EXIT + +cd $(dirname ${BASH_SOURCE[0]}) +if ! source ./pyenv-2.4-2.7-versions ; then + exit $? +fi +if ! source ./setup-python-2.4.sh ; then + exit $? +fi + +cd .. +source $PACKAGE/version.py +if [[ ! -n $__version__ ]]; then + echo "You need to set __version__ first" + exit 1 +fi +echo $__version__ + +for pyversion in $PYVERSIONS; do + echo --- $pyversion --- + if [[ ${pyversion:0:4} == "pypy" ]] ; then + echo "$pyversion - PyPy does not get special packaging" + continue + fi + if ! pyenv local $pyversion ; then + exit $? + fi + + rm -fr build + python setup.py bdist_egg + echo === $pyversion === +done + +echo "--- python 2.7 wheel ---" +pyenv local 2.7.18 +python setup.py bdist_wheel +echo === $pyversion === + +# PyPI can only have one source tarball. +# Tarballs can get created from the above setup, so make sure to remove them since we want +# the tarball from master. + +tarball=dist/${PACKAGE}-$__version__-tar.gz +if [[ -f $tarball ]]; then + rm -v dist/${PACKAGE}-$__version__-tar.gz +fi +finish diff --git a/admin-tools/make-dist-3.0-3.2.sh b/admin-tools/make-dist-3.0-3.2.sh new file mode 100755 index 0000000..8ac4ef3 --- /dev/null +++ b/admin-tools/make-dist-3.0-3.2.sh @@ -0,0 +1,62 @@ +#!/bin/bash +PACKAGE=spark_parser + +# FIXME put some of the below in a common routine +function finish { + cd $make_spark_dist_30_owd +} + +make_spark_dist_30_owd=$(pwd) +cd $(dirname ${BASH_SOURCE[0]}) +trap finish EXIT + +if ! source ./pyenv-3.0-3.2-versions ; then + exit $? +fi +if ! source ./setup-python-3.0.sh ; then + exit $? +fi + +cd .. +source $PACKAGE/version.py +if [[ ! -n $__version__ ]]; then + echo "You need to set __version__ first" + exit 1 +fi +echo $__version__ + +for pyversion in $PYVERSIONS; do + echo --- $pyversion --- + if [[ ${pyversion:0:4} == "pypy" ]] ; then + echo "$pyversion - PyPy does not get special packaging" + continue + fi + if ! pyenv local $pyversion ; then + exit $? + fi + # pip bdist_egg create too-general wheels. So + # we narrow that by moving the generated wheel. + + # Pick out first two numbers of version, e.g. 3.5.1 -> 35 + first_two=$(echo $pyversion | cut -d'.' -f 1-2 | sed -e 's/\.//') + rm -fr build + python setup.py bdist_egg bdist_wheel + if [[ $first_two =~ py* ]]; then + if [[ $first_two =~ pypy* ]]; then + # For PyPy, remove the what is after the dash, e.g. pypy37-none-any.whl instead of pypy37-7-none-any.whl + first_two=${first_two%-*} + fi + mv -v dist/${PACKAGE}-$__version__-{py3,$first_two}-none-any.whl + else + mv -v dist/${PACKAGE}-$__version__-{py3,py$first_two}-none-any.whl + fi + echo === $pyversion === +done + +python ./setup.py sdist + +tarball=dist/${PACKAGE}-${__version__}.tar.gz +if [[ -f $tarball ]]; then + mv -v $tarball dist/${PACKAGE}_31-${__version__}.tar.gz +fi +finish diff --git a/admin-tools/make-dist-3.3-3.5.sh b/admin-tools/make-dist-3.3-3.5.sh new file mode 100755 index 0000000..efdba80 --- /dev/null +++ b/admin-tools/make-dist-3.3-3.5.sh @@ -0,0 +1,62 @@ +#!/bin/bash +PACKAGE=spark_parser + +# FIXME put some of the below in a common routine +function finish { + cd $make_spark_dist_33_owd +} + +make_spark_dist_33_owd=$(pwd) +cd $(dirname ${BASH_SOURCE[0]}) +trap finish EXIT + +if ! source ./pyenv-3.3-3.5-versions ; then + exit $? +fi +if ! source ./setup-python-3.3.sh ; then + exit $? +fi + +cd .. +source $PACKAGE/version.py +if [[ ! -n $__version__ ]]; then + echo "You need to set __version__ first" + exit 1 +fi +echo $__version__ + +for pyversion in $PYVERSIONS; do + echo --- $pyversion --- + if [[ ${pyversion:0:4} == "pypy" ]] ; then + echo "$pyversion - PyPy does not get special packaging" + continue + fi + if ! pyenv local $pyversion ; then + exit $? + fi + # pip bdist_egg create too-general wheels. So + # we narrow that by moving the generated wheel. + + # Pick out first two numbers of version, e.g. 3.5.1 -> 35 + first_two=$(echo $pyversion | cut -d'.' -f 1-2 | sed -e 's/\.//') + rm -fr build + python setup.py bdist_egg bdist_wheel + if [[ $first_two =~ py* ]]; then + if [[ $first_two =~ pypy* ]]; then + # For PyPy, remove the what is after the dash, e.g. pypy37-none-any.whl instead of pypy37-7-none-any.whl + first_two=${first_two%-*} + fi + mv -v dist/${PACKAGE}-$__version__-{py3,$first_two}-none-any.whl + else + mv -v dist/${PACKAGE}-$__version__-{py3,py$first_two}-none-any.whl + fi + echo === $pyversion === +done + +python ./setup.py sdist + +tarball=dist/${PACKAGE}-${__version__}.tar.gz +if [[ -f $tarball ]]; then + mv -v $tarball dist/${PACKAGE}_33-${__version__}.tar.gz +fi +finish diff --git a/admin-tools/make-dist-3.6-3.10.sh b/admin-tools/make-dist-3.6-3.10.sh new file mode 100755 index 0000000..6f591b4 --- /dev/null +++ b/admin-tools/make-dist-3.6-3.10.sh @@ -0,0 +1,62 @@ +#!/bin/bash +PACKAGE=spark_parser + +# FIXME put some of the below in a common routine +function finish { + cd $make_spark_dist_36_owd +} + +cd $(dirname ${BASH_SOURCE[0]}) +make_spark_dist_36_owd=$(pwd) +trap finish EXIT + +if ! source ./pyenv-3.6-3.10-versions ; then + exit $? +fi +if ! source ./setup-python-3.6.sh ; then + exit $? +fi + +cd .. +source $PACKAGE/version.py +if [[ ! -n $__version__ ]]; then + echo "You need to set __version__ first" + exit 1 +fi +echo $__version__ + +for pyversion in $PYVERSIONS; do + echo --- $pyversion --- + if [[ ${pyversion:0:4} == "pypy" ]] ; then + echo "$pyversion - PyPy does not get special packaging" + continue + fi + if ! pyenv local $pyversion ; then + exit $? + fi + # pip bdist_egg create too-general wheels. So + # we narrow that by moving the generated wheel. + + # Pick out first two numbers of version, e.g. 3.5.1 -> 35 + first_two=$(echo $pyversion | cut -d'.' -f 1-2 | sed -e 's/\.//') + rm -fr build + python setup.py bdist_egg bdist_wheel + if [[ $first_two =~ py* ]]; then + if [[ $first_two =~ pypy* ]]; then + # For PyPy, remove the what is after the dash, e.g. pypy37-none-any.whl instead of pypy37-7-none-any.whl + first_two=${first_two%-*} + fi + mv -v dist/${PACKAGE}-$__version__-{py3,$first_two}-none-any.whl + else + mv -v dist/${PACKAGE}-$__version__-{py3,py$first_two}-none-any.whl + fi + echo === $pyversion === +done + +python ./setup.py sdist + +tarball=dist/${PACKAGE}-${__version__}.tar.gz +if [[ -f $tarball ]]; then + mv -v $tarball dist/${PACKAGE}_36-${__version__}.tar.gz +fi +finish diff --git a/admin-tools/pyenv-newer-versions b/admin-tools/pyenv-newer-versions deleted file mode 100644 index b5c4ed6..0000000 --- a/admin-tools/pyenv-newer-versions +++ /dev/null @@ -1,6 +0,0 @@ -# -*- shell-script -*- -if [[ $0 == ${BASH_SOURCE[0]} ]] ; then - echo "This script should be *sourced* rather than run directly through bash" - exit 1 -fi -export PYVERSIONS='3.5.9 3.6.9 2.6.9 3.3.7 2.7.17 3.2.6 3.1.5 3.4.10 3.7.6 3.8.18, 3.11.7 3.12.1' From 1fd9ba5062775964d6708515cce726e716b153d1 Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 8 Oct 2024 07:44:40 -0400 Subject: [PATCH 10/11] Get ready for release 1.9.0. --- admin-tools/make-dist-2.4-2.7.sh | 55 +++++++++++++++++++++++++++ admin-tools/make-dist-3.0-3.2.sh | 62 +++++++++++++++++++++++++++++++ admin-tools/make-dist-3.3-3.5.sh | 62 +++++++++++++++++++++++++++++++ admin-tools/make-dist-3.6-3.10.sh | 62 +++++++++++++++++++++++++++++++ admin-tools/make-dist-newer.sh | 38 ------------------- admin-tools/make-dist-newest.sh | 53 ++++++++++++++++++++++++++ admin-tools/pyenv-newer-versions | 6 --- 7 files changed, 294 insertions(+), 44 deletions(-) create mode 100755 admin-tools/make-dist-2.4-2.7.sh create mode 100755 admin-tools/make-dist-3.0-3.2.sh create mode 100755 admin-tools/make-dist-3.3-3.5.sh create mode 100755 admin-tools/make-dist-3.6-3.10.sh delete mode 100755 admin-tools/make-dist-newer.sh create mode 100755 admin-tools/make-dist-newest.sh delete mode 100644 admin-tools/pyenv-newer-versions diff --git a/admin-tools/make-dist-2.4-2.7.sh b/admin-tools/make-dist-2.4-2.7.sh new file mode 100755 index 0000000..6946b69 --- /dev/null +++ b/admin-tools/make-dist-2.4-2.7.sh @@ -0,0 +1,55 @@ +#!/bin/bash +PACKAGE=spark_parser + +# FIXME put some of the below in a common routine +function finish { + cd $make_spark_dist_24_owd +} +make_spark_dist_24_owd=$(pwd) +trap finish EXIT + +cd $(dirname ${BASH_SOURCE[0]}) +if ! source ./pyenv-2.4-2.7-versions ; then + exit $? +fi +if ! source ./setup-python-2.4.sh ; then + exit $? +fi + +cd .. +source $PACKAGE/version.py +if [[ ! -n $__version__ ]]; then + echo "You need to set __version__ first" + exit 1 +fi +echo $__version__ + +for pyversion in $PYVERSIONS; do + echo --- $pyversion --- + if [[ ${pyversion:0:4} == "pypy" ]] ; then + echo "$pyversion - PyPy does not get special packaging" + continue + fi + if ! pyenv local $pyversion ; then + exit $? + fi + + rm -fr build + python setup.py bdist_egg + echo === $pyversion === +done + +echo "--- python 2.7 wheel ---" +pyenv local 2.7.18 +python setup.py bdist_wheel +echo === $pyversion === + +# PyPI can only have one source tarball. +# Tarballs can get created from the above setup, so make sure to remove them since we want +# the tarball from master. + +tarball=dist/${PACKAGE}-$__version__-tar.gz +if [[ -f $tarball ]]; then + rm -v dist/${PACKAGE}-$__version__-tar.gz +fi +finish diff --git a/admin-tools/make-dist-3.0-3.2.sh b/admin-tools/make-dist-3.0-3.2.sh new file mode 100755 index 0000000..8ac4ef3 --- /dev/null +++ b/admin-tools/make-dist-3.0-3.2.sh @@ -0,0 +1,62 @@ +#!/bin/bash +PACKAGE=spark_parser + +# FIXME put some of the below in a common routine +function finish { + cd $make_spark_dist_30_owd +} + +make_spark_dist_30_owd=$(pwd) +cd $(dirname ${BASH_SOURCE[0]}) +trap finish EXIT + +if ! source ./pyenv-3.0-3.2-versions ; then + exit $? +fi +if ! source ./setup-python-3.0.sh ; then + exit $? +fi + +cd .. +source $PACKAGE/version.py +if [[ ! -n $__version__ ]]; then + echo "You need to set __version__ first" + exit 1 +fi +echo $__version__ + +for pyversion in $PYVERSIONS; do + echo --- $pyversion --- + if [[ ${pyversion:0:4} == "pypy" ]] ; then + echo "$pyversion - PyPy does not get special packaging" + continue + fi + if ! pyenv local $pyversion ; then + exit $? + fi + # pip bdist_egg create too-general wheels. So + # we narrow that by moving the generated wheel. + + # Pick out first two numbers of version, e.g. 3.5.1 -> 35 + first_two=$(echo $pyversion | cut -d'.' -f 1-2 | sed -e 's/\.//') + rm -fr build + python setup.py bdist_egg bdist_wheel + if [[ $first_two =~ py* ]]; then + if [[ $first_two =~ pypy* ]]; then + # For PyPy, remove the what is after the dash, e.g. pypy37-none-any.whl instead of pypy37-7-none-any.whl + first_two=${first_two%-*} + fi + mv -v dist/${PACKAGE}-$__version__-{py3,$first_two}-none-any.whl + else + mv -v dist/${PACKAGE}-$__version__-{py3,py$first_two}-none-any.whl + fi + echo === $pyversion === +done + +python ./setup.py sdist + +tarball=dist/${PACKAGE}-${__version__}.tar.gz +if [[ -f $tarball ]]; then + mv -v $tarball dist/${PACKAGE}_31-${__version__}.tar.gz +fi +finish diff --git a/admin-tools/make-dist-3.3-3.5.sh b/admin-tools/make-dist-3.3-3.5.sh new file mode 100755 index 0000000..efdba80 --- /dev/null +++ b/admin-tools/make-dist-3.3-3.5.sh @@ -0,0 +1,62 @@ +#!/bin/bash +PACKAGE=spark_parser + +# FIXME put some of the below in a common routine +function finish { + cd $make_spark_dist_33_owd +} + +make_spark_dist_33_owd=$(pwd) +cd $(dirname ${BASH_SOURCE[0]}) +trap finish EXIT + +if ! source ./pyenv-3.3-3.5-versions ; then + exit $? +fi +if ! source ./setup-python-3.3.sh ; then + exit $? +fi + +cd .. +source $PACKAGE/version.py +if [[ ! -n $__version__ ]]; then + echo "You need to set __version__ first" + exit 1 +fi +echo $__version__ + +for pyversion in $PYVERSIONS; do + echo --- $pyversion --- + if [[ ${pyversion:0:4} == "pypy" ]] ; then + echo "$pyversion - PyPy does not get special packaging" + continue + fi + if ! pyenv local $pyversion ; then + exit $? + fi + # pip bdist_egg create too-general wheels. So + # we narrow that by moving the generated wheel. + + # Pick out first two numbers of version, e.g. 3.5.1 -> 35 + first_two=$(echo $pyversion | cut -d'.' -f 1-2 | sed -e 's/\.//') + rm -fr build + python setup.py bdist_egg bdist_wheel + if [[ $first_two =~ py* ]]; then + if [[ $first_two =~ pypy* ]]; then + # For PyPy, remove the what is after the dash, e.g. pypy37-none-any.whl instead of pypy37-7-none-any.whl + first_two=${first_two%-*} + fi + mv -v dist/${PACKAGE}-$__version__-{py3,$first_two}-none-any.whl + else + mv -v dist/${PACKAGE}-$__version__-{py3,py$first_two}-none-any.whl + fi + echo === $pyversion === +done + +python ./setup.py sdist + +tarball=dist/${PACKAGE}-${__version__}.tar.gz +if [[ -f $tarball ]]; then + mv -v $tarball dist/${PACKAGE}_33-${__version__}.tar.gz +fi +finish diff --git a/admin-tools/make-dist-3.6-3.10.sh b/admin-tools/make-dist-3.6-3.10.sh new file mode 100755 index 0000000..6f591b4 --- /dev/null +++ b/admin-tools/make-dist-3.6-3.10.sh @@ -0,0 +1,62 @@ +#!/bin/bash +PACKAGE=spark_parser + +# FIXME put some of the below in a common routine +function finish { + cd $make_spark_dist_36_owd +} + +cd $(dirname ${BASH_SOURCE[0]}) +make_spark_dist_36_owd=$(pwd) +trap finish EXIT + +if ! source ./pyenv-3.6-3.10-versions ; then + exit $? +fi +if ! source ./setup-python-3.6.sh ; then + exit $? +fi + +cd .. +source $PACKAGE/version.py +if [[ ! -n $__version__ ]]; then + echo "You need to set __version__ first" + exit 1 +fi +echo $__version__ + +for pyversion in $PYVERSIONS; do + echo --- $pyversion --- + if [[ ${pyversion:0:4} == "pypy" ]] ; then + echo "$pyversion - PyPy does not get special packaging" + continue + fi + if ! pyenv local $pyversion ; then + exit $? + fi + # pip bdist_egg create too-general wheels. So + # we narrow that by moving the generated wheel. + + # Pick out first two numbers of version, e.g. 3.5.1 -> 35 + first_two=$(echo $pyversion | cut -d'.' -f 1-2 | sed -e 's/\.//') + rm -fr build + python setup.py bdist_egg bdist_wheel + if [[ $first_two =~ py* ]]; then + if [[ $first_two =~ pypy* ]]; then + # For PyPy, remove the what is after the dash, e.g. pypy37-none-any.whl instead of pypy37-7-none-any.whl + first_two=${first_two%-*} + fi + mv -v dist/${PACKAGE}-$__version__-{py3,$first_two}-none-any.whl + else + mv -v dist/${PACKAGE}-$__version__-{py3,py$first_two}-none-any.whl + fi + echo === $pyversion === +done + +python ./setup.py sdist + +tarball=dist/${PACKAGE}-${__version__}.tar.gz +if [[ -f $tarball ]]; then + mv -v $tarball dist/${PACKAGE}_36-${__version__}.tar.gz +fi +finish diff --git a/admin-tools/make-dist-newer.sh b/admin-tools/make-dist-newer.sh deleted file mode 100755 index b64e486..0000000 --- a/admin-tools/make-dist-newer.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -PACKAGE=spark_parser - -# FIXME put some of the below in a common routine -function finish { - cd $owd -} - -cd $(dirname ${BASH_SOURCE[0]}) -owd=$(pwd) -trap finish EXIT - -if ! source ./pyenv-newer-versions ; then - exit $? -fi -if ! source ./setup-master.sh ; then - exit $? -fi - -cd .. -source $PACKAGE/version.py -echo $VERSION - -for pyversion in $PYVERSIONS; do - if ! pyenv local $pyversion ; then - exit $? - fi - # pip bdist_egg create too-general wheels. So - # we narrow that by moving the generated wheel. - - # Pick out first two number of version, e.g. 3.5.1 -> 35 - first_two=$(echo $pyversion | cut -d'.' -f 1-2 | sed -e 's/\.//') - rm -fr build - python setup.py bdist_egg bdist_wheel - mv -v dist/${PACKAGE}-${VERSION}-{py2.py3,py$first_two}-none-any.whl -done - -python ./setup.py sdist diff --git a/admin-tools/make-dist-newest.sh b/admin-tools/make-dist-newest.sh new file mode 100755 index 0000000..7209069 --- /dev/null +++ b/admin-tools/make-dist-newest.sh @@ -0,0 +1,53 @@ +#!/bin/bash +PACKAGE=spark_parser + +# FIXME put some of the below in a common routine +function finish { + cd $make_spark_dist_newest_owd +} + +cd $(dirname ${BASH_SOURCE[0]}) +make_spark_dist_newest_owd=$(pwd) +trap finish EXIT + +if ! source ./pyenv-newest-versions ; then + exit $? +fi +if ! source ./setup-master.sh ; then + exit $? +fi + +cd .. +source $PACKAGE/version.py +echo $__version__ + +for pyversion in $PYVERSIONS; do + echo --- $pyversion --- + if [[ ${pyversion:0:4} == "pypy" ]] ; then + echo "$pyversion - PyPy does not get special packaging" + continue + fi + if ! pyenv local $pyversion ; then + exit $? + fi + # pip bdist_egg create too-general wheels. So + # we narrow that by moving the generated wheel. + + # Pick out first two numbers of version, e.g. 3.5.1 -> 35 + first_two=$(echo $pyversion | cut -d'.' -f 1-2 | sed -e 's/\.//') + rm -fr build + python setup.py bdist_egg bdist_wheel + if [[ $first_two =~ py* ]]; then + if [[ $first_two =~ pypy* ]]; then + # For PyPy, remove the what is after the dash, e.g. pypy37-none-any.whl instead of pypy37-7-none-any.whl + first_two=${first_two%-*} + fi + mv -v dist/${PACKAGE}-$__version__-{py3,$first_two}-none-any.whl + else + mv -v dist/${PACKAGE}-$__version__-{py3,py$first_two}-none-any.whl + fi + echo === $pyversion === +done + +python ./setup.py sdist +finish diff --git a/admin-tools/pyenv-newer-versions b/admin-tools/pyenv-newer-versions deleted file mode 100644 index b5c4ed6..0000000 --- a/admin-tools/pyenv-newer-versions +++ /dev/null @@ -1,6 +0,0 @@ -# -*- shell-script -*- -if [[ $0 == ${BASH_SOURCE[0]} ]] ; then - echo "This script should be *sourced* rather than run directly through bash" - exit 1 -fi -export PYVERSIONS='3.5.9 3.6.9 2.6.9 3.3.7 2.7.17 3.2.6 3.1.5 3.4.10 3.7.6 3.8.18, 3.11.7 3.12.1' From 74a94c82e88149e3dff87dc767b8ef48e4a3d913 Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 8 Oct 2024 09:28:47 -0400 Subject: [PATCH 11/11] Reinstate older setup --- spark_parser/bin/parser_coverage.py => bin/spark-parser-coverage | 0 spark_parser/bin/__init__.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename spark_parser/bin/parser_coverage.py => bin/spark-parser-coverage (100%) delete mode 100644 spark_parser/bin/__init__.py diff --git a/spark_parser/bin/parser_coverage.py b/bin/spark-parser-coverage similarity index 100% rename from spark_parser/bin/parser_coverage.py rename to bin/spark-parser-coverage diff --git a/spark_parser/bin/__init__.py b/spark_parser/bin/__init__.py deleted file mode 100644 index e69de29..0000000