mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-24 17:16:12 +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
|
||||
|
||||
from osc import oscerr
|
||||
from oscsslexcp import NoSecureSSLError
|
||||
from .oscsslexcp import NoSecureSSLError
|
||||
from osc.util.cpio import CpioError
|
||||
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.util import rpmquery, debquery, archquery
|
||||
import osc.conf
|
||||
import oscerr
|
||||
from . import oscerr
|
||||
import subprocess
|
||||
try:
|
||||
from xml.etree import cElementTree as ET
|
||||
except ImportError:
|
||||
import cElementTree as ET
|
||||
|
||||
from conf import config, cookiejar
|
||||
from .conf import config, cookiejar
|
||||
|
||||
change_personality = {
|
||||
'i686': 'linux32',
|
||||
@ -298,7 +298,7 @@ def get_repo(path):
|
||||
|
||||
def get_prefer_pkgs(dirs, wanted_arch, type):
|
||||
import glob
|
||||
from util import repodata, packagequery, cpio
|
||||
from .util import repodata, packagequery, cpio
|
||||
paths = []
|
||||
repositories = []
|
||||
|
||||
|
@ -4,17 +4,17 @@
|
||||
# either version 2, or version 3 (at your option).
|
||||
|
||||
|
||||
import cmdln
|
||||
import conf
|
||||
import oscerr
|
||||
from . import cmdln
|
||||
from . import conf
|
||||
from . import oscerr
|
||||
import sys
|
||||
import time
|
||||
import urlparse
|
||||
|
||||
from optparse import SUPPRESS_HELP
|
||||
|
||||
from core import *
|
||||
from util import safewriter
|
||||
from .core import *
|
||||
from .util import safewriter
|
||||
|
||||
MAN_HEADER = r""".TH %(ucname)s "1" "%(date)s" "%(name)s %(version)s" "User Commands"
|
||||
.SH NAME
|
||||
@ -148,7 +148,7 @@ class Osc(cmdln.Cmdln):
|
||||
self.options.verbose = conf.config['verbose']
|
||||
self.download_progress = None
|
||||
if conf.config.get('show_download_progress', False):
|
||||
from meter import TextMeter
|
||||
from .meter import TextMeter
|
||||
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:
|
||||
raise oscerr.WrongArgs('error: a build description is needed if \'--prefer-pkgs\' is used')
|
||||
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)
|
||||
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)
|
||||
@ -6598,7 +6598,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
${cmd_option_list}
|
||||
"""
|
||||
import glob
|
||||
from util import rpmquery
|
||||
from .util import rpmquery
|
||||
|
||||
if opts.delete_old_files and conf.config['do_package_tracking']:
|
||||
# IMHO the --delete-old-files option doesn't really fit into our
|
||||
|
@ -45,9 +45,9 @@ import urllib
|
||||
import urllib2
|
||||
import urlparse
|
||||
|
||||
import OscConfigParser
|
||||
from . import OscConfigParser
|
||||
from osc import oscerr
|
||||
from oscsslexcp import NoSecureSSLError
|
||||
from .oscsslexcp import NoSecureSSLError
|
||||
|
||||
GENERIC_KEYRING = False
|
||||
GNOME_KEYRING = False
|
||||
@ -480,7 +480,7 @@ def _build_opener(url):
|
||||
|
||||
if options['sslcertck']:
|
||||
try:
|
||||
import oscssl
|
||||
from . import oscssl
|
||||
from M2Crypto import m2urllib2
|
||||
except ImportError as e:
|
||||
print e
|
||||
|
@ -19,8 +19,8 @@ from urllib import pathname2url, quote_plus, urlencode, unquote
|
||||
from urlparse import urlsplit, urlunsplit
|
||||
from cStringIO import StringIO
|
||||
import shutil
|
||||
import oscerr
|
||||
import conf
|
||||
from . import oscerr
|
||||
from . import conf
|
||||
import subprocess
|
||||
import re
|
||||
import socket
|
||||
@ -3960,7 +3960,7 @@ def get_binary_file(apiurl, prj, repo, arch,
|
||||
progress_meter = False):
|
||||
progress_obj = None
|
||||
if progress_meter:
|
||||
from meter import TextMeter
|
||||
from .meter import TextMeter
|
||||
progress_obj = TextMeter()
|
||||
|
||||
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.mirror import MirrorGroup
|
||||
from core import makeurl, streamfile
|
||||
from util import packagequery, cpio
|
||||
import conf
|
||||
import oscerr
|
||||
from .core import makeurl, streamfile
|
||||
from .util import packagequery, cpio
|
||||
from . import conf
|
||||
from . import oscerr
|
||||
import tempfile
|
||||
import re
|
||||
try:
|
||||
from meter import TextMeter
|
||||
from .meter import TextMeter
|
||||
except:
|
||||
TextMeter = None
|
||||
|
||||
@ -372,7 +372,7 @@ def verify_pacs(bi):
|
||||
|
||||
print "using keys from", ', '.join(bi.prjkeys)
|
||||
|
||||
import checker
|
||||
from . import checker
|
||||
failed = False
|
||||
checker = checker.Checker()
|
||||
try:
|
||||
|
@ -1,7 +1,7 @@
|
||||
import os.path
|
||||
import re
|
||||
import tarfile
|
||||
import packagequery
|
||||
from . import packagequery
|
||||
import subprocess
|
||||
|
||||
class ArchError(packagequery.PackageError):
|
||||
|
@ -1,8 +1,8 @@
|
||||
import ar
|
||||
from . import ar
|
||||
import os.path
|
||||
import re
|
||||
import tarfile
|
||||
import packagequery
|
||||
from . import packagequery
|
||||
|
||||
class DebError(packagequery.PackageError):
|
||||
pass
|
||||
|
@ -91,18 +91,18 @@ class PackageQuery:
|
||||
extra_tags = ()
|
||||
pkgquery = None
|
||||
if magic[:4] == '\xed\xab\xee\xdb':
|
||||
import rpmquery
|
||||
from . import rpmquery
|
||||
pkgquery = rpmquery.RpmQuery(f)
|
||||
extra_tags = extra_rpmtags
|
||||
elif magic == '!<arch>':
|
||||
import debquery
|
||||
from . import debquery
|
||||
pkgquery = debquery.DebQuery(f)
|
||||
extra_tags = extra_debtags
|
||||
elif magic[:5] == '<?xml':
|
||||
f.close()
|
||||
return None
|
||||
elif magic[:5] == '\375\067zXZ' or magic[:2] == '\037\213':
|
||||
import archquery
|
||||
from . import archquery
|
||||
pkgquery = archquery.ArchQuery(f)
|
||||
else:
|
||||
raise PackageError(filename, 'unsupported package type. magic: \'%s\'' % magic)
|
||||
|
@ -1,7 +1,7 @@
|
||||
import os
|
||||
import re
|
||||
import struct
|
||||
import packagequery
|
||||
from . import packagequery
|
||||
|
||||
class RpmError(packagequery.PackageError):
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user