diff options
author | 2020-08-12 16:29:03 +0200 | |
---|---|---|
committer | 2020-08-14 21:56:17 +0200 | |
commit | f9150a6a3d0650acdc61eb56ac354cda319e345b (patch) | |
tree | 34984391f03788dda2aa4696b2ed4c987ebdccbe /utils | |
parent | c5b848d7192e615ead72419dcf5ce7286cf07a82 (diff) | |
download | buildroot-f9150a6a3d0650acdc61eb56ac354cda319e345b.tar.gz buildroot-f9150a6a3d0650acdc61eb56ac354cda319e345b.tar.bz2 |
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>
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/scanpypi | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/utils/scanpypi b/utils/scanpypi index 212dbea85e..51bc249f9e 100755 --- a/utils/scanpypi +++ b/utils/scanpypi @@ -96,10 +96,10 @@ def pkg_buildroot_name(pkg_name): Keyword arguments: pkg_name -- String to rename """ - name = re.sub('[^\w-]', '', pkg_name.lower()) + name = re.sub(r'[^\w-]', '', pkg_name.lower()) name = name.replace('_', '-') prefix = 'python-' - pattern = re.compile('^(?!' + prefix + ')(.+?)$') + pattern = re.compile(r'^(?!' + prefix + ')(.+?)$') name = pattern.sub(r'python-\1', name) return name @@ -337,7 +337,7 @@ class BuildrootPackage(): self.pkg_req = None return set() 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] # 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", "Zope Public License": "ZPL" } - regexp = re.compile('^License :* *.* *:+ (.*)( \(.*\))?$') + regexp = re.compile(r'^License :* *.* *:+ (.*)( \(.*\))?$') classifiers_licenses = [regexp.sub(r"\1", lic) for lic in self.metadata['info']['classifiers'] if regexp.match(lic)] |