devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: Devicetree Compiler <devicetree-compiler@vger.kernel.org>
Cc: David Gibson <david@gibson.dropbear.id.au>,
	Gua Guo <gua.guo@intel.com>, Simon Glass <sjg@chromium.org>
Subject: [PATCH 2/6] Tidy up some pylint warnings
Date: Sun, 11 Aug 2024 09:02:44 -0600	[thread overview]
Message-ID: <20240811150248.7537-2-sjg@chromium.org> (raw)
In-Reply-To: <20240811150248.7537-1-sjg@chromium.org>

Resolve all the pylint warnings currently in setup.py

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 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@chromium.org>
 """
 
+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@chromium.org',
     description='Python binding for libfdt',
-- 
2.34.1


  reply	other threads:[~2024-08-11 15:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-11 15:02 [PATCH 1/6] Require Python 3 Simon Glass
2024-08-11 15:02 ` Simon Glass [this message]
2024-08-12  1:40   ` [PATCH 2/6] Tidy up some pylint warnings David Gibson
2024-08-11 15:02 ` [PATCH 3/6] setup: Move version and full_description into a function Simon Glass
2024-08-12  1:42   ` David Gibson
2024-08-11 15:02 ` [PATCH 4/6] setup: Collect top-level code together Simon Glass
2024-08-11 15:02 ` [PATCH 5/6] setup: Move setting of srcdir down to the bottom Simon Glass
2024-08-12  1:50   ` David Gibson
2024-08-11 15:02 ` [PATCH 6/6] setup: Add dependencies for Windows Simon Glass
2024-08-12  1:51   ` David Gibson
2024-08-12  2:01     ` David Gibson
2024-08-14  2:15       ` Simon Glass
2024-08-11 15:05 ` [PATCH 1/6] Require Python 3 Simon Glass
2024-08-12  1:39 ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240811150248.7537-2-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=devicetree-compiler@vger.kernel.org \
    --cc=gua.guo@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).