mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
Tidy up some pylint warnings
Resolve all the pylint warnings currently in setup.py Signed-off-by: Simon Glass <sjg@chromium.org> Message-ID: <20240811150248.7537-2-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
3501d373f0
commit
78b6a85c11
1 changed files with 16 additions and 9 deletions
23
setup.py
23
setup.py
|
@ -7,27 +7,31 @@ Copyright (C) 2017 Google, Inc.
|
||||||
Written by Simon Glass <sjg@chromium.org>
|
Written by Simon Glass <sjg@chromium.org>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
from setuptools import setup, Extension
|
from setuptools import setup, Extension
|
||||||
from setuptools.command.build_py import build_py as _build_py
|
from setuptools.command.build_py import build_py as _build_py
|
||||||
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
|
|
||||||
srcdir = os.path.dirname(__file__)
|
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()
|
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()
|
version = fh.readline().strip()
|
||||||
|
|
||||||
def get_top_builddir():
|
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:
|
if '--top-builddir' in sys.argv:
|
||||||
index = sys.argv.index('--top-builddir')
|
index = sys.argv.index('--top-builddir')
|
||||||
sys.argv.pop(index)
|
sys.argv.pop(index)
|
||||||
return sys.argv.pop(index)
|
return sys.argv.pop(index)
|
||||||
else:
|
|
||||||
return srcdir
|
return srcdir
|
||||||
|
|
||||||
top_builddir = get_top_builddir()
|
top_builddir = get_top_builddir()
|
||||||
|
@ -42,15 +46,18 @@ libfdt_module = Extension(
|
||||||
swig_opts=['-I' + os.path.join(srcdir, 'libfdt')],
|
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):
|
def run(self):
|
||||||
self.run_command("build_ext")
|
self.run_command("build_ext")
|
||||||
return super().run()
|
return super().run()
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='libfdt',
|
name='libfdt',
|
||||||
version=version,
|
version=version,
|
||||||
cmdclass = {'build_py' : build_py},
|
cmdclass = {'build_py' : BuildPy},
|
||||||
author='Simon Glass',
|
author='Simon Glass',
|
||||||
author_email='sjg@chromium.org',
|
author_email='sjg@chromium.org',
|
||||||
description='Python binding for libfdt',
|
description='Python binding for libfdt',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue