Remove many lint warnings

Mostly whitespace changes, with max-line-length set to 120
and double-quotes used, adopting black settings.

Related to https://github.com/capnproto/pycapnp/issues/128
This commit is contained in:
John Vandenberg
2021-05-03 14:34:25 +08:00
parent 7556b102c3
commit 8c15feb4eb
10 changed files with 557 additions and 231 deletions

View File

@@ -33,14 +33,13 @@ def write_version_py(filename=None):
Generate pycapnp version
'''
cnt = """\
from .lib.capnp import _CAPNP_VERSION_MAJOR as LIBCAPNP_VERSION_MAJOR # noqa: F401
from .lib.capnp import _CAPNP_VERSION_MINOR as LIBCAPNP_VERSION_MINOR # noqa: F401
from .lib.capnp import _CAPNP_VERSION_MICRO as LIBCAPNP_VERSION_MICRO # noqa: F401
from .lib.capnp import _CAPNP_VERSION as LIBCAPNP_VERSION # noqa: F401
version = '%s'
short_version = '%s'
# flake8: noqa E402 F401
from .lib.capnp import _CAPNP_VERSION_MAJOR as LIBCAPNP_VERSION_MAJOR
from .lib.capnp import _CAPNP_VERSION_MINOR as LIBCAPNP_VERSION_MINOR
from .lib.capnp import _CAPNP_VERSION_MICRO as LIBCAPNP_VERSION_MICRO
from .lib.capnp import _CAPNP_VERSION as LIBCAPNP_VERSION
"""
if not filename:
filename = os.path.join(
@@ -63,6 +62,7 @@ with open('CHANGELOG.md', encoding='utf-8') as f:
changelog = '\nChangelog\n=============\n' + changelog
long_description += changelog
class clean(_clean):
'''
Clean command, invoked with `python setup.py clean`
@@ -105,7 +105,8 @@ try:
except Exception:
pass
from Cython.Distutils import build_ext as build_ext_c
from Cython.Distutils import build_ext as build_ext_c # noqa: E402
class build_libcapnp_ext(build_ext_c):
'''
@@ -114,7 +115,7 @@ class build_libcapnp_ext(build_ext_c):
def build_extension(self, ext):
build_ext_c.build_extension(self, ext)
def run(self):
def run(self): # noqa: C901
if force_bundled_libcapnp:
need_build = True
elif force_system_libcapnp:
@@ -123,9 +124,10 @@ class build_libcapnp_ext(build_ext_c):
# Try to use capnp executable to find include and lib path
capnp_executable = shutil.which("capnp")
if capnp_executable:
self.include_dirs += [os.path.join(os.path.dirname(capnp_executable), '..', 'include')]
self.library_dirs += [os.path.join(os.path.dirname(capnp_executable), '..', 'lib{}'.format(8 * struct.calcsize("P")))]
self.library_dirs += [os.path.join(os.path.dirname(capnp_executable), '..', 'lib')]
capnp_dir = os.path.dirname(capnp_executable)
self.include_dirs += [os.path.join(capnp_dir, "..", "include")]
self.library_dirs += [os.path.join(capnp_dir, "..", "lib{}".format(8 * struct.calcsize("P")))]
self.library_dirs += [os.path.join(capnp_dir, "..", "lib")]
# Look for capnproto using pkg-config (and minimum version)
try:
@@ -176,14 +178,16 @@ class build_libcapnp_ext(build_ext_c):
return build_ext_c.run(self)
extra_compile_args = ['--std=c++14']
extra_link_args = []
if os.name == 'nt':
extra_compile_args = ['/std:c++14', '/MD']
extra_link_args = ['/MANIFEST']
import Cython.Build
import Cython # noqa: F401
import Cython.Build # noqa: E402
import Cython # noqa: E402
extensions = [Extension(
'*', ['capnp/helpers/capabilityHelper.cpp', 'capnp/lib/*.pyx'],
extra_compile_args=extra_compile_args,
@@ -208,14 +212,15 @@ setup(
},
install_requires=[],
entry_points={
'console_scripts' : ['capnpc-cython = capnp._gen:main']
"console_scripts": ["capnpc-cython = capnp._gen:main"]
},
# PyPi info
description="A cython wrapping of the C++ Cap'n Proto library",
long_description=long_description,
long_description_content_type = 'text/markdown',
long_description_content_type="text/markdown",
license='BSD',
author="Jacob Alexander", # <- Current maintainer; Original author -> Jason Paryani (setup.py only supports 1 author...)
# (setup.py only supports 1 author...)
author="Jacob Alexander", # <- Current maintainer; Original author -> Jason Paryani
author_email="haata@kiibohd.com",
url='https://github.com/capnproto/pycapnp',
download_url='https://github.com/haata/pycapnp/archive/v%s.zip' % VERSION,