From 6a295983aa3dae745ef68d2b66199207724703e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=A5=96=E5=BB=BA?= Date: Mon, 13 Nov 2023 14:09:57 +0000 Subject: [PATCH] Revert "python: Rename build related code to ovs_build_helpers." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张祖建 --- Makefile.am | 2 +- build-aux/extract-ofp-fields | 12 ++++----- build-aux/gen_ofp_field_decoders | 4 +-- build-aux/sodepends.py | 3 +-- build-aux/soexpand.py | 3 +-- build-aux/xml2nroff | 10 ++++---- ovsdb/ovsdb-doc | 2 +- python/automake.mk | 25 ++++++++----------- .../{ovs_build_helpers => build}/__init__.py | 0 .../extract_ofp_fields.py | 0 python/{ovs_build_helpers => build}/nroff.py | 0 python/{ovs_build_helpers => build}/soutil.py | 0 12 files changed, 28 insertions(+), 33 deletions(-) rename python/{ovs_build_helpers => build}/__init__.py (100%) rename python/{ovs_build_helpers => build}/extract_ofp_fields.py (100%) rename python/{ovs_build_helpers => build}/nroff.py (100%) rename python/{ovs_build_helpers => build}/soutil.py (100%) diff --git a/Makefile.am b/Makefile.am index eddb981aebb..49d98d6b2b8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -414,7 +414,7 @@ endif CLEANFILES += flake8-check -include manpages.mk -manpages.mk: $(MAN_ROOTS) build-aux/sodepends.py python/ovs_build_helpers/soutil.py +manpages.mk: $(MAN_ROOTS) build-aux/sodepends.py python/build/soutil.py @PYTHONPATH=$$PYTHONPATH$(psep)$(srcdir)/python $(PYTHON3) $(srcdir)/build-aux/sodepends.py -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp @if cmp -s $(@F).tmp $@; then \ touch $@; \ diff --git a/build-aux/extract-ofp-fields b/build-aux/extract-ofp-fields index 89d80c20855..4058f18d5a9 100755 --- a/build-aux/extract-ofp-fields +++ b/build-aux/extract-ofp-fields @@ -4,9 +4,9 @@ import getopt import sys import os.path import xml.dom.minidom +import build.nroff -from ovs_build_helpers import nroff -from ovs_build_helpers.extract_ofp_fields import ( +from build.extract_ofp_fields import ( extract_ofp_fields, PREREQS, OXM_CLASSES, @@ -297,7 +297,7 @@ l lx. body += [".TE\n"] body += [".PP\n"] - body += [nroff.block_xml_to_nroff(field_node.childNodes)] + body += [build.nroff.block_xml_to_nroff(field_node.childNodes)] def group_xml_to_nroff(group_node, fields): @@ -310,11 +310,11 @@ def group_xml_to_nroff(group_node, fields): id_ = node.attributes["id"].nodeValue field_to_xml(node, fields[id_], body, summary) else: - body += [nroff.block_xml_to_nroff([node])] + body += [build.nroff.block_xml_to_nroff([node])] content = [ ".bp\n", - '.SH "%s"\n' % nroff.text_to_nroff(title.upper() + " FIELDS"), + '.SH "%s"\n' % build.nroff.text_to_nroff(title.upper() + " FIELDS"), '.SS "Summary:"\n', ".TS\n", "tab(;),nowarn;\n", @@ -422,7 +422,7 @@ ovs\-fields \- protocol header fields in OpenFlow and Open vSwitch elif node.nodeType == node.COMMENT_NODE: pass else: - s += nroff.block_xml_to_nroff([node]) + s += build.nroff.block_xml_to_nroff([node]) for f in fields: if "used" not in f: diff --git a/build-aux/gen_ofp_field_decoders b/build-aux/gen_ofp_field_decoders index 0cb6108c222..0b797ee8c8c 100755 --- a/build-aux/gen_ofp_field_decoders +++ b/build-aux/gen_ofp_field_decoders @@ -2,7 +2,7 @@ import argparse -from ovs_build_helpers.extract_ofp_fields import extract_ofp_fields +import build.extract_ofp_fields as extract_fields def main(): @@ -19,7 +19,7 @@ def main(): args = parser.parse_args() - fields = extract_ofp_fields(args.metaflow) + fields = extract_fields.extract_ofp_fields(args.metaflow) field_decoders = {} aliases = {} diff --git a/build-aux/sodepends.py b/build-aux/sodepends.py index ac8dd61a4b2..45812bcbd70 100755 --- a/build-aux/sodepends.py +++ b/build-aux/sodepends.py @@ -14,10 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from build import soutil import sys -from ovs_build_helpers import soutil - def sodepends(include_dirs, filenames, dst): ok = True diff --git a/build-aux/soexpand.py b/build-aux/soexpand.py index 7d4dc0486a9..00adcf47a35 100755 --- a/build-aux/soexpand.py +++ b/build-aux/soexpand.py @@ -14,10 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from build import soutil import sys -from ovs_build_helpers import soutil - def soexpand(include_dirs, src, dst): ok = True diff --git a/build-aux/xml2nroff b/build-aux/xml2nroff index 3e937910bed..ee5553f4564 100755 --- a/build-aux/xml2nroff +++ b/build-aux/xml2nroff @@ -18,7 +18,7 @@ import getopt import sys import xml.dom.minidom -from ovs_build_helpers import nroff +import build.nroff argv0 = sys.argv[0] @@ -90,10 +90,10 @@ def manpage_to_nroff(xml_file, subst, include_path, version=None): . I "\\$1" . RE .. -''' % (nroff.text_to_nroff(program), nroff.text_to_nroff(section), - nroff.text_to_nroff(title), nroff.text_to_nroff(version)) +''' % (build.nroff.text_to_nroff(program), build.nroff.text_to_nroff(section), + build.nroff.text_to_nroff(title), build.nroff.text_to_nroff(version)) - s += nroff.block_xml_to_nroff(doc.childNodes) + "\n" + s += build.nroff.block_xml_to_nroff(doc.childNodes) + "\n" return s @@ -139,7 +139,7 @@ if __name__ == "__main__": try: s = manpage_to_nroff(args[0], subst, include_path, version) - except nroff.error.Error as e: + except build.nroff.error.Error as e: sys.stderr.write("%s: %s\n" % (argv0, e.msg)) sys.exit(1) for line in s.splitlines(): diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc index 099770d253f..10d0c0c1343 100755 --- a/ovsdb/ovsdb-doc +++ b/ovsdb/ovsdb-doc @@ -24,7 +24,7 @@ import ovs.json from ovs.db import error import ovs.db.schema -from ovs_build_helpers.nroff import * +from build.nroff import * argv0 = sys.argv[0] diff --git a/python/automake.mk b/python/automake.mk index b0f444169cf..d00911828c6 100644 --- a/python/automake.mk +++ b/python/automake.mk @@ -64,10 +64,10 @@ ovs_pytests = \ # These python files are used at build time but not runtime, # so they are not installed. EXTRA_DIST += \ - python/ovs_build_helpers/__init__.py \ - python/ovs_build_helpers/extract_ofp_fields.py \ - python/ovs_build_helpers/nroff.py \ - python/ovs_build_helpers/soutil.py + python/build/__init__.py \ + python/build/extract_ofp_fields.py \ + python/build/nroff.py \ + python/build/soutil.py # PyPI support. EXTRA_DIST += \ @@ -86,10 +86,10 @@ PYCOV_CLEAN_FILES += $(PYFILES:.py=.py,cover) FLAKE8_PYFILES += \ $(filter-out python/ovs/compat/% python/ovs/dirs.py,$(PYFILES)) \ - python/ovs_build_helpers/__init__.py \ - python/ovs_build_helpers/extract_ofp_fields.py \ - python/ovs_build_helpers/nroff.py \ - python/ovs_build_helpers/soutil.py \ + python/build/__init__.py \ + python/build/extract_ofp_fields.py \ + python/build/nroff.py \ + python/build/soutil.py \ python/ovs/dirs.py.template \ python/setup.py @@ -110,14 +110,11 @@ ovs-install-data-local: $(INSTALL_DATA) python/ovs/dirs.py.tmp $(DESTDIR)$(pkgdatadir)/python/ovs/dirs.py rm python/ovs/dirs.py.tmp -.PHONY: python-sdist python-sdist: $(srcdir)/python/ovs/version.py $(ovs_pyfiles) python/ovs/dirs.py - cd python/ && $(PYTHON3) -m build --sdist - -.PHONY: pypi-upload -pypi-upload: python-sdist - twine upload python/dist/ovs-$(VERSION).tar.gz + (cd python/ && $(PYTHON3) setup.py sdist) +pypi-upload: $(srcdir)/python/ovs/version.py $(ovs_pyfiles) python/ovs/dirs.py + (cd python/ && $(PYTHON3) setup.py sdist upload) install-data-local: ovs-install-data-local UNINSTALL_LOCAL += ovs-uninstall-local diff --git a/python/ovs_build_helpers/__init__.py b/python/build/__init__.py similarity index 100% rename from python/ovs_build_helpers/__init__.py rename to python/build/__init__.py diff --git a/python/ovs_build_helpers/extract_ofp_fields.py b/python/build/extract_ofp_fields.py similarity index 100% rename from python/ovs_build_helpers/extract_ofp_fields.py rename to python/build/extract_ofp_fields.py diff --git a/python/ovs_build_helpers/nroff.py b/python/build/nroff.py similarity index 100% rename from python/ovs_build_helpers/nroff.py rename to python/build/nroff.py diff --git a/python/ovs_build_helpers/soutil.py b/python/build/soutil.py similarity index 100% rename from python/ovs_build_helpers/soutil.py rename to python/build/soutil.py