mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-30 22:11:59 -09:00
utils/scanpypi: use raw strings in re.compile/re.sub
Fixes the following Python 3.x flake8 warning: W605 invalid escape sequence '\w' Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Reviewed-by: Titouan Christophe <titouan.christophe@railnova.eu> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
@@ -96,10 +96,10 @@ def pkg_buildroot_name(pkg_name):
|
|||||||
Keyword arguments:
|
Keyword arguments:
|
||||||
pkg_name -- String to rename
|
pkg_name -- String to rename
|
||||||
"""
|
"""
|
||||||
name = re.sub('[^\w-]', '', pkg_name.lower())
|
name = re.sub(r'[^\w-]', '', pkg_name.lower())
|
||||||
name = name.replace('_', '-')
|
name = name.replace('_', '-')
|
||||||
prefix = 'python-'
|
prefix = 'python-'
|
||||||
pattern = re.compile('^(?!' + prefix + ')(.+?)$')
|
pattern = re.compile(r'^(?!' + prefix + ')(.+?)$')
|
||||||
name = pattern.sub(r'python-\1', name)
|
name = pattern.sub(r'python-\1', name)
|
||||||
return name
|
return name
|
||||||
|
|
||||||
@@ -337,7 +337,7 @@ class BuildrootPackage():
|
|||||||
self.pkg_req = None
|
self.pkg_req = None
|
||||||
return set()
|
return set()
|
||||||
self.pkg_req = self.setup_metadata['install_requires']
|
self.pkg_req = self.setup_metadata['install_requires']
|
||||||
self.pkg_req = [re.sub('([-.\w]+).*', r'\1', req)
|
self.pkg_req = [re.sub(r'([-.\w]+).*', r'\1', req)
|
||||||
for req in self.pkg_req]
|
for req in self.pkg_req]
|
||||||
|
|
||||||
# get rid of commented lines and also strip the package strings
|
# get rid of commented lines and also strip the package strings
|
||||||
@@ -451,7 +451,7 @@ class BuildrootPackage():
|
|||||||
"Mozilla Public License 2.0": "MPL-2.0",
|
"Mozilla Public License 2.0": "MPL-2.0",
|
||||||
"Zope Public License": "ZPL"
|
"Zope Public License": "ZPL"
|
||||||
}
|
}
|
||||||
regexp = re.compile('^License :* *.* *:+ (.*)( \(.*\))?$')
|
regexp = re.compile(r'^License :* *.* *:+ (.*)( \(.*\))?$')
|
||||||
classifiers_licenses = [regexp.sub(r"\1", lic)
|
classifiers_licenses = [regexp.sub(r"\1", lic)
|
||||||
for lic in self.metadata['info']['classifiers']
|
for lic in self.metadata['info']['classifiers']
|
||||||
if regexp.match(lic)]
|
if regexp.match(lic)]
|
||||||
|
|||||||
Reference in New Issue
Block a user