Fixing flake8 warnings and errors

flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude benchmark

Excluding the benchmark directory (due to protobuf generated files)
Also removing some Python2 specific code
This commit is contained in:
Jacob Alexander
2019-09-26 22:18:28 -07:00
parent 1f0200af9c
commit b3021e4f6b
37 changed files with 536 additions and 452 deletions

View File

@@ -5,26 +5,29 @@ import os
import tempfile
def build_libcapnp(bundle_dir, build_dir, verbose=False):
bundle_dir = os.path.abspath(bundle_dir)
capnp_dir = os.path.join(bundle_dir, 'capnproto-c++')
build_dir = os.path.abspath(build_dir)
'''
Build capnproto
'''
bundle_dir = os.path.abspath(bundle_dir)
capnp_dir = os.path.join(bundle_dir, 'capnproto-c++')
build_dir = os.path.abspath(build_dir)
with tempfile.TemporaryFile() as f:
stdout = f
if verbose:
stdout = None
cxxflags = os.environ.get('CXXFLAGS', None)
os.environ['CXXFLAGS'] = (cxxflags or '') + ' -fPIC -O2 -DNDEBUG'
conf = subprocess.Popen(['./configure', '--disable-shared', '--prefix', build_dir], cwd=capnp_dir, stdout=stdout)
returncode = conf.wait()
if returncode != 0:
raise RuntimeError('Configure failed')
with tempfile.TemporaryFile() as f:
stdout = f
if verbose:
stdout = None
cxxflags = os.environ.get('CXXFLAGS', None)
os.environ['CXXFLAGS'] = (cxxflags or '') + ' -fPIC -O2 -DNDEBUG'
conf = subprocess.Popen(['./configure', '--disable-shared', '--prefix', build_dir], cwd=capnp_dir, stdout=stdout)
returncode = conf.wait()
if returncode != 0:
raise RuntimeError('Configure failed')
make = subprocess.Popen(['make', '-j4', 'install'], cwd=capnp_dir, stdout=stdout)
returncode = make.wait()
if cxxflags is None:
del os.environ['CXXFLAGS']
else:
os.environ['CXXFLAGS'] = cxxflags
if returncode != 0:
raise RuntimeError('Make failed')
make = subprocess.Popen(['make', '-j4', 'install'], cwd=capnp_dir, stdout=stdout)
returncode = make.wait()
if cxxflags is None:
del os.environ['CXXFLAGS']
else:
os.environ['CXXFLAGS'] = cxxflags
if returncode != 0:
raise RuntimeError('Make failed')