From e9ec9de84af6dbc8dbf8ce68a018c61dec150718 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 6 Oct 2020 16:13:55 +0200 Subject: setup.py: Fix some flake8 warnings Fix spaces around operators, missing lines, import order. Change-Id: I05ecafec849578fed6018654fcefaa008b6801e8 Reviewed-by: Cristian Maureira-Fredes --- build_scripts/config.py | 1 - build_scripts/main.py | 21 +++++++++------------ build_scripts/qp5_tool.py | 2 +- build_scripts/qtinfo.py | 2 +- build_scripts/setup_runner.py | 1 + build_scripts/utils.py | 16 +++++++++------- 6 files changed, 21 insertions(+), 22 deletions(-) diff --git a/build_scripts/config.py b/build_scripts/config.py index 29bed2e88..b1b32068d 100644 --- a/build_scripts/config.py +++ b/build_scripts/config.py @@ -137,7 +137,6 @@ class Config(object): setup_kwargs['version'] = package_version setup_kwargs['python_requires'] = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.10" - if quiet: # Tells distutils / setuptools to be quiet, and only print warnings or errors. # Makes way less noise in the terminal when building. diff --git a/build_scripts/main.py b/build_scripts/main.py index 046f3502d..f9766520d 100644 --- a/build_scripts/main.py +++ b/build_scripts/main.py @@ -41,6 +41,10 @@ from __future__ import print_function from distutils.version import LooseVersion import os +import platform +import re +import sys +from textwrap import dedent import time from .config import config from .utils import get_python_dict @@ -82,10 +86,6 @@ except ImportError: from ez_setup import use_setuptools use_setuptools() -import sys -import platform -import re - import distutils.log as log from distutils.errors import DistutilsSetupError from distutils.sysconfig import get_config_var @@ -112,8 +112,6 @@ from .platforms.unix import prepare_packages_posix from .platforms.windows_desktop import prepare_packages_win32 from .wheel_override import wheel_module_exists, get_bdist_wheel_override -from textwrap import dedent - def check_allowed_python_version(): """ @@ -1206,9 +1204,11 @@ class PysideBuild(_build): log.info("Patched rpath to '$ORIGIN/' (Linux) or " "updated rpath (OS/X) in {}.".format(srcpath)) + class PysideRstDocs(Command): description = "Build .rst documentation only" user_options = [] + def initialize_options(self): log.info("-- This build process will not include the API documentation." "API documentation requires a full build of pyside/shiboken.") @@ -1269,12 +1269,8 @@ class PysideRstDocs(Command): elif self.name == "shiboken2": self.sphinx_src = self.out_dir - sphinx_cmd = ["sphinx-build", - "-b", "html", - "-c", self.sphinx_src, - self.doc_dir, - self.out_dir - ] + sphinx_cmd = ["sphinx-build", "-b", "html", "-c", self.sphinx_src, + self.doc_dir, self.out_dir] if run_process(sphinx_cmd) != 0: raise DistutilsSetupError("Error running CMake for {}".format(self.doc_dir)) # Last message @@ -1284,6 +1280,7 @@ class PysideRstDocs(Command): def finalize_options(self): pass + cmd_class_dict = { 'build': PysideBuild, 'build_py': PysideBuildPy, diff --git a/build_scripts/qp5_tool.py b/build_scripts/qp5_tool.py index 0f3ed6166..0dea03b27 100644 --- a/build_scripts/qp5_tool.py +++ b/build_scripts/qp5_tool.py @@ -393,7 +393,7 @@ if __name__ == '__main__': build_mode = BuildMode.RECONFIGURE if build_mode == BuildMode.NONE and not (options.clean or options.reset - or options.pull or options.test): + or options.pull or options.test): argument_parser.print_help() sys.exit(0) diff --git a/build_scripts/qtinfo.py b/build_scripts/qtinfo.py index fa2d771b2..62bfee812 100644 --- a/build_scripts/qtinfo.py +++ b/build_scripts/qtinfo.py @@ -125,7 +125,7 @@ class QtInfo(object): return self.get_property("QT_INSTALL_PREFIX/src") def get_property(self, prop_name): - if not self._query_dict: + if not self._query_dict: self._get_query_properties() self._get_other_properties() if prop_name not in self._query_dict: diff --git a/build_scripts/setup_runner.py b/build_scripts/setup_runner.py index 15a0bf380..b54c62796 100644 --- a/build_scripts/setup_runner.py +++ b/build_scripts/setup_runner.py @@ -54,6 +54,7 @@ from setuptools import setup if OPTION["VERBOSE_BUILD"]: log.set_verbosity(1) + class SetupRunner(object): def __init__(self, orig_argv): self.invocations_list = [] diff --git a/build_scripts/utils.py b/build_scripts/utils.py index b0c2f8899..0782ae036 100644 --- a/build_scripts/utils.py +++ b/build_scripts/utils.py @@ -1103,18 +1103,20 @@ def get_qtci_virtualEnv(python_ver, host, hostArch, targetArch): # With windows we are creating building 32-bit target in 64-bit host if hostArch == "X86_64" and targetArch == "X86": if python_ver.startswith("3"): - print("Try to find python from {} env variable".format("PYTHON"+python_ver+"-32_PATH")) - _path = os.getenv("PYTHON"+python_ver+"-32_PATH", "") + var = "PYTHON" + python_ver + "-32_PATH" + print("Try to find python from {} env variable".format(var)) + _path = os.getenv(var, "") _pExe = os.path.join(_path, "python.exe") if not os.path.isfile(_pExe): print("Can't find python.exe from {}, using default python3".format(_pExe)) _pExe = os.path.join(os.getenv("PYTHON3_32_PATH"), "python.exe") else: - _pExe = os.path.join(os.getenv("PYTHON2_32_PATH"), "python.exe") + _pExe = os.path.join(os.getenv("PYTHON2_32_PATH"), "python.exe") else: - if python_ver.startswith("3"): - print("Try to find python from {} env variable".format("PYTHON"+python_ver+"-64_PATH")) - _path = os.getenv("PYTHON"+python_ver+"-64_PATH", "") + if python_ver.startswith("3"): + var = "PYTHON" + python_ver + "-64_PATH" + print("Try to find python from {} env variable".format(var)) + _path = os.getenv(var, "") _pExe = os.path.join(_path, "python.exe") if not os.path.isfile(_pExe): print("Can't find python.exe from {}, using default python3".format(_pExe)) @@ -1159,6 +1161,6 @@ def get_ci_qmake_path(ci_install_dir, ci_host_os): if ci_host_os == "MacOS": return qmake_path + "/bin/qmake" elif ci_host_os == "Windows": - return qmake_path + "\\bin\\qmake.exe" + return qmake_path + "\\bin\\qmake.exe" else: return qmake_path + "/bin/qmake" -- cgit v1.2.3