summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/control2
-rw-r--r--osc/OscConfigParser.py8
-rw-r--r--osc/commandline.py14
-rw-r--r--osc/core.py8
-rw-r--r--osc/util/archquery.py4
-rw-r--r--osc/util/debquery.py18
-rw-r--r--osc/util/rpmquery.py4
7 files changed, 29 insertions, 29 deletions
diff --git a/debian/control b/debian/control
index 9556ff9..600e91d 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: osc
Section: devel
Priority: extra
Maintainer: Adrian Schroeter <adrian@suse.de>
-Build-Depends: debhelper (>= 7.0.15), dpatch, dh-python, python3, python3-dev, python3-urlgrabber
+Build-Depends: debhelper (>= 7.0.15), dh-python, python3, python3-dev, python3-urlgrabber
Standards-Version: 3.8.3
Homepage: http://en.opensuse.org/Build_Service/CLI
diff --git a/osc/OscConfigParser.py b/osc/OscConfigParser.py
index f552887..92e47d7 100644
--- a/osc/OscConfigParser.py
+++ b/osc/OscConfigParser.py
@@ -203,7 +203,7 @@ class OptionLine(Line):
return self.value
-class OscConfigParser(configparser.SafeConfigParser):
+class OscConfigParser(configparser.ConfigParser):
"""
OscConfigParser() behaves like a normal ConfigParser() object. The
only differences is that it preserves the order+format of configuration entries
@@ -212,7 +212,7 @@ class OscConfigParser(configparser.SafeConfigParser):
class.
"""
def __init__(self, defaults={}):
- configparser.SafeConfigParser.__init__(self, defaults)
+ configparser.ConfigParser.__init__(self, defaults)
self._sections = ConfigLineOrder()
# XXX: unfortunately we have to override the _read() method from the ConfigParser()
@@ -321,7 +321,7 @@ class OscConfigParser(configparser.SafeConfigParser):
fp.write(str(self))
fp.write('\n')
else:
- configparser.SafeConfigParser.write(self, fp)
+ configparser.ConfigParser.write(self, fp)
def has_option(self, section, option, proper=False, **kwargs):
"""
@@ -331,7 +331,7 @@ class OscConfigParser(configparser.SafeConfigParser):
"""
if proper:
return self.optionxform(option) in list(self._sections[section].keys())
- return configparser.SafeConfigParser.has_option(self, section, option, **kwargs)
+ return configparser.ConfigParser.has_option(self, section, option, **kwargs)
# XXX: simplify!
def __str__(self):
diff --git a/osc/commandline.py b/osc/commandline.py
index 3516e52..8b0d3c7 100644
--- a/osc/commandline.py
+++ b/osc/commandline.py
@@ -8,9 +8,9 @@
from . import cmdln
from . import conf
from . import oscerr
+from importlib.machinery import SourceFileLoader
import sys
import time
-import imp
import inspect
try:
from urllib.parse import urlsplit
@@ -6814,8 +6814,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
# XXX: is it a good idea to make this the default?
# support perl symbols:
- if re.match('^perl\(\w+(::\w+)*\)$', search_term):
- search_term = re.sub('\)', '', re.sub('(::|\()', '-', search_term))
+ if re.match(r'^perl\(\w+(::\w+)*\)$', search_term):
+ search_term = re.sub(r'\)', '', re.sub(r'(::|\()', '-', search_term))
opts.package = True
if opts.mine:
@@ -6835,8 +6835,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if opts.binary and (opts.title or opts.description or opts.involved or opts.bugowner or opts.maintainer
or opts.project or opts.package):
- raise oscerr.WrongOptions('Sorry, \'--binary\' and \'--title\' or \'--description\' or \'--involved ' \
- 'or \'--bugowner\' or \'--maintainer\' or \'--limit-to-attribute <attr>\ ' \
+ raise oscerr.WrongOptions('Sorry, \'--binary\' and \'--title\' or \'--description\' or \'--involved\' ' \
+ 'or \'--bugowner\' or \'--maintainer\' or \'--limit-to-attribute <attr>\' ' \
'or \'--project\' or \'--package\' are mutually exclusive')
apiurl = self.get_api_url()
@@ -8042,7 +8042,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
fp = file(fn_changelog)
titleline = fp.readline()
fp.close()
- if re.match('^\*\W+(.+\W+\d{1,2}\W+20\d{2})\W+(.+)\W+<(.+)>\W+(.+)$', titleline):
+ if re.match(r'^\*\W+(.+\W+\d{1,2}\W+20\d{2})\W+(.+)\W+<(.+)>\W+(.+)$', titleline):
meego_style = True
except IndexError:
pass
@@ -8338,7 +8338,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
continue
try:
modname = os.path.splitext(extfile)[0]
- mod = imp.load_source(modname, os.path.join(plugin_dir, extfile))
+ mod = SourceFileLoader(modname, os.path.join(plugin_dir, extfile)).load_module()
# restore the old exec semantic
mod.__dict__.update(globals())
for name in dir(mod):
diff --git a/osc/core.py b/osc/core.py
index 9c354ba..8ac8f38 100644
--- a/osc/core.py
+++ b/osc/core.py
@@ -3729,13 +3729,13 @@ def read_meta_from_spec(specfile, *args):
else:
tags.append(itm)
- tag_pat = '(?P<tag>^%s)\s*:\s*(?P<val>.*)'
+ tag_pat = r'(?P<tag>^%s)\s*:\s*(?P<val>.*)'
for tag in tags:
m = re.compile(tag_pat % tag, re.I | re.M).search(''.join(lines))
if m and m.group('val'):
spec_data[tag] = m.group('val').strip()
- section_pat = '^%s\s*?$'
+ section_pat = r'^%s\s*?$'
for section in sections:
m = re.compile(section_pat % section, re.I | re.M).search(''.join(lines))
if m:
@@ -5602,7 +5602,7 @@ def streamfile(url, http_meth = http_GET, bufsize=8192, data=None, progress_obj=
def buildlog_strip_time(data):
"""Strips the leading build time from the log"""
- time_regex = re.compile('^\[[^\]]*\] ', re.M)
+ time_regex = re.compile(r'^\[[^\]]*\] ', re.M)
return time_regex.sub('', data)
@@ -6776,7 +6776,7 @@ def request_interactive_review(apiurl, request, initial_cmd='', group=None, igno
prompt = 'd(i)ff/(a)ccept/(b)uildstatus/(e)dit/(s)kip/(c)ancel > '
else:
state_map = {'a': 'accepted', 'd': 'declined', 'r': 'revoked'}
- mo = re.search('^([adrl])(?:\s+(-f)?\s*-m\s+(.*))?$', repl)
+ mo = re.search(r'^([adrl])(?:\s+(-f)?\s*-m\s+(.*))?$', repl)
if mo is None or orequest and mo.group(1) != 'a':
print('invalid choice: \'%s\'' % repl, file=sys.stderr)
continue
diff --git a/osc/util/archquery.py b/osc/util/archquery.py
index d89903e..304b414 100644
--- a/osc/util/archquery.py
+++ b/osc/util/archquery.py
@@ -127,8 +127,8 @@ class ArchQuery(packagequery.PackageQuery, packagequery.PackageQueryResult):
if not (len(ver1) and len(ver2)):
break
# check if we have a digits segment
- mo1 = re.match('(\d+)', ver1)
- mo2 = re.match('(\d+)', ver2)
+ mo1 = re.match(r'(\d+)', ver1)
+ mo2 = re.match(r'(\d+)', ver2)
numeric = True
if mo1 is None:
mo1 = re.match('([a-zA-Z]+)', ver1)
diff --git a/osc/util/debquery.py b/osc/util/debquery.py
index 0c63983..586137a 100644
--- a/osc/util/debquery.py
+++ b/osc/util/debquery.py
@@ -48,9 +48,9 @@ class DebQuery(packagequery.PackageQuery, packagequery.PackageQueryResult):
def __parse_control(self, control, all_tags=False, self_provides=True, *extra_tags):
data = control.readline().strip()
while data:
- field, val = re.split(':\s*', data.strip(), 1)
+ field, val = re.split(r':\s*', data.strip(), 1)
data = control.readline()
- while data and re.match('\s+', data):
+ while data and re.match(r'\s+', data):
val += '\n' + data.strip()
data = control.readline().rstrip()
field = field.replace('-', '_').lower()
@@ -69,11 +69,11 @@ class DebQuery(packagequery.PackageQuery, packagequery.PackageQueryResult):
self.fields['version'] = verep[1]
else:
self.fields['epoch'] = '0'
- self.fields['provides'] = [ i.strip() for i in re.split(',\s*', self.fields.get('provides', '')) if i ]
- self.fields['depends'] = [ i.strip() for i in re.split(',\s*', self.fields.get('depends', '')) if i ]
- self.fields['pre_depends'] = [ i.strip() for i in re.split(',\s*', self.fields.get('pre_depends', '')) if i ]
- self.fields['conflicts'] = [ i.strip() for i in re.split(',\s*', self.fields.get('conflicts', '')) if i ]
- self.fields['breaks'] = [ i.strip() for i in re.split(',\s*', self.fields.get('breaks', '')) if i ]
+ self.fields['provides'] = [ i.strip() for i in re.split(r',\s*', self.fields.get('provides', '')) if i ]
+ self.fields['depends'] = [ i.strip() for i in re.split(r',\s*', self.fields.get('depends', '')) if i ]
+ self.fields['pre_depends'] = [ i.strip() for i in re.split(r',\s*', self.fields.get('pre_depends', '')) if i ]
+ self.fields['conflicts'] = [ i.strip() for i in re.split(r',\s*', self.fields.get('conflicts', '')) if i ]
+ self.fields['breaks'] = [ i.strip() for i in re.split(r',\s*', self.fields.get('breaks', '')) if i ]
if self_provides:
# add self provides entry
self.fields['provides'].append('%s (= %s)' % (self.name(), '-'.join(versrel)))
@@ -142,8 +142,8 @@ class DebQuery(packagequery.PackageQuery, packagequery.PackageQueryResult):
"""
# 32 is arbitrary - it is needed for the "longer digit string wins" handling
# (found this nice approach in Build/Deb.pm (build package))
- ver1 = re.sub('(\d+)', lambda m: (32 * '0' + m.group(1))[-32:], ver1)
- ver2 = re.sub('(\d+)', lambda m: (32 * '0' + m.group(1))[-32:], ver2)
+ ver1 = re.sub(r'(\d+)', lambda m: (32 * '0' + m.group(1))[-32:], ver1)
+ ver2 = re.sub(r'(\d+)', lambda m: (32 * '0' + m.group(1))[-32:], ver2)
vers = list(map(lambda x, y: (x or '', y or ''), ver1, ver2))
for v1, v2 in vers:
if v1 == v2:
diff --git a/osc/util/rpmquery.py b/osc/util/rpmquery.py
index 9989108..3c7ce18 100644
--- a/osc/util/rpmquery.py
+++ b/osc/util/rpmquery.py
@@ -292,8 +292,8 @@ class RpmQuery(packagequery.PackageQuery, packagequery.PackageQueryResult):
if not (len(ver1) and len(ver2)):
break
# check if we have a digits segment
- mo1 = re.match('(\d+)', ver1)
- mo2 = re.match('(\d+)', ver2)
+ mo1 = re.match(r'(\d+)', ver1)
+ mo2 = re.match(r'(\d+)', ver2)
numeric = True
if mo1 is None:
mo1 = re.match('([a-zA-Z]+)', ver1)