mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-14 01:26:23 +01:00
Merge pull request #1088 from dmach/python3-import-cleanup
Clean imports up, drop python 2 fallbacks
This commit is contained in:
commit
e7af9cebb3
@ -13,19 +13,9 @@
|
|||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import sys
|
import configparser
|
||||||
|
|
||||||
if sys.version_info >= ( 3, ):
|
|
||||||
import configparser
|
|
||||||
ConfigParser = configparser.ConfigParser
|
|
||||||
else:
|
|
||||||
#python 2.x
|
|
||||||
import ConfigParser as configparser
|
|
||||||
ConfigParser = configparser.SafeConfigParser
|
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
# inspired from http://code.google.com/p/iniparse/ - although their implementation is
|
# inspired from http://code.google.com/p/iniparse/ - although their implementation is
|
||||||
# quite different
|
# quite different
|
||||||
@ -192,7 +182,7 @@ class OptionLine(Line):
|
|||||||
self.format(line)
|
self.format(line)
|
||||||
|
|
||||||
def format(self, line):
|
def format(self, line):
|
||||||
mo = ConfigParser.OPTCRE.match(line.strip())
|
mo = configparser.ConfigParser.OPTCRE.match(line.strip())
|
||||||
key, val = mo.group('option', 'value')
|
key, val = mo.group('option', 'value')
|
||||||
self.frmt = line.replace(key.strip(), '%s', 1)
|
self.frmt = line.replace(key.strip(), '%s', 1)
|
||||||
pos = val.find(' ;')
|
pos = val.find(' ;')
|
||||||
@ -205,7 +195,7 @@ class OptionLine(Line):
|
|||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
|
|
||||||
class OscConfigParser(ConfigParser):
|
class OscConfigParser(configparser.ConfigParser):
|
||||||
"""
|
"""
|
||||||
OscConfigParser() behaves like a normal ConfigParser() object. The
|
OscConfigParser() behaves like a normal ConfigParser() object. The
|
||||||
only differences is that it preserves the order+format of configuration entries
|
only differences is that it preserves the order+format of configuration entries
|
||||||
@ -214,7 +204,7 @@ class OscConfigParser(ConfigParser):
|
|||||||
class.
|
class.
|
||||||
"""
|
"""
|
||||||
def __init__(self, defaults={}):
|
def __init__(self, defaults={}):
|
||||||
ConfigParser.__init__(self, defaults)
|
super().__init__(defaults)
|
||||||
self._sections = ConfigLineOrder()
|
self._sections = ConfigLineOrder()
|
||||||
|
|
||||||
# XXX: unfortunately we have to override the _read() method from the ConfigParser()
|
# XXX: unfortunately we have to override the _read() method from the ConfigParser()
|
||||||
@ -323,7 +313,7 @@ class OscConfigParser(ConfigParser):
|
|||||||
fp.write(str(self))
|
fp.write(str(self))
|
||||||
fp.write('\n')
|
fp.write('\n')
|
||||||
else:
|
else:
|
||||||
ConfigParser.write(self, fp)
|
super().write(fp)
|
||||||
|
|
||||||
def has_option(self, section, option, proper=False, **kwargs):
|
def has_option(self, section, option, proper=False, **kwargs):
|
||||||
"""
|
"""
|
||||||
@ -333,7 +323,7 @@ class OscConfigParser(ConfigParser):
|
|||||||
"""
|
"""
|
||||||
if proper:
|
if proper:
|
||||||
return self.optionxform(option) in self._sections[section].keys()
|
return self.optionxform(option) in self._sections[section].keys()
|
||||||
return ConfigParser.has_option(self, section, option, **kwargs)
|
return super().has_option(section, option, **kwargs)
|
||||||
|
|
||||||
# XXX: simplify!
|
# XXX: simplify!
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -3,23 +3,26 @@
|
|||||||
# and distributed under the terms of the GNU General Public Licence,
|
# and distributed under the terms of the GNU General Public Licence,
|
||||||
# either version 2, or (at your option) any later version.
|
# either version 2, or (at your option) any later version.
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import errno
|
import errno
|
||||||
import os.path
|
import os
|
||||||
import pdb
|
import pdb
|
||||||
|
import signal
|
||||||
import ssl
|
import ssl
|
||||||
import sys
|
import sys
|
||||||
import signal
|
|
||||||
import traceback
|
import traceback
|
||||||
|
from http.client import HTTPException, BadStatusLine
|
||||||
|
from urllib.error import URLError, HTTPError
|
||||||
|
|
||||||
from osc import commandline
|
import urllib3.exceptions
|
||||||
from osc import oscerr
|
|
||||||
|
from . import commandline
|
||||||
|
from . import oscerr
|
||||||
|
from .OscConfigParser import configparser
|
||||||
from .oscssl import CertVerificationError
|
from .oscssl import CertVerificationError
|
||||||
from osc.util.cpio import CpioError
|
from .util.cpio import CpioError
|
||||||
from osc.util.packagequery import PackageError
|
from .util.helper import decode_it
|
||||||
from osc.util.helper import decode_it
|
from .util.packagequery import PackageError
|
||||||
from osc.OscConfigParser import configparser
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# import as RPMError because the class "error" is too generic
|
# import as RPMError because the class "error" is too generic
|
||||||
@ -29,9 +32,6 @@ except:
|
|||||||
class RPMError(Exception):
|
class RPMError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
import urllib3.exceptions
|
|
||||||
from http.client import HTTPException, BadStatusLine
|
|
||||||
from urllib.error import URLError, HTTPError
|
|
||||||
|
|
||||||
# the good things are stolen from Matt Mackall's mercurial
|
# the good things are stolen from Matt Mackall's mercurial
|
||||||
|
|
||||||
|
55
osc/build.py
55
osc/build.py
@ -3,42 +3,27 @@
|
|||||||
# and distributed under the terms of the GNU General Public Licence,
|
# and distributed under the terms of the GNU General Public Licence,
|
||||||
# either version 2, or (at your option) any later version.
|
# either version 2, or (at your option) any later version.
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
try:
|
|
||||||
from urllib.parse import urlsplit
|
|
||||||
from urllib.request import URLError, HTTPError
|
|
||||||
except ImportError:
|
|
||||||
#python 2.x
|
|
||||||
from urlparse import urlsplit
|
|
||||||
from urllib2 import URLError, HTTPError
|
|
||||||
|
|
||||||
from tempfile import NamedTemporaryFile, mkdtemp
|
|
||||||
from osc.fetch import *
|
|
||||||
from osc.core import get_buildinfo, store_read_apiurl, store_read_project, store_read_package, meta_exists, quote_plus, get_buildconfig, is_package_dir, dgst
|
|
||||||
from osc.core import get_binarylist, get_binary_file, run_external, return_external, raw_input
|
|
||||||
from osc.util import rpmquery, debquery, archquery
|
|
||||||
from osc.util.helper import decode_it
|
|
||||||
import osc.conf
|
|
||||||
from . import oscerr
|
|
||||||
import subprocess
|
import subprocess
|
||||||
try:
|
import sys
|
||||||
# Works up to Python 3.8, needed for Python < 3.3 (inc 2.7)
|
from tempfile import NamedTemporaryFile, mkdtemp
|
||||||
from xml.etree import cElementTree as ET
|
from urllib.parse import urlsplit
|
||||||
except ImportError:
|
from urllib.request import URLError, HTTPError
|
||||||
# will import a fast implementation from 3.3 onwards, needed
|
from xml.etree import ElementTree as ET
|
||||||
# for 3.9+
|
|
||||||
from xml.etree import ElementTree as ET
|
|
||||||
|
|
||||||
|
from . import conf
|
||||||
from . import connection
|
from . import connection
|
||||||
|
from . import oscerr
|
||||||
from .conf import config
|
from .conf import config
|
||||||
|
from .core import get_buildinfo, store_read_project, store_read_package, meta_exists, quote_plus, get_buildconfig, is_package_dir, dgst
|
||||||
|
from .core import get_binarylist, get_binary_file, run_external, return_external, raw_input
|
||||||
|
from .fetch import Fetcher, verify_pacs
|
||||||
from .meter import create_text_meter
|
from .meter import create_text_meter
|
||||||
|
from .util import rpmquery, debquery, archquery
|
||||||
|
from .util.helper import decode_it
|
||||||
|
|
||||||
|
|
||||||
change_personality = {
|
change_personality = {
|
||||||
'i686': 'linux32',
|
'i686': 'linux32',
|
||||||
@ -819,9 +804,9 @@ def main(apiurl, opts, argv):
|
|||||||
bc_file = None
|
bc_file = None
|
||||||
bi_filename = '_buildinfo-%s-%s.xml' % (repo, arch)
|
bi_filename = '_buildinfo-%s-%s.xml' % (repo, arch)
|
||||||
bc_filename = '_buildconfig-%s-%s' % (repo, arch)
|
bc_filename = '_buildconfig-%s-%s' % (repo, arch)
|
||||||
if is_package_dir('.') and os.access(osc.core.store, os.W_OK):
|
if is_package_dir('.') and os.access(core.store, os.W_OK):
|
||||||
bi_filename = os.path.join(os.getcwd(), osc.core.store, bi_filename)
|
bi_filename = os.path.join(os.getcwd(), core.store, bi_filename)
|
||||||
bc_filename = os.path.join(os.getcwd(), osc.core.store, bc_filename)
|
bc_filename = os.path.join(os.getcwd(), core.store, bc_filename)
|
||||||
elif not os.access('.', os.W_OK):
|
elif not os.access('.', os.W_OK):
|
||||||
bi_file = NamedTemporaryFile(prefix=bi_filename)
|
bi_file = NamedTemporaryFile(prefix=bi_filename)
|
||||||
bi_filename = bi_file.name
|
bi_filename = bi_file.name
|
||||||
@ -849,7 +834,7 @@ def main(apiurl, opts, argv):
|
|||||||
|
|
||||||
# check for source services
|
# check for source services
|
||||||
if not opts.offline and not opts.noservice:
|
if not opts.offline and not opts.noservice:
|
||||||
p = osc.core.Package(os.curdir)
|
p = core.Package(os.curdir)
|
||||||
r = p.run_source_services(verbose=True)
|
r = p.run_source_services(verbose=True)
|
||||||
if r:
|
if r:
|
||||||
raise oscerr.ServiceRuntimeError('Source service run failed!')
|
raise oscerr.ServiceRuntimeError('Source service run failed!')
|
||||||
@ -1132,12 +1117,12 @@ def main(apiurl, opts, argv):
|
|||||||
if not old_pkg_dir.startswith('/') and not opts.offline:
|
if not old_pkg_dir.startswith('/') and not opts.offline:
|
||||||
data = [ prj, pacname, repo, arch]
|
data = [ prj, pacname, repo, arch]
|
||||||
if old_pkg_dir == '_link':
|
if old_pkg_dir == '_link':
|
||||||
p = osc.core.findpacs(os.curdir)[0]
|
p = core.findpacs(os.curdir)[0]
|
||||||
if not p.islink():
|
if not p.islink():
|
||||||
raise oscerr.WrongOptions('package is not a link')
|
raise oscerr.WrongOptions('package is not a link')
|
||||||
data[0] = p.linkinfo.project
|
data[0] = p.linkinfo.project
|
||||||
data[1] = p.linkinfo.package
|
data[1] = p.linkinfo.package
|
||||||
repos = osc.core.get_repositories_of_project(apiurl, data[0])
|
repos = core.get_repositories_of_project(apiurl, data[0])
|
||||||
# hack for links to e.g. Factory
|
# hack for links to e.g. Factory
|
||||||
if not data[2] in repos and 'standard' in repos:
|
if not data[2] in repos and 'standard' in repos:
|
||||||
data[2] = 'standard'
|
data[2] = 'standard'
|
||||||
@ -1455,7 +1440,7 @@ def main(apiurl, opts, argv):
|
|||||||
|
|
||||||
# record our settings for later builds
|
# record our settings for later builds
|
||||||
if is_package_dir(os.curdir):
|
if is_package_dir(os.curdir):
|
||||||
osc.core.store_write_last_buildroot(os.curdir, repo, arch, vm_type)
|
core.store_write_last_buildroot(os.curdir, repo, arch, vm_type)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
rc = run_external(cmd[0], *cmd[1:])
|
rc = run_external(cmd[0], *cmd[1:])
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
from tempfile import mkdtemp
|
|
||||||
import os
|
|
||||||
from shutil import rmtree
|
|
||||||
import rpm
|
|
||||||
import base64
|
import base64
|
||||||
|
import os
|
||||||
|
from tempfile import mkdtemp
|
||||||
|
from shutil import rmtree
|
||||||
|
|
||||||
|
import rpm
|
||||||
|
|
||||||
|
|
||||||
class KeyError(Exception):
|
class KeyError(Exception):
|
||||||
def __init__(self, key, *args):
|
def __init__(self, key, *args):
|
||||||
|
@ -3,39 +3,24 @@
|
|||||||
# and distributed under the terms of the GNU General Public Licence,
|
# and distributed under the terms of the GNU General Public Licence,
|
||||||
# either version 2, or version 3 (at your option).
|
# either version 2, or version 3 (at your option).
|
||||||
|
|
||||||
from __future__ import print_function
|
import imp
|
||||||
|
import inspect
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
from functools import cmp_to_key
|
||||||
|
from operator import itemgetter
|
||||||
|
from optparse import SUPPRESS_HELP
|
||||||
|
from urllib.parse import urlsplit
|
||||||
|
from urllib.error import HTTPError
|
||||||
|
|
||||||
from . import cmdln
|
from . import cmdln
|
||||||
from . import conf
|
from . import conf
|
||||||
from . import oscerr
|
from . import oscerr
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
import imp
|
|
||||||
import inspect
|
|
||||||
import os
|
|
||||||
try:
|
|
||||||
from urllib.parse import urlsplit
|
|
||||||
from urllib.error import HTTPError
|
|
||||||
ET_ENCODING = "unicode"
|
|
||||||
except ImportError:
|
|
||||||
#python 2.x
|
|
||||||
from urlparse import urlsplit
|
|
||||||
from urllib2 import HTTPError
|
|
||||||
ET_ENCODING = "utf-8"
|
|
||||||
|
|
||||||
from optparse import SUPPRESS_HELP
|
|
||||||
|
|
||||||
from .core import *
|
from .core import *
|
||||||
from .util import safewriter
|
from .util import safewriter
|
||||||
|
|
||||||
try:
|
|
||||||
from functools import cmp_to_key
|
|
||||||
except ImportError:
|
|
||||||
from .util.helper import cmp_to_key
|
|
||||||
|
|
||||||
from .util.helper import _html_escape
|
from .util.helper import _html_escape
|
||||||
|
|
||||||
from operator import itemgetter
|
|
||||||
|
|
||||||
MAN_HEADER = r""".TH %(ucname)s "1" "%(date)s" "%(name)s %(version)s" "User Commands"
|
MAN_HEADER = r""".TH %(ucname)s "1" "%(date)s" "%(name)s %(version)s" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
@ -8224,7 +8209,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
data.find('title').text = ''.join(title)
|
data.find('title').text = ''.join(title)
|
||||||
data.find('description').text = ''.join(descr)
|
data.find('description').text = ''.join(descr)
|
||||||
data.find('url').text = url
|
data.find('url').text = url
|
||||||
data = ET.tostring(data, encoding=ET_ENCODING)
|
data = ET.tostring(data, encoding="unicode")
|
||||||
else:
|
else:
|
||||||
print('error - cannot get meta data', file=sys.stderr)
|
print('error - cannot get meta data', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
12
osc/conf.py
12
osc/conf.py
@ -3,7 +3,6 @@
|
|||||||
# and distributed under the terms of the GNU General Public Licence,
|
# and distributed under the terms of the GNU General Public Licence,
|
||||||
# either version 2, or version 3 (at your option).
|
# either version 2, or version 3 (at your option).
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
"""Read osc configuration and store it in a dictionary
|
"""Read osc configuration and store it in a dictionary
|
||||||
|
|
||||||
@ -36,20 +35,21 @@ The configuration dictionary could look like this:
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import bz2
|
import bz2
|
||||||
import errno
|
import errno
|
||||||
|
import getpass
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import getpass
|
|
||||||
|
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from urllib.parse import urlsplit
|
from urllib.parse import urlsplit
|
||||||
|
|
||||||
|
from . import credentials
|
||||||
from . import OscConfigParser
|
from . import OscConfigParser
|
||||||
from osc import oscerr
|
from . import oscerr
|
||||||
from osc.util.helper import raw_input
|
from .util.helper import raw_input
|
||||||
from osc import credentials
|
|
||||||
|
|
||||||
GENERIC_KEYRING = False
|
GENERIC_KEYRING = False
|
||||||
GNOME_KEYRING = False
|
GNOME_KEYRING = False
|
||||||
|
72
osc/core.py
72
osc/core.py
@ -3,8 +3,6 @@
|
|||||||
# and distributed under the terms of the GNU General Public Licence,
|
# and distributed under the terms of the GNU General Public Licence,
|
||||||
# either version 2, or version 3 (at your option).
|
# either version 2, or version 3 (at your option).
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
|
|
||||||
from .util import git_version
|
from .util import git_version
|
||||||
__version__ = git_version.get_version('1.0.0~b0')
|
__version__ = git_version.get_version('1.0.0~b0')
|
||||||
@ -15,62 +13,37 @@ __version__ = git_version.get_version('1.0.0~b0')
|
|||||||
# functionality to check_store_version().
|
# functionality to check_store_version().
|
||||||
__store_version__ = '1.0'
|
__store_version__ = '1.0'
|
||||||
|
|
||||||
|
|
||||||
|
import errno
|
||||||
|
import hashlib
|
||||||
import locale
|
import locale
|
||||||
import os
|
import os
|
||||||
import os.path
|
import platform
|
||||||
import sys
|
import re
|
||||||
|
import shlex
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import re
|
import sys
|
||||||
import socket
|
from functools import cmp_to_key
|
||||||
import errno
|
from http.client import IncompleteRead
|
||||||
import shlex
|
from io import StringIO
|
||||||
import hashlib
|
from urllib.parse import urlsplit, urlunsplit, urlparse, quote_plus, urlencode, unquote
|
||||||
import platform
|
from urllib.error import HTTPError
|
||||||
|
from urllib.request import pathname2url
|
||||||
|
from xml.etree import ElementTree as ET
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import distro
|
import distro
|
||||||
except ImportError:
|
except ImportError:
|
||||||
distro = None
|
distro = None
|
||||||
|
|
||||||
from urllib.parse import urlsplit, urlunsplit, urlparse, quote_plus, urlencode, unquote
|
|
||||||
from urllib.error import HTTPError
|
|
||||||
from urllib.request import pathname2url
|
|
||||||
from io import StringIO
|
|
||||||
from http.client import IncompleteRead
|
|
||||||
|
|
||||||
try:
|
|
||||||
# Works up to Python 3.8, needed for Python < 3.3 (inc 2.7)
|
|
||||||
from xml.etree import cElementTree as ET
|
|
||||||
except ImportError:
|
|
||||||
# will import a fast implementation from 3.3 onwards, needed
|
|
||||||
# for 3.9+
|
|
||||||
from xml.etree import ElementTree as ET
|
|
||||||
|
|
||||||
from . import oscerr
|
|
||||||
from . import conf
|
from . import conf
|
||||||
|
from . import oscerr
|
||||||
from .connection import http_request, http_GET, http_POST, http_PUT, http_DELETE
|
from .connection import http_request, http_GET, http_POST, http_PUT, http_DELETE
|
||||||
|
from .util.helper import decode_list, decode_it, raw_input, _html_escape
|
||||||
|
|
||||||
try:
|
|
||||||
from functools import cmp_to_key
|
|
||||||
except ImportError:
|
|
||||||
from .util.helper import cmp_to_key
|
|
||||||
|
|
||||||
from osc.util.helper import decode_list, decode_it, raw_input, _html_escape
|
ET_ENCODING = "unicode"
|
||||||
|
|
||||||
try:
|
|
||||||
# python 2.6 and python 2.7
|
|
||||||
unicode
|
|
||||||
ET_ENCODING = "utf-8"
|
|
||||||
# python 2.6 does not have bytes and python 2.7 reimplements it as alias to
|
|
||||||
# str, but in incompatible way as it does not accept the same arguments
|
|
||||||
bytes = lambda x, *args: x
|
|
||||||
except:
|
|
||||||
#python3 does not have unicode, so lets reimplement it
|
|
||||||
#as void function as it already gets unicode strings
|
|
||||||
unicode = lambda x, *args: x
|
|
||||||
ET_ENCODING = "unicode"
|
|
||||||
|
|
||||||
def compare(a, b): return cmp(a[1:], b[1:])
|
def compare(a, b): return cmp(a[1:], b[1:])
|
||||||
|
|
||||||
@ -4200,8 +4173,7 @@ def create_release_request(apiurl, src_project, message=''):
|
|||||||
r = Request()
|
r = Request()
|
||||||
# api will complete the request
|
# api will complete the request
|
||||||
r.add_action('maintenance_release', src_project=src_project)
|
r.add_action('maintenance_release', src_project=src_project)
|
||||||
# XXX: clarify why we need the unicode(...) stuff
|
r.description = message
|
||||||
r.description = unicode(message, 'utf8')
|
|
||||||
r.create(apiurl)
|
r.create(apiurl)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
@ -4213,8 +4185,7 @@ def create_maintenance_request(apiurl, src_project, src_packages, tgt_project, t
|
|||||||
r.add_action('maintenance_incident', src_project=src_project, src_package=p, src_rev=rev, tgt_project=tgt_project, tgt_releaseproject=tgt_releaseproject, opt_sourceupdate = opt_sourceupdate)
|
r.add_action('maintenance_incident', src_project=src_project, src_package=p, src_rev=rev, tgt_project=tgt_project, tgt_releaseproject=tgt_releaseproject, opt_sourceupdate = opt_sourceupdate)
|
||||||
else:
|
else:
|
||||||
r.add_action('maintenance_incident', src_project=src_project, tgt_project=tgt_project, tgt_releaseproject=tgt_releaseproject, opt_sourceupdate = opt_sourceupdate)
|
r.add_action('maintenance_incident', src_project=src_project, tgt_project=tgt_project, tgt_releaseproject=tgt_releaseproject, opt_sourceupdate = opt_sourceupdate)
|
||||||
# XXX: clarify why we need the unicode(...) stuff
|
r.description = message
|
||||||
r.description = unicode(message, 'utf8')
|
|
||||||
r.create(apiurl, addrevision=True, enforce_branching=enforce_branching)
|
r.create(apiurl, addrevision=True, enforce_branching=enforce_branching)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
@ -4259,11 +4230,6 @@ def create_submit_request(apiurl,
|
|||||||
options_block,
|
options_block,
|
||||||
_html_escape(message))
|
_html_escape(message))
|
||||||
|
|
||||||
# Don't do _html_escape(unicode(message, "utf8"))) above.
|
|
||||||
# Promoting the string to utf8, causes the post to explode with:
|
|
||||||
# uncaught exception: Fatal error: Start tag expected, '<' not found at :1.
|
|
||||||
# I guess, my original workaround was not that bad.
|
|
||||||
|
|
||||||
u = makeurl(apiurl, ['request'], query='cmd=create')
|
u = makeurl(apiurl, ['request'], query='cmd=create')
|
||||||
r = None
|
r = None
|
||||||
try:
|
try:
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
import importlib
|
|
||||||
import bz2
|
|
||||||
import base64
|
import base64
|
||||||
|
import bz2
|
||||||
import getpass
|
import getpass
|
||||||
|
import importlib
|
||||||
import sys
|
import sys
|
||||||
|
from urllib.parse import urlsplit
|
||||||
try:
|
|
||||||
from urllib.parse import urlsplit
|
|
||||||
except ImportError:
|
|
||||||
from urlparse import urlsplit
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import keyring
|
import keyring
|
||||||
|
28
osc/fetch.py
28
osc/fetch.py
@ -3,28 +3,22 @@
|
|||||||
# and distributed under the terms of the GNU General Public Licence,
|
# and distributed under the terms of the GNU General Public Licence,
|
||||||
# either version 2, or (at your option) any later version.
|
# either version 2, or (at your option) any later version.
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import sys, os
|
import os
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
from urllib.parse import quote_plus
|
||||||
|
from urllib.request import HTTPError
|
||||||
|
|
||||||
try:
|
|
||||||
from urllib.parse import quote_plus
|
|
||||||
from urllib.request import HTTPError
|
|
||||||
except ImportError:
|
|
||||||
#python 2.x
|
|
||||||
from urllib import quote_plus
|
|
||||||
from urllib2 import HTTPError
|
|
||||||
|
|
||||||
from .core import makeurl, streamfile, dgst
|
|
||||||
from .grabber import OscFileGrabber, OscMirrorGroup
|
|
||||||
from .util import packagequery, cpio
|
|
||||||
from . import conf
|
from . import conf
|
||||||
from . import oscerr
|
from . import oscerr
|
||||||
import tempfile
|
from .core import makeurl, streamfile, dgst
|
||||||
import re
|
from .grabber import OscFileGrabber, OscMirrorGroup
|
||||||
|
|
||||||
from osc.util.helper import decode_it
|
|
||||||
from .meter import create_text_meter
|
from .meter import create_text_meter
|
||||||
|
from .util import packagequery, cpio
|
||||||
|
from .util.helper import decode_it
|
||||||
|
|
||||||
|
|
||||||
class Fetcher:
|
class Fetcher:
|
||||||
def __init__(self, cachedir='/tmp', api_host_options={}, urllist=[],
|
def __init__(self, cachedir='/tmp', api_host_options={}, urllist=[],
|
||||||
|
@ -3,20 +3,15 @@
|
|||||||
# and distributed under the terms of the GNU General Public Licence,
|
# and distributed under the terms of the GNU General Public Licence,
|
||||||
# either version 2, or (at your option) any later version.
|
# either version 2, or (at your option) any later version.
|
||||||
|
|
||||||
import sys
|
|
||||||
import os.path
|
|
||||||
from .core import streamfile
|
|
||||||
|
|
||||||
try:
|
import os
|
||||||
from urllib.request import HTTPError
|
import sys
|
||||||
from urllib.parse import urlparse
|
from urllib.request import HTTPError
|
||||||
from urllib.parse import unquote
|
from urllib.parse import urlparse
|
||||||
from urllib.error import URLError
|
from urllib.parse import unquote
|
||||||
except ImportError:
|
from urllib.error import URLError
|
||||||
from urllib2 import HTTPError
|
|
||||||
from urlparse import urlparse
|
from .core import streamfile
|
||||||
from urllib import unquote
|
|
||||||
from urllib2 import URLError
|
|
||||||
|
|
||||||
|
|
||||||
class OscFileGrabber(object):
|
class OscFileGrabber(object):
|
||||||
|
@ -13,13 +13,11 @@
|
|||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
|
||||||
import stat
|
import stat
|
||||||
|
import sys
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
|
import os
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import os.path
|
|
||||||
import re
|
import re
|
||||||
import tarfile
|
|
||||||
from . import packagequery
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import tarfile
|
||||||
|
|
||||||
|
from . import packagequery
|
||||||
|
|
||||||
|
|
||||||
class ArchError(packagequery.PackageError):
|
class ArchError(packagequery.PackageError):
|
||||||
pass
|
pass
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import mmap
|
import mmap
|
||||||
import os
|
import os
|
||||||
@ -21,6 +20,7 @@ import stat
|
|||||||
import struct
|
import struct
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
# workaround for python24
|
# workaround for python24
|
||||||
if not hasattr(os, 'SEEK_SET'):
|
if not hasattr(os, 'SEEK_SET'):
|
||||||
os.SEEK_SET = 0
|
os.SEEK_SET = 0
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
|
import itertools
|
||||||
from __future__ import print_function
|
import os
|
||||||
|
|
||||||
from . import ar
|
|
||||||
import os.path
|
|
||||||
import re
|
import re
|
||||||
import tarfile
|
import tarfile
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
|
from . import ar
|
||||||
from . import packagequery
|
from . import packagequery
|
||||||
import itertools
|
|
||||||
|
|
||||||
|
|
||||||
HAVE_LZMA = True
|
HAVE_LZMA = True
|
||||||
|
@ -3,43 +3,10 @@
|
|||||||
# and distributed under the terms of the GNU General Public Licence,
|
# and distributed under the terms of the GNU General Public Licence,
|
||||||
# either version 2, or (at your option) any later version.
|
# either version 2, or (at your option) any later version.
|
||||||
|
|
||||||
try:
|
|
||||||
import html
|
|
||||||
except ImportError:
|
|
||||||
import cgi as html
|
|
||||||
|
|
||||||
from osc import oscerr
|
import html
|
||||||
|
|
||||||
def cmp_to_key(mycmp):
|
from .. import oscerr
|
||||||
""" Converts a cmp= function into a key= function.
|
|
||||||
"""
|
|
||||||
|
|
||||||
class K(object):
|
|
||||||
def __init__(self, obj, *args):
|
|
||||||
self.obj = obj
|
|
||||||
|
|
||||||
def __lt__(self, other):
|
|
||||||
return mycmp(self.obj, other.obj) < 0
|
|
||||||
|
|
||||||
def __gt__(self, other):
|
|
||||||
return mycmp(self.obj, other.obj) > 0
|
|
||||||
|
|
||||||
def __eq__(self, other):
|
|
||||||
return mycmp(self.obj, other.obj) == 0
|
|
||||||
|
|
||||||
def __le__(self, other):
|
|
||||||
return mycmp(self.obj, other.obj) <= 0
|
|
||||||
|
|
||||||
def __ge__(self, other):
|
|
||||||
return mycmp(self.obj, other.obj) >= 0
|
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return mycmp(self.obj, other.obj) != 0
|
|
||||||
|
|
||||||
def __hash__(self):
|
|
||||||
raise TypeError('hash not implemented')
|
|
||||||
|
|
||||||
return K
|
|
||||||
|
|
||||||
|
|
||||||
def decode_list(ilist):
|
def decode_list(ilist):
|
||||||
@ -72,13 +39,8 @@ def decode_it(obj):
|
|||||||
|
|
||||||
|
|
||||||
def raw_input(*args):
|
def raw_input(*args):
|
||||||
try:
|
import builtins
|
||||||
import builtins
|
func = builtins.input
|
||||||
func = builtins.input
|
|
||||||
except ImportError:
|
|
||||||
#python 2.7
|
|
||||||
import __builtin__
|
|
||||||
func = __builtin__.raw_input
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return func(*args)
|
return func(*args)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
|
from .helper import decode_it
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
from osc.util.helper import decode_it
|
|
||||||
|
|
||||||
class PackageError(Exception):
|
class PackageError(Exception):
|
||||||
"""base class for all package related errors"""
|
"""base class for all package related errors"""
|
||||||
|
@ -1,21 +1,14 @@
|
|||||||
"""Module for reading repodata directory (created with createrepo) for package
|
"""Module for reading repodata directory (created with createrepo) for package
|
||||||
information instead of scanning individual rpms."""
|
information instead of scanning individual rpms."""
|
||||||
|
|
||||||
# standard modules
|
|
||||||
import gzip
|
import gzip
|
||||||
import os.path
|
import os
|
||||||
|
from xml.etree import ElementTree as ET
|
||||||
|
|
||||||
try:
|
from . import rpmquery
|
||||||
# Works up to Python 3.8, needed for Python < 3.3 (inc 2.7)
|
from . import packagequery
|
||||||
from xml.etree import cElementTree as ET
|
|
||||||
except ImportError:
|
|
||||||
# will import a fast implementation from 3.3 onwards, needed
|
|
||||||
# for 3.9+
|
|
||||||
from xml.etree import ElementTree as ET
|
|
||||||
|
|
||||||
# project modules
|
|
||||||
import osc.util.rpmquery
|
|
||||||
import osc.util.packagequery
|
|
||||||
|
|
||||||
def namespace(name):
|
def namespace(name):
|
||||||
return "{http://linux.duke.edu/metadata/%s}" % name
|
return "{http://linux.duke.edu/metadata/%s}" % name
|
||||||
@ -92,7 +85,7 @@ def _to_bytes_list(method):
|
|||||||
return _method
|
return _method
|
||||||
|
|
||||||
|
|
||||||
class RepoDataQueryResult(osc.util.packagequery.PackageQueryResult):
|
class RepoDataQueryResult(packagequery.PackageQueryResult):
|
||||||
"""PackageQueryResult that reads in data from the repodata directory files."""
|
"""PackageQueryResult that reads in data from the repodata directory files."""
|
||||||
|
|
||||||
def __init__(self, directory, element):
|
def __init__(self, directory, element):
|
||||||
@ -206,7 +199,7 @@ class RepoDataQueryResult(osc.util.packagequery.PackageQueryResult):
|
|||||||
release = None
|
release = None
|
||||||
else:
|
else:
|
||||||
release = self.release()
|
release = self.release()
|
||||||
return osc.util.rpmquery.RpmQuery.filename(self.name(), None,
|
return rpmquery.RpmQuery.filename(self.name(), None,
|
||||||
self.version(), release, self.arch())
|
self.version(), release, self.arch())
|
||||||
|
|
||||||
def gettag(self, tag):
|
def gettag(self, tag):
|
||||||
@ -217,13 +210,13 @@ class RepoDataQueryResult(osc.util.packagequery.PackageQueryResult):
|
|||||||
# if either self.epoch() or other.epoch() is None, the vercmp will do
|
# if either self.epoch() or other.epoch() is None, the vercmp will do
|
||||||
# the correct thing because one is transformed into b'None' and the
|
# the correct thing because one is transformed into b'None' and the
|
||||||
# other one into b"b'<epoch>'" (and 'b' is greater than 'N')
|
# other one into b"b'<epoch>'" (and 'b' is greater than 'N')
|
||||||
res = osc.util.rpmquery.RpmQuery.rpmvercmp(str(self.epoch()).encode(), str(other.epoch()).encode())
|
res = rpmquery.RpmQuery.rpmvercmp(str(self.epoch()).encode(), str(other.epoch()).encode())
|
||||||
if res != 0:
|
if res != 0:
|
||||||
return res
|
return res
|
||||||
res = osc.util.rpmquery.RpmQuery.rpmvercmp(self.version(), other.version())
|
res = rpmquery.RpmQuery.rpmvercmp(self.version(), other.version())
|
||||||
if res != 0:
|
if res != 0:
|
||||||
return res
|
return res
|
||||||
res = osc.util.rpmquery.RpmQuery.rpmvercmp(self.release(), other.release())
|
res = rpmquery.RpmQuery.rpmvercmp(self.release(), other.release())
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@_to_bytes_or_None
|
@_to_bytes_or_None
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import struct
|
import struct
|
||||||
from . import packagequery
|
from . import packagequery
|
||||||
from osc.util.helper import decode_it
|
|
||||||
|
from .helper import decode_it
|
||||||
|
|
||||||
|
|
||||||
def cmp(a, b):
|
def cmp(a, b):
|
||||||
return (a > b) - (a < b)
|
return (a > b) - (a < b)
|
||||||
|
13
setup.py
13
setup.py
@ -1,15 +1,14 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from distutils.core import setup
|
|
||||||
import distutils.core
|
import distutils.core
|
||||||
from distutils.command import build, install_data
|
|
||||||
import gzip
|
import gzip
|
||||||
import os.path
|
import os
|
||||||
|
|
||||||
import setuptools
|
import setuptools
|
||||||
|
from distutils.command import build, install_data
|
||||||
|
|
||||||
|
import osc.commandline
|
||||||
import osc.core
|
import osc.core
|
||||||
from osc import commandline
|
|
||||||
|
|
||||||
|
|
||||||
class build_osc(build.build, object):
|
class build_osc(build.build, object):
|
||||||
@ -23,7 +22,7 @@ class build_osc(build.build, object):
|
|||||||
man_path = os.path.join(self.build_base, 'osc.1.gz')
|
man_path = os.path.join(self.build_base, 'osc.1.gz')
|
||||||
distutils.log.info('generating %s' % man_path)
|
distutils.log.info('generating %s' % man_path)
|
||||||
outfile = gzip.open(man_path, 'wt')
|
outfile = gzip.open(man_path, 'wt')
|
||||||
osccli = commandline.Osc(stdout=outfile)
|
osccli = osc.commandline.Osc(stdout=outfile)
|
||||||
# FIXME: we cannot call the main method because osc expects an ~/.oscrc
|
# FIXME: we cannot call the main method because osc expects an ~/.oscrc
|
||||||
# file (this would break builds in environments like the obs)
|
# file (this would break builds in environments like the obs)
|
||||||
# osccli.main(argv = ['osc','man'])
|
# osccli.main(argv = ['osc','man'])
|
||||||
@ -119,9 +118,7 @@ setuptools.setup(
|
|||||||
"Operating System :: POSIX :: BSD :: FreeBSD",
|
"Operating System :: POSIX :: BSD :: FreeBSD",
|
||||||
"Operating System :: POSIX :: Linux",
|
"Operating System :: POSIX :: Linux",
|
||||||
"Programming Language :: Python",
|
"Programming Language :: Python",
|
||||||
"Programming Language :: Python :: 2.7",
|
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.5",
|
|
||||||
"Programming Language :: Python :: 3.6",
|
"Programming Language :: Python :: 3.6",
|
||||||
"Programming Language :: Python :: 3.7",
|
"Programming Language :: Python :: 3.7",
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
import osc.core
|
|
||||||
import osc.oscerr
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import osc.core
|
||||||
|
import osc.oscerr
|
||||||
|
|
||||||
from .common import OscTestCase
|
from .common import OscTestCase
|
||||||
|
|
||||||
|
|
||||||
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'addfile_fixtures')
|
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'addfile_fixtures')
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
|
@ -1,20 +1,13 @@
|
|||||||
import osc.core
|
|
||||||
import osc.oscerr
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from urllib.error import HTTPError
|
||||||
|
from xml.etree import ElementTree as ET
|
||||||
|
|
||||||
|
import osc.core
|
||||||
|
import osc.oscerr
|
||||||
|
|
||||||
from .common import GET, PUT, POST, DELETE, OscTestCase
|
from .common import GET, PUT, POST, DELETE, OscTestCase
|
||||||
try:
|
|
||||||
# Works up to Python 3.8, needed for Python < 3.3 (inc 2.7)
|
|
||||||
from xml.etree import cElementTree as ET
|
|
||||||
except ImportError:
|
|
||||||
# will import a fast implementation from 3.3 onwards, needed
|
|
||||||
# for 3.9+
|
|
||||||
from xml.etree import ElementTree as ET
|
|
||||||
try:
|
|
||||||
from urllib.error import HTTPError
|
|
||||||
except ImportError:
|
|
||||||
#python 2.x
|
|
||||||
from urllib2 import HTTPError
|
|
||||||
|
|
||||||
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'commit_fixtures')
|
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'commit_fixtures')
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
import unittest
|
||||||
|
|
||||||
from osc.core import parseRevisionOption
|
from osc.core import parseRevisionOption
|
||||||
from osc.oscerr import OscInvalidRevision
|
from osc.oscerr import OscInvalidRevision
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
|
|
||||||
class TestParseRevisionOption(unittest.TestCase):
|
class TestParseRevisionOption(unittest.TestCase):
|
||||||
def test_empty(self):
|
def test_empty(self):
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
import osc.core
|
import osc.core
|
||||||
import osc.oscerr
|
import osc.oscerr
|
||||||
import os
|
|
||||||
from .common import OscTestCase
|
from .common import OscTestCase
|
||||||
|
|
||||||
|
|
||||||
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'deletefile_fixtures')
|
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'deletefile_fixtures')
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
import osc.core
|
import osc.core
|
||||||
import osc.oscerr
|
import osc.oscerr
|
||||||
from osc.util.helper import decode_list
|
from osc.util.helper import decode_list
|
||||||
import os
|
|
||||||
import re
|
|
||||||
from .common import GET, OscTestCase
|
from .common import GET, OscTestCase
|
||||||
|
|
||||||
|
|
||||||
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'difffile_fixtures')
|
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'difffile_fixtures')
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from osc.util.helper import decode_it, decode_list
|
from osc.util.helper import decode_it, decode_list
|
||||||
|
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
return unittest.makeSuite(TestResults)
|
return unittest.makeSuite(TestResults)
|
||||||
|
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
import osc.core
|
import osc.core
|
||||||
import osc.oscerr
|
import osc.oscerr
|
||||||
import os
|
|
||||||
from .common import OscTestCase
|
from .common import OscTestCase
|
||||||
|
|
||||||
|
|
||||||
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'init_package_fixtures')
|
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'init_package_fixtures')
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
import osc.core
|
import osc.core
|
||||||
import osc.oscerr
|
import osc.oscerr
|
||||||
import os
|
|
||||||
from .common import GET, OscTestCase
|
from .common import GET, OscTestCase
|
||||||
|
|
||||||
|
|
||||||
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'init_project_fixtures')
|
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'init_project_fixtures')
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
import osc.core
|
import osc.core
|
||||||
import osc.oscerr
|
import osc.oscerr
|
||||||
import os
|
|
||||||
from .common import OscTestCase
|
from .common import OscTestCase
|
||||||
|
|
||||||
|
|
||||||
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'project_package_status_fixtures')
|
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'project_package_status_fixtures')
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import osc.commandline
|
|
||||||
import osc.core
|
|
||||||
import osc.oscerr
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import osc.commandline
|
||||||
|
import osc.core
|
||||||
|
import osc.oscerr
|
||||||
|
|
||||||
from .common import GET, POST, OscTestCase, EXPECTED_REQUESTS
|
from .common import GET, POST, OscTestCase, EXPECTED_REQUESTS
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
import osc.core
|
import osc.core
|
||||||
import osc.oscerr
|
import osc.oscerr
|
||||||
import os
|
|
||||||
from .common import OscTestCase
|
from .common import OscTestCase
|
||||||
|
|
||||||
|
|
||||||
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'project_package_status_fixtures')
|
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'project_package_status_fixtures')
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
import osc.core
|
|
||||||
import osc.oscerr
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from xml.etree import ElementTree as ET
|
||||||
|
|
||||||
|
import osc.core
|
||||||
|
import osc.oscerr
|
||||||
|
|
||||||
from .common import GET, PUT, POST, DELETE, OscTestCase
|
from .common import GET, PUT, POST, DELETE, OscTestCase
|
||||||
try:
|
|
||||||
# Works up to Python 3.8, needed for Python < 3.3 (inc 2.7)
|
|
||||||
from xml.etree import cElementTree as ET
|
|
||||||
except ImportError:
|
|
||||||
# will import a fast implementation from 3.3 onwards, needed
|
|
||||||
# for 3.9+
|
|
||||||
from xml.etree import ElementTree as ET
|
|
||||||
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'repairwc_fixtures')
|
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'repairwc_fixtures')
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
try:
|
import os
|
||||||
# Works up to Python 3.8, needed for Python < 3.3 (inc 2.7)
|
from xml.etree import ElementTree as ET
|
||||||
from xml.etree import cElementTree as ET
|
|
||||||
except ImportError:
|
|
||||||
# will import a fast implementation from 3.3 onwards, needed
|
|
||||||
# for 3.9+
|
|
||||||
from xml.etree import ElementTree as ET
|
|
||||||
|
|
||||||
import osc.core
|
import osc.core
|
||||||
import osc.oscerr
|
import osc.oscerr
|
||||||
import os
|
|
||||||
from .common import OscTestCase
|
from .common import OscTestCase
|
||||||
|
|
||||||
|
|
||||||
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'request_fixtures')
|
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'request_fixtures')
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
import osc.commandline
|
|
||||||
from .common import GET, OscTestCase
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import osc.commandline
|
||||||
|
|
||||||
|
from .common import GET, OscTestCase
|
||||||
|
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
import unittest
|
import unittest
|
||||||
return unittest.makeSuite(TestResults)
|
return unittest.makeSuite(TestResults)
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
import osc.core
|
import osc.core
|
||||||
import osc.oscerr
|
import osc.oscerr
|
||||||
import os
|
|
||||||
from .common import OscTestCase
|
from .common import OscTestCase
|
||||||
|
|
||||||
|
|
||||||
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'revertfile_fixtures')
|
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'revertfile_fixtures')
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
import osc.core
|
import osc.core
|
||||||
import osc.oscerr
|
import osc.oscerr
|
||||||
import os
|
|
||||||
from .common import GET, PUT, OscTestCase
|
from .common import GET, PUT, OscTestCase
|
||||||
|
|
||||||
|
|
||||||
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'setlinkrev_fixtures')
|
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'setlinkrev_fixtures')
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
@ -60,10 +64,7 @@ class TestSetLinkRev(OscTestCase):
|
|||||||
@GET('http://localhost/source/srcprj/srcpkg?rev=latest&expand=1', text='conflict in file merge', code=400)
|
@GET('http://localhost/source/srcprj/srcpkg?rev=latest&expand=1', text='conflict in file merge', code=400)
|
||||||
def test_linkerror(self):
|
def test_linkerror(self):
|
||||||
"""link is broken"""
|
"""link is broken"""
|
||||||
try:
|
from urllib.error import HTTPError
|
||||||
from urllib.error import HTTPError
|
|
||||||
except ImportError:
|
|
||||||
from urllib2 import HTTPError
|
|
||||||
# the backend returns status 400 if we try to expand a broken _link
|
# the backend returns status 400 if we try to expand a broken _link
|
||||||
self.assertRaises(HTTPError, osc.core.set_link_rev, 'http://localhost', 'osctest', 'simple', expand=True)
|
self.assertRaises(HTTPError, osc.core.set_link_rev, 'http://localhost', 'osctest', 'simple', expand=True)
|
||||||
|
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
import osc.core
|
|
||||||
import osc.oscerr
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import osc.core
|
||||||
|
import osc.oscerr
|
||||||
|
|
||||||
from .common import GET, OscTestCase
|
from .common import GET, OscTestCase
|
||||||
|
|
||||||
|
|
||||||
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'update_fixtures')
|
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'update_fixtures')
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
|
Loading…
Reference in New Issue
Block a user