From e3591cb7b897d9007c4c4b7839bf9c244b18d7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Mon, 4 Jan 2016 16:57:57 +0100 Subject: [PATCH] Fix imports in Python 3 Since common and metadata import each other, we must import via "fdroidserver.*". --- fdroidserver/common.py | 10 +++++----- fdroidserver/metadata.py | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 0b4c2dd0..94c36b78 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -43,7 +43,7 @@ except ImportError: from zipfile import ZipFile -import metadata +import fdroidserver.metadata from fdroidserver.asynchronousfilereader import AsynchronousFileReader @@ -486,9 +486,9 @@ def getvcs(vcstype, remote, local): def getsrclibvcs(name): - if name not in metadata.srclibs: + if name not in fdroidserver.metadata.srclibs: raise VCSException("Missing srclib " + name) - return metadata.srclibs[name]['Repo Type'] + return fdroidserver.metadata.srclibs[name]['Repo Type'] class vcs: @@ -1215,10 +1215,10 @@ def getsrclib(spec, srclib_dir, subdir=None, basepath=False, if '/' in name: name, subdir = name.split('/', 1) - if name not in metadata.srclibs: + if name not in fdroidserver.metadata.srclibs: raise VCSException('srclib ' + name + ' not found.') - srclib = metadata.srclibs[name] + srclib = fdroidserver.metadata.srclibs[name] sdir = os.path.join(srclib_dir, name) diff --git a/fdroidserver/metadata.py b/fdroidserver/metadata.py index bc8708df..52771fbd 100644 --- a/fdroidserver/metadata.py +++ b/fdroidserver/metadata.py @@ -41,7 +41,7 @@ except ImportError: # use the C implementation when available import xml.etree.cElementTree as ElementTree -import common +import fdroidserver.common srclibs = None @@ -352,7 +352,7 @@ class Build(): version = self.ndk if not version: version = 'r10e' # falls back to latest - paths = common.config['ndk_paths'] + paths = fdroidserver.common.config['ndk_paths'] if version not in paths: return '' return paths[version] @@ -826,7 +826,7 @@ def get_default_app_info(metadatapath=None): if metadatapath is None: appid = None else: - appid, _ = common.get_extension(os.path.basename(metadatapath)) + appid, _ = fdroidserver.common.get_extension(os.path.basename(metadatapath)) app = App() app.metadatapath = metadatapath @@ -947,15 +947,15 @@ def _decode_bool(s): def parse_metadata(metadatapath): - _, ext = common.get_extension(metadatapath) - accepted = common.config['accepted_formats'] + _, ext = fdroidserver.common.get_extension(metadatapath) + accepted = fdroidserver.common.config['accepted_formats'] if ext not in accepted: raise MetaDataException('"%s" is not an accepted format, convert to: %s' % ( metadatapath, ', '.join(accepted))) app = App() app.metadatapath = metadatapath - app.id, _ = common.get_extension(os.path.basename(metadatapath)) + app.id, _ = fdroidserver.common.get_extension(os.path.basename(metadatapath)) with open(metadatapath, 'r') as mf: if ext == 'txt':