mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-25 01:16:14 +01:00
python3 compatibility: use relative imports
Use relative imports when using module's own modules - this makes a clear distinction between already developed copy and installed package.
This commit is contained in:
parent
f814fe4af4
commit
c612e8d47e
@ -11,7 +11,7 @@ import signal
|
|||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from osc import oscerr
|
from osc import oscerr
|
||||||
from oscsslexcp import NoSecureSSLError
|
from .oscsslexcp import NoSecureSSLError
|
||||||
from osc.util.cpio import CpioError
|
from osc.util.cpio import CpioError
|
||||||
from osc.util.packagequery import PackageError
|
from osc.util.packagequery import PackageError
|
||||||
|
|
||||||
|
@ -16,14 +16,14 @@ from osc.core import get_buildinfo, store_read_apiurl, store_read_project, store
|
|||||||
from osc.core import get_binarylist, get_binary_file, run_external
|
from osc.core import get_binarylist, get_binary_file, run_external
|
||||||
from osc.util import rpmquery, debquery, archquery
|
from osc.util import rpmquery, debquery, archquery
|
||||||
import osc.conf
|
import osc.conf
|
||||||
import oscerr
|
from . import oscerr
|
||||||
import subprocess
|
import subprocess
|
||||||
try:
|
try:
|
||||||
from xml.etree import cElementTree as ET
|
from xml.etree import cElementTree as ET
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import cElementTree as ET
|
import cElementTree as ET
|
||||||
|
|
||||||
from conf import config, cookiejar
|
from .conf import config, cookiejar
|
||||||
|
|
||||||
change_personality = {
|
change_personality = {
|
||||||
'i686': 'linux32',
|
'i686': 'linux32',
|
||||||
@ -298,7 +298,7 @@ def get_repo(path):
|
|||||||
|
|
||||||
def get_prefer_pkgs(dirs, wanted_arch, type):
|
def get_prefer_pkgs(dirs, wanted_arch, type):
|
||||||
import glob
|
import glob
|
||||||
from util import repodata, packagequery, cpio
|
from .util import repodata, packagequery, cpio
|
||||||
paths = []
|
paths = []
|
||||||
repositories = []
|
repositories = []
|
||||||
|
|
||||||
|
@ -4,17 +4,17 @@
|
|||||||
# either version 2, or version 3 (at your option).
|
# either version 2, or version 3 (at your option).
|
||||||
|
|
||||||
|
|
||||||
import cmdln
|
from . import cmdln
|
||||||
import conf
|
from . import conf
|
||||||
import oscerr
|
from . import oscerr
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import urlparse
|
import urlparse
|
||||||
|
|
||||||
from optparse import SUPPRESS_HELP
|
from optparse import SUPPRESS_HELP
|
||||||
|
|
||||||
from core import *
|
from .core import *
|
||||||
from util import safewriter
|
from .util import safewriter
|
||||||
|
|
||||||
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
|
||||||
@ -148,7 +148,7 @@ class Osc(cmdln.Cmdln):
|
|||||||
self.options.verbose = conf.config['verbose']
|
self.options.verbose = conf.config['verbose']
|
||||||
self.download_progress = None
|
self.download_progress = None
|
||||||
if conf.config.get('show_download_progress', False):
|
if conf.config.get('show_download_progress', False):
|
||||||
from meter import TextMeter
|
from .meter import TextMeter
|
||||||
self.download_progress = TextMeter(hide_finished=True)
|
self.download_progress = TextMeter(hide_finished=True)
|
||||||
|
|
||||||
|
|
||||||
@ -4990,7 +4990,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
if opts.prefer_pkgs and build_descr_data is None:
|
if opts.prefer_pkgs and build_descr_data is None:
|
||||||
raise oscerr.WrongArgs('error: a build description is needed if \'--prefer-pkgs\' is used')
|
raise oscerr.WrongArgs('error: a build description is needed if \'--prefer-pkgs\' is used')
|
||||||
elif opts.prefer_pkgs:
|
elif opts.prefer_pkgs:
|
||||||
from build import get_prefer_pkgs
|
from .build import get_prefer_pkgs
|
||||||
print 'Scanning the following dirs for local packages: %s' % ', '.join(opts.prefer_pkgs)
|
print 'Scanning the following dirs for local packages: %s' % ', '.join(opts.prefer_pkgs)
|
||||||
prefer_pkgs, cpio = get_prefer_pkgs(opts.prefer_pkgs, arch, os.path.splitext(args[2])[1])
|
prefer_pkgs, cpio = get_prefer_pkgs(opts.prefer_pkgs, arch, os.path.splitext(args[2])[1])
|
||||||
cpio.add(os.path.basename(args[2]), build_descr_data)
|
cpio.add(os.path.basename(args[2]), build_descr_data)
|
||||||
@ -6598,7 +6598,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
${cmd_option_list}
|
${cmd_option_list}
|
||||||
"""
|
"""
|
||||||
import glob
|
import glob
|
||||||
from util import rpmquery
|
from .util import rpmquery
|
||||||
|
|
||||||
if opts.delete_old_files and conf.config['do_package_tracking']:
|
if opts.delete_old_files and conf.config['do_package_tracking']:
|
||||||
# IMHO the --delete-old-files option doesn't really fit into our
|
# IMHO the --delete-old-files option doesn't really fit into our
|
||||||
|
@ -45,9 +45,9 @@ import urllib
|
|||||||
import urllib2
|
import urllib2
|
||||||
import urlparse
|
import urlparse
|
||||||
|
|
||||||
import OscConfigParser
|
from . import OscConfigParser
|
||||||
from osc import oscerr
|
from osc import oscerr
|
||||||
from oscsslexcp import NoSecureSSLError
|
from .oscsslexcp import NoSecureSSLError
|
||||||
|
|
||||||
GENERIC_KEYRING = False
|
GENERIC_KEYRING = False
|
||||||
GNOME_KEYRING = False
|
GNOME_KEYRING = False
|
||||||
@ -480,7 +480,7 @@ def _build_opener(url):
|
|||||||
|
|
||||||
if options['sslcertck']:
|
if options['sslcertck']:
|
||||||
try:
|
try:
|
||||||
import oscssl
|
from . import oscssl
|
||||||
from M2Crypto import m2urllib2
|
from M2Crypto import m2urllib2
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
print e
|
print e
|
||||||
|
@ -19,8 +19,8 @@ from urllib import pathname2url, quote_plus, urlencode, unquote
|
|||||||
from urlparse import urlsplit, urlunsplit
|
from urlparse import urlsplit, urlunsplit
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
import shutil
|
import shutil
|
||||||
import oscerr
|
from . import oscerr
|
||||||
import conf
|
from . import conf
|
||||||
import subprocess
|
import subprocess
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
@ -3960,7 +3960,7 @@ def get_binary_file(apiurl, prj, repo, arch,
|
|||||||
progress_meter = False):
|
progress_meter = False):
|
||||||
progress_obj = None
|
progress_obj = None
|
||||||
if progress_meter:
|
if progress_meter:
|
||||||
from meter import TextMeter
|
from .meter import TextMeter
|
||||||
progress_obj = TextMeter()
|
progress_obj = TextMeter()
|
||||||
|
|
||||||
target_filename = target_filename or filename
|
target_filename = target_filename or filename
|
||||||
|
12
osc/fetch.py
12
osc/fetch.py
@ -9,14 +9,14 @@ from urllib import quote_plus
|
|||||||
|
|
||||||
from urlgrabber.grabber import URLGrabError
|
from urlgrabber.grabber import URLGrabError
|
||||||
from urlgrabber.mirror import MirrorGroup
|
from urlgrabber.mirror import MirrorGroup
|
||||||
from core import makeurl, streamfile
|
from .core import makeurl, streamfile
|
||||||
from util import packagequery, cpio
|
from .util import packagequery, cpio
|
||||||
import conf
|
from . import conf
|
||||||
import oscerr
|
from . import oscerr
|
||||||
import tempfile
|
import tempfile
|
||||||
import re
|
import re
|
||||||
try:
|
try:
|
||||||
from meter import TextMeter
|
from .meter import TextMeter
|
||||||
except:
|
except:
|
||||||
TextMeter = None
|
TextMeter = None
|
||||||
|
|
||||||
@ -372,7 +372,7 @@ def verify_pacs(bi):
|
|||||||
|
|
||||||
print "using keys from", ', '.join(bi.prjkeys)
|
print "using keys from", ', '.join(bi.prjkeys)
|
||||||
|
|
||||||
import checker
|
from . import checker
|
||||||
failed = False
|
failed = False
|
||||||
checker = checker.Checker()
|
checker = checker.Checker()
|
||||||
try:
|
try:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
import tarfile
|
import tarfile
|
||||||
import packagequery
|
from . import packagequery
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
class ArchError(packagequery.PackageError):
|
class ArchError(packagequery.PackageError):
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import ar
|
from . import ar
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
import tarfile
|
import tarfile
|
||||||
import packagequery
|
from . import packagequery
|
||||||
|
|
||||||
class DebError(packagequery.PackageError):
|
class DebError(packagequery.PackageError):
|
||||||
pass
|
pass
|
||||||
|
@ -91,18 +91,18 @@ class PackageQuery:
|
|||||||
extra_tags = ()
|
extra_tags = ()
|
||||||
pkgquery = None
|
pkgquery = None
|
||||||
if magic[:4] == '\xed\xab\xee\xdb':
|
if magic[:4] == '\xed\xab\xee\xdb':
|
||||||
import rpmquery
|
from . import rpmquery
|
||||||
pkgquery = rpmquery.RpmQuery(f)
|
pkgquery = rpmquery.RpmQuery(f)
|
||||||
extra_tags = extra_rpmtags
|
extra_tags = extra_rpmtags
|
||||||
elif magic == '!<arch>':
|
elif magic == '!<arch>':
|
||||||
import debquery
|
from . import debquery
|
||||||
pkgquery = debquery.DebQuery(f)
|
pkgquery = debquery.DebQuery(f)
|
||||||
extra_tags = extra_debtags
|
extra_tags = extra_debtags
|
||||||
elif magic[:5] == '<?xml':
|
elif magic[:5] == '<?xml':
|
||||||
f.close()
|
f.close()
|
||||||
return None
|
return None
|
||||||
elif magic[:5] == '\375\067zXZ' or magic[:2] == '\037\213':
|
elif magic[:5] == '\375\067zXZ' or magic[:2] == '\037\213':
|
||||||
import archquery
|
from . import archquery
|
||||||
pkgquery = archquery.ArchQuery(f)
|
pkgquery = archquery.ArchQuery(f)
|
||||||
else:
|
else:
|
||||||
raise PackageError(filename, 'unsupported package type. magic: \'%s\'' % magic)
|
raise PackageError(filename, 'unsupported package type. magic: \'%s\'' % magic)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import struct
|
import struct
|
||||||
import packagequery
|
from . import packagequery
|
||||||
|
|
||||||
class RpmError(packagequery.PackageError):
|
class RpmError(packagequery.PackageError):
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user