Re: [PATCH 2/6] Tidy up some pylint warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Sun, Aug 11, 2024 at 09:02:44AM -0600, Simon Glass wrote:
> Resolve all the pylint warnings currently in setup.py
> 
> Signed-off-by: Simon Glass <sjg@xxxxxxxxxxxx>

Applied, thanks.

> ---
> 
>  setup.py | 25 ++++++++++++++++---------
>  1 file changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/setup.py b/setup.py
> index 749bf1b..4e880e4 100755
> --- a/setup.py
> +++ b/setup.py
> @@ -7,28 +7,32 @@ Copyright (C) 2017 Google, Inc.
>  Written by Simon Glass <sjg@xxxxxxxxxxxx>
>  """
>  
> +import os
> +import sys
> +
>  from setuptools import setup, Extension
>  from setuptools.command.build_py import build_py as _build_py
>  
> -import os
> -import re
> -import sys
>  
>  srcdir = os.path.dirname(__file__)
>  
> -with open(os.path.join(srcdir, "README.md"), "r") as fh:
> +with open(os.path.join(srcdir, "README.md"), "r", encoding='utf-8') as fh:
>      long_description = fh.read()
>  
> -with open(os.path.join(srcdir, "VERSION.txt"), "r") as fh:
> +with open(os.path.join(srcdir, "VERSION.txt"), "r", encoding='utf-8') as fh:
>      version = fh.readline().strip()
>  
>  def get_top_builddir():
> +    """Figure out the top-level directory containing the source code
> +
> +    Returns:
> +        str: Directory to build in
> +    """
>      if '--top-builddir' in sys.argv:
>          index = sys.argv.index('--top-builddir')
>          sys.argv.pop(index)
>          return sys.argv.pop(index)
> -    else:
> -        return srcdir
> +    return srcdir
>  
>  top_builddir = get_top_builddir()
>  
> @@ -42,15 +46,18 @@ libfdt_module = Extension(
>      swig_opts=['-I' + os.path.join(srcdir, 'libfdt')],
>  )
>  
> -class build_py(_build_py):
> +
> +class BuildPy(_build_py):
> +    """Small class to run the build_ext command"""
>      def run(self):
>          self.run_command("build_ext")
>          return super().run()
>  
> +
>  setup(
>      name='libfdt',
>      version=version,
> -    cmdclass = {'build_py' : build_py},
> +    cmdclass = {'build_py' : BuildPy},
>      author='Simon Glass',
>      author_email='sjg@xxxxxxxxxxxx',
>      description='Python binding for libfdt',

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux