return parser.parse_args()
-CONFIG_IN_FILENAME = re.compile("Config\.\S*$")
-DO_CHECK_INTREE = re.compile("|".join([
- "Config.in",
- "arch/",
- "boot/",
- "fs/",
- "linux/",
- "package/",
- "system/",
- "toolchain/",
+CONFIG_IN_FILENAME = re.compile(r"Config\.\S*$")
+DO_CHECK_INTREE = re.compile(r"|".join([
+ r"Config.in",
+ r"arch/",
+ r"boot/",
+ r"fs/",
+ r"linux/",
+ r"package/",
+ r"system/",
+ r"toolchain/",
]))
-DO_NOT_CHECK_INTREE = re.compile("|".join([
- "boot/barebox/barebox\.mk$",
- "fs/common\.mk$",
- "package/doc-asciidoc\.mk$",
- "package/pkg-\S*\.mk$",
- "toolchain/helpers\.mk$",
- "toolchain/toolchain-external/pkg-toolchain-external\.mk$",
+DO_NOT_CHECK_INTREE = re.compile(r"|".join([
+ r"boot/barebox/barebox\.mk$",
+ r"fs/common\.mk$",
+ r"package/doc-asciidoc\.mk$",
+ r"package/pkg-\S*\.mk$",
+ r"toolchain/helpers\.mk$",
+ r"toolchain/toolchain-external/pkg-toolchain-external\.mk$",
]))
class Indent(_CheckFunction):
- COMMENT = re.compile("^\s*#")
- CONDITIONAL = re.compile("^\s*({})\s".format("|".join(start_conditional + end_conditional)))
+ COMMENT = re.compile(r"^\s*#")
+ CONDITIONAL = re.compile(r"^\s*({})\s".format("|".join(start_conditional + end_conditional)))
ENDS_WITH_BACKSLASH = re.compile(r"^[^#].*\\$")
- END_DEFINE = re.compile("^\s*endef\s")
- MAKEFILE_TARGET = re.compile("^[^# \t]+:\s")
- START_DEFINE = re.compile("^\s*define\s")
+ END_DEFINE = re.compile(r"^\s*endef\s")
+ MAKEFILE_TARGET = re.compile(r"^[^# \t]+:\s")
+ START_DEFINE = re.compile(r"^\s*define\s")
def before(self):
self.define = False
class OverriddenVariable(_CheckFunction):
- CONCATENATING = re.compile("^([A-Z0-9_]+)\s*(\+|:|)=\s*\$\(\\1\)")
- END_CONDITIONAL = re.compile("^\s*({})".format("|".join(end_conditional)))
+ CONCATENATING = re.compile(r"^([A-Z0-9_]+)\s*(\+|:|)=\s*\$\(\\1\)")
+ END_CONDITIONAL = re.compile(r"^\s*({})".format("|".join(end_conditional)))
OVERRIDING_ASSIGNMENTS = [':=', "="]
- START_CONDITIONAL = re.compile("^\s*({})".format("|".join(start_conditional)))
- VARIABLE = re.compile("^([A-Z0-9_]+)\s*((\+|:|)=)")
- USUALLY_OVERRIDDEN = re.compile("^[A-Z0-9_]+({})".format("|".join([
- "_ARCH\s*=\s*",
- "_CPU\s*=\s*",
- "_SITE\s*=\s*",
- "_SOURCE\s*=\s*",
- "_VERSION\s*=\s*"])))
+ START_CONDITIONAL = re.compile(r"^\s*({})".format("|".join(start_conditional)))
+ VARIABLE = re.compile(r"^([A-Z0-9_]+)\s*((\+|:|)=)")
+ USUALLY_OVERRIDDEN = re.compile(r"^[A-Z0-9_]+({})".format("|".join([
+ r"_ARCH\s*=\s*",
+ r"_CPU\s*=\s*",
+ r"_SITE\s*=\s*",
+ r"_SOURCE\s*=\s*",
+ r"_VERSION\s*=\s*"])))
def before(self):
self.conditional = 0
package_upper = package.replace("-", "_").upper()
self.package = package
self.FIND_SOURCE = re.compile(
- "^{}_SOURCE\s*=\s*{}-\$\({}_VERSION\)\.tar\.gz"
+ r"^{}_SOURCE\s*=\s*{}-\$\({}_VERSION\)\.tar\.gz"
.format(package_upper, package, package_upper))
def check_line(self, lineno, text):
class TypoInPackageVariable(_CheckFunction):
- ALLOWED = re.compile("|".join([
+ ALLOWED = re.compile(r"|".join([
"ACLOCAL_DIR",
"ACLOCAL_HOST_DIR",
"ACLOCAL_PATH",
"TARGET_FINALIZE_HOOKS",
"TARGETS_ROOTFS",
"XTENSA_CORE_NAME"]))
- VARIABLE = re.compile("^([A-Z0-9_]+_[A-Z0-9_]+)\s*(\+|)=")
+ VARIABLE = re.compile(r"^([A-Z0-9_]+_[A-Z0-9_]+)\s*(\+|)=")
def before(self):
package, _ = os.path.splitext(os.path.basename(self.filename))
# linux extensions do not use LINUX_EXT_ prefix for variables
package = package.replace("LINUX_EXT_", "")
self.package = package
- self.REGEX = re.compile("^(HOST_|ROOTFS_)?({}_[A-Z0-9_]+)".format(package))
+ self.REGEX = re.compile(r"^(HOST_|ROOTFS_)?({}_[A-Z0-9_]+)".format(package))
self.FIND_VIRTUAL = re.compile(
- "^{}_PROVIDES\s*(\+|)=\s*(.*)".format(package))
+ r"^{}_PROVIDES\s*(\+|)=\s*(.*)".format(package))
self.virtual = []
def check_line(self, lineno, text):
class UselessFlag(_CheckFunction):
- DEFAULT_AUTOTOOLS_FLAG = re.compile("^.*{}".format("|".join([
- "_AUTORECONF\s*=\s*NO",
- "_LIBTOOL_PATCH\s*=\s*YES"])))
- DEFAULT_GENERIC_FLAG = re.compile("^.*{}".format("|".join([
- "_INSTALL_IMAGES\s*=\s*NO",
- "_INSTALL_REDISTRIBUTE\s*=\s*YES",
- "_INSTALL_STAGING\s*=\s*NO",
- "_INSTALL_TARGET\s*=\s*YES"])))
- END_CONDITIONAL = re.compile("^\s*({})".format("|".join(end_conditional)))
- START_CONDITIONAL = re.compile("^\s*({})".format("|".join(start_conditional)))
+ DEFAULT_AUTOTOOLS_FLAG = re.compile(r"^.*{}".format("|".join([
+ r"_AUTORECONF\s*=\s*NO",
+ r"_LIBTOOL_PATCH\s*=\s*YES"])))
+ DEFAULT_GENERIC_FLAG = re.compile(r"^.*{}".format("|".join([
+ r"_INSTALL_IMAGES\s*=\s*NO",
+ r"_INSTALL_REDISTRIBUTE\s*=\s*YES",
+ r"_INSTALL_STAGING\s*=\s*NO",
+ r"_INSTALL_TARGET\s*=\s*YES"])))
+ END_CONDITIONAL = re.compile(r"^\s*({})".format("|".join(end_conditional)))
+ START_CONDITIONAL = re.compile(r"^\s*({})".format("|".join(start_conditional)))
def before(self):
self.conditional = 0