Fixing remaining flake8 lint warnings
This commit is contained in:
@@ -6,6 +6,7 @@ import shutil
|
||||
import struct
|
||||
import sys
|
||||
|
||||
|
||||
def build_libcapnp(bundle_dir, build_dir):
|
||||
'''
|
||||
Build capnproto
|
||||
|
||||
@@ -20,10 +20,12 @@ from .msg import info
|
||||
|
||||
pjoin = os.path.join
|
||||
|
||||
|
||||
#
|
||||
# Constants
|
||||
#
|
||||
|
||||
|
||||
bundled_version = (0, 7, 0)
|
||||
libcapnp_name = "capnproto-c++-%i.%i.%i.tar.gz" % (bundled_version)
|
||||
libcapnp_url = "https://capnproto.org/" + libcapnp_name
|
||||
@@ -31,6 +33,7 @@ libcapnp_url = "https://capnproto.org/" + libcapnp_name
|
||||
HERE = os.path.dirname(__file__)
|
||||
ROOT = os.path.dirname(HERE)
|
||||
|
||||
|
||||
#
|
||||
# Utilities
|
||||
#
|
||||
@@ -40,11 +43,13 @@ def untgz(archive):
|
||||
"""Remove .tar.gz"""
|
||||
return archive.replace('.tar.gz', '')
|
||||
|
||||
|
||||
def localpath(*args):
|
||||
"""construct an absolute path from a list relative to the root pycapnp directory"""
|
||||
plist = [ROOT] + list(args)
|
||||
return os.path.abspath(pjoin(*plist))
|
||||
|
||||
|
||||
def fetch_archive(savedir, url, fname, force=False):
|
||||
"""download an archive to a specific location"""
|
||||
dest = pjoin(savedir, fname)
|
||||
@@ -59,10 +64,12 @@ def fetch_archive(savedir, url, fname, force=False):
|
||||
f.write(req.read())
|
||||
return dest
|
||||
|
||||
|
||||
#
|
||||
# libcapnp
|
||||
#
|
||||
|
||||
|
||||
def fetch_libcapnp(savedir, url=None):
|
||||
"""download and extract libcapnp"""
|
||||
is_preconfigured = False
|
||||
@@ -84,4 +91,3 @@ def fetch_libcapnp(savedir, url=None):
|
||||
else:
|
||||
cpp_dir = os.path.join(with_version, 'c++')
|
||||
shutil.move(cpp_dir, dest)
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
# Utility functions (adapted from h5py: http://h5py.googlecode.com)
|
||||
#
|
||||
|
||||
|
||||
def v_str(v_tuple):
|
||||
"""turn (2,0,1) into '2.0.1'."""
|
||||
return ".".join(str(x) for x in v_tuple)
|
||||
|
||||
@@ -32,6 +32,7 @@ pjoin = os.path.join
|
||||
# Utility functions (adapted from h5py: http://h5py.googlecode.com)
|
||||
#
|
||||
|
||||
|
||||
def test_compilation(cfile, compiler=None, **compiler_attrs):
|
||||
"""Test simple compilation with given settings"""
|
||||
cc = get_compiler(compiler, **compiler_attrs)
|
||||
|
||||
@@ -24,9 +24,11 @@ def customize_mingw(cc):
|
||||
if 'msvcr90' in cc.dll_libraries:
|
||||
cc.dll_libraries.remove('msvcr90')
|
||||
|
||||
|
||||
def customize_msvc(cc):
|
||||
pass
|
||||
|
||||
|
||||
def get_compiler(compiler, **compiler_attrs):
|
||||
"""get and customize a compiler"""
|
||||
if compiler is None or isinstance(compiler, str):
|
||||
|
||||
@@ -21,23 +21,28 @@ else:
|
||||
logger.setLevel(logging.INFO)
|
||||
logger.addHandler(logging.StreamHandler(sys.stderr))
|
||||
|
||||
|
||||
def debug(msg):
|
||||
"""Debug"""
|
||||
logger.debug(msg)
|
||||
|
||||
|
||||
def info(msg):
|
||||
"""Info"""
|
||||
logger.info(msg)
|
||||
|
||||
|
||||
def fatal(msg, code=1):
|
||||
"""Fatal"""
|
||||
logger.error("Fatal: %s", msg)
|
||||
exit(code)
|
||||
|
||||
|
||||
def warn(msg):
|
||||
"""Warning"""
|
||||
logger.error("Warning: %s", msg)
|
||||
|
||||
|
||||
def line(c='*', width=48):
|
||||
"""Horizontal rule"""
|
||||
print(c * (width // len(c)))
|
||||
|
||||
@@ -14,8 +14,10 @@ from .misc import get_output_error
|
||||
pjoin = os.path.join
|
||||
|
||||
# LIB_PAT from delocate
|
||||
LIB_PAT = re.compile(r"\s*(.*) \(compatibility version (\d+\.\d+\.\d+), "
|
||||
r"current version (\d+\.\d+\.\d+)\)")
|
||||
LIB_PAT = re.compile(
|
||||
r"\s*(.*) \(compatibility version (\d+\.\d+\.\d+), current version (\d+\.\d+\.\d+)\)"
|
||||
)
|
||||
|
||||
|
||||
def _get_libs(fname):
|
||||
rc, so, se = get_output_error(['otool', '-L', fname])
|
||||
@@ -27,6 +29,7 @@ def _get_libs(fname):
|
||||
if m:
|
||||
yield m.group(1)
|
||||
|
||||
|
||||
def _find_library(lib, path):
|
||||
"""Find a library"""
|
||||
for d in path[::-1]:
|
||||
@@ -35,11 +38,13 @@ def _find_library(lib, path):
|
||||
return real_lib
|
||||
return None
|
||||
|
||||
|
||||
def _install_name_change(fname, lib, real_lib):
|
||||
rc, so, se = get_output_error(['install_name_tool', '-change', lib, real_lib, fname])
|
||||
if rc:
|
||||
logging.error("Couldn't update load path: %s", se)
|
||||
|
||||
|
||||
def patch_lib_paths(fname, library_dirs):
|
||||
"""Load any weakly-defined libraries from their real location
|
||||
|
||||
|
||||
Reference in New Issue
Block a user