2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

Revert "Test the Python C JSON extension"

This reverts commit a7be68a4d7
and a subsequent commit 4617d1f6bd.
There are too many issues with these patches. It's better to revert
them for now and make a separate fixed versions later if needed.

List of issues (maybe not full):

1. 'make clean' removes entire 'python' directory.

2. Fully broken Travis-CI testsuite build:
    building 'ovs._json' extension
    creating build/temp.linux-x86_64-2.7
    error: could not create 'build/temp.linux-x86_64-2.7': \
           Permission denied
    https://travis-ci.org/openvswitch/ovs/jobs/440693765

3. Broken local testsuite build on Ubuntu 18.04:
    running build_ext
    building 'ovs._json' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/ovs
    <...>
    /usr/bin/ld: .libs/libopenvswitch.a(util.o): \
        relocation R_X86_64_TPOFF32 against `var.7749' can not be \
        used when making a shared object; recompile with -fPIC
    <...>
    collect2: error: ld returned 1 exit status

4. Fedora build failure because of 'setuptools' ('distutils')
   hard dependency on 'redhat-rpm-config' package:
    building 'ovs._json' extension
    <...>
    gcc: error: <...>/redhat-hardened-cc1: No such file or directory

5. Looks like 'setuptools' also could download and install
   unwanted python modules during package build.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Ilya Maximets
2018-10-15 19:44:36 +03:00
committed by Ben Pfaff
parent efc93e6613
commit e6703555e5
9 changed files with 84 additions and 206 deletions

View File

@@ -92,17 +92,6 @@ python-sdist: $(srcdir)/python/ovs/version.py $(ovs_pyfiles) python/ovs/dirs.py
pypi-upload: $(srcdir)/python/ovs/version.py $(ovs_pyfiles) python/ovs/dirs.py
(cd python/ && $(PYTHON) setup.py sdist upload)
ALL_LOCAL += python-build
python-build:$(lib_LTLIBRARIES)
(cd $(srcdir)/python/ && $(PYTHON) setup.py build_py -d $(abs_top_builddir)/python && $(PYTHON) setup.py build_ext -b $(abs_top_builddir)/python -I$(abs_top_srcdir)/include:$(abs_top_builddir)/include -L$(abs_top_builddir)/lib/.libs)
if HAVE_PYTHON3
(cd $(srcdir)/python/ && $(PYTHON3) setup.py build_py -d $(abs_top_builddir)/python && $(PYTHON3) setup.py build_ext -b $(abs_top_builddir)/python -I$(abs_top_srcdir)/include:$(abs_top_builddir)/include -L$(abs_top_builddir)/lib/.libs)
CLEAN_LOCAL += python-clean
python-clean:
rm -rf $(abs_top_builddir)/python
endif
else
ovs-install-data-local:
@:

View File

@@ -21,13 +21,10 @@ import sys
import six
PARSER_C = 'C'
PARSER_PY = 'PYTHON'
try:
import ovs._json
PARSER = PARSER_C
except ImportError:
PARSER = PARSER_PY
pass
__pychecker__ = 'no-stringiter'
@@ -94,9 +91,10 @@ class Parser(object):
MAX_HEIGHT = 1000
def __new__(cls, *args, **kwargs):
if PARSER == PARSER_C:
try:
return ovs._json.Parser(*args, **kwargs)
return super(Parser, cls).__new__(cls)
except NameError:
return super(Parser, cls).__new__(cls)
def __init__(self, check_trailer=False):
self.check_trailer = check_trailer

View File

@@ -272,8 +272,7 @@ class Connection(object):
# data, so we convert it here as soon as possible.
if data and not error:
try:
if six.PY3 or ovs.json.PARSER == ovs.json.PARSER_PY:
data = decoder.decode(data)
data = decoder.decode(data)
except UnicodeError:
error = errno.EILSEQ
if error:
@@ -299,11 +298,7 @@ class Connection(object):
else:
if self.parser is None:
self.parser = ovs.json.Parser()
if six.PY3 and ovs.json.PARSER == ovs.json.PARSER_C:
self.input = self.input.encode('utf-8')[
self.parser.feed(self.input):].decode()
else:
self.input = self.input[self.parser.feed(self.input):]
self.input = self.input[self.parser.feed(self.input):]
if self.parser.is_done():
msg = self.__process_msg()
if msg: